VoiceOver for macOS
diff --git a/scripts/review-template.mustache b/scripts/review-template.mustache
index 76cda6ae0..48105f7e5 100644
--- a/scripts/review-template.mustache
+++ b/scripts/review-template.mustache
@@ -55,6 +55,44 @@
}
}
}
+
+ function executeScriptInTestPage(setupScriptName, testPageWindow) {
+ if (testPageWindow.location.origin !== window.location.origin // make sure the origin is the same, and prevent this from firing on an 'about' page
+ || testPageWindow.document.readyState !== 'complete'
+ ) {
+ window.setTimeout(() => {
+ executeScriptInTestPage(setupScriptName, testPageWindow);
+ }, 100);
+ return;
+ }
+
+ if (setupScriptName) {
+ var scripts = {
+ {{{setupScripts}}}
+ };
+
+ scripts[setupScriptName](testPageWindow.document);
+ }
+ }
+
+ function openTestPage(testPageUri, testNumber, setupScriptName) {
+ testPageWindow = window.open(testPageUri, '_blank', 'toolbar=0,location=0,menubar=0,width=400,height=400');
+
+ document.getElementById('open-test-page-' + testNumber).disabled = true;
+
+ // If the window is closed, re-enable open popup button
+ testPageWindow.onunload = function(event) {
+ window.setTimeout(() => {
+ if (testPageWindow.closed) {
+ testPageWindow = undefined;
+ document.getElementById('open-test-page-' + testNumber).disabled = false;
+ }
+ }, 100);
+
+ };
+
+ executeScriptInTestPage(setupScriptName, testPageWindow);
+ }
@@ -91,6 +129,9 @@
+
+
{{#ATTests}}
diff --git a/scripts/test-reviewer.mjs b/scripts/test-reviewer.mjs
index 5e8982413..bb4f5aaf6 100644
--- a/scripts/test-reviewer.mjs
+++ b/scripts/test-reviewer.mjs
@@ -1,4 +1,5 @@
import path from 'path';
+import fs from 'fs';
import fse from 'fs-extra';
import htmlparser2 from 'htmlparser2';
import { spawnSync } from 'child_process';
@@ -17,6 +18,7 @@ let allATKeys = [];
support.ats.forEach(at => {
allATKeys.push(at.key);
});
+const scripts = [];
const getPriorityString = function(priority) {
priority = parseInt(priority);
@@ -43,6 +45,26 @@ fse.readdirSync(testDir).forEach(function (subDir) {
const commAPI = new commandsAPI(commands, support);
const tests = [];
+
+ const referencesCsv = fs.readFileSync(path.join(subDirFullPath, 'data', 'references.csv'), 'UTF-8');
+ const reference = referencesCsv.split(/\r?\n/).find(s => s.startsWith('reference,')).split(',')[1];
+
+ const scriptsPath = path.join(subDirFullPath, 'data', 'js');
+ fse.readdirSync(scriptsPath).forEach(function (scriptFile) {
+ let script = '';
+ try {
+ const data = fs.readFileSync(path.join(scriptsPath, scriptFile), 'UTF-8');
+ const lines = data.split(/\r?\n/);
+ lines.forEach((line) => {
+ if (line.trim().length)
+ script += '\t' + line.trim() + '\n';
+ });
+ } catch (err) {
+ console.error(err);
+ }
+ scripts.push(`\t${scriptFile.split('.js')[0]}: function(testPageDocument){\n${script}}`);
+ });
+
fse.readdirSync(subDirFullPath).forEach(function (test) {
if (path.extname(test) === '.html' && path.basename(test) !== 'index.html') {
@@ -116,7 +138,7 @@ fse.readdirSync(testDir).forEach(function (subDir) {
assertions: assertions && assertions.length ? assertions.map(a => ({ priority: getPriorityString(a[0]), description: a[1] })) : undefined,
userInstruction,
modeInstruction: commAPI.getModeInstructions(mode, at),
- setupScriptDescription: testData.setup_script_description
+ setupScriptDescription: testData.setup_script_description,
});
}
@@ -129,8 +151,10 @@ fse.readdirSync(testDir).forEach(function (subDir) {
testNumber: tests.length+1,
name: testFullName,
location: `/${subDir}/${test}`,
+ reference: `/${subDir}/${reference}`,
allReleventATsFormatted: testData.applies_to.join(', '),
allReleventATs: testData.applies_to,
+ setupScriptName: testData.setupTestPage,
task,
mode,
ATTests,
@@ -161,7 +185,8 @@ for (let pattern in allTestsForPattern) {
pattern: pattern,
totalTests: allTestsForPattern[pattern].length,
tests: allTestsForPattern[pattern],
- AToptions: support.ats
+ AToptions: support.ats,
+ setupScripts: scripts
});
let summaryFile = path.resolve(reviewDir, `${pattern}.html`);