Skip to content

modify test to accept both solutions in English and Spanish #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions exercises/03-Type-Radio/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,31 @@ describe('basic HTML structure', function () {
})
test("the radio inputs should have the requested values, aka, Male, Female, Heterosexual, LGBTI", function () {
let inpts = document.querySelectorAll("input[type=radio]")
let requestedValues = ["Male", "Female", "Heterosexual", "LGBTI"]
let requestedValues_en = ["Male", "Female", "Heterosexual", "LGBTI"]
let requestedValues_es = ["Masculino", "Femenino", "Heterosexual", "LGTBI"]

let check_en = false
let check_es = false

for(let idx = 0; idx < inpts.length; idx++) {
check_en = inpts[idx].getAttribute("value") === requestedValues_en[idx];

if (!check_en){
break;
}
}

for(let idx = 0; idx < inpts.length; idx++) {
check_es = inpts[idx].getAttribute("value") === requestedValues_es[idx];
if (!check_es){
break;
}
}

let expected = check_en || check_es

inpts.forEach((e,idx) => {
expect(e.getAttribute("value")).toBe(requestedValues[idx]);
expect(expected).toBeTruthy()
})
})
test("there should only be two unique names, one per pair of radio inputs", function () {
Expand Down