forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiFrameScripts.js
More file actions
26 lines (25 loc) · 752 Bytes
/
iFrameScripts.js
File metadata and controls
26 lines (25 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* eslint-disable no-undef, no-unused-vars, no-native-reassign */
(function() {
var expect = chai.expect;
var tests = parent.tests;
var editor = parent.editorValueForIFrame;
setTimeout(function() {
for (var i = 0; i < tests.length; i++) {
var thisTest = true;
try {
/* eslint-disable no-eval */
eval(parent.tests[i]);
/* eslint-enable no-eval */
} catch (err) {
allTestsGood = false;
thisTest = false;
parent.postError(JSON.stringify(err.message.split(':').shift()));
} finally {
if (thisTest) {
parent.postSuccess(JSON.stringify(tests[i].split(',').pop().replace(
/\'/g, '').replace(/\)/, '')));
}
}
}
}, 10);
})();