From cc66b69b245cbafe1c0654b54036c56a266e9588 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Fri, 4 Oct 2019 17:45:44 +0200 Subject: [PATCH] Run tests after setuping editor. --- tests/plugins/pastefromword/generated/functions.js | 6 ++---- .../plugins/pastefromword/generated/heuristics.js | 6 ++---- tests/plugins/pastefromword/helpers.js | 6 ++---- tests/plugins/pastefromword/pasteimage.js | 2 +- tests/plugins/pastetools/_helpers/ptTools.js | 14 ++++++++++++++ tests/plugins/pastetools/filter/functions.js | 10 +++------- tests/plugins/pastetools/filter/parsestyles.js | 6 ++---- 7 files changed, 26 insertions(+), 24 deletions(-) diff --git a/tests/plugins/pastefromword/generated/functions.js b/tests/plugins/pastefromword/generated/functions.js index 48c3c0ad362..29c8e965f81 100644 --- a/tests/plugins/pastefromword/generated/functions.js +++ b/tests/plugins/pastefromword/generated/functions.js @@ -269,10 +269,8 @@ ptTools.ignoreTestsOnMobiles( tests ); - ptTools.loadFilters( [ + ptTools.testWithFilters( tests, [ CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastetools' ) + 'filter/common.js' ), CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastefromword' ) + 'filter/default.js' ) - ], function() { - bender.test( tests ); - } ); + ] ); } )(); diff --git a/tests/plugins/pastefromword/generated/heuristics.js b/tests/plugins/pastefromword/generated/heuristics.js index d76b64cf499..0977db952d5 100644 --- a/tests/plugins/pastefromword/generated/heuristics.js +++ b/tests/plugins/pastefromword/generated/heuristics.js @@ -96,10 +96,8 @@ ptTools.ignoreTestsOnMobiles( tests ); - ptTools.loadFilters( [ + ptTools.testWithFilters( tests, [ CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastetools' ) + 'filter/common.js' ), CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastefromword' ) + 'filter/default.js' ) - ], function() { - bender.test( tests ); - } ); + ] ); } )(); diff --git a/tests/plugins/pastefromword/helpers.js b/tests/plugins/pastefromword/helpers.js index 09e92a80d46..334f611199d 100644 --- a/tests/plugins/pastefromword/helpers.js +++ b/tests/plugins/pastefromword/helpers.js @@ -73,10 +73,8 @@ ptTools.ignoreTestsOnMobiles( tests ); - ptTools.loadFilters( [ + ptTools.testWithFilters( tests, [ CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastetools' ) + 'filter/common.js' ), CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastefromword' ) + 'filter/default.js' ) - ], function() { - bender.test( tests ); - } ); + ] ); } )(); diff --git a/tests/plugins/pastefromword/pasteimage.js b/tests/plugins/pastefromword/pasteimage.js index 5500f7c0c2c..a9a11f15b93 100644 --- a/tests/plugins/pastefromword/pasteimage.js +++ b/tests/plugins/pastefromword/pasteimage.js @@ -25,7 +25,7 @@ ptTools.ignoreTestsOnMobiles( tests ); - ptTools.loadFilters( [ + ptTools.testWithFilters( tests, [ CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastetools' ) + 'filter/common.js' ), CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastefromword' ) + 'filter/default.js' ) ], function() { diff --git a/tests/plugins/pastetools/_helpers/ptTools.js b/tests/plugins/pastetools/_helpers/ptTools.js index 5640d9cd8ee..49d223b36f4 100644 --- a/tests/plugins/pastetools/_helpers/ptTools.js +++ b/tests/plugins/pastetools/_helpers/ptTools.js @@ -29,6 +29,20 @@ } ); }( filters[ i ] ) ); } + }, + + testWithFilters: function( tests, filters, callback ) { + this.loadFilters( filters, function() { + tests[ 'async:init' ] = function() { + if ( callback ) { + callback( this ); + } + + this.callback(); + }; + + bender.test( tests ); + } ); } }; } )(); diff --git a/tests/plugins/pastetools/filter/functions.js b/tests/plugins/pastetools/filter/functions.js index 2c714b9016a..3a30f68ed68 100644 --- a/tests/plugins/pastetools/filter/functions.js +++ b/tests/plugins/pastetools/filter/functions.js @@ -22,10 +22,6 @@ filterMock = new CKEDITOR.htmlParser.filter(), tests = { - setUp: function( ) { - this.commonFilter = CKEDITOR.plugins.pastetools.filters.common; - }, - 'test create style stack': function() { var element = new CKEDITOR.htmlParser.element( 'p' ); @@ -97,10 +93,10 @@ ptTools.ignoreTestsOnMobiles( tests ); - ptTools.loadFilters( [ + ptTools.testWithFilters( tests, [ CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastetools' ) + 'filter/common.js' ), CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastefromword' ) + 'filter/default.js' ) - ], function() { - bender.test( tests ); + ], function( testCase ) { + testCase.commonFilter = CKEDITOR.plugins.pastetools.filters.common; } ); } )(); diff --git a/tests/plugins/pastetools/filter/parsestyles.js b/tests/plugins/pastetools/filter/parsestyles.js index 468b1f2f14a..a244e33a736 100644 --- a/tests/plugins/pastetools/filter/parsestyles.js +++ b/tests/plugins/pastetools/filter/parsestyles.js @@ -109,10 +109,8 @@ ptTools.ignoreTestsOnMobiles( tests ); - ptTools.loadFilters( [ + ptTools.testWithFilters( tests, [ CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastetools' ) + 'filter/common.js' ), CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'pastefromword' ) + 'filter/default.js' ) - ], function() { - bender.test( tests ); - } ); + ] ); } )();