|
|
@@ -1,13 +1,9 @@
|
|
|
describe('short month name', function() {
|
|
|
- var settings = {}
|
|
|
var referenceDate = '2014-01-01' // The day the world is hung-over
|
|
|
var locales = [ 'es', 'fr', 'de', 'zh-cn', 'nl' ]
|
|
|
|
|
|
- beforeEach(function() {
|
|
|
- affix('#cal')
|
|
|
- settings = {
|
|
|
- defaultDate: referenceDate
|
|
|
- }
|
|
|
+ pushOptions({
|
|
|
+ defaultDate: referenceDate
|
|
|
})
|
|
|
|
|
|
afterEach(function() {
|
|
|
@@ -16,25 +12,27 @@ describe('short month name', function() {
|
|
|
|
|
|
[ 'agendaWeek', 'basicWeek' ].forEach(function(viewClass, index, viewClasses) {
|
|
|
describe('when view is ' + viewClass, function() {
|
|
|
- beforeEach(function() {
|
|
|
- settings.defaultView = viewClass
|
|
|
+ pushOptions({
|
|
|
+ defaultView: viewClass
|
|
|
})
|
|
|
|
|
|
describe('when locale is default', function() {
|
|
|
beforeEach(function() {
|
|
|
- settings.locale = 'en'
|
|
|
moment.locale('en')
|
|
|
})
|
|
|
+ pushOptions({
|
|
|
+ locale: 'en'
|
|
|
+ })
|
|
|
|
|
|
moment.monthsShort().forEach(function(monthShort, index) {
|
|
|
it('should be ' + monthShort, function(done) {
|
|
|
- settings.defaultDate = $.fullCalendar.moment(referenceDate).add(index, 'months')
|
|
|
- settings.eventAfterAllRender = function() {
|
|
|
- expect($('.fc-toolbar h2')).toContainText(monthShort)
|
|
|
- done()
|
|
|
- }
|
|
|
-
|
|
|
- $('#cal').fullCalendar(settings)
|
|
|
+ initCalendar({
|
|
|
+ defaultDate: $.fullCalendar.moment(referenceDate).add(index, 'months'),
|
|
|
+ eventAfterAllRender: function() {
|
|
|
+ expect($('.fc-toolbar h2')).toContainText(monthShort)
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
@@ -42,22 +40,23 @@ describe('short month name', function() {
|
|
|
locales.forEach(function(locale, index, locales) {
|
|
|
describe('when locale is ' + locale, function() {
|
|
|
beforeEach(function() {
|
|
|
- settings.locale = locale
|
|
|
moment.locale(locale)
|
|
|
})
|
|
|
+ pushOptions({
|
|
|
+ locale: locale
|
|
|
+ })
|
|
|
|
|
|
moment.monthsShort().forEach(function(monthShort, index) { // `monthShort` will always be English
|
|
|
it('should be the translated name for ' + monthShort, function(done) {
|
|
|
var localeMonthsShort = moment.monthsShort()
|
|
|
var localeMonthShort = localeMonthsShort[index]
|
|
|
-
|
|
|
- settings.defaultDate = $.fullCalendar.moment(referenceDate).add(index, 'months')
|
|
|
- settings.eventAfterAllRender = function() {
|
|
|
- expect($('.fc-toolbar h2')).toContainText(localeMonthShort)
|
|
|
- done()
|
|
|
- }
|
|
|
-
|
|
|
- $('#cal').fullCalendar(settings)
|
|
|
+ initCalendar({
|
|
|
+ defaultDate: $.fullCalendar.moment(referenceDate).add(index, 'months'),
|
|
|
+ eventAfterAllRender: function() {
|
|
|
+ expect($('.fc-toolbar h2')).toContainText(localeMonthShort)
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
@@ -81,14 +80,14 @@ describe('short month name', function() {
|
|
|
|
|
|
monthsShort.forEach(function(monthShort, index) { // `monthShort` will be our custom month name
|
|
|
it('should be the translated name for ' + monthShort, function(done) {
|
|
|
- settings.defaultDate = $.fullCalendar.moment(referenceDate).add(index, 'months')
|
|
|
- settings.monthNamesShort = monthsShort
|
|
|
- settings.eventAfterAllRender = function() {
|
|
|
- expect($('.fc-toolbar h2')).toContainText(monthShort)
|
|
|
- done()
|
|
|
- }
|
|
|
-
|
|
|
- $('#cal').fullCalendar(settings)
|
|
|
+ initCalendar({
|
|
|
+ defaultDate: $.fullCalendar.moment(referenceDate).add(index, 'months'),
|
|
|
+ monthNamesShort: monthsShort,
|
|
|
+ eventAfterAllRender: function() {
|
|
|
+ expect($('.fc-toolbar h2')).toContainText(monthShort)
|
|
|
+ done()
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
})
|
|
|
})
|