Parcourir la source

automated tests for weekNumberTitle

Adam Shaw il y a 11 ans
Parent
commit
a5463da84a
1 fichiers modifiés avec 51 ajouts et 0 suppressions
  1. 51 0
      tests/automated/weekNumberTitle.js

+ 51 - 0
tests/automated/weekNumberTitle.js

@@ -0,0 +1,51 @@
+describe('weekNumberTitle', function() {
+
+	var options;
+
+	beforeEach(function() {
+		affix('#cal');
+		options = {
+			weekNumbers: true
+		};
+	});
+
+	function getRenderedWeekNumberTitle() {
+		// works for both kinds of views
+		var text = $('th.fc-week-number').text();
+		return text.replace(/\d/g, '');
+	}
+
+	[ 'basicWeek', 'agendaWeek' ].forEach(function(viewName) {
+		describe('when views is ' + viewName, function() {
+
+			beforeEach(function() {
+				options.defaultView = viewName;
+			});
+
+			it('renders correctly by default', function() {
+				$('#cal').fullCalendar(options);
+				expect(getRenderedWeekNumberTitle()).toBe('W');
+			});
+
+			it('renders correctly when unspecified and when language is customized', function() {
+				options.lang = 'es';
+				$('#cal').fullCalendar(options);
+				expect(getRenderedWeekNumberTitle()).toBe('Sm');
+			});
+
+			it('renders correctly when customized and LTR', function() {
+				options.isRTL = false;
+				options.weekNumberTitle = 'YO';
+				$('#cal').fullCalendar(options);
+				expect(getRenderedWeekNumberTitle()).toBe('YO');
+			});
+
+			it('renders correctly when customized and RTL', function() {
+				options.isRTL = true;
+				options.weekNumberTitle = 'YO';
+				$('#cal').fullCalendar(options);
+				expect(getRenderedWeekNumberTitle()).toBe('YO');
+			});
+		});
+	});
+});