ckeditor.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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, CKEDITOR */
  6. 'use strict';
  7. describe( 'getPluginPath()', function() {
  8. it( 'should return a proper path', function( done ) {
  9. CKEDITOR.require( [ 'ckeditor' ], function( CKEDITOR ) {
  10. var basePath = CKEDITOR.basePath;
  11. var 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. done();
  18. } );
  19. } );
  20. it( '(the production version) should work even when in dev', function( done ) {
  21. CKEDITOR.require( [ 'ckeditor', 'ckeditor-core' ], function( CKEDITOR, core ) {
  22. // To be able to run this test on both dev and production code, we need to override getPluginPath with the
  23. // core version of it and restore it after testing.
  24. var originalGetPluginPath = CKEDITOR.getPluginPath;
  25. CKEDITOR.getPluginPath = core.getPluginPath;
  26. // This test is good for both the development and production codes.
  27. var basePath = CKEDITOR.basePath;
  28. var path = CKEDITOR.getPluginPath( 'test' );
  29. // Revert the override before assertions or it will not do it in case of errors.
  30. CKEDITOR.getPluginPath = originalGetPluginPath;
  31. expect( path ).to.equal( basePath + 'plugins/test/' );
  32. done();
  33. } );
  34. } );
  35. } );