diff --git a/tests/automated/agenda-view.js b/tests/automated/agenda-view.js index e36e132..68662fc 100644 --- a/tests/automated/agenda-view.js +++ b/tests/automated/agenda-view.js @@ -15,8 +15,8 @@ describe('agenda view rendering', function() { }); it('should have have days ordered sun to sat', function() { - var fc = $('#cal').find('.fc-agenda-days th'); - expect(fc[0]).toHaveClass('fc-agenda-axis'); + var fc = $('#cal').find('.fc-view > table > thead th'); + expect(fc[0]).toHaveClass('fc-axis'); expect(fc[1]).toHaveClass('fc-sun'); expect(fc[2]).toHaveClass('fc-mon'); expect(fc[3]).toHaveClass('fc-tue'); @@ -37,15 +37,15 @@ describe('agenda view rendering', function() { }); it('should have have days ordered sat to sun', function() { - var fc = $('#cal').find('.fc-agenda-days th'); - expect(fc[0]).toHaveClass('fc-agenda-axis'); - expect(fc[1]).toHaveClass('fc-sat'); - expect(fc[2]).toHaveClass('fc-fri'); - expect(fc[3]).toHaveClass('fc-thu'); - expect(fc[4]).toHaveClass('fc-wed'); - expect(fc[5]).toHaveClass('fc-tue'); - expect(fc[6]).toHaveClass('fc-mon'); - expect(fc[7]).toHaveClass('fc-sun'); + var fc = $('#cal').find('.fc-view > table > thead th'); + expect(fc[0]).toHaveClass('fc-sat'); + expect(fc[1]).toHaveClass('fc-fri'); + expect(fc[2]).toHaveClass('fc-thu'); + expect(fc[3]).toHaveClass('fc-wed'); + expect(fc[4]).toHaveClass('fc-tue'); + expect(fc[5]).toHaveClass('fc-mon'); + expect(fc[6]).toHaveClass('fc-sun'); + expect(fc[7]).toHaveClass('fc-axis'); }); }); diff --git a/tests/automated/allDaySlot.js b/tests/automated/allDaySlot.js index 578209b..21aef33 100644 --- a/tests/automated/allDaySlot.js +++ b/tests/automated/allDaySlot.js @@ -12,7 +12,7 @@ describe('allDaySlots', function() { defaultView: 'agendaWeek' }; $('#cal').fullCalendar(options); - var allDaySlotCount = $('table.fc-agenda-allday').length; + var allDaySlotCount = $('.fc-day-grid').length; expect(allDaySlotCount).toEqual(1); }); }); @@ -22,7 +22,7 @@ describe('allDaySlots', function() { defaultView: 'agendaDay' }; $('#cal').fullCalendar(options); - var allDaySlotCount = $('table.fc-agenda-allday').length; + var allDaySlotCount = $('.fc-day-grid').length; expect(allDaySlotCount).toEqual(1); }); }); @@ -36,7 +36,7 @@ describe('allDaySlots', function() { allDaySlot: true }; $('#cal').fullCalendar(options); - var allDaySlotCount = $('table.fc-agenda-allday').length; + var allDaySlotCount = $('.fc-day-grid').length; expect(allDaySlotCount).toEqual(1); }); }); @@ -47,7 +47,7 @@ describe('allDaySlots', function() { allDaySlot: true }; $('#cal').fullCalendar(options); - var allDaySlotCount = $('table.fc-agenda-allday').length; + var allDaySlotCount = $('.fc-day-grid').length; expect(allDaySlotCount).toEqual(1); }); }); @@ -61,7 +61,7 @@ describe('allDaySlots', function() { allDaySlot: false }; $('#cal').fullCalendar(options); - var allDaySlotCount = $('table.fc-agenda-allday').length; + var allDaySlotCount = $('.fc-day-grid').length; expect(allDaySlotCount).toEqual(0); }); }); @@ -72,7 +72,7 @@ describe('allDaySlots', function() { allDaySlot: false }; $('#cal').fullCalendar(options); - var allDaySlotCount = $('table.fc-agenda-allday').length; + var allDaySlotCount = $('.fc-day-grid').length; expect(allDaySlotCount).toEqual(0); }); }); diff --git a/tests/automated/allDayText.js b/tests/automated/allDayText.js index 74eab57..f2711e1 100644 --- a/tests/automated/allDayText.js +++ b/tests/automated/allDayText.js @@ -12,7 +12,7 @@ describe('allDayText', function() { defaultView: 'agendaWeek' }; $('#cal').fullCalendar(options); - var allDayText = $('.fc-agenda-allday .fc-agenda-axis').text(); + var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); expect(allDayText).toEqual('all-day'); }); }); @@ -22,7 +22,7 @@ describe('allDayText', function() { defaultView: 'agendaDay' }; $('#cal').fullCalendar(options); - var allDayText = $('.fc-agenda-allday .fc-agenda-axis').text(); + var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); expect(allDayText).toEqual('all-day'); }); }); @@ -36,7 +36,7 @@ describe('allDayText', function() { allDaySlot: true }; $('#cal').fullCalendar(options); - var allDayText = $('.fc-agenda-allday .fc-agenda-axis').text(); + var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); expect(allDayText).toEqual('all-day'); }); }); @@ -47,7 +47,7 @@ describe('allDayText', function() { allDaySlot: true }; $('#cal').fullCalendar(options); - var allDayText = $('.fc-agenda-allday .fc-agenda-axis').text(); + var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); expect(allDayText).toEqual('all-day'); }); }); @@ -62,7 +62,7 @@ describe('allDayText', function() { lang: 'pt-br' }; $('#cal').fullCalendar(options); - var allDayText = $('.fc-agenda-allday .fc-agenda-axis').text(); + var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); expect(allDayText).toEqual('dia inteiro'); }); }); @@ -74,7 +74,7 @@ describe('allDayText', function() { lang: 'pt-br' }; $('#cal').fullCalendar(options); - var allDayText = $('.fc-agenda-allday .fc-agenda-axis').text(); + var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); expect(allDayText).toEqual('dia inteiro'); }); }); @@ -89,7 +89,7 @@ describe('allDayText', function() { allDayText: 'axis-phosy' }; $('#cal').fullCalendar(options); - var allDayText = $('.fc-agenda-allday .fc-agenda-axis').text(); + var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); expect(allDayText).toEqual('axis-phosy'); }); }); @@ -100,7 +100,7 @@ describe('allDayText', function() { allDayText: 'axis-phosy' }; $('#cal').fullCalendar(options); - var allDayText = $('.fc-agenda-allday .fc-agenda-axis').text(); + var allDayText = $('.fc-day-grid > .fc-row > .fc-bg .fc-axis').text(); expect(allDayText).toEqual('axis-phosy'); }); }); diff --git a/tests/automated/aspectRatio.js b/tests/automated/aspectRatio.js index de22e7f..ced7f0a 100644 --- a/tests/automated/aspectRatio.js +++ b/tests/automated/aspectRatio.js @@ -11,11 +11,11 @@ describe('aspectRatio', function() { $('#cal').fullCalendar(); }); it('fc-content should use the ratio 1:35 to set height', function() { - var height = $('.fc-content').height(); + var height = $('.fc-view-container').height(); expect(height).toEqual(500); }); it('fc-content should have width of div', function() { - var width = $('.fc-content').width(); + var width = $('.fc-view-container').width(); expect(width).toEqual(675); }); }); @@ -30,12 +30,12 @@ describe('aspectRatio', function() { }); }); it('should not change the width', function() { - var width = $('.fc-content').width(); + var width = $('.fc-view-container').width(); expect(width).toEqual(1000); }); it('should set the height to width sizes very close to ratio of 2', function() { - var width = $('.fc-content').width(); - var height = $('.fc-content').height(); + var width = $('.fc-view-container').width(); + var height = $('.fc-view-container').height(); var ratio = Math.round(width / height * 100); expect(ratio).toEqual(200); }); @@ -49,12 +49,12 @@ describe('aspectRatio', function() { }); }); it('should not change the width', function() { - var width = $('.fc-content').width(); + var width = $('.fc-view-container').width(); expect(width).toEqual(1000); }); it('should set the height to width sizes very close to ratio of 2', function() { - var width = $('.fc-content').width(); - var height = $('.fc-content').height(); + var width = $('.fc-view-container').width(); + var height = $('.fc-view-container').height(); var ratio = Math.round(width / height * 100); expect(ratio).toEqual(100); }); @@ -68,12 +68,12 @@ describe('aspectRatio', function() { }); }); it('should not change the width', function() { - var width = $('.fc-content').width(); + var width = $('.fc-view-container').width(); expect(width).toEqual(1000); }); it('should set the height to width ratio to 0.5', function() { - var width = $('.fc-content').width(); - var height = $('.fc-content').height(); + var width = $('.fc-view-container').width(); + var height = $('.fc-view-container').height(); var ratio = Math.round(width / height * 100); expect(ratio).toEqual(50); }); @@ -87,12 +87,12 @@ describe('aspectRatio', function() { }); }); it('should not change the width', function() { - var width = $('.fc-content').width(); + var width = $('.fc-view-container').width(); expect(width).toEqual(1000); }); it('should set the height to width ratio to 0.5', function() { - var width = $('.fc-content').width(); - var height = $('.fc-content').height(); + var width = $('.fc-view-container').width(); + var height = $('.fc-view-container').height(); var ratio = Math.round(width / height * 100); expect(ratio).toEqual(50); }); @@ -106,12 +106,12 @@ describe('aspectRatio', function() { }); }); it('should not change the width', function() { - var width = $('.fc-content').width(); + var width = $('.fc-view-container').width(); expect(width).toEqual(1000); }); it('should set the height to width ratio to 0.5', function() { - var width = $('.fc-content').width(); - var height = $('.fc-content').height(); + var width = $('.fc-view-container').width(); + var height = $('.fc-view-container').height(); var ratio = Math.round(width / height * 100); expect(ratio).toEqual(50); }); @@ -125,13 +125,13 @@ describe('aspectRatio', function() { }); }); it('should not change the width', function() { - var width = $('.fc-content').width(); + var width = $('.fc-view-container').width(); expect(width).toEqual(1000); }); it('should cause rows to be natural height', function() { - var actualHeight = $('.fc-content').height(); + var actualHeight = $('.fc-view-container').height(); $('tr.fc-week td:first-child > div').css('min-height', '').css('background', 'red'); - var naturalHeight = $('.fc-content').height(); + var naturalHeight = $('.fc-view-container').height(); expect(actualHeight).toEqual(naturalHeight); }); }); diff --git a/tests/automated/axisFormat.js b/tests/automated/axisFormat.js index f51f130..78b9489 100644 --- a/tests/automated/axisFormat.js +++ b/tests/automated/axisFormat.js @@ -3,7 +3,7 @@ describe('axisFormat', function() { var options; function getAxisText() { - return $('.fc-agenda-slots tr th.fc-agenda-axis:first').text(); + return $('.fc-slats tr:first-child .fc-time').text(); } beforeEach(function() { diff --git a/tests/automated/buttonIcons.js b/tests/automated/buttonIcons.js index c2dc40b..ff70afa 100644 --- a/tests/automated/buttonIcons.js +++ b/tests/automated/buttonIcons.js @@ -17,10 +17,10 @@ describe('buttonIcons', function() { }); it('should have default values', function() { - var prevBtn = $('#cal').find('.fc-button-prev'); - var nextBtn = $('#cal').find('.fc-button-next'); - var nextYearBtn = $('#cal').find('.fc-button-nextYear'); - var prevYearBtn = $('#cal').find('.fc-button-prevYear'); + var prevBtn = $('#cal').find('.fc-prev-button'); + var nextBtn = $('#cal').find('.fc-next-button'); + var nextYearBtn = $('#cal').find('.fc-nextYear-button'); + var prevYearBtn = $('#cal').find('.fc-prevYear-button'); expect(prevBtn.find('span:first')).toHaveClass('fc-icon-left-single-arrow'); expect(nextBtn.find('span:first')).toHaveClass('fc-icon-right-single-arrow'); @@ -48,10 +48,10 @@ describe('buttonIcons', function() { }); it('should have the set values', function() { - var prevBtn = $('#cal').find('.fc-button-prev'); - var nextBtn = $('#cal').find('.fc-button-next'); - var prevYearBtn = $('#cal').find('.fc-button-prevYear'); - var nextYearBtn = $('#cal').find('.fc-button-nextYear'); + var prevBtn = $('#cal').find('.fc-prev-button'); + var nextBtn = $('#cal').find('.fc-next-button'); + var prevYearBtn = $('#cal').find('.fc-prevYear-button'); + var nextYearBtn = $('#cal').find('.fc-nextYear-button'); expect(prevBtn.find('span:first')).toHaveClass('fc-icon-some-icon-left'); @@ -75,10 +75,10 @@ describe('buttonIcons', function() { }); it('buttonIcons is ignored', function() { - var prevBtn = $('#cal').find('.fc-button-prev'); - var nextBtn = $('#cal').find('.fc-button-next'); - var prevYearBtn = $('#cal').find('.fc-button-prevYear'); - var nextYearBtn = $('#cal').find('.fc-button-nextYear'); + var prevBtn = $('#cal').find('.fc-prev-button'); + var nextBtn = $('#cal').find('.fc-next-button'); + var prevYearBtn = $('#cal').find('.fc-prevYear-button'); + var nextYearBtn = $('#cal').find('.fc-nextYear-button'); var classesToSearch = [ '.fc-icon-left-single-arrow', '.fc-icon-right-double-arrow', '.fc-icon-right-single-arrow', '.fc-icon-left-double-arrow' ]; diff --git a/tests/automated/buttonText.js b/tests/automated/buttonText.js index d176252..4835d0c 100644 --- a/tests/automated/buttonText.js +++ b/tests/automated/buttonText.js @@ -21,17 +21,17 @@ describe('button text', function() { $('#cal').fullCalendar(settings); // will have button icons, to text will be empty - expect($('.fc-button-next')).toHaveText(''); - expect($('.fc-button-nextYear')).toHaveText(''); - expect($('.fc-button-prev')).toHaveText(''); - expect($('.fc-button-prevYear')).toHaveText(''); + expect($('.fc-next-button')).toHaveText(''); + expect($('.fc-nextYear-button')).toHaveText(''); + expect($('.fc-prev-button')).toHaveText(''); + expect($('.fc-prevYear-button')).toHaveText(''); - expect($('.fc-button-today')).toHaveText('today'); - expect($('.fc-button-month')).toHaveText('month'); - expect($('.fc-button-basicWeek')).toHaveText('week'); - expect($('.fc-button-agendaWeek')).toHaveText('week'); - expect($('.fc-button-basicDay')).toHaveText('day'); - expect($('.fc-button-agendaDay')).toHaveText('day'); + expect($('.fc-today-button')).toHaveText('today'); + expect($('.fc-month-button')).toHaveText('month'); + expect($('.fc-basicWeek-button')).toHaveText('week'); + expect($('.fc-agendaWeek-button')).toHaveText('week'); + expect($('.fc-basicDay-button')).toHaveText('day'); + expect($('.fc-agendaDay-button')).toHaveText('day'); }); it('should contain specified text values', function() { @@ -47,17 +47,17 @@ describe('button text', function() { }; $('#cal').fullCalendar(settings); - expect($('.fc-button-next')).toHaveText('->'); - expect($('.fc-button-nextYear')).toHaveText('-->'); - expect($('.fc-button-prev')).toHaveText('<-'); - expect($('.fc-button-prevYear')).toHaveText('<--'); + expect($('.fc-next-button')).toHaveText('->'); + expect($('.fc-nextYear-button')).toHaveText('-->'); + expect($('.fc-prev-button')).toHaveText('<-'); + expect($('.fc-prevYear-button')).toHaveText('<--'); - expect($('.fc-button-today')).toHaveText('tidei'); - expect($('.fc-button-month')).toHaveText('mun'); - expect($('.fc-button-agendaDay')).toHaveText('dei'); - expect($('.fc-button-agendaWeek')).toHaveText('wiki'); - expect($('.fc-button-basicDay')).toHaveText('dei'); - expect($('.fc-button-basicWeek')).toHaveText('wiki'); + expect($('.fc-today-button')).toHaveText('tidei'); + expect($('.fc-month-button')).toHaveText('mun'); + expect($('.fc-agendaDay-button')).toHaveText('dei'); + expect($('.fc-agendaWeek-button')).toHaveText('wiki'); + expect($('.fc-basicDay-button')).toHaveText('dei'); + expect($('.fc-basicWeek-button')).toHaveText('wiki'); }); }); @@ -72,17 +72,17 @@ describe('button text', function() { $('#cal').fullCalendar(settings); // will have actual text now - expect($('.fc-button-next')).toHaveText('next'); - expect($('.fc-button-nextYear')).toHaveText('next year'); - expect($('.fc-button-prev')).toHaveText('prev'); - expect($('.fc-button-prevYear')).toHaveText('prev year'); + expect($('.fc-next-button')).toHaveText('next'); + expect($('.fc-nextYear-button')).toHaveText('next year'); + expect($('.fc-prev-button')).toHaveText('prev'); + expect($('.fc-prevYear-button')).toHaveText('prev year'); - expect($('.fc-button-today')).toHaveText('today'); - expect($('.fc-button-month')).toHaveText('month'); - expect($('.fc-button-basicWeek')).toHaveText('week'); - expect($('.fc-button-agendaWeek')).toHaveText('week'); - expect($('.fc-button-basicDay')).toHaveText('day'); - expect($('.fc-button-agendaDay')).toHaveText('day'); + expect($('.fc-today-button')).toHaveText('today'); + expect($('.fc-month-button')).toHaveText('month'); + expect($('.fc-basicWeek-button')).toHaveText('week'); + expect($('.fc-agendaWeek-button')).toHaveText('week'); + expect($('.fc-basicDay-button')).toHaveText('day'); + expect($('.fc-agendaDay-button')).toHaveText('day'); }); it('should contain specified text values', function() { @@ -98,17 +98,17 @@ describe('button text', function() { }; $('#cal').fullCalendar(settings); - expect($('.fc-button-next')).toHaveText('->'); - expect($('.fc-button-nextYear')).toHaveText('-->'); - expect($('.fc-button-prev')).toHaveText('<-'); - expect($('.fc-button-prevYear')).toHaveText('<--'); + expect($('.fc-next-button')).toHaveText('->'); + expect($('.fc-nextYear-button')).toHaveText('-->'); + expect($('.fc-prev-button')).toHaveText('<-'); + expect($('.fc-prevYear-button')).toHaveText('<--'); - expect($('.fc-button-today')).toHaveText('tidei'); - expect($('.fc-button-month')).toHaveText('mun'); - expect($('.fc-button-agendaDay')).toHaveText('dei'); - expect($('.fc-button-agendaWeek')).toHaveText('wiki'); - expect($('.fc-button-basicDay')).toHaveText('dei'); - expect($('.fc-button-basicWeek')).toHaveText('wiki'); + expect($('.fc-today-button')).toHaveText('tidei'); + expect($('.fc-month-button')).toHaveText('mun'); + expect($('.fc-agendaDay-button')).toHaveText('dei'); + expect($('.fc-agendaWeek-button')).toHaveText('wiki'); + expect($('.fc-basicDay-button')).toHaveText('dei'); + expect($('.fc-basicWeek-button')).toHaveText('wiki'); }); }); @@ -127,17 +127,17 @@ describe('button text', function() { $('#cal').fullCalendar(settings); // will contain icons, so will contain no text - expect($('.fc-button-next')).toHaveText(''); - expect($('.fc-button-nextYear')).toHaveText(''); - expect($('.fc-button-prev')).toHaveText(''); - expect($('.fc-button-prevYear')).toHaveText(''); + expect($('.fc-next-button')).toHaveText(''); + expect($('.fc-nextYear-button')).toHaveText(''); + expect($('.fc-prev-button')).toHaveText(''); + expect($('.fc-prevYear-button')).toHaveText(''); - expect($('.fc-button-today')).toHaveText('Aujourd\'hui'); - expect($('.fc-button-month')).toHaveText('Mois'); - expect($('.fc-button-basicWeek')).toHaveText('Semaine'); - expect($('.fc-button-agendaWeek')).toHaveText('Semaine'); - expect($('.fc-button-basicDay')).toHaveText('Jour'); - expect($('.fc-button-agendaDay')).toHaveText('Jour'); + expect($('.fc-today-button')).toHaveText('Aujourd\'hui'); + expect($('.fc-month-button')).toHaveText('Mois'); + expect($('.fc-basicWeek-button')).toHaveText('Semaine'); + expect($('.fc-agendaWeek-button')).toHaveText('Semaine'); + expect($('.fc-basicDay-button')).toHaveText('Jour'); + expect($('.fc-agendaDay-button')).toHaveText('Jour'); }); it('should contain specified text values', function() { @@ -153,17 +153,17 @@ describe('button text', function() { }; $('#cal').fullCalendar(settings); - expect($('.fc-button-next')).toHaveText('->'); - expect($('.fc-button-nextYear')).toHaveText('-->'); - expect($('.fc-button-prev')).toHaveText('<-'); - expect($('.fc-button-prevYear')).toHaveText('<--'); + expect($('.fc-next-button')).toHaveText('->'); + expect($('.fc-nextYear-button')).toHaveText('-->'); + expect($('.fc-prev-button')).toHaveText('<-'); + expect($('.fc-prevYear-button')).toHaveText('<--'); - expect($('.fc-button-today')).toHaveText('tidei'); - expect($('.fc-button-month')).toHaveText('mun'); - expect($('.fc-button-agendaDay')).toHaveText('dei'); - expect($('.fc-button-agendaWeek')).toHaveText('wiki'); - expect($('.fc-button-basicDay')).toHaveText('dei'); - expect($('.fc-button-basicWeek')).toHaveText('wiki'); + expect($('.fc-today-button')).toHaveText('tidei'); + expect($('.fc-month-button')).toHaveText('mun'); + expect($('.fc-agendaDay-button')).toHaveText('dei'); + expect($('.fc-agendaWeek-button')).toHaveText('wiki'); + expect($('.fc-basicDay-button')).toHaveText('dei'); + expect($('.fc-basicWeek-button')).toHaveText('wiki'); }); }); @@ -178,18 +178,18 @@ describe('button text', function() { $('#cal').fullCalendar(settings); // will have the language's actual text now - expect($('.fc-button-next')).toHaveText('Suivant'); - expect($('.fc-button-prev')).toHaveText('Précédent'); + expect($('.fc-next-button')).toHaveText('Suivant'); + expect($('.fc-prev-button')).toHaveText('Précédent'); //// languages files don't have data for prev/next *year* - //expect($('.fc-button-nextYear')).toHaveText('Suivant'); - //expect($('.fc-button-prevYear')).toHaveText('Précédent'); + //expect($('.fc-nextYear-button')).toHaveText('Suivant'); + //expect($('.fc-prevYear-button')).toHaveText('Précédent'); - expect($('.fc-button-today')).toHaveText('Aujourd\'hui'); - expect($('.fc-button-month')).toHaveText('Mois'); - expect($('.fc-button-basicWeek')).toHaveText('Semaine'); - expect($('.fc-button-agendaWeek')).toHaveText('Semaine'); - expect($('.fc-button-basicDay')).toHaveText('Jour'); - expect($('.fc-button-agendaDay')).toHaveText('Jour'); + expect($('.fc-today-button')).toHaveText('Aujourd\'hui'); + expect($('.fc-month-button')).toHaveText('Mois'); + expect($('.fc-basicWeek-button')).toHaveText('Semaine'); + expect($('.fc-agendaWeek-button')).toHaveText('Semaine'); + expect($('.fc-basicDay-button')).toHaveText('Jour'); + expect($('.fc-agendaDay-button')).toHaveText('Jour'); }); it('should contain specified text values', function() { @@ -205,17 +205,17 @@ describe('button text', function() { }; $('#cal').fullCalendar(settings); - expect($('.fc-button-next')).toHaveText('->'); - expect($('.fc-button-nextYear')).toHaveText('-->'); - expect($('.fc-button-prev')).toHaveText('<-'); - expect($('.fc-button-prevYear')).toHaveText('<--'); + expect($('.fc-next-button')).toHaveText('->'); + expect($('.fc-nextYear-button')).toHaveText('-->'); + expect($('.fc-prev-button')).toHaveText('<-'); + expect($('.fc-prevYear-button')).toHaveText('<--'); - expect($('.fc-button-today')).toHaveText('tidei'); - expect($('.fc-button-month')).toHaveText('mun'); - expect($('.fc-button-agendaDay')).toHaveText('dei'); - expect($('.fc-button-agendaWeek')).toHaveText('wiki'); - expect($('.fc-button-basicDay')).toHaveText('dei'); - expect($('.fc-button-basicWeek')).toHaveText('wiki'); + expect($('.fc-today-button')).toHaveText('tidei'); + expect($('.fc-month-button')).toHaveText('mun'); + expect($('.fc-agendaDay-button')).toHaveText('dei'); + expect($('.fc-agendaWeek-button')).toHaveText('wiki'); + expect($('.fc-basicDay-button')).toHaveText('dei'); + expect($('.fc-basicWeek-button')).toHaveText('wiki'); }); }); diff --git a/tests/automated/constructor.js b/tests/automated/constructor.js index 8614e15..552e48d 100644 --- a/tests/automated/constructor.js +++ b/tests/automated/constructor.js @@ -61,13 +61,13 @@ describe('constructor', function() { $('#calendar').fullCalendar(); }); - it('should contain a table fc-header', function() { - var header = $('#calendar > table.fc-header'); + it('should contain a table fc-toolbar', function() { + var header = $('#calendar > .fc-toolbar'); expect(header[0]).not.toBeUndefined(); }); - it('should contain a div fc-content', function() { - var content = ($('#calendar > div.fc-content')); + it('should contain a div fc-view-container', function() { + var content = ($('#calendar > .fc-view-container')); expect(content[0]).not.toBeUndefined(); }); diff --git a/tests/automated/contentHeight.js b/tests/automated/contentHeight.js index 590b399..b83f478 100644 --- a/tests/automated/contentHeight.js +++ b/tests/automated/contentHeight.js @@ -10,7 +10,7 @@ describe('contentHeight', function() { it('should set the height', function() { $('#cal').width(1350); $('#cal').fullCalendar(); - var height = $('.fc-content').height(); + var height = $('.fc-view-container').height(); expect(height).toEqual(1000); }); }); @@ -20,7 +20,7 @@ describe('contentHeight', function() { $('#cal').fullCalendar({ contentHeight: 1000 }); - var height = $('.fc-content').height(); + var height = $('.fc-view-container').height(); expect(height).toEqual(1000); }); it('should not change the container width', function() { @@ -36,7 +36,7 @@ describe('contentHeight', function() { it('should set the content height', function() { $('#cal').fullCalendar(); $('#cal').fullCalendar('option', 'contentHeight', 1137); - var height = $('.fc-content').height(); + var height = $('.fc-view-container').height(); expect(height).toEqual(1137); }); it('should not change the container width', function() { diff --git a/tests/automated/current-date.js b/tests/automated/current-date.js index 77dfe55..12d9053 100644 --- a/tests/automated/current-date.js +++ b/tests/automated/current-date.js @@ -284,7 +284,7 @@ describe('current date', function() { TITLE_FORMAT ); } - expect($('.fc-header-title h2')).toContainText(title); + expect($('.fc-toolbar h2')).toContainText(title); } }); diff --git a/tests/automated/dayClick.js b/tests/automated/dayClick.js index 050048f..43d31f0 100644 --- a/tests/automated/dayClick.js +++ b/tests/automated/dayClick.js @@ -63,7 +63,7 @@ describe('dayClick', function() { }; spyOn(options, 'dayClick').and.callThrough(); $('#cal').fullCalendar(options); - var dayContent = $('.fc-agenda-allday .fc-day-content'); // the middle is 2014-05-28 (regardless of isRTL) + var dayContent = $('.fc-agenda-view .fc-day-grid .fc-day:eq(3)'); // 2014-05-28 (regardless of isRTL) dayContent.simulate('drag-n-drop', { // for simulating the mousedown/mouseup/click (relevant for selectable) callback: function() { dayContent.simulate('click'); @@ -73,6 +73,11 @@ describe('dayClick', function() { }); }); it('fires correctly when clicking on a timed slot', function(done) { + + // make sure the click slot will be in scroll view + options.contentHeight = 500; + options.scrollTime = '07:00:00'; + options.dayClick = function(date, jsEvent, view) { expect(moment.isMoment(date)).toEqual(true); expect(typeof jsEvent).toEqual('object'); // TODO: more descrimination @@ -82,10 +87,9 @@ describe('dayClick', function() { }; spyOn(options, 'dayClick').and.callThrough(); $('#cal').fullCalendar(options); - var slotRow = $('tr.fc-slot18 td'); // the middle is 2014-05-28T09:00:00 (regardless of isRTL) + var slotRow = $('.fc-slats tr:eq(18) td:not(.fc-time)'); // the middle is 2014-05-28T09:00:00 (regardless of isRTL) slotRow.simulate('drag-n-drop', { // for simulating the mousedown/mouseup/click (relevant for selectable) callback: function() { - slotRow.simulate('click'); expect(options.dayClick).toHaveBeenCalled(); done(); } diff --git a/tests/automated/displayEventEnd.js b/tests/automated/displayEventEnd.js index 35cef45..80c090a 100644 --- a/tests/automated/displayEventEnd.js +++ b/tests/automated/displayEventEnd.js @@ -36,7 +36,7 @@ describe('displayEventEnd', function() { }); it('displays no time text', function(done) { options.eventAfterAllRender = function() { - expect($('.fc-event-time').length).toBe(0); + expect($('.fc-event .fc-time').length).toBe(0); done(); }; $('#cal').fullCalendar(options); @@ -53,7 +53,7 @@ describe('displayEventEnd', function() { }); it('displays only the start time text', function(done) { options.eventAfterAllRender = function() { - expect($('.fc-event-time')).toHaveText('1:00'); + expect($('.fc-event .fc-time')).toHaveText('1:00'); done(); }; $('#cal').fullCalendar(options); @@ -71,7 +71,7 @@ describe('displayEventEnd', function() { }); it('displays only the start time text', function(done) { options.eventAfterAllRender = function() { - expect($('.fc-event-time')).toHaveText('1:00'); + expect($('.fc-event .fc-time')).toHaveText('1:00'); done(); }; $('#cal').fullCalendar(options); @@ -95,7 +95,7 @@ describe('displayEventEnd', function() { }); it('displays no time text', function(done) { options.eventAfterAllRender = function() { - expect($('.fc-event-time').length).toBe(0); + expect($('.fc-event .fc-time').length).toBe(0); done(); }; $('#cal').fullCalendar(options); @@ -112,7 +112,7 @@ describe('displayEventEnd', function() { }); it('displays only the start time text', function(done) { options.eventAfterAllRender = function() { - expect($('.fc-event-time')).toHaveText('1:00'); + expect($('.fc-event .fc-time')).toHaveText('1:00'); done(); }; $('#cal').fullCalendar(options); @@ -130,7 +130,7 @@ describe('displayEventEnd', function() { }); it('displays both the start and end time text', function(done) { options.eventAfterAllRender = function() { - expect($('.fc-event-time')).toHaveText('1:00 - 2:00'); + expect($('.fc-event .fc-time')).toHaveText('1:00 - 2:00'); done(); }; $('#cal').fullCalendar(options); diff --git a/tests/automated/event-dnd.js b/tests/automated/event-dnd.js index 1559bf7..71f41a7 100644 --- a/tests/automated/event-dnd.js +++ b/tests/automated/event-dnd.js @@ -28,12 +28,10 @@ describe('eventDrop', function() { init( function() { - $('.fc-event') - .simulate('mouseover') // for our dumb optimization - .simulate('drag-n-drop', { - dx: $('.fc-day').width() * 2, - dy: $('.fc-day').height() - }); + $('.fc-event').simulate('drag-n-drop', { + dx: $('.fc-day').width() * 2, + dy: $('.fc-day').height() + }); }, function(event, delta, revertFunc) { expect(delta.asDays()).toBe(9); @@ -64,12 +62,10 @@ describe('eventDrop', function() { init( function() { - $('.fc-event') - .simulate('mouseover') // for our dumb optimization - .simulate('drag-n-drop', { - dx: $('.fc-day').width() * -2, - dy: $('.fc-day').height() - }); + $('.fc-event').simulate('drag-n-drop', { + dx: $('.fc-day').width() * -2, + dy: $('.fc-day').height() + }); }, function(event, delta, revertFunc) { expect(delta.asDays()).toBe(5); @@ -106,12 +102,10 @@ describe('eventDrop', function() { init( function() { - $('.fc-event') - .simulate('mouseover') // for our dumb optimization - .simulate('drag-n-drop', { - dx: $('th.fc-wed').width(), // 1 day - dy: $('tr.fc-slot1').height() * 3 // 1.5 hours - }); + $('.fc-event .fc-time').simulate('drag-n-drop', { + dx: $('th.fc-wed').width(), // 1 day + dy: $('.fc-slats tr:eq(1)').outerHeight() * 2.9 // 1.5 hours + }); }, function(event, delta, revertFunc) { expect(delta.days()).toBe(1); @@ -142,11 +136,9 @@ describe('eventDrop', function() { init( function() { - $('.fc-event') - .simulate('mouseover') // for our dumb optimization - .simulate('drag-n-drop', { - dx: $('th.fc-wed').width() * 2 // 2 days - }); + $('.fc-event').simulate('drag-n-drop', { + dx: $('th.fc-wed').width() * 2 // 2 days + }); }, function(event, delta, revertFunc) { expect(delta.days()).toBe(2); @@ -179,12 +171,12 @@ describe('eventDrop', function() { init( function() { - $('.fc-event') - .simulate('mouseover') // for our dumb optimization - .simulate('drag-n-drop', { - dx: $('th.fc-wed').width() * -1, - dy: $('.fc-agenda-allday').outerHeight() + $('.fc-agenda-divider').outerHeight() - }); + var allDayGrid = $('.fc-agenda-view .fc-day-grid'); + var hr = allDayGrid.next('hr'); + $('.fc-event').simulate('drag-n-drop', { + dx: $('th.fc-wed').width() * -1, + dy: allDayGrid.outerHeight() + hr.outerHeight() + }); }, function(event, delta, revertFunc) { expect(delta.days()).toBe(-1); @@ -221,28 +213,26 @@ describe('eventDrop', function() { init( function() { - eventElm = $('.fc-event') - .simulate('mouseover') // for our dumb optimization - .simulate('drag', { - dx: $('th.fc-wed').width() * -1, - dy: -$('.fc-agenda-allday').outerHeight(), - callback: function() { - // the all day slot works off of mouse-moving coordinates - var offset = eventElm.offset(); - $('.fc-agenda-allday .fc-day-content') - .simulate('mouseover', { - clientX: offset.left + 10, - clientY: offset.top + 10 - }) - .simulate('mousemove', { - clientX: offset.left + 10, - clientY: offset.top + 10 - }); - setTimeout(function() { - eventElm.simulate('drop'); - }, 100); - } - }); + eventElm = $('.fc-event .fc-time').simulate('drag', { // grabs the top of the event + dx: $('th.fc-wed').width() * -1, + dy: -$('.fc-agenda-view .fc-day-grid').outerHeight(), + callback: function() { + // the all day slot works off of mouse-moving coordinates + var offset = eventElm.offset(); + $('.fc-agenda-allday .fc-day-content') + .simulate('mouseover', { + clientX: offset.left + 10, + clientY: offset.top + 10 + }) + .simulate('mousemove', { + clientX: offset.left + 10, + clientY: offset.top + 10 + }); + setTimeout(function() { + eventElm.simulate('drop'); + }, 100); + } + }); }, function(event, delta, revertFunc) { expect(delta.days()).toBe(-1); @@ -280,16 +270,14 @@ describe('eventDrop', function() { init( function() { - eventElm = $('.fc-event') - .simulate('mouseover') // for our dumb optimization - .simulate('drag', { - dy: $('tr.fc-slot1').height() * 3, // 1.5 hours - callback: function() { - dragged = true; - expect(eventElm.find('.fc-event-time')).toHaveText('2:30'); - eventElm.simulate('drop'); - } - }); + eventElm = $('.fc-event .fc-time').simulate('drag', { + dy: $('.fc-slats tr:eq(1)').height() * 2.9, // 1.5 hours + callback: function() { + dragged = true; + expect($('.fc-event.fc-helper .fc-time')).toHaveText('2:30'); + eventElm.simulate('drop'); + } + }); }, function() { expect(dragged).toBe(true); @@ -315,16 +303,14 @@ describe('eventDrop', function() { init( function() { - eventElm = $('.fc-event') - .simulate('mouseover') // for our dumb optimization - .simulate('drag', { - dy: $('tr.fc-slot1').height() * 3, // 1.5 hours - callback: function() { - dragged = true; - expect(eventElm.find('.fc-event-time')).toHaveText('2:30 - 3:30'); - eventElm.simulate('drop'); - } - }); + eventElm = $('.fc-event .fc-time').simulate('drag', { + dy: $('.fc-slats tr:eq(1)').height() * 2.9, // 1.5 hours + callback: function() { + dragged = true; + expect($('.fc-event.fc-helper .fc-time')).toHaveText('2:30 - 3:30'); + eventElm.simulate('drop'); + } + }); }, function() { expect(dragged).toBe(true); diff --git a/tests/automated/event-resize.js b/tests/automated/event-resize.js index c903e02..17510bc 100644 --- a/tests/automated/event-resize.js +++ b/tests/automated/event-resize.js @@ -28,12 +28,10 @@ describe('eventResize', function() { init( function() { - $('.fc-event .ui-resizable-handle') - .simulate('mouseover') // for our dumb optimization - .simulate('drag-n-drop', { - dx: $('.fc-day').width() * -2, - dy: $('.fc-day').height() - }); + $('.fc-event .fc-resizer').simulate('drag-n-drop', { + dx: $('.fc-day').width() * -2.5, // guarantee 2 days to left + dy: $('.fc-day').height() + }); }, function(event, delta, revertFunc) { expect(delta.asDays()).toBe(5); @@ -62,7 +60,7 @@ describe('eventResize', function() { allDay: false } ]; options.eventAfterAllRender = function() { - expect($('.fc-event .ui-resizable-handle').length).toBe(0); + expect($('.fc-event .fc-resizer').length).toBe(0); done(); }; $('#cal').fullCalendar(options); @@ -85,11 +83,9 @@ describe('eventResize', function() { init( function() { - $('.fc-event .ui-resizable-handle') - .simulate('mouseover') // for our dumb optimization - .simulate('drag-n-drop', { - dx: $('th.fc-wed').width() * 1.5 // two days - }); + $('.fc-event .fc-resizer').simulate('drag-n-drop', { + dx: $('th.fc-wed').width() * 1.5 // two days + }); }, function(event, delta, revertFunc) { expect(delta.asDays()).toBe(2); @@ -123,11 +119,9 @@ describe('eventResize', function() { it('should have correct arguments with a timed delta', function(done) { init( function() { - $('.fc-event .ui-resizable-handle') - .simulate('mouseover') // for our dumb optimization - .simulate('drag-n-drop', { - dy: $('tr.fc-slot1').height() * 4.5 // 5 slots, so 2.5 hours - }); + $('.fc-event .fc-resizer').simulate('drag-n-drop', { + dy: $('.fc-slats tr:eq(1)').height() * 4.5 // 5 slots, so 2.5 hours + }); }, function(event, delta, revertFunc) { expect(delta.days()).toBe(0); @@ -153,30 +147,30 @@ describe('eventResize', function() { init( function() { - dy = $('tr.fc-slot1').height() * 4.5; // 5 slots, so 2.5 hours - handle = $('.fc-event .ui-resizable-handle') - .simulate('mouseover') // for our dumb optimization - .simulate('drag', { - dy: dy, - callback: function() { - expect($('.fc-event-time')).toHaveText('5:00 - 9:30'); - handle.simulate('drag', { - // BUG with jquery-simulate-ext - // I guess the delta is still relative to the original position, so should be zero. - // But zero causes nothing to happen, so make it a tiny non-zero delta. - dy: -1, + dy = $('.fc-slats tr:eq(1)').height() * 4.5; // 5 slots, so 2.5 hours + handle = $('.fc-event .fc-resizer').simulate('drag', { + dy: dy, + callback: function() { + expect($('.fc-event.fc-helper .fc-time')).toHaveText('5:00 - 9:30'); + handle.simulate('drag', { + // BUG with jquery-simulate-ext + // I guess the delta is still relative to the original position, so should be zero. + // But zero causes nothing to happen, so make it a tiny non-zero delta. + dy: -1, - callback: function() { - expect($('.fc-event-time')).toHaveText('5:00 - 7:00'); - handle.simulate('drop', { - callback: function() { - done(); - } - }); - } - }); - } - }); + callback: function() { + expect($('.fc-event.fc-helper')).not.toExist(); + expect($('.fc-event')).toBeVisible(); + expect($('.fc-event .fc-time')).toHaveText('5:00 - 7:00'); + handle.simulate('drop', { + callback: function() { + done(); + } + }); + } + }); + } + }); }, function() { // this wasn't firing for some reason. do it in the drop callback instead @@ -186,23 +180,29 @@ describe('eventResize', function() { }); it('should not fire the windowResize handler', function(done) { // bug 1116 - options.windowResize = function() { }; + + // has to do this crap because PhantomJS was trigger false window resizes unrelated to the fc-event resize + var isDragging = false; + var calledWhileDragging = false; + options.windowResizeDelay = 0; - spyOn(options, 'windowResize'); + options.windowResize = function(ev) { + if (isDragging) { + calledWhileDragging = true; + } + }; + init( function() { - $('.fc-event .ui-resizable-handle') - .simulate('mouseover') // for our dumb optimization - .simulate('drag-n-drop', { - dy: 200, - interpolation: { - stepCount: 10, - duration: 100 - } + setTimeout(function() { + isDragging = true; + $('.fc-event .fc-resizer').simulate('drag-n-drop', { + dy: 100 }); + }, 100); // hack for PhantomJS. after any initial false window resizes }, - function() { // if an unintended rerender happened, won't get here anyway - expect(options.windowResize).not.toHaveBeenCalled(); + function() { + expect(calledWhileDragging).toBe(false); done(); } ); @@ -224,30 +224,30 @@ describe('eventResize', function() { init( function() { - dy = $('tr.fc-slot1').height() * 4.5; // 5 slots, so 2.5 hours - handle = $('.fc-event .ui-resizable-handle') - .simulate('mouseover') // for our dumb optimization - .simulate('drag', { - dy: dy, - callback: function() { - expect($('.fc-event-time')).toHaveText('5:00 - 9:30'); - handle.simulate('drag', { - // BUG with jquery-simulate-ext - // I guess the delta is still relative to the original position, so should be zero. - // But zero causes nothing to happen, so make it a tiny non-zero delta. - dy: -1, + dy = $('.fc-slats tr:eq(1)').height() * 4.5; // 5 slots, so 2.5 hours + handle = $('.fc-event .fc-resizer').simulate('drag', { + dy: dy, + callback: function() { + expect($('.fc-event.fc-helper .fc-time')).toHaveText('5:00 - 9:30'); + handle.simulate('drag', { + // BUG with jquery-simulate-ext + // I guess the delta is still relative to the original position, so should be zero. + // But zero causes nothing to happen, so make it a tiny non-zero delta. + dy: -1, - callback: function() { - expect($('.fc-event-time')).toHaveText('5:00'); - handle.simulate('drop', { - callback: function() { - done(); - } - }); - } - }); - } - }); + callback: function() { + expect($('.fc-event.fc-helper')).not.toExist(); + expect($('.fc-event')).toBeVisible(); + expect($('.fc-event .fc-time')).toHaveText('5:00'); + handle.simulate('drop', { + callback: function() { + done(); + } + }); + } + }); + } + }); }, function() { // this wasn't firing for some reason. do it in the drop callback instead diff --git a/tests/automated/formatRange.js b/tests/automated/formatRange.js index a6c2341..2796566 100644 --- a/tests/automated/formatRange.js +++ b/tests/automated/formatRange.js @@ -116,7 +116,7 @@ describe('formatRange', function() { isRTL: true, titleFormat: 'MMMM Do YYYY' }); - expect($('.fc-header-title h2')).toHaveText('May 24th - 18th 2014'); + expect($('.fc-toolbar h2')).toHaveText('May 24th - 18th 2014'); }); }); @@ -131,7 +131,7 @@ describe('formatRange', function() { lang: 'fr', titleFormat: 'dddd MMMM D YYYY' }); - expect($('.fc-header-title h2')).toHaveText('lundi mai 19 - dimanche mai 25 2014'); + expect($('.fc-toolbar h2')).toHaveText('lundi mai 19 - dimanche mai 25 2014'); }); }); diff --git a/tests/automated/header-navigation.js b/tests/automated/header-navigation.js index 99cef28..5e8fc79 100644 --- a/tests/automated/header-navigation.js +++ b/tests/automated/header-navigation.js @@ -16,7 +16,7 @@ describe('header navigation', function() { describe('and click next', function() { it('should change view to next month', function() { $('#calendar').fullCalendar('gotoDate', '2010-02-01'); - $('.fc-button-next').simulate('click'); + $('.fc-next-button').simulate('click'); var newDate = $('#calendar').fullCalendar('getDate'); expect(newDate).toEqualMoment('2010-03-01'); }); @@ -25,7 +25,7 @@ describe('header navigation', function() { describe('and click prev', function() { it('should change view to prev month', function() { $('#calendar').fullCalendar('gotoDate', '2010-02-01'); - $('.fc-button-prev').simulate('click'); + $('.fc-prev-button').simulate('click'); var newDate = $('#calendar').fullCalendar('getDate'); expect(newDate).toEqualMoment('2010-01-01'); }); @@ -34,7 +34,7 @@ describe('header navigation', function() { describe('and click prevYear', function() { it('should change view to prev month', function() { $('#calendar').fullCalendar('gotoDate', '2010-02-01'); - $('.fc-button-prevYear').simulate('click'); + $('.fc-prevYear-button').simulate('click'); var newDate = $('#calendar').fullCalendar('getDate'); expect(newDate).toEqualMoment('2009-02-01'); }); @@ -43,7 +43,7 @@ describe('header navigation', function() { describe('and click nextYear', function() { it('should change view to prev month', function() { $('#calendar').fullCalendar('gotoDate', '2010-02-01'); - $('.fc-button-nextYear').simulate('click'); + $('.fc-nextYear-button').simulate('click'); var newDate = $('#calendar').fullCalendar('getDate'); expect(newDate).toEqualMoment('2011-02-01'); }); @@ -52,7 +52,7 @@ describe('header navigation', function() { describe('and click today', function() { it('should change view to prev month', function() { $('#calendar').fullCalendar('gotoDate', '2010-02-01'); - $('.fc-button-today').simulate('click'); + $('.fc-today-button').simulate('click'); var newDate = $('#calendar').fullCalendar('getDate'); expect(newDate).toEqualNow(); }); diff --git a/tests/automated/header-rendering.js b/tests/automated/header-rendering.js index 82cdbed..b6aea89 100644 --- a/tests/automated/header-rendering.js +++ b/tests/automated/header-rendering.js @@ -8,24 +8,23 @@ describe('header rendering', function() { describe('when using default header options', function() { it('should have title as default on left', function() { $('#calendar').fullCalendar(); - var headr = $('#calendar > table.fc-header .fc-header-left > span')[0]; - expect(headr).toHaveClass('fc-header-title'); + expect($('#calendar > .fc-toolbar > .fc-left > *')).toBeMatchedBy('h2') }); it('should have empty center', function() { $('#calendar').fullCalendar(); - var cntr = $('#calendar > table.fc-header .fc-header-center')[0]; - expect(cntr).toBeEmpty(); + var center = $('#calendar > .fc-toolbar > .fc-center'); + expect(center).toBeEmpty(); }); it('should have right with today|space|left|right', function() { $('#calendar').fullCalendar(); - var td = $('#calendar > table.fc-header .fc-header-right > span')[0]; - var sp = $('#calendar > table.fc-header .fc-header-right > span')[1]; - var lft = $('#calendar > table.fc-header .fc-header-right > span')[2]; - var rt = $('#calendar > table.fc-header .fc-header-right > span')[3]; - expect(td).toHaveClass('fc-button-today'); - expect(sp).toHaveClass('fc-header-space'); - expect(lft).toHaveClass('fc-button-prev'); - expect(rt).toHaveClass('fc-button-next'); + var rightChildren = $('#calendar > .fc-toolbar > .fc-right > *');; + var todayButton = rightChildren.eq(0); + var buttonGroup = rightChildren.eq(1); + var prevNextButtons = buttonGroup.children(); + expect(todayButton).toHaveClass('fc-today-button'); + expect(buttonGroup).toHaveClass('fc-button-group'); + expect(prevNextButtons.eq(0)).toHaveClass('fc-prev-button'); + expect(prevNextButtons.eq(1)).toHaveClass('fc-next-button'); }); }); @@ -41,26 +40,19 @@ describe('header rendering', function() { $('#calendar').fullCalendar(options); }); it('should have title on the right', function() { - var item = $('#calendar > table.fc-header .fc-header-right > span')[0]; - expect(item).toHaveClass('fc-header-title'); + expect($('#calendar > .fc-toolbar > .fc-right > *')).toBeMatchedBy('h2'); }); it('should have next|prev on left', function() { - var nxt = $('#calendar > table.fc-header .fc-header-left > span')[0]; - var prv = $('#calendar > table.fc-header .fc-header-left > span')[1]; - expect(nxt).toHaveClass('fc-button-next'); - expect(prv).toHaveClass('fc-button-prev'); + var buttonGroup = $('#calendar > .fc-toolbar > .fc-left > *'); + var prevNextButtons = buttonGroup.children(); + expect(prevNextButtons.eq(0)).toHaveClass('fc-next-button'); + expect(prevNextButtons.eq(1)).toHaveClass('fc-prev-button'); }); it('should have prevYear|space|today|space|nextYear in center', function() { - var py = $('#calendar > table.fc-header .fc-header-center > span')[0]; - var sp1 = $('#calendar > table.fc-header .fc-header-center > span')[1]; - var td = $('#calendar > table.fc-header .fc-header-center > span')[2]; - var sp2 = $('#calendar > table.fc-header .fc-header-center > span')[3]; - var ny = $('#calendar > table.fc-header .fc-header-center > span')[4]; - expect(py).toHaveClass('fc-button-prevYear'); - expect(sp1).toHaveClass('fc-header-space'); - expect(td).toHaveClass('fc-button-today'); - expect(sp2).toHaveClass('fc-header-space'); - expect(ny).toHaveClass('fc-button-nextYear'); + var items = $('#calendar > .fc-toolbar > .fc-center > *'); + expect(items.eq(0)).toHaveClass('fc-prevYear-button'); + expect(items.eq(1)).toHaveClass('fc-today-button'); + expect(items.eq(2)).toHaveClass('fc-nextYear-button'); }); }); @@ -72,8 +64,7 @@ describe('header rendering', function() { $('#calendar').fullCalendar(options); }); it('should not have header table', function() { - var headerTableCount = $('table.fc-header').length; - expect(headerTableCount).toEqual(0); + expect($('.fc-toolbar')).not.toBeInDOM(); }); }); @@ -92,16 +83,16 @@ describe('header rendering', function() { }); }); it('should have prev in left', function() { - var fcHeaderLeft = $('#calendar').find('.fc-header-left')[0]; - expect(fcHeaderLeft).toContainElement('.fc-button-prev'); + var fcHeaderLeft = $('#calendar .fc-toolbar > .fc-left'); + expect(fcHeaderLeft).toContainElement('.fc-prev-button'); }); it('should have today in center', function() { - var fcHeaderCenter = $('#calendar').find('.fc-header-center')[0]; - expect(fcHeaderCenter).toContainElement('.fc-button-today'); + var fcHeaderCenter = $('#calendar .fc-toolbar > .fc-center'); + expect(fcHeaderCenter).toContainElement('.fc-today-button'); }); it('should have next in right', function() { - var fcHeaderRight = $('#calendar').find('.fc-header-right')[0]; - expect(fcHeaderRight).toContainElement('.fc-button-next'); + var fcHeaderRight = $('#calendar .fc-toolbar > .fc-right'); + expect(fcHeaderRight).toContainElement('.fc-next-button'); }); }); }); diff --git a/tests/automated/height.js b/tests/automated/height.js index 620de1c..cce8441 100644 --- a/tests/automated/height.js +++ b/tests/automated/height.js @@ -9,7 +9,7 @@ describe('height', function() { it('should use default height based on default aspect ratio of 1:35', function() { $('#cal').width(1350); $('#cal').fullCalendar(); - var height = $('.fc-content').height(); + var height = $('.fc-view-container').height(); expect(height).toEqual(1000); }); }); diff --git a/tests/automated/maxTime.js b/tests/automated/maxTime.js index 91493c2..c0eb550 100644 --- a/tests/automated/maxTime.js +++ b/tests/automated/maxTime.js @@ -21,7 +21,7 @@ describe('maxTime', function() { defaultView: 'agendaWeek' }; $('#cal').fullCalendar(options); - var lastSlotText = $('.fc-agenda-slots tr:not(.fc-minor):last th').text(); + var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); expect(lastSlotText).toEqual('11pm'); }); }); @@ -32,7 +32,7 @@ describe('maxTime', function() { defaultView: 'agendaDay' }; $('#cal').fullCalendar(options); - var lastSlotText = $('.fc-agenda-slots tr:not(.fc-minor):last th').text(); + var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); expect(lastSlotText).toEqual('11pm'); }); }); @@ -53,7 +53,7 @@ describe('maxTime', function() { maxTime: { hours: hourNumber } }; $('#cal2').fullCalendar(options); - var lastSlotText = $('.fc-agenda-slots tr:not(.fc-minor):last th').text(); + var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); var expected = numToStringConverter(hourNumber - 1); expect(lastSlotText).toEqual(expected); }); @@ -71,7 +71,7 @@ describe('maxTime', function() { maxTime: hourNumber + ':00' // in addition, test string duration input }; $('#cal2').fullCalendar(options); - var lastSlotText = $('.fc-agenda-slots tr:not(.fc-minor):last th').text(); + var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); var expected = numToStringConverter(hourNumber - 1); expect(lastSlotText).toEqual(expected); }); @@ -94,7 +94,7 @@ describe('maxTime', function() { maxTime: { hours: hourNumber, minutes: 20 } }; $('#cal2').fullCalendar(options); - var lastSlotText = $('.fc-agenda-slots tr:not(.fc-minor):last th').text(); + var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); // since exclusive end is :20, last slot will be on the current hour's 00:00 var expected = numToStringConverter(hourNumber); expect(lastSlotText).toEqual(expected); @@ -113,7 +113,7 @@ describe('maxTime', function() { maxTime: { hours: hourNumber, minutes: 20 } }; $('#cal2').fullCalendar(options); - var lastSlotText = $('.fc-agenda-slots tr:not(.fc-minor):last th').text(); + var lastSlotText = $('.fc-slats tr:not(.fc-minor):last .fc-time').text(); // since exclusive end is :20, last slot will be on the current hour's 00:00 var expected = numToStringConverter(hourNumber); expect(lastSlotText).toEqual(expected); diff --git a/tests/automated/minTime.js b/tests/automated/minTime.js index 36bf9ca..76c7593 100644 --- a/tests/automated/minTime.js +++ b/tests/automated/minTime.js @@ -21,7 +21,7 @@ describe('minTime', function() { defaultView: 'agendaWeek' }; $('#cal').fullCalendar(options); - var firstSlotText = $('.fc-slot0 th').text(); + var firstSlotText = $('.fc-slats tr:eq(0) .fc-time').text(); expect(firstSlotText).toEqual('12am'); }); }); @@ -32,7 +32,7 @@ describe('minTime', function() { defaultView: 'agendaDay' }; $('#cal').fullCalendar(options); - var firstSlotText = $('.fc-slot0 th').text(); + var firstSlotText = $('.fc-slats tr:eq(0) .fc-time').text(); expect(firstSlotText).toEqual('12am'); }); }); @@ -53,7 +53,7 @@ describe('minTime', function() { minTime: { hours: hourNumber } }; $('#cal2').fullCalendar(options); - var firstSlotText = $('.fc-slot0 th').text(); + var firstSlotText = $('.fc-slats tr:eq(0) .fc-time').text(); var expected = numToStringConverter(hourNumber); expect(firstSlotText).toEqual(expected); }); @@ -71,7 +71,7 @@ describe('minTime', function() { minTime: hourNumber + ':00' // in addition, test string duration input }; $('#cal2').fullCalendar(options); - var firstSlotText = $('.fc-slot0 th').text(); + var firstSlotText = $('.fc-slats tr:eq(0) .fc-time').text(); var expected = numToStringConverter(hourNumber); expect(firstSlotText).toEqual(expected); }); @@ -94,12 +94,10 @@ describe('minTime', function() { minTime: { hours: hourNumber, minutes: 20 } }; $('#cal2').fullCalendar(options); - var firstSlotElement = $('.fc-slot0')[0]; - var secondSlotElement = $('.fc-slot1')[0]; - var thirdSlotElement = $('.fc-slot2')[0]; - expect(firstSlotElement).toHaveClass('fc-minor'); - expect(secondSlotElement).toHaveClass('fc-minor'); - expect(thirdSlotElement).toHaveClass('fc-minor'); + var slatRows = $('.fc-slats tr'); + expect(slatRows.eq(0)).toHaveClass('fc-minor'); + expect(slatRows.eq(1)).toHaveClass('fc-minor'); + expect(slatRows.eq(2)).toHaveClass('fc-minor'); // TODO: fix bad behavior in src where no slots have text }); }); @@ -116,12 +114,10 @@ describe('minTime', function() { minTime: { hours: hourNumber, minutes: 20 } }; $('#cal2').fullCalendar(options); - var firstSlotElement = $('.fc-slot0')[0]; - var secondSlotElement = $('.fc-slot1')[0]; - var thirdSlotElement = $('.fc-slot2')[0]; - expect(firstSlotElement).toHaveClass('fc-minor'); - expect(secondSlotElement).toHaveClass('fc-minor'); - expect(thirdSlotElement).toHaveClass('fc-minor'); + var slatRows = $('.fc-slats tr'); + expect(slatRows.eq(0)).toHaveClass('fc-minor'); + expect(slatRows.eq(1)).toHaveClass('fc-minor'); + expect(slatRows.eq(2)).toHaveClass('fc-minor'); // TODO: fix bad behavior in src where no slots have text }); }); diff --git a/tests/automated/monthNames.js b/tests/automated/monthNames.js index e87eba4..d5fb28c 100644 --- a/tests/automated/monthNames.js +++ b/tests/automated/monthNames.js @@ -30,7 +30,7 @@ describe('month name', function() { it('should be ' + month, function(done) { settings.defaultDate = $.fullCalendar.moment(referenceDate).add('months', index); settings.eventAfterAllRender = function() { - expect($('.fc-header-title')[0]).toContainText(month); + expect($('.fc-toolbar h2')).toContainText(month); done(); }; @@ -54,10 +54,10 @@ describe('month name', function() { settings.defaultDate = $.fullCalendar.moment(referenceDate).add('months', index); settings.eventAfterAllRender = function() { if (viewClass == 'month') { // with month view check for occurence of the monthname in the title - expect($('.fc-header-title')[0]).toContainText(langMonth); + expect($('.fc-toolbar h2')).toContainText(langMonth); } else { // with day views ensure that title contains the properly formatted phrase - expect($('.fc-header-title')[0]).toHaveText(settings.defaultDate.format('LL')); + expect($('.fc-toolbar h2')).toHaveText(settings.defaultDate.format('LL')); } done(); }; @@ -89,7 +89,7 @@ describe('month name', function() { settings.defaultDate = $.fullCalendar.moment(referenceDate).add('months', index); settings.monthNames = months; settings.eventAfterAllRender = function() { - expect($('.fc-header-title')[0]).toContainText(month); + expect($('.fc-toolbar h2')).toContainText(month); done(); }; diff --git a/tests/automated/monthNamesShort.js b/tests/automated/monthNamesShort.js index bafd98d..a340040 100644 --- a/tests/automated/monthNamesShort.js +++ b/tests/automated/monthNamesShort.js @@ -30,7 +30,7 @@ describe('short month name', function() { it('should be ' + monthShort, function(done) { settings.defaultDate = $.fullCalendar.moment(referenceDate).add('months', index); settings.eventAfterAllRender = function() { - expect($('.fc-header-title')[0]).toContainText(monthShort); + expect($('.fc-toolbar h2')).toContainText(monthShort); done(); }; @@ -53,7 +53,7 @@ describe('short month name', function() { settings.defaultDate = $.fullCalendar.moment(referenceDate).add('months', index); settings.eventAfterAllRender = function() { - expect($('.fc-header-title')[0]).toContainText(langMonthShort); + expect($('.fc-toolbar h2')).toContainText(langMonthShort); done(); }; @@ -84,7 +84,7 @@ describe('short month name', function() { settings.defaultDate = $.fullCalendar.moment(referenceDate).add('months', index); settings.monthNamesShort = monthsShort; settings.eventAfterAllRender = function() { - expect($('.fc-header-title')[0]).toContainText(monthShort); + expect($('.fc-toolbar h2')).toContainText(monthShort); done(); }; diff --git a/tests/automated/now.js b/tests/automated/now.js index 6fdf9cc..2ab1106 100644 --- a/tests/automated/now.js +++ b/tests/automated/now.js @@ -30,7 +30,7 @@ describe('now', function() { options.now = '2014-04-29T12:00:00'; $('#cal').fullCalendar(options); var todayCell = $('#cal td.fc-today'); - expect(todayCell).toHaveClass('fc-col2'); // no date metadata, but we know which column # + expect(todayCell.data('date')).toBe('2014-04-29'); }); }); diff --git a/tests/automated/scrollTime.js b/tests/automated/scrollTime.js index 495ca75..586a203 100644 --- a/tests/automated/scrollTime.js +++ b/tests/automated/scrollTime.js @@ -13,9 +13,9 @@ describe('scrollTime', function() { options.scrollTime = '02:00:00'; options.height = 400; // short enough to make scrolling happen $('#cal').fullCalendar(options); - var slotCell = $('.fc-slot4 td'); // 2am slot + var slotCell = $('.fc-slats tr:eq(4)'); // 2am slot var slotTop = slotCell.position().top; - var scrollContainer = $('.fc-agenda-slots').parent().parent(); + var scrollContainer = $('.fc-time-grid-container'); var scrollTop = scrollContainer.scrollTop(); var diff = Math.abs(slotTop - scrollTop); expect(slotTop).toBeGreaterThan(0); @@ -27,9 +27,9 @@ describe('scrollTime', function() { options.scrollTime = { hours: 2 }; options.height = 400; // short enough to make scrolling happen $('#cal').fullCalendar(options); - var slotCell = $('.fc-slot4 td'); // 2am slot + var slotCell = $('.fc-slats tr:eq(4)'); // 2am slot var slotTop = slotCell.position().top; - var scrollContainer = $('.fc-agenda-slots').parent().parent(); + var scrollContainer = $('.fc-time-grid-container'); var scrollTop = scrollContainer.scrollTop(); var diff = Math.abs(slotTop - scrollTop); expect(slotTop).toBeGreaterThan(0); diff --git a/tests/automated/select-callback.js b/tests/automated/select-callback.js index 00818d7..3f31648 100644 --- a/tests/automated/select-callback.js +++ b/tests/automated/select-callback.js @@ -85,7 +85,7 @@ describe('select callback', function() { }; spyOn(options, 'select').and.callThrough(); $('#cal').fullCalendar(options); - $('.fc-agenda-allday .fc-day-content').simulate('drag-n-drop', { // middle will be 2014-05-28 + $('.fc-agenda-view .fc-day-grid .fc-day:eq(3)').simulate('drag-n-drop', { // will be 2014-05-28 for LTR and RTL dx: $('.fc-sun').outerWidth() * (isRTL ? -1 : 1), // the width of one column callback: function() { expect(options.select).toHaveBeenCalled(); @@ -106,7 +106,7 @@ describe('select callback', function() { }; spyOn(options, 'select').and.callThrough(); $('#cal').fullCalendar(options); - $('.fc-agenda-allday .fc-day-content').simulate('drag-n-drop', { // middle will be 2014-05-28 + $('.fc-agenda-view .fc-day-grid .fc-day:eq(3)').simulate('drag-n-drop', { // will be 2014-05-28 for LTR and RTL callback: function() { expect(options.select).toHaveBeenCalled(); done(); @@ -128,8 +128,8 @@ describe('select callback', function() { }; spyOn(options, 'select').and.callThrough(); $('#cal').fullCalendar(options); - $('tr.fc-slot18 td').simulate('drag-n-drop', { // middle will be 2014-05-28T09:00:00 - dy: $('tr.fc-slot18 td').outerHeight() * 2, // move down two slots + $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag-n-drop', { // middle will be 2014-05-28T09:00:00 + dy: $('.fc-slats tr:eq(18)').outerHeight() * 2, // move down two slots callback: function() { expect(options.select).toHaveBeenCalled(); done(); @@ -149,7 +149,7 @@ describe('select callback', function() { }; spyOn(options, 'select').and.callThrough(); $('#cal').fullCalendar(options); - $('tr.fc-slot18 td').simulate('drag-n-drop', { // middle will be 2014-05-28T09:00:00 + $('.fc-slats tr:eq(18) td:not(.fc-time)').simulate('drag-n-drop', { // middle will be 2014-05-28T09:00:00 callback: function() { expect(options.select).toHaveBeenCalled(); done(); diff --git a/tests/automated/select-method.js b/tests/automated/select-method.js index 9c04e20..63299d4 100644 --- a/tests/automated/select-method.js +++ b/tests/automated/select-method.js @@ -36,12 +36,12 @@ describe('select method', function() { it('renders a selection', function() { $('#cal').fullCalendar(options); $('#cal').fullCalendar('select', '2014-05-07', '2014-05-09'); - expect($('.fc-cell-overlay')).toBeVisible(); + expect($('.fc-highlight')).toBeVisible(); }); it('renders a selection when called with one argument', function() { $('#cal').fullCalendar(options); $('#cal').fullCalendar('select', '2014-05-07'); - expect($('.fc-cell-overlay')).toBeVisible(); + expect($('.fc-highlight')).toBeVisible(); }); it('fires a selection event', function() { options.select = function(start, end) { @@ -60,7 +60,7 @@ describe('select method', function() { it('doesn\'t render a selection', function() { $('#cal').fullCalendar(options); $('#cal').fullCalendar('select', '2015-05-07', '2015-05-09'); - expect($('.fc-cell-overlay')).not.toBeVisible(); + expect($('.fc-highlight')).not.toBeVisible(); }); /* TODO: implement this behavior @@ -81,7 +81,7 @@ describe('select method', function() { it('renders a selection', function() { $('#cal').fullCalendar(options); $('#cal').fullCalendar('select', '2014-05-07T06:00:00', '2014-05-09T07:00:00'); - expect($('.fc-cell-overlay')).toBeVisible(); + expect($('.fc-highlight')).toBeVisible(); }); it('fires a selection event', function() { options.select = function(start, end) { @@ -108,15 +108,14 @@ describe('select method', function() { it('renders a selection when called with one argument', function() { $('#cal').fullCalendar(options); $('#cal').fullCalendar('select', '2014-05-26T06:00:00'); - expect($('.fc-cell-overlay')).toBeVisible(); + expect($('.fc-highlight')).toBeVisible(); }); it('renders a selection over the slot area', function() { $('#cal').fullCalendar(options); $('#cal').fullCalendar('select', '2014-05-26T06:00:00', '2014-05-26T08:00:00'); - expect($('.fc-cell-overlay')).toBeVisible(); - var slotArea = $('.fc-agenda-slots').parent().parent(); - var slotAreaTop = slotArea.offset().top; - var overlayTop = $('.fc-cell-overlay').offset().top; + expect($('.fc-highlight')).toBeVisible(); + var slotAreaTop = $('.fc-time-grid-container').offset().top; + var overlayTop = $('.fc-highlight').offset().top; expect(overlayTop).toBeGreaterThan(slotAreaTop); }); }); @@ -124,7 +123,7 @@ describe('select method', function() { it('doesn\'t render a selection', function() { $('#cal').fullCalendar(options); $('#cal').fullCalendar('select', '2015-05-26T06:00:00', '2015-05-26T07:00:00'); - expect($('.fc-cell-overlay')).not.toBeVisible(); + expect($('.fc-highlight')).not.toBeVisible(); }); /* TODO: implement this behavior @@ -149,10 +148,9 @@ describe('select method', function() { it('renders a selection over the day area', function() { $('#cal').fullCalendar(options); $('#cal').fullCalendar('select', '2014-05-26', '2014-05-28'); - expect($('.fc-cell-overlay')).toBeVisible(); - var slotArea = $('.fc-agenda-slots').parent().parent(); - var slotAreaTop = slotArea.offset().top; - var overlayTop = $('.fc-cell-overlay').offset().top; + expect($('.fc-highlight')).toBeVisible(); + var slotAreaTop = $('.fc-time-grid-container').offset().top; + var overlayTop = $('.fc-highlight').offset().top; expect(overlayTop).toBeLessThan(slotAreaTop); }); it('fires a selection event', function() { @@ -175,7 +173,7 @@ describe('select method', function() { it('doesn\'t render', function() { $('#cal').fullCalendar(options); $('#cal').fullCalendar('select', '2014-05-26', '2014-05-28'); - expect($('.fc-cell-overlay')).not.toBeVisible(); + expect($('.fc-highlight')).not.toBeVisible(); }); /* TODO: implement diff --git a/tests/automated/slotDuration.js b/tests/automated/slotDuration.js index 36c0c7c..d7cd87e 100644 --- a/tests/automated/slotDuration.js +++ b/tests/automated/slotDuration.js @@ -14,7 +14,7 @@ describe('slotDuration', function() { defaultView: 'agendaWeek' }; $('#cal').fullCalendar(options); - var slotCount = $('.fc-agenda-slots tr').length; + var slotCount = $('.fc-slats tr').length; expect(slotCount).toEqual(Math.ceil(minutesInADay / 30)); }); }); @@ -24,7 +24,7 @@ describe('slotDuration', function() { defaultView: 'agendaDay' }; $('#cal').fullCalendar(options); - var slotCount = $('.fc-agenda-slots tr').length; + var slotCount = $('.fc-slats tr').length; expect(slotCount).toEqual(Math.ceil(minutesInADay / 30)); }); }); @@ -37,7 +37,7 @@ describe('slotDuration', function() { defaultView: 'agendaWeek' }; $('#cal').fullCalendar(options); - var slotCount = $('.fc-agenda-slots tr').length; + var slotCount = $('.fc-slats tr').length; expect(slotCount).toEqual(Math.ceil(minutesInADay / 30)); }); }); @@ -47,7 +47,7 @@ describe('slotDuration', function() { defaultView: 'agendaDay' }; $('#cal').fullCalendar(options); - var slotCount = $('.fc-agenda-slots tr').length; + var slotCount = $('.fc-slats tr').length; expect(slotCount).toEqual(Math.ceil(minutesInADay / 30)); }); }); @@ -68,7 +68,7 @@ describe('slotDuration', function() { slotDuration: { minutes: slotMinutes } }; $('#cal2').fullCalendar(options); - var slotCount = $('.fc-agenda-slots tr').length; + var slotCount = $('.fc-slats tr').length; var expected = Math.ceil(minutesInADay / slotMinutes); expect(slotCount).toEqual(expected); }); @@ -86,7 +86,7 @@ describe('slotDuration', function() { slotDuration: { minutes: slotMinutes } }; $('#cal2').fullCalendar(options); - var slotCount = $('.fc-agenda-slots tr').length; + var slotCount = $('.fc-slats tr').length; var expected = Math.ceil(minutesInADay / slotMinutes); expect(slotCount).toEqual(expected); }); diff --git a/tests/automated/timeFormat.js b/tests/automated/timeFormat.js index 551d612..bca652d 100644 --- a/tests/automated/timeFormat.js +++ b/tests/automated/timeFormat.js @@ -15,7 +15,7 @@ describe('timeFormat', function() { }); function getRenderedEventTime() { - return $('.fc-event-time:first').text(); + return $('.fc-event:first .fc-time').text(); } describe('when in month view', function() { diff --git a/tests/automated/titleFormat.js b/tests/automated/titleFormat.js index ad5030e..a6277ce 100644 --- a/tests/automated/titleFormat.js +++ b/tests/automated/titleFormat.js @@ -1,6 +1,6 @@ describe('titleFormat', function() { - var SELECTOR = '.fc-header-title h2'; + var SELECTOR = '.fc-toolbar h2'; beforeEach(function() { affix('#cal'); diff --git a/tests/automated/weekMode.js b/tests/automated/weekMode.js index 3d891f3..c6a755b 100644 --- a/tests/automated/weekMode.js +++ b/tests/automated/weekMode.js @@ -5,9 +5,6 @@ describe('weekMode', function() { affix('#cal'); }); - // - // Remember gotoDate uses month base 0 - // describe('when weekMode is default', function() { beforeEach(function() { $('#cal').fullCalendar(); @@ -29,11 +26,14 @@ describe('weekMode', function() { }); it('should not change height whether 4,5 or weeks', function() { $('#cal').fullCalendar('gotoDate', '2009-02-01'); - var fourWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var fourWeekHeight = $('.fc-week:first').outerHeight(); $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var fiveWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var fiveWeekHeight = $('.fc-week:first').outerHeight(); $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var sixWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var sixWeekHeight = $('.fc-week:first').outerHeight(); + expect(fourWeekHeight).toBeGreaterThan(0); + expect(fiveWeekHeight).toBeGreaterThan(0); + expect(sixWeekHeight).toBeGreaterThan(0); expect(fourWeekHeight).toEqual(fiveWeekHeight); expect(fiveWeekHeight).toEqual(sixWeekHeight); }); @@ -85,30 +85,30 @@ describe('weekMode', function() { }); it('should increase height when moving from 6 week to 5 weeks', function() { $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var fiveWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var fiveWeekHeight = $('.fc-week:first').outerHeight(); $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var sixWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var sixWeekHeight = $('.fc-week:first').outerHeight(); expect(fiveWeekHeight).toBeGreaterThan(sixWeekHeight); }); it('should reduce height when moving from 5 weeks to 6 weeks', function() { $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var sixWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var sixWeekHeight = $('.fc-week:first').outerHeight(); $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var fiveWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var fiveWeekHeight = $('.fc-week:first').outerHeight(); expect(fiveWeekHeight).toBeGreaterThan(sixWeekHeight); }); it('should increase height when moving from 5 weeks to 4 weeks', function() { $('#cal').fullCalendar('gotoDate', '2013-05-01'); - var fiveWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var fiveWeekHeight = $('.fc-week:first').outerHeight(); $('#cal').fullCalendar('gotoDate', '2009-02-01'); - var fourWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var fourWeekHeight = $('.fc-week:first').outerHeight(); expect(fourWeekHeight).toBeGreaterThan(fiveWeekHeight); }); it('should reduce height when moving from 4 weeks to 5 weeks', function() { $('#cal').fullCalendar('gotoDate', '2009-02-01'); - var fourWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var fourWeekHeight = $('.fc-week:first').outerHeight(); $('#cal').fullCalendar('gotoDate', '2013-05-01'); - var fiveWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var fiveWeekHeight = $('.fc-week:first').outerHeight(); expect(fourWeekHeight).toBeGreaterThan(fiveWeekHeight); }); }); @@ -145,11 +145,14 @@ describe('weekMode', function() { }); it('should not change height whether 4,5 or weeks', function() { $('#cal').fullCalendar('gotoDate', '2009-02-01'); - var fourWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var fourWeekHeight = $('.fc-week:first').outerHeight(); $('#cal').fullCalendar('gotoDate', '2013-10-01'); - var fiveWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var fiveWeekHeight = $('.fc-week:first').outerHeight(); $('#cal').fullCalendar('gotoDate', '2013-06-01'); - var sixWeekHeight = parseInt($('.fc-week.fc-first .fc-first.fc-day div').css('min-height'), 10); + var sixWeekHeight = $('.fc-week:first').outerHeight(); + expect(fourWeekHeight).toBeGreaterThan(0); + expect(fiveWeekHeight).toBeGreaterThan(0); + expect(sixWeekHeight).toBeGreaterThan(0); expect(fourWeekHeight).toEqual(fiveWeekHeight); expect(fiveWeekHeight).toEqual(sixWeekHeight); }); diff --git a/tests/automated/weekNumberCalculation.js b/tests/automated/weekNumberCalculation.js index 25a8879..274364f 100644 --- a/tests/automated/weekNumberCalculation.js +++ b/tests/automated/weekNumberCalculation.js @@ -11,7 +11,7 @@ describe('weekNumberCalculation', function() { function getRenderedWeekNumber() { // works for both kinds of views - var text = $('.fc-agenda-axis.fc-week-number, .fc-week:first .fc-week-number').text(); + var text = $('.fc-agenda-view .fc-week-number, .fc-week:first .fc-content-skeleton .fc-week-number').text(); return parseInt(text.replace(/\D/g, ''), 10); } diff --git a/tests/automated/weekNumbers.js b/tests/automated/weekNumbers.js index 1613346..3bd6d1a 100644 --- a/tests/automated/weekNumbers.js +++ b/tests/automated/weekNumbers.js @@ -12,7 +12,7 @@ describe('weekNumbers', function() { $('#cal').fullCalendar({ defaultView: 'month' }); - var weekNumbersCount = $('.fc-week-number').length; + var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; expect(weekNumbersCount).toEqual(0); }); }); @@ -23,7 +23,7 @@ describe('weekNumbers', function() { defaultView: 'month', weekNumbers: false }); - var weekNumbersCount = $('.fc-week-number').length; + var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; expect(weekNumbersCount).toEqual(0); }); }); @@ -35,9 +35,8 @@ describe('weekNumbers', function() { weekNumbers: true, weekMode: 'fixed' // will make 6 rows }); - var weekNumbersCount = $('.fc-week-number').length; - // 1 is the header row, the other 6 are the rows - expect(weekNumbersCount).toEqual(7); + var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; + expect(weekNumbersCount).toEqual(6); }); }); @@ -50,7 +49,7 @@ describe('weekNumbers', function() { $('#cal').fullCalendar({ defaultView: 'basicWeek' }); - var weekNumbersCount = $('.fc-week-number').length; + var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; expect(weekNumbersCount).toEqual(0); }); }); @@ -61,7 +60,7 @@ describe('weekNumbers', function() { defaultView: 'basicWeek', weekNumbers: false }); - var weekNumbersCount = $('.fc-week-number').length; + var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; expect(weekNumbersCount).toEqual(0); }); }); @@ -72,10 +71,8 @@ describe('weekNumbers', function() { defaultView: 'basicWeek', weekNumbers: true }); - var weekNumbersCount = $('.fc-week-number').length; - // 1 row is header - // 1 row is actual week number - expect(weekNumbersCount).toEqual(2); + var weekNumbersCount = $('.fc-content-skeleton thead .fc-week-number').length; + expect(weekNumbersCount).toEqual(1); }); });