8
0

ckeditor.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 */
  6. 'use strict';
  7. var modules = bender.amd.require( 'ckeditor', 'ckeditor-core' );
  8. describe( 'getPluginPath()', function() {
  9. it( 'should return a proper path', function() {
  10. var CKEDITOR = modules.ckeditor;
  11. var basePath = CKEDITOR.basePath;
  12. var path = CKEDITOR.getPluginPath( 'test' );
  13. if ( CKEDITOR.isDev ) {
  14. expect( path ).to.equal( basePath + 'node_modules/ckeditor-plugin-test/src/' );
  15. } else {
  16. expect( path ).to.equal( basePath + 'plugins/test/' );
  17. }
  18. } );
  19. it( '(the production version) should work even when in dev', function() {
  20. var CKEDITOR = modules.ckeditor;
  21. var core = modules[ '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. } );
  33. } );