Fix editor.getValue not returning the correct code
This commit is contained in:
@ -15,6 +15,7 @@ window.common = (function(global) {
|
|||||||
|
|
||||||
common.executeChallenge$ = function executeChallenge$() {
|
common.executeChallenge$ = function executeChallenge$() {
|
||||||
const code = common.editor.getValue();
|
const code = common.editor.getValue();
|
||||||
|
const originalCode = code;
|
||||||
const head = common.arrayToNewLineString(common.head);
|
const head = common.arrayToNewLineString(common.head);
|
||||||
const tail = common.arrayToNewLineString(common.tail);
|
const tail = common.arrayToNewLineString(common.tail);
|
||||||
|
|
||||||
@ -75,6 +76,7 @@ window.common = (function(global) {
|
|||||||
data,
|
data,
|
||||||
code,
|
code,
|
||||||
userTests,
|
userTests,
|
||||||
|
originalCode,
|
||||||
output: data.output.replace(/\\\"/gi, '')
|
output: data.output.replace(/\\\"/gi, '')
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -5,14 +5,19 @@ window.common = (function(global) {
|
|||||||
common = { init: [] }
|
common = { init: [] }
|
||||||
} = global;
|
} = global;
|
||||||
|
|
||||||
common.runTests$ = function runTests$({ code, userTests, ...rest }) {
|
common.runTests$ = function runTests$({
|
||||||
|
code,
|
||||||
|
originalCode,
|
||||||
|
userTests,
|
||||||
|
...rest
|
||||||
|
}) {
|
||||||
|
|
||||||
return Observable.from(userTests)
|
return Observable.from(userTests)
|
||||||
.map(function(test) {
|
.map(function(test) {
|
||||||
|
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
const assert = chai.assert;
|
const assert = chai.assert;
|
||||||
const editor = { getValue() { return code; }};
|
const editor = { getValue() { return originalCode; }};
|
||||||
/* eslint-enable no-unused-vars */
|
/* eslint-enable no-unused-vars */
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user