editor.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* globals describe, it, expect, beforeEach, sinon, document */
  6. 'use strict';
  7. var modules = bender.amd.require( 'editor', 'editorconfig' );
  8. var editor;
  9. var element;
  10. beforeEach( function() {
  11. var Editor = modules.editor;
  12. element = document.createElement( 'div' );
  13. document.body.appendChild( element );
  14. editor = new Editor( element );
  15. } );
  16. describe( 'constructor', function() {
  17. it( 'should create a new editor instance', function() {
  18. expect( editor ).to.have.property( 'element' ).to.equal( element );
  19. } );
  20. } );
  21. describe( 'config', function() {
  22. it( 'should be an instance of EditorConfig', function() {
  23. var EditorConfig = modules.editorconfig;
  24. expect( editor.config ).to.be.an.instanceof( EditorConfig );
  25. } );
  26. } );
  27. describe( 'destroy', function() {
  28. it( 'should fire "destroy"', function() {
  29. var spy = sinon.spy();
  30. editor.on( 'destroy', spy );
  31. editor.destroy();
  32. sinon.assert.called( spy );
  33. } );
  34. it( 'should delete the "element" property', function() {
  35. editor.destroy();
  36. expect( editor ).to.not.have.property( 'element' );
  37. } );
  38. } );