|
|
@@ -1,28 +1,19 @@
|
|
|
-
|
|
|
describe('viewRender', function() {
|
|
|
- var options;
|
|
|
|
|
|
- beforeEach(function() {
|
|
|
- options = {
|
|
|
- defaultDate: '2015-02-20'
|
|
|
- };
|
|
|
- affix('#cal');
|
|
|
+ pushOptions({
|
|
|
+ defaultDate: '2015-02-20'
|
|
|
});
|
|
|
|
|
|
describe('when in month view', function() {
|
|
|
- beforeEach(function() {
|
|
|
- options = {
|
|
|
- defaultView: 'month'
|
|
|
- };
|
|
|
+ pushOptions({
|
|
|
+ defaultView: 'month'
|
|
|
});
|
|
|
defineTests();
|
|
|
});
|
|
|
|
|
|
describe('when in agendaWeek view', function() {
|
|
|
- beforeEach(function() {
|
|
|
- options = {
|
|
|
- defaultView: 'agendaWeek'
|
|
|
- };
|
|
|
+ pushOptions({
|
|
|
+ defaultView: 'agendaWeek'
|
|
|
});
|
|
|
defineTests();
|
|
|
});
|
|
|
@@ -30,16 +21,17 @@ describe('viewRender', function() {
|
|
|
function defineTests() {
|
|
|
|
|
|
it('fires after the view is rendered, with correct arguments', function(done) {
|
|
|
- options.viewRender = function(givenViewObj, givenViewEl) {
|
|
|
- var viewObj = $('#cal').fullCalendar('getView');
|
|
|
- var viewEl = $('#cal .fc-view');
|
|
|
+ initCalendar({
|
|
|
+ viewRender: function(givenViewObj, givenViewEl) {
|
|
|
+ var viewObj = currentCalendar.getView();
|
|
|
+ var viewEl = $('.fc-view', currentCalendar.el);
|
|
|
|
|
|
- expect(viewObj).toBe(givenViewObj);
|
|
|
- expect(viewEl[0]).toBe(givenViewEl[0]);
|
|
|
- expect(viewEl.children().length >= 1).toBe(true); // has it rendered content?
|
|
|
- done();
|
|
|
- };
|
|
|
- $('#cal').fullCalendar(options);
|
|
|
+ expect(viewObj).toBe(givenViewObj);
|
|
|
+ expect(viewEl[0]).toBe(givenViewEl[0]);
|
|
|
+ expect(viewEl.children().length >= 1).toBe(true); // has it rendered content?
|
|
|
+ done();
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
});
|