summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew Ritter <drew@primeradiant.com>2026-11-26 00:30:54 -0800
committerDrew Ritter <drew@primeradiant.com>2026-11-26 00:30:54 -0800
commit97a38235f1de37173fe69c1939c032ee242e1b40 (patch)
tree9540389c2c088e190a8b2288b28bb365e006b88f
parent49fd83b448eaae83627ae5031d7ffbf1ccf1d6b3 (diff)
test(brainstorm-server): cover the single-select deselect of a [data-choice] button that is not an .option or .cardfix/wave1-brainstorming-companion
toggleSelect's single-select deselect query includes [data-choice], so a selected choice that is neither an .option nor a .card loses selected when another choice is picked (#2523). No test failed with that part of the query removed. The new case clicks the fixture's <button data-choice>, then option A, and asserts the button has no selected class and aria-pressed "false". Against a copy of helper.js without [data-choice] in that query, it fails because the button keeps selected, and the other 19 cases pass; with it, the file passes 20 of 20. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rw-r--r--tests/brainstorm-server/helper.test.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/brainstorm-server/helper.test.js b/tests/brainstorm-server/helper.test.js
index cd5285f..33bc70d 100644
--- a/tests/brainstorm-server/helper.test.js
+++ b/tests/brainstorm-server/helper.test.js
@@ -334,6 +334,16 @@ test('data-multiselect toggles aria-pressed independently', () => {
assert.strictEqual(c.divB.getAttribute('aria-pressed'), 'true');
});
+test('picking another single-select choice deselects a [data-choice] button that is not an .option or .card', () => {
+ const c = makeChoiceEnv();
+ c.boot();
+ c.buttonChoice.click();
+ assert.strictEqual(c.buttonChoice.getAttribute('aria-pressed'), 'true');
+ c.divA.click();
+ assert.strictEqual(c.buttonChoice.classList.contains('selected'), false);
+ assert.strictEqual(c.buttonChoice.getAttribute('aria-pressed'), 'false');
+});
+
test('ignores keydown on native controls and editable descendants', () => {
const c = makeChoiceEnv();
c.boot();