Fix jQuery challenges

This commit is contained in:
Berkeley Martinez
2015-11-24 13:48:14 -08:00
parent 159b202940
commit eec7fff909
6 changed files with 90 additions and 70 deletions

View File

@@ -26,7 +26,8 @@ $(document).ready(function() {
code$
.flatMap(code => {
if (common.hasJs(code)) {
return common.detectLoops$(code)
return common.detectUnsafeCode$(code)
.flatMap(code => common.detectLoops$(code))
.flatMap(
({ err }) => err ? Observable.throw(err) : Observable.just(code)
);
@@ -101,12 +102,13 @@ $(document).ready(function() {
}
);
// initial challenge run to populate tests
if (challengeType === challengeTypes.HTML) {
var $preview = $('#preview');
return Observable.fromCallback($preview.ready, $preview)()
.delay(500)
.flatMap(() => common.executeChallenge$())
.catch(err => Observable.just(err))
.catch(err => Observable.just({ err }))
.subscribe(
({ err, tests }) => {
if (err) {