| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- /**
- * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
- /* globals describe, it, expect, CKEDITOR */
- 'use strict';
- describe( 'getPluginPath()', function() {
- it( 'should return a proper path', function( done ) {
- CKEDITOR.require( [ 'ckeditor' ], function( CKEDITOR ) {
- var basePath = CKEDITOR.basePath;
- var path = CKEDITOR.getPluginPath( 'test' );
- if ( CKEDITOR.isDev ) {
- expect( path ).to.equal( basePath + 'node_modules/ckeditor-plugin-test/src/' );
- } else {
- expect( path ).to.equal( basePath + 'plugins/test/' );
- }
- done();
- } );
- } );
- it( '(the production version) should work even when in dev', function( done ) {
- CKEDITOR.require( [ 'ckeditor', 'ckeditor-core' ], function( CKEDITOR, core ) {
- // To be able to run this test on both dev and production code, we need to override getPluginPath with the
- // core version of it and restore it after testing.
- var originalGetPluginPath = CKEDITOR.getPluginPath;
- CKEDITOR.getPluginPath = core.getPluginPath;
- // This test is good for both the development and production codes.
- var basePath = CKEDITOR.basePath;
- var path = CKEDITOR.getPluginPath( 'test' );
- // Revert the override before assertions or it will not do it in case of errors.
- CKEDITOR.getPluginPath = originalGetPluginPath;
- expect( path ).to.equal( basePath + 'plugins/test/' );
- done();
- } );
- } );
- } );
|