Skip to content

Commit

Permalink
Tests: ignore some unit tests on build version.
Browse files Browse the repository at this point in the history
  • Loading branch information
f1ames committed Feb 5, 2018
1 parent d6ab2f2 commit b2d9f31
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions tests/plugins/button/buttonicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@

var editorCounter = 0,
originalBasePath = null,
isDev = CKEDITOR.version === '%VERSION%',
isHidpi,
tests;

function createIconTests( testsObj, tests ) {
CKEDITOR.tools.array.forEach( tests, function( test ) {
testsObj[ test.name ] = function() {
CKEDITOR.env.hidpi = test.name.indexOf( 'hidpi' ) !== -1;
assertIcon( test.config, test.button, test.iconPath, test.iconName );
if ( test.ignore ) {
// On a build version icons sprite image is loaded before any test code is execute so we are not able
// to emulate `CKEDITOR.env.hidpi` to force different icons loading. Due to this behaviour some tests
// needs to be ignored in build version.
assert.ignore();
} else {
CKEDITOR.env.hidpi = test.name.indexOf( 'hidpi' ) !== -1;
assertIcon( test.config, test.button, test.iconPath, test.iconName );
}
};
} );
}
Expand All @@ -30,7 +38,7 @@

if ( iconPath === undefined ) {
// Standard icon should be checked.
if ( CKEDITOR.version === '%VERSION%' ) {
if ( isDev ) {
var iconFileName = ( iconName || btnName ).toLowerCase(),
hidpi = CKEDITOR.env.hidpi ? 'hidpi\\/' : '';

Expand Down Expand Up @@ -66,13 +74,15 @@
button: 'Link',
config: {
extraPlugins: 'link'
}
},
ignore: !isDev && CKEDITOR.env.hidpi
}, {
name: 'test default button icon (hidpi)',
button: 'Find',
config: {
extraPlugins: 'find'
}
},
ignore: !isDev && !CKEDITOR.env.hidpi
}, {
name: 'test overwriting default button icon',
button: 'Replace',
Expand Down Expand Up @@ -123,7 +133,8 @@
} );
}
}
}
},
ignore: !isDev && CKEDITOR.env.hidpi
}, {
name: 'test button icon from different plugin (hidpi)',
button: 'custom_btn2',
Expand All @@ -138,7 +149,8 @@
} );
}
}
}
},
ignore: !isDev && !CKEDITOR.env.hidpi
}, {
name: 'test custom button icon',
button: 'custom_btn3',
Expand Down

0 comments on commit b2d9f31

Please sign in to comment.