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

clean up theme-related root className

Adam Shaw 8 лет назад
Родитель
Сommit
c191171109
2 измененных файлов с 15 добавлено и 1 удалено
  1. 4 1
      src/Calendar.render.js
  2. 11 0
      tests/legacy/destroy.js

+ 4 - 1
src/Calendar.render.js

@@ -104,7 +104,10 @@ Calendar.mixin({
 
 		this.toolbarsManager.proxyCall('removeElement');
 		this.contentEl.remove();
-		this.el.removeClass('fc fc-ltr fc-rtl fc-unthemed ui-widget');
+		this.el.removeClass('fc fc-ltr fc-rtl');
+
+		// removes theme-related root className
+		this.optionsModel.unwatch('settingTheme');
 
 		this.el.off('.fc'); // unbind nav link handlers
 

+ 11 - 0
tests/legacy/destroy.js

@@ -24,6 +24,17 @@ describe('destroy', function() {
 		});
 	});
 
+	describeOptions('theme', {
+		'when jquery-ui theme': 'jquery-ui',
+		'when bootstrap theme': 'bootstrap3'
+	}, function() {
+		it('cleans up all classNames on the root element', function() {
+			initCalendar();
+			$('#cal').fullCalendar('destroy');
+			expect($('#cal')[0].className).toBe('');
+		});
+	});
+
 	[ 'month', 'basicWeek', 'agendaWeek' ].forEach(function(viewName) {
 
 		describe('when in ' + viewName + ' view', function() {