Jelajahi Sumber

Update legacy tests

Dylan 7 tahun lalu
induk
melakukan
f747cf5aee
1 mengubah file dengan 32 tambahan dan 33 penghapusan
  1. 32 33
      tests/automated/legacy/monthNamesShort.js

+ 32 - 33
tests/automated/legacy/monthNamesShort.js

@@ -1,13 +1,9 @@
 describe('short month name', function() {
 describe('short month name', function() {
-  var settings = {}
   var referenceDate = '2014-01-01' // The day the world is hung-over
   var referenceDate = '2014-01-01' // The day the world is hung-over
   var locales = [ 'es', 'fr', 'de', 'zh-cn', 'nl' ]
   var locales = [ 'es', 'fr', 'de', 'zh-cn', 'nl' ]
 
 
-  beforeEach(function() {
-    affix('#cal')
-    settings = {
-      defaultDate: referenceDate
-    }
+  pushOptions({
+    defaultDate: referenceDate
   })
   })
 
 
   afterEach(function() {
   afterEach(function() {
@@ -16,25 +12,27 @@ describe('short month name', function() {
 
 
   [ 'agendaWeek', 'basicWeek' ].forEach(function(viewClass, index, viewClasses) {
   [ 'agendaWeek', 'basicWeek' ].forEach(function(viewClass, index, viewClasses) {
     describe('when view is ' + viewClass, function() {
     describe('when view is ' + viewClass, function() {
-      beforeEach(function() {
-        settings.defaultView = viewClass
+      pushOptions({
+        defaultView: viewClass
       })
       })
 
 
       describe('when locale is default', function() {
       describe('when locale is default', function() {
         beforeEach(function() {
         beforeEach(function() {
-          settings.locale = 'en'
           moment.locale('en')
           moment.locale('en')
         })
         })
+        pushOptions({
+          locale: 'en'
+        })
 
 
         moment.monthsShort().forEach(function(monthShort, index) {
         moment.monthsShort().forEach(function(monthShort, index) {
           it('should be ' + monthShort, function(done) {
           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) {
       locales.forEach(function(locale, index, locales) {
         describe('when locale is ' + locale, function() {
         describe('when locale is ' + locale, function() {
           beforeEach(function() {
           beforeEach(function() {
-            settings.locale = locale
             moment.locale(locale)
             moment.locale(locale)
           })
           })
+          pushOptions({
+            locale: locale
+          })
 
 
           moment.monthsShort().forEach(function(monthShort, index) { // `monthShort` will always be English
           moment.monthsShort().forEach(function(monthShort, index) { // `monthShort` will always be English
             it('should be the translated name for ' + monthShort, function(done) {
             it('should be the translated name for ' + monthShort, function(done) {
               var localeMonthsShort = moment.monthsShort()
               var localeMonthsShort = moment.monthsShort()
               var localeMonthShort = localeMonthsShort[index]
               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
         monthsShort.forEach(function(monthShort, index) { // `monthShort` will be our custom month name
           it('should be the translated name for ' + monthShort, function(done) {
           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()
+              }
+            })
           })
           })
         })
         })
       })
       })