diff --git a/src/Calendar.js b/src/Calendar.js index c2df973..b23ba55 100644 --- a/src/Calendar.js +++ b/src/Calendar.js @@ -345,7 +345,7 @@ function Calendar(element, instanceOptions) { header.destroy(); content.remove(); - element.removeClass('fc fc-rtl ui-widget'); + element.removeClass('fc fc-ltr fc-rtl ui-widget'); } diff --git a/tests/automated/destroy.js b/tests/automated/destroy.js new file mode 100644 index 0000000..046e101 --- /dev/null +++ b/tests/automated/destroy.js @@ -0,0 +1,27 @@ +describe('destroy', function() { + + beforeEach(function() { + affix('#cal'); + }); + + describe('when calendar is LTR', function() { + it('cleans up all classNames on the root element', function() { + $('#cal').fullCalendar({ + isRTL: false + }); + $('#cal').fullCalendar('destroy'); + expect($('#cal')[0].className).toBe(''); + }); + }); + + describe('when calendar is RTL', function() { + it('cleans up all classNames on the root element', function() { + $('#cal').fullCalendar({ + isRTL: true + }); + $('#cal').fullCalendar('destroy'); + expect($('#cal')[0].className).toBe(''); + }); + }); + +}); \ No newline at end of file