/** * Context.spec.js * (c) 2015~ Summernote Team * summernote may be freely distributed under the MIT license./ */ import chai from 'chai'; import spies from 'chai-spies'; /* eslint-disable import/first */ import $ from 'jquery'; window.jQuery = $; import 'bootstrap'; import chaidom from '../../chaidom'; import env from '../../../src/js/base/core/env'; import Context from '../../../src/js/base/Context'; /* eslint-enable import/first */ var expect = chai.expect; chai.use(spies); chai.use(chaidom); describe('Context lifecycle', () => { it('should be initialized without calling callback', () => { var options = $.extend({}, $.summernote.options); options.langInfo = $.extend(true, {}, $.summernote.lang['en-US'], $.summernote.lang[options.lang]); var spy = chai.spy(); var $note = $('
hello
hello
hello
hello
'); context.code('hello2
'); expect(context.code()).to.equalsIgnoreCase('hello2
'); }); it('should enable or disable editor', () => { expect(context.isDisabled()).to.be.false; context.disable(); expect(context.isDisabled()).to.be.true; context.enable(); expect(context.isDisabled()).to.be.false; }); it('should preserve disabled status after reset', () => { expect(context.isDisabled()).to.be.false; context.disable(); expect(context.isDisabled()).to.be.true; context.reset(); expect(context.isDisabled()).to.be.true; }); });