From b2d9f31f6a35ea41357d1ef7818994cb8b9cb592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Krzto=C5=84?= Date: Mon, 5 Feb 2018 11:08:40 +0100 Subject: [PATCH] Tests: ignore some unit tests on build version. --- tests/plugins/button/buttonicon.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/plugins/button/buttonicon.js b/tests/plugins/button/buttonicon.js index 8798e467df1..addd240d495 100644 --- a/tests/plugins/button/buttonicon.js +++ b/tests/plugins/button/buttonicon.js @@ -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 ); + } }; } ); } @@ -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\\/' : ''; @@ -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', @@ -123,7 +133,8 @@ } ); } } - } + }, + ignore: !isDev && CKEDITOR.env.hidpi }, { name: 'test button icon from different plugin (hidpi)', button: 'custom_btn2', @@ -138,7 +149,8 @@ } ); } } - } + }, + ignore: !isDev && !CKEDITOR.env.hidpi }, { name: 'test custom button icon', button: 'custom_btn3',