Skip to content

Commit

Permalink
Ignored IE8 in tests. Added a logic that will make sure that plugin d…
Browse files Browse the repository at this point in the history
…oes not explode when loaded in IE8.
  • Loading branch information
mlewand committed Nov 21, 2017
1 parent 5be1011 commit faf3e02
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 5 deletions.
13 changes: 12 additions & 1 deletion plugins/inlinetoolbar/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
( function() {
'use strict';

var matchingFunctionName = getElementMatchFuncitonName();

/**
* Class representing view of inline toolbar, used by {@link CKEDITOR.ui.inlineToolbar}.
*
Expand Down Expand Up @@ -294,7 +296,8 @@
return;
}

return !!elem.$.matches( this.options.cssSelector ) ? elem : false;
// Note that IE8 doesn't have matching function at all.
return matchingFunctionName && !!elem.$[ matchingFunctionName ]( this.options.cssSelector ) ? elem : false;
},

/**
Expand Down Expand Up @@ -756,6 +759,14 @@
}
};

function getElementMatchFuncitonName() {
// Temp solution, we'll extract it to CKEDITOR.dom.element.
return CKEDITOR.tools.array.filter( [ 'matches', 'msMatchesSelector', 'webkitMatchesSelector', 'mozMatchesSelector', 'oMatchesSelector' ], function( fnName ) {
// Note that only IE8 doesn't know HTMLElement, nor it has msMatchesSelector so we can return false.
return window.HTMLElement ? fnName in HTMLElement.prototype : false;
} )[ 0 ];
}

/**
* This is an abstract class that describes the definition of a {@link CKEDITOR.plugins.inlinetoolbar.context Inline Toolbar Context}.
*
Expand Down
6 changes: 6 additions & 0 deletions tests/plugins/inlinetoolbar/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
bender.editor = {};

bender.test( {
setUp: function() {
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
assert.ignore();
}
},

tearDown: function() {
this.editor.inlineToolbar._manager._clear();
},
Expand Down
6 changes: 6 additions & 0 deletions tests/plugins/inlinetoolbar/context/cssselector.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
};

bender.test( {
setUp: function() {
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
assert.ignore();
}
},

tearDown: function() {
this.editor.inlineToolbar._manager._clear();
},
Expand Down
6 changes: 6 additions & 0 deletions tests/plugins/inlinetoolbar/context/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
};

bender.test( {
setUp: function() {
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
assert.ignore();
}
},

tearDown: function() {
this.editor.inlineToolbar._manager._clear();
},
Expand Down
6 changes: 6 additions & 0 deletions tests/plugins/inlinetoolbar/context/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
bender.editor = {};

bender.test( {
setUp: function() {
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
assert.ignore();
}
},

tearDown: function() {
this.editor.inlineToolbar._manager._clear();
},
Expand Down
4 changes: 4 additions & 0 deletions tests/plugins/inlinetoolbar/context/manual/complex.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
</div>

<script>
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
bender.ignore();
}

CKEDITOR.disableAutoInline = true;

var config = {
Expand Down
4 changes: 4 additions & 0 deletions tests/plugins/inlinetoolbar/context/manual/context.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
</div>

<script>
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
bender.ignore();
}

CKEDITOR.disableAutoInline = true;

var config = {
Expand Down
4 changes: 4 additions & 0 deletions tests/plugins/inlinetoolbar/context/manual/toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
</style>

<script>
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
bender.ignore();
}

CKEDITOR.disableAutoInline = true;

var config = {
Expand Down
4 changes: 4 additions & 0 deletions tests/plugins/inlinetoolbar/context/manual/widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
</div>

<script>
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
bender.ignore();
}

CKEDITOR.disableAutoInline = true;

var config = {
Expand Down
12 changes: 8 additions & 4 deletions tests/plugins/inlinetoolbar/context/priorities.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@
};

bender.test( {
tearDown: function() {
this.editor.inlineToolbar._manager._clear();
},

setUp: function() {
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
assert.ignore();
}

this.editor.widgets.add( 'bar', {
editables: {
header: 'h1'
}
} );
},

tearDown: function() {
this.editor.inlineToolbar._manager._clear();
},

'test options.refresh has the highest priority': function() {
this.editorBot.setData( CKEDITOR.document.getById( 'widgetWithEditable' ).getHtml(), function() {
var rng = this.editor.createRange();
Expand Down
6 changes: 6 additions & 0 deletions tests/plugins/inlinetoolbar/context/refresh.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
};

bender.test( {
setUp: function() {
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
assert.ignore();
}
},

tearDown: function() {
this.editor.inlineToolbar._manager._clear();
},
Expand Down
6 changes: 6 additions & 0 deletions tests/plugins/inlinetoolbar/context/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
};

bender.test( {
setUp: function() {
if ( CKEDITOR.env.ie && CKEDITOR.env.version === 8 ) {
assert.ignore();
}
},

tearDown: function() {
this.editor.inlineToolbar._manager._clear();
},
Expand Down

0 comments on commit faf3e02

Please sign in to comment.