Skip to content

Commit

Permalink
Fix tests under IE
Browse files Browse the repository at this point in the history
  • Loading branch information
kpdecker committed Sep 24, 2015
1 parent fffb5a9 commit 861d6f7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion lib/handlebars/logger.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import {indexOf} from './utils';

let logger = {
methodMap: ['debug', 'info', 'warn', 'error'],
level: 'info',

// Maps a given level value to the `methodMap` indexes above.
lookupLevel: function(level) {
if (typeof level === 'string') {
let levelMap = logger.methodMap.indexOf(level.toLowerCase());
let levelMap = indexOf(logger.methodMap, level.toLowerCase());
if (levelMap >= 0) {
level = levelMap;
} else {
Expand Down
10 changes: 5 additions & 5 deletions spec/env/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ global.shouldThrow = function(callback, type, msg) {
try {
callback();
failed = true;
} catch (err) {
if (type && !(err instanceof type)) {
throw new AssertError('Type failure: ' + err);
} catch (caught) {
if (type && !(caught instanceof type)) {
throw new AssertError('Type failure: ' + caught);
}
if (msg && !(msg.test ? msg.test(err.message) : msg === err.message)) {
throw new AssertError('Throw mismatch: Expected ' + err.message + ' to match ' + msg + '\n\n' + err.stack, shouldThrow);
if (msg && !(msg.test ? msg.test(caught.message) : msg === caught.message)) {
throw new AssertError('Throw mismatch: Expected ' + caught.message + ' to match ' + msg + '\n\n' + caught.stack, shouldThrow);
}
}
if (failed) {
Expand Down
1 change: 1 addition & 0 deletions spec/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!doctype html>
<html>
<head>
<title>Mocha</title>
Expand Down
3 changes: 2 additions & 1 deletion spec/regressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ describe('Regressions', function() {
return 'found';
}
}
return 'not';
// And to make IE happy, check for the known string as length is not enumerated.
return (this == 'bat' ? 'found' : 'not');
}
};

Expand Down

0 comments on commit 861d6f7

Please sign in to comment.