Skip to content

Commit 861d6f7

Browse files
committed
Fix tests under IE
1 parent fffb5a9 commit 861d6f7

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

lib/handlebars/logger.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import {indexOf} from './utils';
2+
13
let logger = {
24
methodMap: ['debug', 'info', 'warn', 'error'],
35
level: 'info',
46

57
// Maps a given level value to the `methodMap` indexes above.
68
lookupLevel: function(level) {
79
if (typeof level === 'string') {
8-
let levelMap = logger.methodMap.indexOf(level.toLowerCase());
10+
let levelMap = indexOf(logger.methodMap, level.toLowerCase());
911
if (levelMap >= 0) {
1012
level = levelMap;
1113
} else {

spec/env/common.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ global.shouldThrow = function(callback, type, msg) {
6161
try {
6262
callback();
6363
failed = true;
64-
} catch (err) {
65-
if (type && !(err instanceof type)) {
66-
throw new AssertError('Type failure: ' + err);
64+
} catch (caught) {
65+
if (type && !(caught instanceof type)) {
66+
throw new AssertError('Type failure: ' + caught);
6767
}
68-
if (msg && !(msg.test ? msg.test(err.message) : msg === err.message)) {
69-
throw new AssertError('Throw mismatch: Expected ' + err.message + ' to match ' + msg + '\n\n' + err.stack, shouldThrow);
68+
if (msg && !(msg.test ? msg.test(caught.message) : msg === caught.message)) {
69+
throw new AssertError('Throw mismatch: Expected ' + caught.message + ' to match ' + msg + '\n\n' + caught.stack, shouldThrow);
7070
}
7171
}
7272
if (failed) {

spec/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!doctype html>
12
<html>
23
<head>
34
<title>Mocha</title>

spec/regressions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ describe('Regressions', function() {
215215
return 'found';
216216
}
217217
}
218-
return 'not';
218+
// And to make IE happy, check for the known string as length is not enumerated.
219+
return (this == 'bat' ? 'found' : 'not');
219220
}
220221
};
221222

0 commit comments

Comments
 (0)