Skip to content

Commit

Permalink
fix: accept solutions to chips challenges regardless of case (#1494)
Browse files Browse the repository at this point in the history
* test: Add test for chips case insensitivity

* fix: Accept solutions to chips challenges regardless of case
  • Loading branch information
zmbc authored Aug 2, 2021
1 parent 26ead71 commit 2050607
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
12 changes: 12 additions & 0 deletions apps/web/cypress/integration/chips.feature
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,15 @@ Feature: Chips challenge
And I see a "Continue" button
Given I click "Continue"
Then I see a panel with only a skip and a finish early button

Scenario: Submitting an alternative correct solution with uncapitalized chips
Given I open "/course/test/skill/chips-test-0?testChallenge=59cd9b603be9"
And I click "como"
And I click "estás"
And I click "hoy"
Given I click "Submit"
Then I see the challenge panel with no skip button
And I read "Correct solution"
And I see a "Continue" button
Given I click "Continue"
Then I see a panel with only a skip and a finish early button
4 changes: 2 additions & 2 deletions apps/web/src/components/ChipsChallenge/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
if (!$answer) return
if (submitted) return
correct = false
const answerForm = $answer.join(" ")
const answerForm = $answer.join(" ").toLowerCase()
challenge.solutions.map((solution: string[]) => {
correct = correct || answerForm === solution.join(" ")
correct = correct || answerForm === solution.join(" ").toLowerCase()
})
registerResult(correct)
submitted = true
Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/courses/test/challenges/chips-test-0.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
"como",
"estás",
"hoy"
],
[
"Como",
"estás",
"hoy"
]
],
"formattedSolution": "Tu como estás hoy?",
Expand Down
2 changes: 2 additions & 0 deletions courses/test/basics/skills/chips-test-0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Phrases:

- Translation: How are you today?
Phrase: Tu como estás hoy?
Alternative versions:
- Como estás hoy?

New words: []

Expand Down

1 comment on commit 2050607

@vercel
Copy link

@vercel vercel bot commented on 2050607 Aug 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.