Parcourir la source

tests for theme switching, bootstrap glyphicons

Adam Shaw il y a 8 ans
Parent
commit
8edbe9c252
2 fichiers modifiés avec 67 ajouts et 0 suppressions
  1. 33 0
      tests/theme/bootstrap3.js
  2. 34 0
      tests/theme/switching.js

+ 33 - 0
tests/theme/bootstrap3.js

@@ -0,0 +1,33 @@
+
+describe('bootstrap3 theme', function() {
+	pushOptions({ theme: 'bootstrap3' });
+
+	describe('glyphicons', function() {
+		pushOptions({
+			header: { left: '', center: '', right: 'next' },
+		});
+
+		it('renders default', function() {
+			initCalendar();
+			expect($('.glyphicon')).toHaveClass('glyphicon-chevron-right');
+		});
+
+		it('renders a customized icon', function() {
+			initCalendar({
+				bootstrapGlyphicons: {
+					next: 'asdf'
+				}
+			});
+			expect($('.glyphicon')).toHaveClass('glyphicon-asdf');
+		});
+
+		it('renders text when specified as false', function() {
+			initCalendar({
+				bootstrapGlyphicons: false
+			});
+			expect($('.glyphicon')).not.toBeInDOM();
+			expect($('.fc-next-button')).toHaveText('next');
+		});
+	});
+
+});

+ 34 - 0
tests/theme/switching.js

@@ -0,0 +1,34 @@
+
+describe('theme switching', function() {
+
+	it('can switch from standard to jquery-ui', function() {
+		initCalendar();
+		verifyStandardTheme();
+		currentCalendar.option('theme', 'jquery-ui');
+		verifyJqueryUiTheme();
+	});
+
+	it('can switch from jquery-ui to boostrap3', function() {
+		initCalendar({ theme: 'jquery-ui' });
+		verifyJqueryUiTheme();
+		currentCalendar.option('theme', 'bootstrap3');
+		verifyBootstrapTheme();
+	});
+
+
+	function verifyStandardTheme() {
+		expect($('.fc-unthemed')).toBeInDOM();
+		expect($('.fc-widget-header')).toBeInDOM();
+	}
+
+	function verifyJqueryUiTheme() {
+		expect($('.fc.ui-widget')).toBeInDOM();
+		expect($('.ui-widget-header')).toBeInDOM();
+	}
+
+	function verifyBootstrapTheme() {
+		expect($('.fc-bootstrap3')).toBeInDOM();
+		expect($('.fc .table-bordered')).toBeInDOM();
+	}
+
+});