Skip to content

Commit

Permalink
Merge branch 't/13917'
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewand committed Feb 2, 2016
2 parents 29e1080 + 5911ece commit 8761a51
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/core/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
( function() {
'use strict';

var error, warn, _log, _error, _warn,
var error,
warn,
_console,
consoleEnabled = !!window.console,
ignore = !consoleEnabled,
errorPrefix = '[CKEDITOR] ',
Expand Down Expand Up @@ -49,26 +51,25 @@
},

setUp: function() {
// In ie <= 9 console methods log(), warn() and error() are pseudo-functions that do not have
// In IE <= 9 console methods log(), warn() and error() are pseudo-functions that do not have
// call/apply methods. This leads to situation when spy methods cannot work properly.
// Because of that each function should be wrapped before use.
// The console object should be also stubbed because newer sinon version cannot work on that object in
// IE <= 9 (#13917).
if ( consoleEnabled && CKEDITOR.env.ie && CKEDITOR.env.version <= 9 ) {
_log = console.log;
_error = console.error;
_warn = console.warn;

console.log = wrap( _log, console );
console.error = wrap( _error, console );
console.warn = wrap( _warn, console );
_console = window.console;
window.console = {
log: wrap( _console.log, _console ),
warn: wrap( _console[ warn ], _console ),
error: wrap( _console[ error ], _console )
};
}
},

tearDown: function() {
// Cleaning wrapping made in setUp function for ie <= 9.
if ( consoleEnabled && CKEDITOR.env.ie && CKEDITOR.env.version <= 9 ) {
console.log = _log;
console.error = _error;
console.warn = _warn;
window.console = _console;
}
},

Expand All @@ -77,7 +78,6 @@
assert.isFunction( CKEDITOR.warn, 'CKEDTIOR.warn function should be defined.' );
},


'no log event and output after CKEDITOR.warn() when verbosity = 0': function() {
var warnStub = sinon.stub( console, warn ),
logEventSpy = sinon.spy();
Expand Down

0 comments on commit 8761a51

Please sign in to comment.