Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d045118

Browse files
Merge pull request #123 from moormaster/fix-fail-if-line-matches-incompletely-that-should-not-match-at-all
fix: make challenge fail when lines match incompletely but should not match at all
2 parents ca83c21 + 21faa6c commit d045118

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

‎_layouts/tutorial.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
content: "{{ site.data.localization.match.matchedIncompletely[page.lang] }}";
4040
}
4141

42+
.playfield.verbose .incompletematch.fail:after {
43+
content: "{{ site.data.localization.match.shouldNotMatch[page.lang] }}";
44+
}
45+
4246
.playfield.verbose .match.ok:after {
4347
content: "{{ site.data.localization.match.matched[page.lang] }}";
4448
}

‎css/playfield.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@
5454
.playfield .incompletematch.ok {
5555
background-color: {{ site.data.colors.fails }};
5656
}
57+
.playfield .incompletematch.fail {
58+
background-color: {{ site.data.colors.fails }};
59+
}
5760
.playfield .nomatch.ok {
5861
background-color: {{ site.data.colors.fails }};
5962
}

‎js/playfield.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ function watchExpression(playfield, examples, regex, message) {
119119

120120
matchExample(match, isIncomplete, text, example);
121121

122-
// enforce overall result to fail if any match is incomplete
123-
match = !isIncomplete;
122+
// enforce overall result to fail if any expected match is incomplete
123+
if (referenceInfo.shouldMatchWholeLine && !shouldNotMatch)
124+
match = match && !isIncomplete;
124125
} else {
125126
unmatchExample(example);
126127
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /