Compare commits

..

2 Commits

Author SHA1 Message Date
Neale Pickett c20cc1484f Pass unit tests 2023-10-03 11:44:51 -07:00
Neale Pickett 44dfbd43b5 window.checkAnswer function 2023-10-03 11:24:26 -07:00
2 changed files with 3 additions and 2 deletions

View File

@ -45,7 +45,7 @@ func TestHttpd(t *testing.T) {
if r := hs.TestRequest("/state", nil); r.Result().StatusCode != 200 {
t.Error(r.Result())
} else if r.Body.String() != `{"Config":{"Devel":false},"TeamNames":{},"PointsLog":[],"Puzzles":{}}` {
} else if r.Body.String() != `{"Config":{"Devel":false},"Enabled":true,"TeamNames":{},"PointsLog":[],"Puzzles":{}}` {
t.Error("Unexpected state", r.Body.String())
}
@ -71,7 +71,7 @@ func TestHttpd(t *testing.T) {
if r := hs.TestRequest("/state", nil); r.Result().StatusCode != 200 {
t.Error(r.Result())
} else if r.Body.String() != `{"Config":{"Devel":false},"TeamNames":{"self":"GoTeam"},"PointsLog":[],"Puzzles":{"pategory":[1]}}` {
} else if r.Body.String() != `{"Config":{"Devel":false},"Enabled":true,"TeamNames":{"self":"GoTeam"},"PointsLog":[],"Puzzles":{"pategory":[1]}}` {
t.Error("Unexpected state", r.Body.String())
}

View File

@ -209,6 +209,7 @@ async function loadPuzzle(category, points) {
async function init() {
window.app = {}
window.setanswer = (str => SetAnswer(str))
window.checkAnswer = (str => window.app.puzzle.IsPossiblyCorrect(str))
for (let form of document.querySelectorAll("form.answer")) {
form.addEventListener("submit", formSubmitHandler)