From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../browser_accessibility_sidebar_checks.js | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 devtools/client/accessibility/test/browser/browser_accessibility_sidebar_checks.js (limited to 'devtools/client/accessibility/test/browser/browser_accessibility_sidebar_checks.js') diff --git a/devtools/client/accessibility/test/browser/browser_accessibility_sidebar_checks.js b/devtools/client/accessibility/test/browser/browser_accessibility_sidebar_checks.js new file mode 100644 index 0000000000..f9c0abe8dc --- /dev/null +++ b/devtools/client/accessibility/test/browser/browser_accessibility_sidebar_checks.js @@ -0,0 +1,83 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const { + accessibility: { SCORES }, +} = require("resource://devtools/shared/constants.js"); + +const TEST_URI = ` + + + Accessibility Panel Test + + +

Red

+

Blue

+

Gray

+ +`; + +/** + * Test data has the format of: + * { + * desc {String} description for better logging + * setup {Function} An optional setup that needs to be performed before + * the state of the tree and the sidebar can be checked. + * expected {JSON} An expected states for the tree and the sidebar. + * } + */ +const tests = [ + { + desc: "Test the initial accessibility audit state.", + setup: async ({ doc }) => { + await selectRow(doc, 0); + }, + expected: { + audit: { CONTRAST: null }, + }, + }, + { + desc: "Check accessible representing text node in red.", + setup: async ({ doc }) => { + await toggleRow(doc, 0); + await toggleRow(doc, 1); + await selectRow(doc, 2); + }, + expected: { + audit: { + CONTRAST: { + value: 4.0, + color: [255, 0, 0, 1], + backgroundColor: [255, 255, 255, 1], + isLargeText: false, + score: SCORES.FAIL, + }, + }, + }, + }, + { + desc: "Check accessible representing text node in blue.", + setup: async ({ doc }) => { + await toggleRow(doc, 3); + await selectRow(doc, 4); + }, + expected: { + audit: { + CONTRAST: { + value: 8.59, + color: [0, 0, 255, 1], + backgroundColor: [255, 255, 255, 1], + isLargeText: false, + score: SCORES.AAA, + }, + }, + }, + }, +]; + +/** + * Test that checks the Accessibility panel sidebar. + */ +addA11yPanelTestsTask(tests, TEST_URI, "Test Accessibility panel sidebar."); -- cgit v1.2.3