Skip to content

Commit

Permalink
Merge pull request #3539 from ckeditor/t/3424
Browse files Browse the repository at this point in the history
Improve stability of Paste Tools tests with filters
  • Loading branch information
f1ames authored Nov 18, 2019
2 parents 422c234 + cc66b69 commit 438226e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 24 deletions.
6 changes: 2 additions & 4 deletions tests/plugins/pastefromword/generated/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
} );
] );
} )();
6 changes: 2 additions & 4 deletions tests/plugins/pastefromword/generated/heuristics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
} );
] );
} )();
6 changes: 2 additions & 4 deletions tests/plugins/pastefromword/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
} );
] );
} )();
2 changes: 1 addition & 1 deletion tests/plugins/pastefromword/pasteimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
14 changes: 14 additions & 0 deletions tests/plugins/pastetools/_helpers/ptTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
} );
}
};
} )();
Expand Down
10 changes: 3 additions & 7 deletions tests/plugins/pastetools/filter/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );

Expand Down Expand Up @@ -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;
} );
} )();
6 changes: 2 additions & 4 deletions tests/plugins/pastetools/filter/parsestyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
} );
] );
} )();

0 comments on commit 438226e

Please sign in to comment.