8
0

editorconfig.js 1.0 KB

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 */
  6. 'use strict';
  7. var modules = bender.amd.require( 'editorconfig', 'ckeditor' );
  8. var config;
  9. beforeEach( function() {
  10. var EditorConfig = modules.editorconfig;
  11. config = new EditorConfig( {
  12. test: 1
  13. } );
  14. } );
  15. describe( 'constructor', function() {
  16. it( 'should set configurations', function() {
  17. expect( config ).to.have.property( 'test' ).to.equal( 1 );
  18. } );
  19. } );
  20. describe( 'get', function() {
  21. it( 'should retrieve a configuration', function() {
  22. expect( config.get( 'test' ) ).to.equal( 1 );
  23. } );
  24. it( 'should fallback to CKEDITOR.config', function() {
  25. var CKEDITOR = modules.ckeditor;
  26. CKEDITOR.config.set( {
  27. globalConfig: 2
  28. } );
  29. expect( config.get( 'globalConfig' ) ).to.equal( 2 );
  30. } );
  31. it( 'should return undefined for non existing configuration', function() {
  32. expect( config.get( 'invalid' ) ).to.be.undefined();
  33. } );
  34. } );