ckeditor.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. const modules = bender.amd.require( 'ckeditor', 'ckeditor-core' );
  7. describe( 'getPluginPath()', () => {
  8. it( 'should return a proper path', () => {
  9. const CKEDITOR = modules.ckeditor;
  10. const basePath = CKEDITOR.basePath;
  11. const path = CKEDITOR.getPluginPath( 'test' );
  12. if ( CKEDITOR.isDev ) {
  13. expect( path ).to.equal( basePath + 'node_modules/ckeditor-plugin-test/src/' );
  14. } else {
  15. expect( path ).to.equal( basePath + 'plugins/test/' );
  16. }
  17. } );
  18. it( '(the production version) should work even when in dev', () => {
  19. const CKEDITOR = modules.ckeditor;
  20. const core = modules[ 'ckeditor-core' ];
  21. // To be able to run this test on both dev and production code, we need to override getPluginPath with the
  22. // core version of it and restore it after testing.
  23. const originalGetPluginPath = CKEDITOR.getPluginPath;
  24. CKEDITOR.getPluginPath = core.getPluginPath;
  25. // This test is good for both the development and production codes.
  26. const basePath = CKEDITOR.basePath;
  27. const path = CKEDITOR.getPluginPath( 'test' );
  28. // Revert the override before assertions or it will not do it in case of errors.
  29. CKEDITOR.getPluginPath = originalGetPluginPath;
  30. expect( path ).to.equal( basePath + 'plugins/test/' );
  31. } );
  32. } );
  33. describe( 'isDebug', () => {
  34. it( 'is a boolean', () => {
  35. const CKEDITOR = modules.ckeditor;
  36. expect( CKEDITOR.isDebug ).to.be.a( 'boolean' );
  37. } );
  38. } );