ckeditor.js 1.3 KB

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