Commit 7a732c1c authored by Stephane Glondu's avatar Stephane Glondu

Invert the logic of homomorphism checkbox in the question editor

parent b8a7eb9f
Pipeline #91516 passed with stages
in 26 minutes and 48 seconds
......@@ -201,26 +201,26 @@ let rec createQuestionDiv question answers props =
let x = Dom_html.createDiv document in
Dom.appendChild container x;
let cb_type = Dom_html.createInput ~_type:(Js.string "checkbox") document in
cb_type##.className := Js.string "homomorphic_tally";
cb_type##.className := Js.string "nonhomomorphic_tally";
(match props with
| Some _ ->
Dom.appendChild container prop_div_h;
cb_type##.checked := Js._true
cb_type##.checked := Js._false
| None ->
Dom.appendChild container prop_div_nh;
cb_type##.checked := Js._false
cb_type##.checked := Js._true
);
let f _ =
if Js.to_bool cb_type##.checked then
Dom.replaceChild container prop_div_h prop_div_nh
else
Dom.replaceChild container prop_div_nh prop_div_h
else
Dom.replaceChild container prop_div_h prop_div_nh
in
cb_type##.onchange := handler f;
if not (Js.to_bool (Js.Unsafe.pure_js_expr "allow_nh")) then
cb_type##.disabled := Js._true;
Dom.appendChild x cb_type;
Dom.appendChild x (document##createTextNode (Js.string "Homomorphic tally"));
Dom.appendChild x (document##createTextNode (Js.string "Non homomorphic tally (experimental)"));
(* answers *)
let h_answers = Dom_html.createDiv document in
h_answers##.className := Js.string "question_answers";
......
......@@ -495,10 +495,10 @@ def administrator_edits_election_questions(browser, nh_question=False):
wait_for_element_exists_and_contains_expected_text(browser, page_title_css_selector, page_title_expected_content, settings.EXPLICIT_WAIT_TIMEOUT)
if nh_question:
# She unchecks "Homomorphic tally"
htally_css_selector = ".homomorphic_tally"
htally_checkbox_element = browser.find_element_by_css_selector(htally_css_selector)
htally_checkbox_element.click()
# She checks "Non homomorphic tally"
nhtally_css_selector = ".nonhomomorphic_tally"
nhtally_checkbox_element = browser.find_element_by_css_selector(nhtally_css_selector)
nhtally_checkbox_element.click()
# She removes answer 3
question_to_remove = 3
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment