From 8d4e5a9a5320da21f65c7b68fe14cacdb0bd75e6 Mon Sep 17 00:00:00 2001 From: alflennik Date: Mon, 8 Aug 2022 20:41:40 -0400 Subject: [PATCH 1/5] Update test renderer to support unexpected behavior note --- tests/resources/aria-at-harness.mjs | 63 ++++--- tests/resources/aria-at-test-io-format.mjs | 78 ++++----- tests/resources/aria-at-test-run.mjs | 190 +++++++++++---------- tests/resources/at-commands.mjs | 2 +- 4 files changed, 177 insertions(+), 156 deletions(-) diff --git a/tests/resources/aria-at-harness.mjs b/tests/resources/aria-at-harness.mjs index b95489bc7..e66b9b638 100644 --- a/tests/resources/aria-at-harness.mjs +++ b/tests/resources/aria-at-harness.mjs @@ -166,7 +166,7 @@ function displayInstructionsForBehaviorTest() { if (window.parent && window.parent.postMessage) { // results can be submitted by parent posting a message to the // iFrame with a data.type property of 'submit' - window.addEventListener('message', function (message) { + window.addEventListener('message', function(message) { if (!validateMessage(message, 'submit')) return; app.hooks.submit(); }); @@ -417,7 +417,7 @@ function renderVirtualInstructionDocument(doc) { type('checkbox'), value(failOption.description), id(`${failOption.description}-${commandIndex}`), - className([`undesirable-${commandIndex}`]), + className([`unexpected-${commandIndex}`]), tabIndex(failOption.tabbable ? '0' : '-1'), disabled(!failOption.enabled), checked(failOption.checked), @@ -436,28 +436,24 @@ function renderVirtualInstructionDocument(doc) { forInput(`${failOption.description}-${commandIndex}`), rich(failOption.description) ), - br(), - failOption.more - ? div( - label( - forInput(`${failOption.description}-${commandIndex}-input`), - rich(failOption.more.description) - ), - input( - type('text'), - id(`${failOption.description}-${commandIndex}-input`), - name(`${failOption.description}-${commandIndex}-input`), - className(['undesirable-other-input']), - disabled(!failOption.more.enabled), - value(failOption.more.value), - onchange(ev => - failOption.more.change( - /** @type {HTMLInputElement} */ (ev.currentTarget).value - ) - ) - ) - ) - : fragment() + br() + ) + ), + fragment( + // TODO: Figure out why this isn't appearing + div( + label(forInput('unexpected-behavior-note'), rich('Add an explanation')), + input( + type('text'), + id('unexpected-behavior-note'), + name('unexpected-behavior-note'), + className(['unexpected-behavior-note']), + value(unexpected.failChoice.note.value), + disabled(!unexpected.failChoice.note.enabled), + onchange(ev => + unexpected.failChoice.note.change(/** @type {HTMLInputElement} */ (ev.currentTarget).value) + ) + ) ) ) ) @@ -592,9 +588,24 @@ function renderVirtualResultsTable(results) { * @param {object} list * @param {Description} list.description * @param {Description[]} list.items + * @param {String} [list.note] */ - function commandDetailsList({ description, items }) { - return div(description, ul(...items.map(description => li(rich(description))))); + function commandDetailsList({ + description, + items, + note: { value: noteValue = '', description: noteDescription } = {}, + }) { + return div( + description, + ul( + ...items.map( + description => li(rich(description)), + ), + noteValue.length + ? li(rich(noteDescription), ' ', em(noteValue)) + : fragment() + ) + ); } } diff --git a/tests/resources/aria-at-test-io-format.mjs b/tests/resources/aria-at-test-io-format.mjs index 16a4770c8..5f7e4b286 100644 --- a/tests/resources/aria-at-test-io-format.mjs +++ b/tests/resources/aria-at-test-io-format.mjs @@ -80,7 +80,7 @@ class KeysInput { modeInstructions: { reading: { jaws: `Verify the Virtual Cursor is active by pressing ${keys.ALT_DELETE}. If it is not, turn on the Virtual Cursor by pressing ${keys.INS_Z}.`, - nvda: `Ensure NVDA is in browse mode by pressing ${keys.ESC}. Note: This command has no effect if NVDA is already in browse mode.`, + nvda: `Insure NVDA is in browse mode by pressing ${keys.ESC}. Note: This command has no effect if NVDA is already in browse mode.`, voiceover_macos: `Toggle Quick Nav ON by pressing the ${keys.LEFT} and ${keys.RIGHT} keys at the same time.`, }[atKey], interaction: { @@ -234,8 +234,9 @@ class CommandsInput { commands: { [collectedTest.info.task]: { [collectedTest.target.mode]: { - [collectedTest.target.at.key]: collectedTest.commands.map( - ({ id, extraInstruction }) => (extraInstruction ? [id, extraInstruction] : [id]) + [collectedTest.target.at + .key]: collectedTest.commands.map(({ id, extraInstruction }) => + extraInstruction ? [id, extraInstruction] : [id] ), }, }, @@ -891,36 +892,39 @@ export class TestRunInputOutput { enabled: true, }, commands: test.commands.map( - command => - /** @type {import("./aria-at-test-run.mjs").TestRunCommand} */ ({ - description: command, - atOutput: { - highlightRequired: false, - value: '', - }, - assertions: test.assertions.map(assertion => ({ - description: assertion.assertion, - highlightRequired: false, - priority: assertion.priority, - result: CommonResultMap.NOT_SET, - })), - additionalAssertions: test.additionalAssertions.map(assertion => ({ - description: assertion.assertion, - highlightRequired: false, - priority: assertion.priority, - result: CommonResultMap.NOT_SET, + command => /** @type {import("./aria-at-test-run.mjs").TestRunCommand} */ ({ + description: command, + atOutput: { + highlightRequired: false, + value: '', + }, + assertions: test.assertions.map(assertion => ({ + description: assertion.assertion, + highlightRequired: false, + priority: assertion.priority, + result: CommonResultMap.NOT_SET, + })), + additionalAssertions: test.additionalAssertions.map(assertion => ({ + description: assertion.assertion, + highlightRequired: false, + priority: assertion.priority, + result: CommonResultMap.NOT_SET, + })), + unexpected: { + highlightRequired: false, + hasUnexpected: HasUnexpectedBehaviorMap.NOT_SET, + tabbedBehavior: 0, + behaviors: test.unexpectedBehaviors.map(({ description, requireExplanation }) => ({ + description, + checked: false, + requireExplanation, })), - unexpected: { + note: { highlightRequired: false, - hasUnexpected: HasUnexpectedBehaviorMap.NOT_SET, - tabbedBehavior: 0, - behaviors: test.unexpectedBehaviors.map(({ description, requireExplanation }) => ({ - description, - checked: false, - more: requireExplanation ? { highlightRequired: false, value: '' } : null, - })), + value: '', }, - }) + }, + }) ), }; @@ -1009,7 +1013,7 @@ export class TestRunInputOutput { ), unexpected_behaviors: command.unexpected.behaviors .filter(({ checked }) => checked) - .map(({ description, more }) => (more ? more.value : description)), + .map(({ description }) => description), })), }; @@ -1125,11 +1129,11 @@ export class TestRunInputOutput { behavior.checked ? { text: behavior.description, - otherUnexpectedBehaviorText: behavior.more ? behavior.more.value : null, } : null ) .filter(Boolean), + unexpectedBehaviorNote: command.unexpected.note.value || null, })), }; } @@ -1194,14 +1198,12 @@ export class TestRunInputOutput { return { ...behavior, checked: behaviorResult ? true : false, - more: behavior.more - ? { - highlightRequired: false, - value: behaviorResult ? behaviorResult.otherUnexpectedBehaviorText : '', - } - : behavior.more, }; }), + note: { + highlightRequired: false, + value: scenarioResult.unexpectedBehaviorNote || '', + }, }, }; }), diff --git a/tests/resources/aria-at-test-run.mjs b/tests/resources/aria-at-test-run.mjs index cfdc0b7e0..f8897d8d4 100644 --- a/tests/resources/aria-at-test-run.mjs +++ b/tests/resources/aria-at-test-run.mjs @@ -19,7 +19,7 @@ export class TestRun { setCommandAssertion: bindDispatch(userChangeCommandAssertion), setCommandHasUnexpectedBehavior: bindDispatch(userChangeCommandHasUnexpectedBehavior), setCommandUnexpectedBehavior: bindDispatch(userChangeCommandUnexpectedBehavior), - setCommandUnexpectedBehaviorMore: bindDispatch(userChangeCommandUnexpectedBehaviorMore), + setCommandUnexpectedBehaviorNote: bindDispatch(userChangeCommandUnexpectedBehaviorNote), setCommandOutput: bindDispatch(userChangeCommandOutput), submit: () => submitResult(this), ...hooks, @@ -230,7 +230,7 @@ export function instructionDocument(resultState, hooks) { ], unexpectedBehaviors: { description: [ - 'Were there additional undesirable behaviors?', + 'Were there additional unexpected behaviors?', { required: true, highlightRequired: resultStateCommand.unexpected.highlightRequired, @@ -238,7 +238,7 @@ export function instructionDocument(resultState, hooks) { }, ], passChoice: { - label: 'No, there were no additional undesirable behaviors.', + label: 'No, there were no additional unexpected behaviors.', checked: resultUnexpectedBehavior.hasUnexpected === HasUnexpectedBehaviorMap.DOES_NOT_HAVE_UNEXPECTED, @@ -254,7 +254,7 @@ export function instructionDocument(resultState, hooks) { }), }, failChoice: { - label: 'Yes, there were additional undesirable behaviors', + label: 'Yes, there were additional unexpected behaviors.', checked: resultUnexpectedBehavior.hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED, focus: @@ -268,7 +268,7 @@ export function instructionDocument(resultState, hooks) { hasUnexpected: HasUnexpectedBehaviorMap.HAS_UNEXPECTED, }), options: { - header: 'Undesirable behaviors', + header: 'Unexpected behaviors', options: resultUnexpectedBehavior.behaviors.map((behavior, unexpectedIndex) => { return { description: behavior.description, @@ -279,7 +279,7 @@ export function instructionDocument(resultState, hooks) { checked: behavior.checked, focus: typeof resultState.currentUserAction === 'object' && - resultState.currentUserAction.action === UserObjectActionMap.FOCUS_UNDESIRABLE + resultState.currentUserAction.action === UserObjectActionMap.FOCUS_UNEXPECTED ? resultState.currentUserAction.commandIndex === commandIndex && resultUnexpectedBehavior.tabbedBehavior === unexpectedIndex : resultState.currentUserAction === UserActionMap.VALIDATE_RESULTS && @@ -301,33 +301,40 @@ export function instructionDocument(resultState, hooks) { } return false; }, - more: behavior.more - ? { - description: /** @type {Description[]} */ ([ - `If "other" selected, explain`, - { - required: true, - highlightRequired: behavior.more.highlightRequired, - description: '(required)', - }, - ]), - enabled: behavior.checked, - value: behavior.more.value, - focus: - resultState.currentUserAction === 'validateResults' && - behavior.more.highlightRequired && - focusFirstRequired(), - change: value => - hooks.setCommandUnexpectedBehaviorMore({ - commandIndex, - unexpectedIndex, - more: value, - }), - } - : null, }; }), }, + note: { + description: /** @type {Description[]} */ ([ + `Add an explanation`, + { + required: resultUnexpectedBehavior.behaviors.some( + ({ checked, requireExplanation }) => requireExplanation && checked + ), + highlightRequired: + resultState.currentUserAction === 'validateResults' && + resultUnexpectedBehavior.behaviors.some( + ({ checked, requireExplanation }) => requireExplanation && checked + ), + description: resultUnexpectedBehavior.behaviors.some( + ({ checked, requireExplanation }) => requireExplanation && checked + ) + ? ' (required)' + : ' (not required)', + }, + ]), + enabled: + resultUnexpectedBehavior.hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED && + resultUnexpectedBehavior.behaviors.some(({ checked }) => checked), + value: resultUnexpectedBehavior.note.value, + focus: + resultState.currentUserAction === 'validateResults' && + resultUnexpectedBehavior.behaviors.some( + ({ checked, requireExplanation }) => requireExplanation && checked + ) && + focusFirstRequired(), + change: value => hooks.setCommandUnexpectedBehaviorNote({ commandIndex, note: value }), + }, }, }, }; @@ -455,7 +462,7 @@ export const UserActionMap = createEnumMap({ */ export const UserObjectActionMap = createEnumMap({ - FOCUS_UNDESIRABLE: 'focusUndesirable', + FOCUS_UNEXPECTED: 'focusUnexpected', }); /** @@ -503,7 +510,7 @@ export const AssertionResultMap = createEnumMap({ * @returns {(state: TestRunState) => TestRunState} */ export function userChangeCommandOutput({ commandIndex, atOutput }) { - return function (state) { + return function(state) { return { ...state, currentUserAction: UserActionMap.CHANGE_TEXT, @@ -530,7 +537,7 @@ export function userChangeCommandOutput({ commandIndex, atOutput }) { * @returns {(state: TestRunState) => TestRunState} */ export function userChangeCommandAssertion({ commandIndex, assertionIndex, result }) { - return function (state) { + return function(state) { return { ...state, currentUserAction: UserActionMap.CHANGE_SELECTION, @@ -560,7 +567,7 @@ export function userChangeCommandAdditionalAssertion({ additionalAssertionIndex, result, }) { - return function (state) { + return function(state) { return { ...state, currentUserAction: UserActionMap.CHANGE_SELECTION, @@ -585,7 +592,7 @@ export function userChangeCommandAdditionalAssertion({ * @returns {(state: TestRunState) => TestRunState} */ export function userChangeCommandHasUnexpectedBehavior({ commandIndex, hasUnexpected }) { - return function (state) { + return function(state) { return { ...state, currentUserAction: UserActionMap.CHANGE_SELECTION, @@ -601,8 +608,11 @@ export function userChangeCommandHasUnexpectedBehavior({ commandIndex, hasUnexpe behaviors: command.unexpected.behaviors.map(behavior => ({ ...behavior, checked: false, - more: behavior.more ? { ...behavior.more, value: '' } : null, })), + note: { + ...command.unexpected.note, + value: '', + } }, } ), @@ -618,7 +628,7 @@ export function userChangeCommandHasUnexpectedBehavior({ commandIndex, hasUnexpe * @returns {(state: TestRunState) => TestRunState} */ export function userChangeCommandUnexpectedBehavior({ commandIndex, unexpectedIndex, checked }) { - return function (state) { + return function(state) { return { ...state, currentUserAction: UserActionMap.CHANGE_SELECTION, @@ -647,12 +657,11 @@ export function userChangeCommandUnexpectedBehavior({ commandIndex, unexpectedIn /** * @param {object} props * @param {number} props.commandIndex - * @param {number} props.unexpectedIndex - * @param {string} props.more + * @param {string} props.note * @returns {(state: TestRunState) => TestRunState} */ -export function userChangeCommandUnexpectedBehaviorMore({ commandIndex, unexpectedIndex, more }) { - return function (state) { +export function userChangeCommandUnexpectedBehaviorNote({ commandIndex, note }) { + return function(state) { return { ...state, currentUserAction: UserActionMap.CHANGE_TEXT, @@ -663,17 +672,10 @@ export function userChangeCommandUnexpectedBehaviorMore({ commandIndex, unexpect ...command, unexpected: { ...command.unexpected, - behaviors: command.unexpected.behaviors.map((unexpected, unexpectedI) => - unexpectedI !== unexpectedIndex - ? unexpected - : /** @type {TestRunUnexpectedBehavior} */ ({ - ...unexpected, - more: { - ...unexpected.more, - value: more, - }, - }) - ), + note: { + ...command.unexpected.note, + value: note, + }, }, }) ), @@ -739,7 +741,7 @@ function submitResult(app) { } export function userShowResults() { - return function (/** @type {TestRunState} */ state) { + return function(/** @type {TestRunState} */ state) { return /** @type {TestRunState} */ ({ ...state, currentUserAction: UserActionMap.SHOW_RESULTS, @@ -763,7 +765,10 @@ function isSomeFieldRequired(state) { (command.unexpected.hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED && (command.unexpected.behaviors.every(({ checked }) => !checked) || command.unexpected.behaviors.some( - behavior => behavior.checked && behavior.more && behavior.more.value.trim() === '' + behavior => + behavior.checked && + command.unexpected.note && + command.unexpected.note.value.trim() === '' ))) ); } @@ -814,7 +819,7 @@ function resultsTableDocument(state) { if (command.unexpected.behaviors.some(({ checked }) => checked)) { unexpectedBehaviors = command.unexpected.behaviors .filter(({ checked }) => checked) - .map(({ description, more }) => (more ? more.value : description)); + .map(({ description }) => description); } return { @@ -834,13 +839,15 @@ function resultsTableDocument(state) { 'output:', /** @type {DescriptionWhitespace} */ ({ whitespace: WhitespaceStyleMap.LINE_BREAK }), ' ', - ...command.atOutput.value.split(/(\r\n|\r|\n)/g).map(output => - /\r\n|\r|\n/.test(output) - ? /** @type {DescriptionWhitespace} */ ({ - whitespace: WhitespaceStyleMap.LINE_BREAK, - }) - : output - ), + ...command.atOutput.value + .split(/(\r\n|\r|\n)/g) + .map(output => + /\r\n|\r|\n/.test(output) + ? /** @type {DescriptionWhitespace} */ ({ + whitespace: WhitespaceStyleMap.LINE_BREAK, + }) + : output + ), ], passingAssertions: { description: 'Passing Assertions:', @@ -851,8 +858,12 @@ function resultsTableDocument(state) { items: failingAssertions, }, unexpectedBehaviors: { - description: 'Unexpected Behavior', + description: 'Unexpected Behavior:', items: unexpectedBehaviors, + note: { + description: 'Explanation:', + value: command.unexpected.note.value, + }, }, }, }; @@ -862,21 +873,19 @@ function resultsTableDocument(state) { } export function userOpenWindow() { - return (/** @type {TestRunState} */ state) => - /** @type {TestRunState} */ ({ - ...state, - currentUserAction: UserActionMap.OPEN_TEST_WINDOW, - openTest: { ...state.openTest, enabled: false }, - }); + return (/** @type {TestRunState} */ state) => /** @type {TestRunState} */ ({ + ...state, + currentUserAction: UserActionMap.OPEN_TEST_WINDOW, + openTest: { ...state.openTest, enabled: false }, + }); } export function userCloseWindow() { - return (/** @type {TestRunState} */ state) => - /** @type {TestRunState} */ ({ - ...state, - currentUserAction: UserActionMap.CLOSE_TEST_WINDOW, - openTest: { ...state.openTest, enabled: true }, - }); + return (/** @type {TestRunState} */ state) => /** @type {TestRunState} */ ({ + ...state, + currentUserAction: UserActionMap.CLOSE_TEST_WINDOW, + openTest: { ...state.openTest, enabled: true }, + }); } /** @@ -887,7 +896,7 @@ export function userCloseWindow() { * @returns {(state: TestRunState) => TestRunState} */ export function userFocusCommandUnexpectedBehavior({ commandIndex, unexpectedIndex, increment }) { - return function (state) { + return function(state) { const unexpectedLength = state.commands[commandIndex].unexpected.behaviors.length; const incrementValue = increment === 'next' ? 1 : -1; const newUnexpectedIndex = @@ -896,7 +905,7 @@ export function userFocusCommandUnexpectedBehavior({ commandIndex, unexpectedInd return { ...state, currentUserAction: { - action: UserObjectActionMap.FOCUS_UNDESIRABLE, + action: UserObjectActionMap.FOCUS_UNEXPECTED, commandIndex, unexpectedIndex: newUnexpectedIndex, }, @@ -923,7 +932,7 @@ export function userFocusCommandUnexpectedBehavior({ commandIndex, unexpectedInd * @returns {(state: TestRunState) => TestRunState} */ export function userValidateState() { - return function (state) { + return function(state) { return { ...state, currentUserAction: UserActionMap.VALIDATE_RESULTS, @@ -948,17 +957,16 @@ export function userValidateState() { command.unexpected.hasUnexpected === HasUnexpectedBehaviorMap.NOT_SET || (command.unexpected.hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED && command.unexpected.behaviors.every(({ checked }) => !checked)), - behaviors: command.unexpected.behaviors.map(unexpected => { - return unexpected.more - ? { - ...unexpected, - more: { - ...unexpected.more, - highlightRequired: unexpected.checked && !unexpected.more.value.trim(), - }, - } - : unexpected; - }), + note: { + ...command.unexpected.note, + highlightRequired: + command.unexpected.note.value.trim() === '' && + command.unexpected.hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED && + (command.unexpected.behaviors.every(({ checked }) => !checked) || + command.unexpected.behaviors.some( + ({ checked, requireExplanation }) => requireExplanation && checked + )), + }, }, }; }), @@ -1168,13 +1176,13 @@ export function userValidateState() { * @property {(options: {commandIndex: number, hasUnexpected: HasUnexpectedBehavior}) => void } setCommandHasUnexpectedBehavior * @property {(options: {commandIndex: number, atOutput: string}) => void} setCommandOutput * @property {(options: {commandIndex: number, unexpectedIndex: number, checked}) => void } setCommandUnexpectedBehavior - * @property {(options: {commandIndex: number, unexpectedIndex: number, more: string}) => void } setCommandUnexpectedBehaviorMore + * @property {(options: {commandIndex: number, unexpectedIndex: number, more: string}) => void } setCommandUnexpectedBehaviorNote * @property {() => void} submit */ /** * @typedef UserActionFocusUnexpected - * @property {typeof UserObjectActionMap["FOCUS_UNDESIRABLE"]} action + * @property {typeof UserObjectActionMap["FOCUS_UNEXPECTED"]} action * @property {number} commandIndex * @property {number} unexpectedIndex */ diff --git a/tests/resources/at-commands.mjs b/tests/resources/at-commands.mjs index 9d13bc106..a95ffdf85 100644 --- a/tests/resources/at-commands.mjs +++ b/tests/resources/at-commands.mjs @@ -35,7 +35,7 @@ export class commandsAPI { this.MODE_INSTRUCTIONS = { reading: { jaws: `Verify the Virtual Cursor is active by pressing ${keys.ALT_DELETE}. If it is not, turn on the Virtual Cursor by pressing ${keys.INS_Z}.`, - nvda: `Ensure NVDA is in browse mode by pressing ${keys.ESC}. Note: This command has no effect if NVDA is already in browse mode.`, + nvda: `Insure NVDA is in browse mode by pressing ${keys.ESC}. Note: This command has no effect if NVDA is already in browse mode.`, voiceover_macos: `Toggle Quick Nav ON by pressing the ${keys.LEFT} and ${keys.RIGHT} keys at the same time.`, }, interaction: { From d24f5c8bb9e60edef15b707512e6be5db8593714 Mon Sep 17 00:00:00 2001 From: alflennik Date: Mon, 8 Aug 2022 21:06:12 -0400 Subject: [PATCH 2/5] Fix validation bug --- tests/resources/aria-at-test-run.mjs | 34 +++++++++++++--------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/tests/resources/aria-at-test-run.mjs b/tests/resources/aria-at-test-run.mjs index f8897d8d4..967bd98f8 100644 --- a/tests/resources/aria-at-test-run.mjs +++ b/tests/resources/aria-at-test-run.mjs @@ -612,7 +612,7 @@ export function userChangeCommandHasUnexpectedBehavior({ commandIndex, hasUnexpe note: { ...command.unexpected.note, value: '', - } + }, }, } ), @@ -764,12 +764,14 @@ function isSomeFieldRequired(state) { command.unexpected.hasUnexpected === HasUnexpectedBehaviorMap.NOT_SET || (command.unexpected.hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED && (command.unexpected.behaviors.every(({ checked }) => !checked) || - command.unexpected.behaviors.some( - behavior => + command.unexpected.behaviors.some(behavior => { + return ( behavior.checked && + behavior.requireExplanation && command.unexpected.note && command.unexpected.note.value.trim() === '' - ))) + ); + }))) ); } @@ -839,15 +841,13 @@ function resultsTableDocument(state) { 'output:', /** @type {DescriptionWhitespace} */ ({ whitespace: WhitespaceStyleMap.LINE_BREAK }), ' ', - ...command.atOutput.value - .split(/(\r\n|\r|\n)/g) - .map(output => - /\r\n|\r|\n/.test(output) - ? /** @type {DescriptionWhitespace} */ ({ - whitespace: WhitespaceStyleMap.LINE_BREAK, - }) - : output - ), + ...command.atOutput.value.split(/(\r\n|\r|\n)/g).map(output => + /\r\n|\r|\n/.test(output) + ? /** @type {DescriptionWhitespace} */ ({ + whitespace: WhitespaceStyleMap.LINE_BREAK, + }) + : output + ), ], passingAssertions: { description: 'Passing Assertions:', @@ -961,11 +961,9 @@ export function userValidateState() { ...command.unexpected.note, highlightRequired: command.unexpected.note.value.trim() === '' && - command.unexpected.hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED && - (command.unexpected.behaviors.every(({ checked }) => !checked) || - command.unexpected.behaviors.some( - ({ checked, requireExplanation }) => requireExplanation && checked - )), + command.unexpected.behaviors.some( + ({ checked, requireExplanation }) => requireExplanation && checked + ), }, }, }; From adfe5190588f6ba7db8587915ccafa8fb2904bf1 Mon Sep 17 00:00:00 2001 From: Erika Miguel Date: Wed, 5 Apr 2023 16:06:09 -0400 Subject: [PATCH 3/5] formatting changes --- tests/resources/aria-at-harness.mjs | 14 +- tests/resources/aria-at-test-run.mjs | 40 ++--- tests/resources/types/aria-at-test-result.js | 54 +++---- tests/resources/types/aria-at-test-run.js | 160 +++++++++---------- 4 files changed, 134 insertions(+), 134 deletions(-) diff --git a/tests/resources/aria-at-harness.mjs b/tests/resources/aria-at-harness.mjs index e66b9b638..c5a4f1ac7 100644 --- a/tests/resources/aria-at-harness.mjs +++ b/tests/resources/aria-at-harness.mjs @@ -166,7 +166,7 @@ function displayInstructionsForBehaviorTest() { if (window.parent && window.parent.postMessage) { // results can be submitted by parent posting a message to the // iFrame with a data.type property of 'submit' - window.addEventListener('message', function(message) { + window.addEventListener('message', function (message) { if (!validateMessage(message, 'submit')) return; app.hooks.submit(); }); @@ -451,7 +451,9 @@ function renderVirtualInstructionDocument(doc) { value(unexpected.failChoice.note.value), disabled(!unexpected.failChoice.note.enabled), onchange(ev => - unexpected.failChoice.note.change(/** @type {HTMLInputElement} */ (ev.currentTarget).value) + unexpected.failChoice.note.change( + /** @type {HTMLInputElement} */ (ev.currentTarget).value + ) ) ) ) @@ -598,12 +600,8 @@ function renderVirtualResultsTable(results) { return div( description, ul( - ...items.map( - description => li(rich(description)), - ), - noteValue.length - ? li(rich(noteDescription), ' ', em(noteValue)) - : fragment() + ...items.map(description => li(rich(description))), + noteValue.length ? li(rich(noteDescription), ' ', em(noteValue)) : fragment() ) ); } diff --git a/tests/resources/aria-at-test-run.mjs b/tests/resources/aria-at-test-run.mjs index 967bd98f8..197537f74 100644 --- a/tests/resources/aria-at-test-run.mjs +++ b/tests/resources/aria-at-test-run.mjs @@ -510,7 +510,7 @@ export const AssertionResultMap = createEnumMap({ * @returns {(state: TestRunState) => TestRunState} */ export function userChangeCommandOutput({ commandIndex, atOutput }) { - return function(state) { + return function (state) { return { ...state, currentUserAction: UserActionMap.CHANGE_TEXT, @@ -537,7 +537,7 @@ export function userChangeCommandOutput({ commandIndex, atOutput }) { * @returns {(state: TestRunState) => TestRunState} */ export function userChangeCommandAssertion({ commandIndex, assertionIndex, result }) { - return function(state) { + return function (state) { return { ...state, currentUserAction: UserActionMap.CHANGE_SELECTION, @@ -567,7 +567,7 @@ export function userChangeCommandAdditionalAssertion({ additionalAssertionIndex, result, }) { - return function(state) { + return function (state) { return { ...state, currentUserAction: UserActionMap.CHANGE_SELECTION, @@ -592,7 +592,7 @@ export function userChangeCommandAdditionalAssertion({ * @returns {(state: TestRunState) => TestRunState} */ export function userChangeCommandHasUnexpectedBehavior({ commandIndex, hasUnexpected }) { - return function(state) { + return function (state) { return { ...state, currentUserAction: UserActionMap.CHANGE_SELECTION, @@ -628,7 +628,7 @@ export function userChangeCommandHasUnexpectedBehavior({ commandIndex, hasUnexpe * @returns {(state: TestRunState) => TestRunState} */ export function userChangeCommandUnexpectedBehavior({ commandIndex, unexpectedIndex, checked }) { - return function(state) { + return function (state) { return { ...state, currentUserAction: UserActionMap.CHANGE_SELECTION, @@ -661,7 +661,7 @@ export function userChangeCommandUnexpectedBehavior({ commandIndex, unexpectedIn * @returns {(state: TestRunState) => TestRunState} */ export function userChangeCommandUnexpectedBehaviorNote({ commandIndex, note }) { - return function(state) { + return function (state) { return { ...state, currentUserAction: UserActionMap.CHANGE_TEXT, @@ -741,7 +741,7 @@ function submitResult(app) { } export function userShowResults() { - return function(/** @type {TestRunState} */ state) { + return function (/** @type {TestRunState} */ state) { return /** @type {TestRunState} */ ({ ...state, currentUserAction: UserActionMap.SHOW_RESULTS, @@ -873,19 +873,21 @@ function resultsTableDocument(state) { } export function userOpenWindow() { - return (/** @type {TestRunState} */ state) => /** @type {TestRunState} */ ({ - ...state, - currentUserAction: UserActionMap.OPEN_TEST_WINDOW, - openTest: { ...state.openTest, enabled: false }, - }); + return (/** @type {TestRunState} */ state) => + /** @type {TestRunState} */ ({ + ...state, + currentUserAction: UserActionMap.OPEN_TEST_WINDOW, + openTest: { ...state.openTest, enabled: false }, + }); } export function userCloseWindow() { - return (/** @type {TestRunState} */ state) => /** @type {TestRunState} */ ({ - ...state, - currentUserAction: UserActionMap.CLOSE_TEST_WINDOW, - openTest: { ...state.openTest, enabled: true }, - }); + return (/** @type {TestRunState} */ state) => + /** @type {TestRunState} */ ({ + ...state, + currentUserAction: UserActionMap.CLOSE_TEST_WINDOW, + openTest: { ...state.openTest, enabled: true }, + }); } /** @@ -896,7 +898,7 @@ export function userCloseWindow() { * @returns {(state: TestRunState) => TestRunState} */ export function userFocusCommandUnexpectedBehavior({ commandIndex, unexpectedIndex, increment }) { - return function(state) { + return function (state) { const unexpectedLength = state.commands[commandIndex].unexpected.behaviors.length; const incrementValue = increment === 'next' ? 1 : -1; const newUnexpectedIndex = @@ -932,7 +934,7 @@ export function userFocusCommandUnexpectedBehavior({ commandIndex, unexpectedInd * @returns {(state: TestRunState) => TestRunState} */ export function userValidateState() { - return function(state) { + return function (state) { return { ...state, currentUserAction: UserActionMap.VALIDATE_RESULTS, diff --git a/tests/resources/types/aria-at-test-result.js b/tests/resources/types/aria-at-test-result.js index ff989c6a5..00bec4399 100644 --- a/tests/resources/types/aria-at-test-result.js +++ b/tests/resources/types/aria-at-test-result.js @@ -5,34 +5,34 @@ /** * @typedef {"REQUIRED" - * | "OPTIONAL"} AriaATTestResult.AssertionPriorityJSON - */ +* | "OPTIONAL"} AriaATTestResult.AssertionPriorityJSON +*/ /** - * @typedef {"INCORRECT_OUTPUT" - * | "NO_OUTPUT"} AriaATTestResult.AssertionFailedReasonJSON - */ +* @typedef {"INCORRECT_OUTPUT" +* | "NO_OUTPUT"} AriaATTestResult.AssertionFailedReasonJSON +*/ /** - * @typedef AriaATTestResult.JSON - * @property {object} test - * @property {string} test.title - * @property {object} test.at - * @property {string} test.at.id - * @property {string} test.atMode - * @property {object[]} scenarioResults - * @property {object} scenarioResults[].scenario - * @property {object} scenarioResults[].scenario.command - * @property {string} scenarioResults[].scenario.command.id - * @property {string} scenarioResults[].output - * @property {object[]} scenarioResults[].assertionResults - * @property {object} scenarioResults[].assertionResults[].assertion - * @property {AriaATTestResult.AssertionPriorityJSON} scenarioResults[].assertionResults[].assertion.priority - * @property {string} scenarioResults[].assertionResults[].assertion.text - * @property {boolean} scenarioResults[].assertionResults[].passed - * @property {AriaATTestResult.AssertionFailedReasonJSON | null} [scenarioResults[].assertionResults[].failedReason] - * @property {object[]} scenarioResults[].unexpectedBehaviors - * @property {string} scenarioResults[].unexpectedBehaviors[].id - * @property {string} scenarioResults[].unexpectedBehaviors[].text - * @property {string | null} [scenarioResults[].unexpectedBehaviors[].otherUnexpectedBehaviorText] - */ +* @typedef AriaATTestResult.JSON +* @property {object} test +* @property {string} test.title +* @property {object} test.at +* @property {string} test.at.id +* @property {string} test.atMode +* @property {object[]} scenarioResults +* @property {object} scenarioResults[].scenario +* @property {object} scenarioResults[].scenario.command +* @property {string} scenarioResults[].scenario.command.id +* @property {string} scenarioResults[].output +* @property {object[]} scenarioResults[].assertionResults +* @property {object} scenarioResults[].assertionResults[].assertion +* @property {AriaATTestResult.AssertionPriorityJSON} scenarioResults[].assertionResults[].assertion.priority +* @property {string} scenarioResults[].assertionResults[].assertion.text +* @property {boolean} scenarioResults[].assertionResults[].passed +* @property {AriaATTestResult.AssertionFailedReasonJSON | null} [scenarioResults[].assertionResults[].failedReason] +* @property {object[]} scenarioResults[].unexpectedBehaviors +* @property {string} scenarioResults[].unexpectedBehaviors[].id +* @property {string} scenarioResults[].unexpectedBehaviors[].text +* @property {string | null} [scenarioResults[].unexpectedBehaviorNote] +*/ diff --git a/tests/resources/types/aria-at-test-run.js b/tests/resources/types/aria-at-test-run.js index cdeceb90e..1274723d3 100644 --- a/tests/resources/types/aria-at-test-run.js +++ b/tests/resources/types/aria-at-test-run.js @@ -2,99 +2,99 @@ /** * @typedef {"reading" - * | "interaction"} AriaATTestRun.ATMode - */ +* | "interaction"} AriaATTestRun.ATMode +*/ /** - * @typedef {"loadPage" - * | "openTestWindow" - * | "closeTestWindow" - * | "validateResults" - * | "changeText" - * | "changeSelection" - * | "showResults"} AriaATTestRun.UserActionName - */ +* @typedef {"loadPage" +* | "openTestWindow" +* | "closeTestWindow" +* | "validateResults" +* | "changeText" +* | "changeSelection" +* | "showResults"} AriaATTestRun.UserActionName +*/ /** - * @typedef {"focusUndesirable"} AriaATTestRun.UserActionObjectName - */ +* @typedef {"focusUnexpected"} AriaATTestRun.UserActionObjectName +*/ /** - * @typedef AriaATTestRun.UserActionFocusUnexpected - * @property {"focusUndesirable"} action - * @property {number} commandIndex - * @property {number} unexpectedIndex - */ +* @typedef AriaATTestRun.UserActionFocusUnexpected +* @property {"focusUnexpected"} action +* @property {number} commandIndex +* @property {number} unexpectedIndex +*/ /** - * @typedef {AriaATTestRun.UserActionName - * | AriaATTestRun.UserActionFocusUnexpected} AriaATTestRun.UserAction - */ +* @typedef {AriaATTestRun.UserActionName +* | AriaATTestRun.UserActionFocusUnexpected} AriaATTestRun.UserAction +*/ /** - * @typedef {"notSet" - * | "pass" - * | "failMissing" - * | "failIncorrect"} AriaATTestRun.AssertionResult - */ +* @typedef {"notSet" +* | "pass" +* | "failMissing" +* | "failIncorrect"} AriaATTestRun.AssertionResult +*/ /** - * @typedef {"notSet" - * | "pass" - * | "failSupport"} AriaATTestRun.AdditionalAssertionResult - */ +* @typedef {"notSet" +* | "pass" +* | "failSupport"} AriaATTestRun.AdditionalAssertionResult +*/ /** - * @typedef {"notSet" - * | "hasUnexpected" - * | "doesNotHaveUnexpected"} AriaATTestRun.HasUnexpectedBehavior - */ +* @typedef {"notSet" +* | "hasUnexpected" +* | "doesNotHaveUnexpected"} AriaATTestRun.HasUnexpectedBehavior +*/ /** - * @typedef AriaATTestRun.State - * This state contains all the serializable values that are needed to render any of the documents (InstructionDocument, - * ResultsTableDocument, and TestPageDocument) from the test-run module. - * - * @property {string[] | null} errors - * @property {object} info - * @property {string} info.description - * @property {string} info.task - * @property {AriaATTestRun.ATMode} info.mode - * @property {string} info.modeInstructions - * @property {string[]} info.userInstructions - * @property {string} info.setupScriptDescription - * @property {object} config - * @property {object} config.at - * @property {string} config.at.key - * @property {string} config.at.name - * @property {boolean} config.renderResultsAfterSubmit - * @property {boolean} config.displaySubmitButton - * @property {AriaATTestRun.UserAction} currentUserAction - * @property {object[]} commands - * @property {string} commands[].description - * @property {object} commands[].atOutput - * @property {boolean} commands[].atOutput.highlightRequired - * @property {string} commands[].atOutput.value - * @property {object[]} commands[].assertions - * @property {string} commands[].assertions[].description - * @property {boolean} commands[].assertions[].highlightRequired - * @property {number} commands[].assertions[].priority - * @property {AriaATTestRun.AssertionResult} commands[].assertions[].result - * @property {object[]} commands[].additionalAssertions - * @property {string} commands[].additionalAssertions[].description - * @property {boolean} commands[].additionalAssertions[].highlightRequired - * @property {number} commands[].additionalAssertions[].priority - * @property {AriaATTestRun.AdditionalAssertionResult} commands[].additionalAssertions[].result - * @property {object} commands[].unexpected - * @property {boolean} commands[].unexpected.highlightRequired - * @property {AriaATTestRun.HasUnexpectedBehavior} commands[].unexpected.hasUnexpected - * @property {number} commands[].unexpected.tabbedBehavior - * @property {object[]} commands[].unexpected.behaviors - * @property {string} commands[].unexpected.behaviors[].description - * @property {boolean} commands[].unexpected.behaviors[].checked - * @property {object} [commands[].unexpected.behaviors[].more] - * @property {boolean} commands[].unexpected.behaviors[].more.highlightRequired - * @property {string} commands[].unexpected.behaviors[].more.value - * @property {object} openTest - * @property {boolean} openTest.enabled - */ +* @typedef AriaATTestRun.State +* This state contains all the serializable values that are needed to render any of the documents (InstructionDocument, +* ResultsTableDocument, and TestPageDocument) from the test-run module. +* +* @property {string[] | null} errors +* @property {object} info +* @property {string} info.description +* @property {string} info.task +* @property {AriaATTestRun.ATMode} info.mode +* @property {string} info.modeInstructions +* @property {string[]} info.userInstructions +* @property {string} info.setupScriptDescription +* @property {object} config +* @property {object} config.at +* @property {string} config.at.key +* @property {string} config.at.name +* @property {boolean} config.renderResultsAfterSubmit +* @property {boolean} config.displaySubmitButton +* @property {AriaATTestRun.UserAction} currentUserAction +* @property {object[]} commands +* @property {string} commands[].description +* @property {object} commands[].atOutput +* @property {boolean} commands[].atOutput.highlightRequired +* @property {string} commands[].atOutput.value +* @property {object[]} commands[].assertions +* @property {string} commands[].assertions[].description +* @property {boolean} commands[].assertions[].highlightRequired +* @property {number} commands[].assertions[].priority +* @property {AriaATTestRun.AssertionResult} commands[].assertions[].result +* @property {object[]} commands[].additionalAssertions +* @property {string} commands[].additionalAssertions[].description +* @property {boolean} commands[].additionalAssertions[].highlightRequired +* @property {number} commands[].additionalAssertions[].priority +* @property {AriaATTestRun.AdditionalAssertionResult} commands[].additionalAssertions[].result +* @property {object} commands[].unexpected +* @property {boolean} commands[].unexpected.highlightRequired +* @property {AriaATTestRun.HasUnexpectedBehavior} commands[].unexpected.hasUnexpected +* @property {number} commands[].unexpected.tabbedBehavior +* @property {object[]} commands[].unexpected.behaviors +* @property {string} commands[].unexpected.behaviors[].description +* @property {boolean} commands[].unexpected.behaviors[].checked +* @property {object} [commands[].unexpected.behaviors[].more] +* @property {boolean} commands[].unexpected.behaviors[].more.highlightRequired +* @property {string} commands[].unexpected.behaviors[].more.value +* @property {object} openTest +* @property {boolean} openTest.enabled +*/ From 797af9a1396a2abf674a96ab88f8e72e5c75ee50 Mon Sep 17 00:00:00 2001 From: Erika Miguel Date: Wed, 5 Apr 2023 16:09:59 -0400 Subject: [PATCH 4/5] lint fixes --- tests/resources/aria-at-test-io-format.mjs | 66 ++++---- tests/resources/types/aria-at-test-result.js | 54 +++---- tests/resources/types/aria-at-test-run.js | 160 +++++++++---------- 3 files changed, 140 insertions(+), 140 deletions(-) diff --git a/tests/resources/aria-at-test-io-format.mjs b/tests/resources/aria-at-test-io-format.mjs index 19be71e3a..33516457a 100644 --- a/tests/resources/aria-at-test-io-format.mjs +++ b/tests/resources/aria-at-test-io-format.mjs @@ -234,9 +234,8 @@ class CommandsInput { commands: { [collectedTest.info.task]: { [collectedTest.target.mode]: { - [collectedTest.target.at - .key]: collectedTest.commands.map(({ id, extraInstruction }) => - extraInstruction ? [id, extraInstruction] : [id] + [collectedTest.target.at.key]: collectedTest.commands.map( + ({ id, extraInstruction }) => (extraInstruction ? [id, extraInstruction] : [id]) ), }, }, @@ -892,39 +891,40 @@ export class TestRunInputOutput { enabled: true, }, commands: test.commands.map( - command => /** @type {import("./aria-at-test-run.mjs").TestRunCommand} */ ({ - description: command, - atOutput: { - highlightRequired: false, - value: '', - }, - assertions: test.assertions.map(assertion => ({ - description: assertion.assertion, - highlightRequired: false, - priority: assertion.priority, - result: CommonResultMap.NOT_SET, - })), - additionalAssertions: test.additionalAssertions.map(assertion => ({ - description: assertion.assertion, - highlightRequired: false, - priority: assertion.priority, - result: CommonResultMap.NOT_SET, - })), - unexpected: { - highlightRequired: false, - hasUnexpected: HasUnexpectedBehaviorMap.NOT_SET, - tabbedBehavior: 0, - behaviors: test.unexpectedBehaviors.map(({ description, requireExplanation }) => ({ - description, - checked: false, - requireExplanation, - })), - note: { + command => + /** @type {import("./aria-at-test-run.mjs").TestRunCommand} */ ({ + description: command, + atOutput: { highlightRequired: false, value: '', }, - }, - }) + assertions: test.assertions.map(assertion => ({ + description: assertion.assertion, + highlightRequired: false, + priority: assertion.priority, + result: CommonResultMap.NOT_SET, + })), + additionalAssertions: test.additionalAssertions.map(assertion => ({ + description: assertion.assertion, + highlightRequired: false, + priority: assertion.priority, + result: CommonResultMap.NOT_SET, + })), + unexpected: { + highlightRequired: false, + hasUnexpected: HasUnexpectedBehaviorMap.NOT_SET, + tabbedBehavior: 0, + behaviors: test.unexpectedBehaviors.map(({ description, requireExplanation }) => ({ + description, + checked: false, + requireExplanation, + })), + note: { + highlightRequired: false, + value: '', + }, + }, + }) ), }; diff --git a/tests/resources/types/aria-at-test-result.js b/tests/resources/types/aria-at-test-result.js index 00bec4399..be8cd78ac 100644 --- a/tests/resources/types/aria-at-test-result.js +++ b/tests/resources/types/aria-at-test-result.js @@ -5,34 +5,34 @@ /** * @typedef {"REQUIRED" -* | "OPTIONAL"} AriaATTestResult.AssertionPriorityJSON -*/ + * | "OPTIONAL"} AriaATTestResult.AssertionPriorityJSON + */ /** -* @typedef {"INCORRECT_OUTPUT" -* | "NO_OUTPUT"} AriaATTestResult.AssertionFailedReasonJSON -*/ + * @typedef {"INCORRECT_OUTPUT" + * | "NO_OUTPUT"} AriaATTestResult.AssertionFailedReasonJSON + */ /** -* @typedef AriaATTestResult.JSON -* @property {object} test -* @property {string} test.title -* @property {object} test.at -* @property {string} test.at.id -* @property {string} test.atMode -* @property {object[]} scenarioResults -* @property {object} scenarioResults[].scenario -* @property {object} scenarioResults[].scenario.command -* @property {string} scenarioResults[].scenario.command.id -* @property {string} scenarioResults[].output -* @property {object[]} scenarioResults[].assertionResults -* @property {object} scenarioResults[].assertionResults[].assertion -* @property {AriaATTestResult.AssertionPriorityJSON} scenarioResults[].assertionResults[].assertion.priority -* @property {string} scenarioResults[].assertionResults[].assertion.text -* @property {boolean} scenarioResults[].assertionResults[].passed -* @property {AriaATTestResult.AssertionFailedReasonJSON | null} [scenarioResults[].assertionResults[].failedReason] -* @property {object[]} scenarioResults[].unexpectedBehaviors -* @property {string} scenarioResults[].unexpectedBehaviors[].id -* @property {string} scenarioResults[].unexpectedBehaviors[].text -* @property {string | null} [scenarioResults[].unexpectedBehaviorNote] -*/ + * @typedef AriaATTestResult.JSON + * @property {object} test + * @property {string} test.title + * @property {object} test.at + * @property {string} test.at.id + * @property {string} test.atMode + * @property {object[]} scenarioResults + * @property {object} scenarioResults[].scenario + * @property {object} scenarioResults[].scenario.command + * @property {string} scenarioResults[].scenario.command.id + * @property {string} scenarioResults[].output + * @property {object[]} scenarioResults[].assertionResults + * @property {object} scenarioResults[].assertionResults[].assertion + * @property {AriaATTestResult.AssertionPriorityJSON} scenarioResults[].assertionResults[].assertion.priority + * @property {string} scenarioResults[].assertionResults[].assertion.text + * @property {boolean} scenarioResults[].assertionResults[].passed + * @property {AriaATTestResult.AssertionFailedReasonJSON | null} [scenarioResults[].assertionResults[].failedReason] + * @property {object[]} scenarioResults[].unexpectedBehaviors + * @property {string} scenarioResults[].unexpectedBehaviors[].id + * @property {string} scenarioResults[].unexpectedBehaviors[].text + * @property {string | null} [scenarioResults[].unexpectedBehaviorNote] + */ diff --git a/tests/resources/types/aria-at-test-run.js b/tests/resources/types/aria-at-test-run.js index 1274723d3..c12c3b142 100644 --- a/tests/resources/types/aria-at-test-run.js +++ b/tests/resources/types/aria-at-test-run.js @@ -2,99 +2,99 @@ /** * @typedef {"reading" -* | "interaction"} AriaATTestRun.ATMode -*/ + * | "interaction"} AriaATTestRun.ATMode + */ /** -* @typedef {"loadPage" -* | "openTestWindow" -* | "closeTestWindow" -* | "validateResults" -* | "changeText" -* | "changeSelection" -* | "showResults"} AriaATTestRun.UserActionName -*/ + * @typedef {"loadPage" + * | "openTestWindow" + * | "closeTestWindow" + * | "validateResults" + * | "changeText" + * | "changeSelection" + * | "showResults"} AriaATTestRun.UserActionName + */ /** -* @typedef {"focusUnexpected"} AriaATTestRun.UserActionObjectName -*/ + * @typedef {"focusUnexpected"} AriaATTestRun.UserActionObjectName + */ /** -* @typedef AriaATTestRun.UserActionFocusUnexpected -* @property {"focusUnexpected"} action -* @property {number} commandIndex -* @property {number} unexpectedIndex -*/ + * @typedef AriaATTestRun.UserActionFocusUnexpected + * @property {"focusUnexpected"} action + * @property {number} commandIndex + * @property {number} unexpectedIndex + */ /** -* @typedef {AriaATTestRun.UserActionName -* | AriaATTestRun.UserActionFocusUnexpected} AriaATTestRun.UserAction -*/ + * @typedef {AriaATTestRun.UserActionName + * | AriaATTestRun.UserActionFocusUnexpected} AriaATTestRun.UserAction + */ /** -* @typedef {"notSet" -* | "pass" -* | "failMissing" -* | "failIncorrect"} AriaATTestRun.AssertionResult -*/ + * @typedef {"notSet" + * | "pass" + * | "failMissing" + * | "failIncorrect"} AriaATTestRun.AssertionResult + */ /** -* @typedef {"notSet" -* | "pass" -* | "failSupport"} AriaATTestRun.AdditionalAssertionResult -*/ + * @typedef {"notSet" + * | "pass" + * | "failSupport"} AriaATTestRun.AdditionalAssertionResult + */ /** -* @typedef {"notSet" -* | "hasUnexpected" -* | "doesNotHaveUnexpected"} AriaATTestRun.HasUnexpectedBehavior -*/ + * @typedef {"notSet" + * | "hasUnexpected" + * | "doesNotHaveUnexpected"} AriaATTestRun.HasUnexpectedBehavior + */ /** -* @typedef AriaATTestRun.State -* This state contains all the serializable values that are needed to render any of the documents (InstructionDocument, -* ResultsTableDocument, and TestPageDocument) from the test-run module. -* -* @property {string[] | null} errors -* @property {object} info -* @property {string} info.description -* @property {string} info.task -* @property {AriaATTestRun.ATMode} info.mode -* @property {string} info.modeInstructions -* @property {string[]} info.userInstructions -* @property {string} info.setupScriptDescription -* @property {object} config -* @property {object} config.at -* @property {string} config.at.key -* @property {string} config.at.name -* @property {boolean} config.renderResultsAfterSubmit -* @property {boolean} config.displaySubmitButton -* @property {AriaATTestRun.UserAction} currentUserAction -* @property {object[]} commands -* @property {string} commands[].description -* @property {object} commands[].atOutput -* @property {boolean} commands[].atOutput.highlightRequired -* @property {string} commands[].atOutput.value -* @property {object[]} commands[].assertions -* @property {string} commands[].assertions[].description -* @property {boolean} commands[].assertions[].highlightRequired -* @property {number} commands[].assertions[].priority -* @property {AriaATTestRun.AssertionResult} commands[].assertions[].result -* @property {object[]} commands[].additionalAssertions -* @property {string} commands[].additionalAssertions[].description -* @property {boolean} commands[].additionalAssertions[].highlightRequired -* @property {number} commands[].additionalAssertions[].priority -* @property {AriaATTestRun.AdditionalAssertionResult} commands[].additionalAssertions[].result -* @property {object} commands[].unexpected -* @property {boolean} commands[].unexpected.highlightRequired -* @property {AriaATTestRun.HasUnexpectedBehavior} commands[].unexpected.hasUnexpected -* @property {number} commands[].unexpected.tabbedBehavior -* @property {object[]} commands[].unexpected.behaviors -* @property {string} commands[].unexpected.behaviors[].description -* @property {boolean} commands[].unexpected.behaviors[].checked -* @property {object} [commands[].unexpected.behaviors[].more] -* @property {boolean} commands[].unexpected.behaviors[].more.highlightRequired -* @property {string} commands[].unexpected.behaviors[].more.value -* @property {object} openTest -* @property {boolean} openTest.enabled -*/ + * @typedef AriaATTestRun.State + * This state contains all the serializable values that are needed to render any of the documents (InstructionDocument, + * ResultsTableDocument, and TestPageDocument) from the test-run module. + * + * @property {string[] | null} errors + * @property {object} info + * @property {string} info.description + * @property {string} info.task + * @property {AriaATTestRun.ATMode} info.mode + * @property {string} info.modeInstructions + * @property {string[]} info.userInstructions + * @property {string} info.setupScriptDescription + * @property {object} config + * @property {object} config.at + * @property {string} config.at.key + * @property {string} config.at.name + * @property {boolean} config.renderResultsAfterSubmit + * @property {boolean} config.displaySubmitButton + * @property {AriaATTestRun.UserAction} currentUserAction + * @property {object[]} commands + * @property {string} commands[].description + * @property {object} commands[].atOutput + * @property {boolean} commands[].atOutput.highlightRequired + * @property {string} commands[].atOutput.value + * @property {object[]} commands[].assertions + * @property {string} commands[].assertions[].description + * @property {boolean} commands[].assertions[].highlightRequired + * @property {number} commands[].assertions[].priority + * @property {AriaATTestRun.AssertionResult} commands[].assertions[].result + * @property {object[]} commands[].additionalAssertions + * @property {string} commands[].additionalAssertions[].description + * @property {boolean} commands[].additionalAssertions[].highlightRequired + * @property {number} commands[].additionalAssertions[].priority + * @property {AriaATTestRun.AdditionalAssertionResult} commands[].additionalAssertions[].result + * @property {object} commands[].unexpected + * @property {boolean} commands[].unexpected.highlightRequired + * @property {AriaATTestRun.HasUnexpectedBehavior} commands[].unexpected.hasUnexpected + * @property {number} commands[].unexpected.tabbedBehavior + * @property {object[]} commands[].unexpected.behaviors + * @property {string} commands[].unexpected.behaviors[].description + * @property {boolean} commands[].unexpected.behaviors[].checked + * @property {object} [commands[].unexpected.behaviors[].more] + * @property {boolean} commands[].unexpected.behaviors[].more.highlightRequired + * @property {string} commands[].unexpected.behaviors[].more.value + * @property {object} openTest + * @property {boolean} openTest.enabled + */ From e2ea314e29b08a22887f4ab10872ca6ad53bfc47 Mon Sep 17 00:00:00 2001 From: Erika Miguel Date: Mon, 8 May 2023 13:56:42 -0400 Subject: [PATCH 5/5] support for expanding empty unexpected behaviors --- tests/resources/aria-at-test-run.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/resources/aria-at-test-run.mjs b/tests/resources/aria-at-test-run.mjs index 197537f74..f9e1dd117 100644 --- a/tests/resources/aria-at-test-run.mjs +++ b/tests/resources/aria-at-test-run.mjs @@ -256,7 +256,8 @@ export function instructionDocument(resultState, hooks) { failChoice: { label: 'Yes, there were additional unexpected behaviors.', checked: - resultUnexpectedBehavior.hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED, + resultUnexpectedBehavior.hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED || + resultUnexpectedBehavior.expand, focus: resultState.currentUserAction === 'validateResults' && resultUnexpectedBehavior.highlightRequired && @@ -603,6 +604,7 @@ export function userChangeCommandHasUnexpectedBehavior({ commandIndex, hasUnexpe ...command, unexpected: { ...command.unexpected, + expand: hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED, hasUnexpected: hasUnexpected, tabbedBehavior: hasUnexpected === HasUnexpectedBehaviorMap.HAS_UNEXPECTED ? 0 : -1, behaviors: command.unexpected.behaviors.map(behavior => ({