Просмотр исходного кода

tests for isRTL and lang option changes

Adam Shaw 9 лет назад
Родитель
Сommit
bc9a75fd70
2 измененных файлов с 28 добавлено и 0 удалено
  1. 13 0
      tests/automated/isRTL.js
  2. 15 0
      tests/automated/lang.js

+ 13 - 0
tests/automated/isRTL.js

@@ -12,4 +12,17 @@ describe('isRTL', function() {
 	// NOTE: don't put tests related to other options in here!
 	// Put them in the test file for the individual option!
 
+	it('adapts to dynamic option change', function() {
+		affix('#cal');
+		$('#cal').fullCalendar({
+			isRTL: false
+		});
+		expect($('#cal')).toHaveClass('fc-ltr');
+		expect($('#cal')).not.toHaveClass('fc-rtl');
+
+		$('#cal').fullCalendar('option', 'isRTL', true);
+		expect($('#cal')).toHaveClass('fc-rtl');
+		expect($('#cal')).not.toHaveClass('fc-ltr');
+	});
+
 });

+ 15 - 0
tests/automated/lang.js

@@ -69,4 +69,19 @@ describe('lang', function() {
 		expect($('.fc-event .fc-time')).toHaveText('10:00');
 	});
 
+	it('allows dynamic setting', function() {
+		affix('#cal');
+		$('#cal').fullCalendar({
+			lang: 'es',
+			defaultDate: '2016-07-10',
+			defaultView: 'month'
+		});
+		expect($('.fc h2')).toHaveText('julio 2016');
+		expect($('.fc')).not.toHaveClass('fc-rtl');
+
+		$('#cal').fullCalendar('option', 'lang', 'ar');
+		expect($('.fc h2')).toHaveText('تموز يوليو ٢٠١٦');
+		expect($('.fc')).toHaveClass('fc-rtl');
+	});
+
 });