8
0

editor.js 977 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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' );
  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( 'destroy', function() {
  22. it( 'should fire "destroy"', function() {
  23. var spy = sinon.spy();
  24. editor.on( 'destroy', spy );
  25. editor.destroy();
  26. sinon.assert.called( spy );
  27. } );
  28. it( 'should delete the "element" property', function() {
  29. editor.destroy();
  30. expect( editor ).to.not.have.property( 'element' );
  31. } );
  32. } );