Bug 1030470 - (part 1) moved the non-android localization part out of AccessFu to be handled in Gaia. r=eeejay

---
 accessible/jsat/AccessFu.jsm                       | 176 ++-----
 accessible/jsat/OutputGenerator.jsm                | 337 +++++--------
 accessible/jsat/Presentation.jsm                   | 193 ++++----
 accessible/jsat/Utils.jsm                          |  43 +-
 accessible/tests/mochitest/jsat/jsatcommon.js      |  19 +-
 accessible/tests/mochitest/jsat/output.js          |  12 +-
 accessible/tests/mochitest/jsat/test_alive.html    |  22 +-
 .../mochitest/jsat/test_content_integration.html   |  95 ++--
 .../tests/mochitest/jsat/test_content_text.html    |   8 +-
 .../tests/mochitest/jsat/test_explicit_names.html  |  73 +--
 .../tests/mochitest/jsat/test_landmarks.html       | 125 +++--
 .../tests/mochitest/jsat/test_live_regions.html    | 144 +++---
 accessible/tests/mochitest/jsat/test_output.html   | 526 +++++++++++----------
 accessible/tests/mochitest/jsat/test_tables.html   | 492 ++++++++++++++-----
 .../en-US/chrome/accessibility/AccessFu.properties | 103 +++-
 15 files changed, 1306 insertions(+), 1062 deletions(-)
This commit is contained in:
Yura Zenevich 2014-08-06 09:38:50 -04:00
Родитель b96df50cf0
Коммит 442f4b74af
15 изменённых файлов: 1311 добавлений и 1067 удалений

Просмотреть файл

@ -12,7 +12,6 @@ const Cr = Components.results;
this.EXPORTED_SYMBOLS = ['AccessFu']; this.EXPORTED_SYMBOLS = ['AccessFu'];
Cu.import('resource://gre/modules/Services.jsm'); Cu.import('resource://gre/modules/Services.jsm');
Cu.import('resource://gre/modules/accessibility/Utils.jsm'); Cu.import('resource://gre/modules/accessibility/Utils.jsm');
const ACCESSFU_DISABLE = 0; const ACCESSFU_DISABLE = 0;
@ -135,8 +134,7 @@ this.AccessFu = {
} }
if (Utils.MozBuildApp !== 'mobile/android') { if (Utils.MozBuildApp !== 'mobile/android') {
this.announce( this.announce('screenReaderStarted');
Utils.stringBundle.GetStringFromName('screenReaderStarted'));
} }
}, },
@ -154,8 +152,7 @@ this.AccessFu = {
Utils.win.document.removeChild(this.stylesheet.get()); Utils.win.document.removeChild(this.stylesheet.get());
if (Utils.MozBuildApp !== 'mobile/android') { if (Utils.MozBuildApp !== 'mobile/android') {
this.announce( this.announce('screenReaderStopped');
Utils.stringBundle.GetStringFromName('screenReaderStopped'));
} }
for each (let mm in Utils.AllMessageManagers) { for each (let mm in Utils.AllMessageManagers) {
@ -509,97 +506,8 @@ var Output = {
} }
}, },
speechHelper: {
EARCONS: ['virtual_cursor_move.ogg',
'virtual_cursor_key.ogg',
'clicked.ogg'],
earconBuffers: {},
inited: false,
webspeechEnabled: false,
deferredOutputs: [],
init: function init() {
let window = Utils.win;
this.webspeechEnabled = !!window.speechSynthesis &&
!!window.SpeechSynthesisUtterance;
let settingsToGet = 2;
let settingsCallback = (aName, aSetting) => {
if (--settingsToGet > 0) {
return;
}
this.inited = true;
for (let actions of this.deferredOutputs) {
this.output(actions);
}
};
this._volumeSetting = new SettingCache(
'accessibility.screenreader-volume', settingsCallback,
{ defaultValue: 1, callbackNow: true, callbackOnce: true });
this._rateSetting = new SettingCache(
'accessibility.screenreader-rate', settingsCallback,
{ defaultValue: 0, callbackNow: true, callbackOnce: true });
for (let earcon of this.EARCONS) {
let earconName = /(^.*)\..*$/.exec(earcon)[1];
this.earconBuffers[earconName] = new WeakMap();
this.earconBuffers[earconName].set(
window, new window.Audio('chrome://global/content/accessibility/' + earcon));
}
},
uninit: function uninit() {
if (this.inited) {
delete this._volumeSetting;
delete this._rateSetting;
}
this.inited = false;
},
output: function output(aActions) {
if (!this.inited) {
this.deferredOutputs.push(aActions);
return;
}
for (let action of aActions) {
let window = Utils.win;
Logger.debug('tts.' + action.method, '"' + action.data + '"',
JSON.stringify(action.options));
if (!action.options.enqueue && this.webspeechEnabled) {
window.speechSynthesis.cancel();
}
if (action.method === 'speak' && this.webspeechEnabled) {
let utterance = new window.SpeechSynthesisUtterance(action.data);
let requestedRate = this._rateSetting.value;
utterance.volume = this._volumeSetting.value;
utterance.rate = requestedRate >= 0 ?
requestedRate + 1 : 1 / (Math.abs(requestedRate) + 1);
window.speechSynthesis.speak(utterance);
} else if (action.method === 'playEarcon') {
let audioBufferWeakMap = this.earconBuffers[action.data];
if (audioBufferWeakMap) {
let node = audioBufferWeakMap.get(window).cloneNode(false);
node.volume = this._volumeSetting.value;
node.play();
}
}
}
}
},
start: function start() { start: function start() {
Cu.import('resource://gre/modules/Geometry.jsm'); Cu.import('resource://gre/modules/Geometry.jsm');
this.speechHelper.init();
}, },
stop: function stop() { stop: function stop() {
@ -607,22 +515,32 @@ var Output = {
Utils.win.document.documentElement.removeChild(this.highlightBox.get()); Utils.win.document.documentElement.removeChild(this.highlightBox.get());
delete this.highlightBox; delete this.highlightBox;
} }
},
if (this.announceBox) { B2G: function B2G(aDetails) {
Utils.win.document.documentElement.removeChild(this.announceBox.get()); let details = {
delete this.announceBox; type: 'accessfu-output',
details: JSON.stringify(aDetails)
};
let window = Utils.win;
if (window.shell) {
// On B2G device.
window.shell.sendChromeEvent(details);
} else {
// Dispatch custom event to have support for desktop and screen reader
// emulator add-on.
window.dispatchEvent(new window.CustomEvent(details.type, {
bubbles: true,
cancelable: true,
detail: details
}));
} }
this.speechHelper.uninit();
}, },
Speech: function Speech(aDetails, aBrowser) { Visual: function Visual(aDetail, aBrowser) {
this.speechHelper.output(aDetails.actions); switch (aDetail.eventType) {
}, case 'viewport-change':
case 'vc-change':
Visual: function Visual(aDetails, aBrowser) {
switch (aDetails.method) {
case 'showBounds':
{ {
let highlightBox = null; let highlightBox = null;
if (!this.highlightBox) { if (!this.highlightBox) {
@ -643,8 +561,8 @@ var Output = {
highlightBox = this.highlightBox.get(); highlightBox = this.highlightBox.get();
} }
let padding = aDetails.padding; let padding = aDetail.padding;
let r = AccessFu.adjustContentBounds(aDetails.bounds, aBrowser, true); let r = AccessFu.adjustContentBounds(aDetail.bounds, aBrowser, true);
// First hide it to avoid flickering when changing the style. // First hide it to avoid flickering when changing the style.
highlightBox.style.display = 'none'; highlightBox.style.display = 'none';
@ -656,45 +574,13 @@ var Output = {
break; break;
} }
case 'hideBounds': case 'tabstate-change':
{ {
let highlightBox = this.highlightBox ? this.highlightBox.get() : null; let highlightBox = this.highlightBox ? this.highlightBox.get() : null;
if (highlightBox) if (highlightBox)
highlightBox.style.display = 'none'; highlightBox.style.display = 'none';
break; break;
} }
case 'showAnnouncement':
{
let announceBox = this.announceBox ? this.announceBox.get() : null;
if (!announceBox) {
announceBox = Utils.win.document.
createElementNS('http://www.w3.org/1999/xhtml', 'div');
announceBox.id = 'announce-box';
Utils.win.document.documentElement.appendChild(announceBox);
this.announceBox = Cu.getWeakReference(announceBox);
}
announceBox.innerHTML = '<div>' + aDetails.text + '</div>';
announceBox.classList.add('showing');
if (this._announceHideTimeout)
Utils.win.clearTimeout(this._announceHideTimeout);
if (aDetails.duration > 0)
this._announceHideTimeout = Utils.win.setTimeout(
function () {
announceBox.classList.remove('showing');
this._announceHideTimeout = 0;
}.bind(this), aDetails.duration);
break;
}
case 'hideAnnouncement':
{
let announceBox = this.announceBox ? this.announceBox.get() : null;
if (announceBox)
announceBox.classList.remove('showing');
break;
}
} }
}, },
@ -736,12 +622,8 @@ var Output = {
} }
}, },
Haptic: function Haptic(aDetails, aBrowser) { Braille: function Braille(aDetails) {
Utils.win.navigator.vibrate(aDetails.pattern); Logger.debug('Braille output: ' + aDetails.output);
},
Braille: function Braille(aDetails, aBrowser) {
Logger.debug('Braille output: ' + aDetails.text);
} }
}; };

Просмотреть файл

@ -26,8 +26,6 @@ XPCOMUtils.defineLazyModuleGetter(this, 'PrefCache',
'resource://gre/modules/accessibility/Utils.jsm'); 'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Logger', XPCOMUtils.defineLazyModuleGetter(this, 'Logger',
'resource://gre/modules/accessibility/Utils.jsm'); 'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'PluralForm',
'resource://gre/modules/PluralForm.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles', XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm'); 'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'States', XPCOMUtils.defineLazyModuleGetter(this, 'States',
@ -44,12 +42,9 @@ this.OutputGenerator = {
* @param {PivotContext} aContext object that generates and caches * @param {PivotContext} aContext object that generates and caches
* context information for a given accessible and its relationship with * context information for a given accessible and its relationship with
* another accessible. * another accessible.
* @return {Object} An object that neccessarily has an output property which * @return {Object} An array of speech data. Depending on the utterance order,
* is an array of strings. Depending on the utterance order, * the data describes the context for an accessible object either
* the strings describe the context for an accessible object either
* starting from the accessible's ancestry or accessible's subtree. * starting from the accessible's ancestry or accessible's subtree.
* The object may also have properties specific to the type of output
* generated.
*/ */
genForContext: function genForContext(aContext) { genForContext: function genForContext(aContext) {
let output = []; let output = [];
@ -82,10 +77,7 @@ this.OutputGenerator = {
contextStart.reverse().forEach(addOutput); contextStart.reverse().forEach(addOutput);
} }
// Clean up the white space. return output;
let trimmed;
output = [trimmed for (word of output) if (trimmed = word.trim())];
return {output: output};
}, },
@ -96,10 +88,10 @@ this.OutputGenerator = {
* @param {PivotContext} aContext object that generates and caches * @param {PivotContext} aContext object that generates and caches
* context information for a given accessible and its relationship with * context information for a given accessible and its relationship with
* another accessible. * another accessible.
* @return {Array} Two string array. The first string describes the object * @return {Array} A 2 element array of speech data. The first element
* and its state. The second string is the object's name. Whether the * describes the object and its state. The second element is the object's
* object's description or it's role is included is determined by * name. Whether the object's description or it's role is included is
* {@link roleRuleMap}. * determined by {@link roleRuleMap}.
*/ */
genForObject: function genForObject(aAccessible, aContext) { genForObject: function genForObject(aAccessible, aContext) {
let roleString = Utils.AccRetrieval.getStringRole(aAccessible.role); let roleString = Utils.AccRetrieval.getStringRole(aAccessible.role);
@ -122,15 +114,14 @@ this.OutputGenerator = {
* invoked in. * invoked in.
* @param {string} aActionName the name of the action, one of the keys in * @param {string} aActionName the name of the action, one of the keys in
* {@link gActionMap}. * {@link gActionMap}.
* @return {Array} A one string array with the action. * @return {Array} A one element array with action data.
*/ */
genForAction: function genForAction(aObject, aActionName) {}, genForAction: function genForAction(aObject, aActionName) {},
/** /**
* Generates output for an announcement. Basically attempts to localize * Generates output for an announcement.
* the announcement string.
* @param {string} aAnnouncement unlocalized announcement. * @param {string} aAnnouncement unlocalized announcement.
* @return {Array} A one string array with the announcement. * @return {Array} An announcement speech data to be localized.
*/ */
genForAnnouncement: function genForAnnouncement(aAnnouncement) {}, genForAnnouncement: function genForAnnouncement(aAnnouncement) {},
@ -153,6 +144,12 @@ this.OutputGenerator = {
_getContextStart: function getContextStart(aContext) {}, _getContextStart: function getContextStart(aContext) {},
/**
* Adds an accessible name and description to the output if available.
* @param {Array} aOutput Output array.
* @param {nsIAccessible} aAccessible current accessible object.
* @param {Number} aFlags output flags.
*/
_addName: function _addName(aOutput, aAccessible, aFlags) { _addName: function _addName(aOutput, aAccessible, aFlags) {
let name; let name;
if ((Utils.getAttributes(aAccessible)['explicit-name'] === 'true' && if ((Utils.getAttributes(aAccessible)['explicit-name'] === 'true' &&
@ -173,10 +170,10 @@ this.OutputGenerator = {
} }
} }
if (name) { if (!name || !name.trim()) {
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? return;
'push' : 'unshift'](name);
} }
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'push' : 'unshift'](name);
}, },
/** /**
@ -189,23 +186,18 @@ this.OutputGenerator = {
if (!landmarkName) { if (!landmarkName) {
return; return;
} }
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'unshift' : 'push']({
let landmark = Utils.stringBundle.GetStringFromName(landmarkName); string: landmarkName
if (!landmark) { });
return;
}
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'unshift' : 'push'](
landmark);
}, },
/** /**
* Adds an entry type attribute to the description if available. * Adds an entry type attribute to the description if available.
* @param {Array} aDesc Description array. * @param {Array} aOutput Output array.
* @param {nsIAccessible} aAccessible current accessible object. * @param {nsIAccessible} aAccessible current accessible object.
* @param {String} aRoleStr aAccessible's role string. * @param {String} aRoleStr aAccessible's role string.
*/ */
_addType: function _addType(aDesc, aAccessible, aRoleStr) { _addType: function _addType(aOutput, aAccessible, aRoleStr) {
if (aRoleStr !== 'entry') { if (aRoleStr !== 'entry') {
return; return;
} }
@ -215,14 +207,13 @@ this.OutputGenerator = {
if (!typeName || typeName === 'text') { if (!typeName || typeName === 'text') {
return; return;
} }
typeName = 'textInputType_' + typeName; aOutput.push({string: 'textInputType_' + typeName});
try {
aDesc.push(Utils.stringBundle.GetStringFromName(typeName));
} catch (x) {
Logger.warning('Failed to get a string from a bundle for', typeName);
}
}, },
_addState: function _addState(aOutput, aState) {},
_addRole: function _addRole(aOutput, aRoleStr) {},
get outputOrder() { get outputOrder() {
if (!this._utteranceOrder) { if (!this._utteranceOrder) {
this._utteranceOrder = new PrefCache('accessibility.accessfu.utterance'); this._utteranceOrder = new PrefCache('accessibility.accessfu.utterance');
@ -235,16 +226,6 @@ this.OutputGenerator = {
return aName.replace(' ', ''); return aName.replace(' ', '');
}, },
_getLocalizedRole: function _getLocalizedRole(aRoleStr) {},
_getLocalizedState: function _getLocalizedState(aState) {},
_getPluralFormString: function _getPluralFormString(aString, aCount) {
let str = Utils.stringBundle.GetStringFromName(this._getOutputName(aString));
str = PluralForm.get(aCount, str);
return str.replace('#1', aCount);
},
roleRuleMap: { roleRuleMap: {
'menubar': INCLUDE_DESC, 'menubar': INCLUDE_DESC,
'scrollbar': INCLUDE_DESC, 'scrollbar': INCLUDE_DESC,
@ -326,21 +307,14 @@ this.OutputGenerator = {
let output = []; let output = [];
if (aFlags & INCLUDE_DESC) { if (aFlags & INCLUDE_DESC) {
let desc = this._getLocalizedState(aState); this._addState(output, aState);
let roleStr = this._getLocalizedRole(aRoleStr); this._addType(output, aAccessible, aRoleStr);
if (roleStr) { this._addRole(output, aRoleStr);
this._addType(desc, aAccessible, aRoleStr);
desc.push(roleStr);
}
output.push(desc.join(' '));
} }
if (aFlags & INCLUDE_VALUE) { if (aFlags & INCLUDE_VALUE && aAccessible.value.trim()) {
let value = aAccessible.value; output[this.outputOrder === OUTPUT_DESC_FIRST ? 'push' : 'unshift'](
if (value) { aAccessible.value);
output[this.outputOrder === OUTPUT_DESC_FIRST ?
'push' : 'unshift'](value);
}
} }
this._addName(output, aAccessible, aFlags); this._addName(output, aAccessible, aFlags);
@ -367,16 +341,16 @@ this.OutputGenerator = {
}, },
pagetab: function pagetab(aAccessible, aRoleStr, aState, aFlags) { pagetab: function pagetab(aAccessible, aRoleStr, aState, aFlags) {
let localizedRole = this._getLocalizedRole(aRoleStr);
let itemno = {}; let itemno = {};
let itemof = {}; let itemof = {};
aAccessible.groupPosition({}, itemof, itemno); aAccessible.groupPosition({}, itemof, itemno);
let output = []; let output = [];
let desc = this._getLocalizedState(aState); this._addState(output, aState);
desc.push( this._addRole(output, aRoleStr);
Utils.stringBundle.formatStringFromName( output.push({
'objItemOf', [localizedRole, itemno.value, itemof.value], 3)); string: 'objItemOfN',
output.push(desc.join(' ')); args: [itemno.value, itemof.value]
});
this._addName(output, aAccessible, aFlags); this._addName(output, aAccessible, aFlags);
this._addLandmark(output, aAccessible); this._addLandmark(output, aAccessible);
@ -398,13 +372,14 @@ this.OutputGenerator = {
if (table.isProbablyForLayout()) { if (table.isProbablyForLayout()) {
return output; return output;
} }
let tableColumnInfo = this._getPluralFormString('tableColumnInfo', this._addRole(output, aRoleStr);
table.columnCount); output.push.call(output, {
let tableRowInfo = this._getPluralFormString('tableRowInfo', string: this._getOutputName('tblColumnInfo'),
table.rowCount); count: table.columnCount
output.push(Utils.stringBundle.formatStringFromName( }, {
this._getOutputName('tableInfo'), [this._getLocalizedRole(aRoleStr), string: this._getOutputName('tblRowInfo'),
tableColumnInfo, tableRowInfo], 3)); count: table.rowCount
});
this._addName(output, aAccessible, aFlags); this._addName(output, aAccessible, aFlags);
this._addLandmark(output, aAccessible); this._addLandmark(output, aAccessible);
return output; return output;
@ -415,7 +390,7 @@ this.OutputGenerator = {
/** /**
* Generates speech utterances from objects, actions and state changes. * Generates speech utterances from objects, actions and state changes.
* An utterance is an array of strings. * An utterance is an array of speech data.
* *
* It should not be assumed that flattening an utterance array would create a * It should not be assumed that flattening an utterance array would create a
* gramatically correct sentence. For example, {@link genForObject} might * gramatically correct sentence. For example, {@link genForObject} might
@ -451,47 +426,42 @@ this.UtteranceGenerator = {
//TODO: May become more verbose in the future. //TODO: May become more verbose in the future.
genForAction: function genForAction(aObject, aActionName) { genForAction: function genForAction(aObject, aActionName) {
return [Utils.stringBundle.GetStringFromName(this.gActionMap[aActionName])]; return [{string: this.gActionMap[aActionName]}];
}, },
genForLiveRegion: function genForLiveRegion(aContext, aIsHide, aModifiedText) { genForLiveRegion: function genForLiveRegion(aContext, aIsHide, aModifiedText) {
let utterance = []; let utterance = [];
if (aIsHide) { if (aIsHide) {
utterance.push(Utils.stringBundle.GetStringFromName('hidden')); utterance.push({string: 'hidden'});
} }
return utterance.concat( return utterance.concat(aModifiedText || this.genForContext(aContext));
aModifiedText || this.genForContext(aContext).output);
}, },
genForAnnouncement: function genForAnnouncement(aAnnouncement) { genForAnnouncement: function genForAnnouncement(aAnnouncement) {
try { return [{
return [Utils.stringBundle.GetStringFromName(aAnnouncement)]; string: aAnnouncement
} catch (x) { }];
return [aAnnouncement];
}
}, },
genForTabStateChange: function genForTabStateChange(aObject, aTabState) { genForTabStateChange: function genForTabStateChange(aObject, aTabState) {
switch (aTabState) { switch (aTabState) {
case 'newtab': case 'newtab':
return [Utils.stringBundle.GetStringFromName('tabNew')]; return [{string: 'tabNew'}];
case 'loading': case 'loading':
return [Utils.stringBundle.GetStringFromName('tabLoading')]; return [{string: 'tabLoading'}];
case 'loaded': case 'loaded':
return [aObject.name || '', return [aObject.name, {string: 'tabLoaded'}];
Utils.stringBundle.GetStringFromName('tabLoaded')];
case 'loadstopped': case 'loadstopped':
return [Utils.stringBundle.GetStringFromName('tabLoadStopped')]; return [{string: 'tabLoadStopped'}];
case 'reload': case 'reload':
return [Utils.stringBundle.GetStringFromName('tabReload')]; return [{string: 'tabReload'}];
default: default:
return []; return [];
} }
}, },
genForEditingMode: function genForEditingMode(aIsEditing) { genForEditingMode: function genForEditingMode(aIsEditing) {
return [Utils.stringBundle.GetStringFromName( return [{string: aIsEditing ? 'editingMode' : 'navigationMode'}];
aIsEditing ? 'editingMode' : 'navigationMode')];
}, },
objectOutputFunctions: { objectOutputFunctions: {
@ -505,9 +475,7 @@ this.UtteranceGenerator = {
heading: function heading(aAccessible, aRoleStr, aState, aFlags) { heading: function heading(aAccessible, aRoleStr, aState, aFlags) {
let level = {}; let level = {};
aAccessible.groupPosition(level, {}, {}); aAccessible.groupPosition(level, {}, {});
let utterance = let utterance = [{string: 'headingLevel', args: [level.value]}];
[Utils.stringBundle.formatStringFromName(
'headingLevel', [level.value], 1)];
this._addName(utterance, aAccessible, aFlags); this._addName(utterance, aAccessible, aFlags);
this._addLandmark(utterance, aAccessible); this._addLandmark(utterance, aAccessible);
@ -520,10 +488,14 @@ this.UtteranceGenerator = {
let itemof = {}; let itemof = {};
aAccessible.groupPosition({}, itemof, itemno); aAccessible.groupPosition({}, itemof, itemno);
let utterance = []; let utterance = [];
if (itemno.value == 1) // Start of list if (itemno.value == 1) {
utterance.push(Utils.stringBundle.GetStringFromName('listStart')); // Start of list
else if (itemno.value == itemof.value) // last item utterance.push({string: 'listStart'});
utterance.push(Utils.stringBundle.GetStringFromName('listEnd')); }
else if (itemno.value == itemof.value) {
// last item
utterance.push({string: 'listEnd'});
}
this._addName(utterance, aAccessible, aFlags); this._addName(utterance, aAccessible, aFlags);
this._addLandmark(utterance, aAccessible); this._addLandmark(utterance, aAccessible);
@ -554,35 +526,32 @@ this.UtteranceGenerator = {
let utterance = []; let utterance = [];
let cell = aContext.getCellInfo(aAccessible); let cell = aContext.getCellInfo(aAccessible);
if (cell) { if (cell) {
let desc = []; let addCellChanged =
let addCellChanged = function addCellChanged(aDesc, aChanged, aString, aIndex) { function addCellChanged(aUtterance, aChanged, aString, aIndex) {
if (aChanged) { if (aChanged) {
aDesc.push(Utils.stringBundle.formatStringFromName(aString, aUtterance.push({string: aString, args: [aIndex + 1]});
[aIndex + 1], 1));
} }
}; };
let addExtent = function addExtent(aDesc, aExtent, aString) { let addExtent = function addExtent(aUtterance, aExtent, aString) {
if (aExtent > 1) { if (aExtent > 1) {
aDesc.push(Utils.stringBundle.formatStringFromName(aString, aUtterance.push({string: aString, args: [aExtent]});
[aExtent], 1));
} }
}; };
let addHeaders = function addHeaders(aDesc, aHeaders) { let addHeaders = function addHeaders(aUtterance, aHeaders) {
if (aHeaders.length > 0) { if (aHeaders.length > 0) {
aDesc.push.apply(aDesc, aHeaders); aUtterance.push.apply(aUtterance, aHeaders);
} }
}; };
addCellChanged(desc, cell.columnChanged, 'columnInfo', cell.columnIndex); addCellChanged(utterance, cell.columnChanged, 'columnInfo',
addCellChanged(desc, cell.rowChanged, 'rowInfo', cell.rowIndex); cell.columnIndex);
addCellChanged(utterance, cell.rowChanged, 'rowInfo', cell.rowIndex);
addExtent(desc, cell.columnExtent, 'spansColumns'); addExtent(utterance, cell.columnExtent, 'spansColumns');
addExtent(desc, cell.rowExtent, 'spansRows'); addExtent(utterance, cell.rowExtent, 'spansRows');
addHeaders(desc, cell.columnHeaders); addHeaders(utterance, cell.columnHeaders);
addHeaders(desc, cell.rowHeaders); addHeaders(utterance, cell.rowHeaders);
utterance.push(desc.join(' '));
} }
this._addName(utterance, aAccessible, aFlags); this._addName(utterance, aAccessible, aFlags);
@ -612,76 +581,61 @@ this.UtteranceGenerator = {
return aContext.newAncestry; return aContext.newAncestry;
}, },
_getLocalizedRole: function _getLocalizedRole(aRoleStr) { _addRole: function _addRole(aOutput, aRoleStr) {
try { aOutput.push({string: this._getOutputName(aRoleStr)});
return Utils.stringBundle.GetStringFromName(
this._getOutputName(aRoleStr));
} catch (x) {
return '';
}
}, },
_getLocalizedState: function _getLocalizedState(aState) { _addState: function _addState(aOutput, aState) {
let stateUtterances = [];
if (aState.contains(States.UNAVAILABLE)) { if (aState.contains(States.UNAVAILABLE)) {
stateUtterances.push( aOutput.push({string: 'stateUnavailable'});
Utils.stringBundle.GetStringFromName('stateUnavailable'));
} }
// Don't utter this in Jelly Bean, we let TalkBack do it for us there. // Don't utter this in Jelly Bean, we let TalkBack do it for us there.
// This is because we expose the checked information on the node itself. // This is because we expose the checked information on the node itself.
// XXX: this means the checked state is always appended to the end, regardless // XXX: this means the checked state is always appended to the end,
// of the utterance ordering preference. // regardless of the utterance ordering preference.
if ((Utils.AndroidSdkVersion < 16 || Utils.MozBuildApp === 'browser') && if ((Utils.AndroidSdkVersion < 16 || Utils.MozBuildApp === 'browser') &&
aState.contains(States.CHECKABLE)) { aState.contains(States.CHECKABLE)) {
let statetr = aState.contains(States.CHECKED) ? let statetr = aState.contains(States.CHECKED) ?
'stateChecked' : 'stateNotChecked'; 'stateChecked' : 'stateNotChecked';
stateUtterances.push(Utils.stringBundle.GetStringFromName(statetr)); aOutput.push({string: statetr});
} }
if (aState.contains(States.PRESSED)) { if (aState.contains(States.PRESSED)) {
stateUtterances.push( aOutput.push({string: 'statePressed'});
Utils.stringBundle.GetStringFromName('statePressed'));
} }
if (aState.contains(States.EXPANDABLE)) { if (aState.contains(States.EXPANDABLE)) {
let statetr = aState.contains(States.EXPANDED) ? let statetr = aState.contains(States.EXPANDED) ?
'stateExpanded' : 'stateCollapsed'; 'stateExpanded' : 'stateCollapsed';
stateUtterances.push(Utils.stringBundle.GetStringFromName(statetr)); aOutput.push({string: statetr});
} }
if (aState.contains(States.REQUIRED)) { if (aState.contains(States.REQUIRED)) {
stateUtterances.push( aOutput.push({string: 'stateRequired'});
Utils.stringBundle.GetStringFromName('stateRequired'));
} }
if (aState.contains(States.TRAVERSED)) { if (aState.contains(States.TRAVERSED)) {
stateUtterances.push( aOutput.push({string: 'stateTraversed'});
Utils.stringBundle.GetStringFromName('stateTraversed'));
} }
if (aState.contains(States.HASPOPUP)) { if (aState.contains(States.HASPOPUP)) {
stateUtterances.push( aOutput.push({string: 'stateHasPopup'});
Utils.stringBundle.GetStringFromName('stateHasPopup'));
} }
if (aState.contains(States.SELECTED)) { if (aState.contains(States.SELECTED)) {
stateUtterances.push( aOutput.push({string: 'stateSelected'});
Utils.stringBundle.GetStringFromName('stateSelected'));
} }
return stateUtterances;
}, },
_getListUtterance: function _getListUtterance(aAccessible, aRoleStr, aFlags, aItemCount) { _getListUtterance: function _getListUtterance(aAccessible, aRoleStr, aFlags, aItemCount) {
let desc = []; let utterance = [];
let roleStr = this._getLocalizedRole(aRoleStr); this._addRole(utterance, aRoleStr);
if (roleStr) { utterance.push({
desc.push(roleStr); string: this._getOutputName('listItemsCount'),
} count: aItemCount
desc.push(this._getPluralFormString('listItemsCount', aItemCount)); });
let utterance = [desc.join(' ')];
this._addName(utterance, aAccessible, aFlags); this._addName(utterance, aAccessible, aFlags);
this._addLandmark(utterance, aAccessible); this._addLandmark(utterance, aAccessible);
@ -690,7 +644,6 @@ this.UtteranceGenerator = {
} }
}; };
this.BrailleGenerator = { this.BrailleGenerator = {
__proto__: OutputGenerator, __proto__: OutputGenerator,
@ -703,7 +656,7 @@ this.BrailleGenerator = {
// direct first children of listitems, because these are both common browsing // direct first children of listitems, because these are both common browsing
// scenarios // scenarios
let addListitemIndicator = function addListitemIndicator(indicator = '*') { let addListitemIndicator = function addListitemIndicator(indicator = '*') {
output.output.unshift(indicator); output.unshift(indicator);
}; };
if (acc.indexInParent === 1 && if (acc.indexInParent === 1 &&
@ -724,12 +677,6 @@ this.BrailleGenerator = {
} }
} }
if (acc instanceof Ci.nsIAccessibleText) {
output.endOffset = this.outputOrder === OUTPUT_DESC_FIRST ?
output.output.join(' ').length : acc.characterCount;
output.startOffset = output.endOffset - acc.characterCount;
}
return output; return output;
}, },
@ -754,20 +701,19 @@ this.BrailleGenerator = {
let braille = []; let braille = [];
let cell = aContext.getCellInfo(aAccessible); let cell = aContext.getCellInfo(aAccessible);
if (cell) { if (cell) {
let desc = []; let addHeaders = function addHeaders(aBraille, aHeaders) {
let addHeaders = function addHeaders(aDesc, aHeaders) {
if (aHeaders.length > 0) { if (aHeaders.length > 0) {
aDesc.push.apply(aDesc, aHeaders); aBraille.push.apply(aBraille, aHeaders);
} }
}; };
desc.push(Utils.stringBundle.formatStringFromName( braille.push({
this._getOutputName('cellInfo'), [cell.columnIndex + 1, string: this._getOutputName('cellInfo'),
cell.rowIndex + 1], 2)); args: [cell.columnIndex + 1, cell.rowIndex + 1]
});
addHeaders(desc, cell.columnHeaders); addHeaders(braille, cell.columnHeaders);
addHeaders(desc, cell.rowHeaders); addHeaders(braille, cell.rowHeaders);
braille.push(desc.join(' '));
} }
this._addName(braille, aAccessible, aFlags); this._addName(braille, aAccessible, aFlags);
@ -795,10 +741,7 @@ this.BrailleGenerator = {
_useStateNotRole: function _useStateNotRole(aAccessible, aRoleStr, aState, aFlags) { _useStateNotRole: function _useStateNotRole(aAccessible, aRoleStr, aState, aFlags) {
let braille = []; let braille = [];
this._addState(braille, aState, aAccessible.role);
let desc = this._getLocalizedState(aState, aAccessible.role);
braille.push(desc.join(' '));
this._addName(braille, aAccessible, aFlags); this._addName(braille, aAccessible, aFlags);
this._addLandmark(braille, aAccessible); this._addLandmark(braille, aAccessible);
@ -813,7 +756,7 @@ this.BrailleGenerator = {
return this.objectOutputFunctions._useStateNotRole.apply(this, arguments); return this.objectOutputFunctions._useStateNotRole.apply(this, arguments);
}, },
togglebutton: function radiobutton(aAccessible, aRoleStr, aState, aFlags) { togglebutton: function togglebutton(aAccessible, aRoleStr, aState, aFlags) {
return this.objectOutputFunctions._useStateNotRole.apply(this, arguments); return this.objectOutputFunctions._useStateNotRole.apply(this, arguments);
} }
}, },
@ -830,42 +773,24 @@ this.BrailleGenerator = {
return OutputGenerator._getOutputName(aName) + 'Abbr'; return OutputGenerator._getOutputName(aName) + 'Abbr';
}, },
_getLocalizedRole: function _getLocalizedRole(aRoleStr) { _addRole: function _addRole(aBraille, aRoleStr) {
try { aBraille.push({string: this._getOutputName(aRoleStr)});
return Utils.stringBundle.GetStringFromName(
this._getOutputName(aRoleStr));
} catch (x) {
try {
return Utils.stringBundle.GetStringFromName(
OutputGenerator._getOutputName(aRoleStr));
} catch (y) {
return '';
}
}
}, },
_getLocalizedState: function _getLocalizedState(aState, aRole) { _addState: function _addState(aBraille, aState, aRole) {
let stateBraille = [];
let getResultMarker = function getResultMarker(aMarker) {
// aMarker is a simple boolean.
let resultMarker = [];
resultMarker.push('(');
resultMarker.push(aMarker ? 'x' : ' ');
resultMarker.push(')');
return resultMarker.join('');
};
if (aState.contains(States.CHECKABLE)) { if (aState.contains(States.CHECKABLE)) {
stateBraille.push(getResultMarker(aState.contains(States.CHECKED))); aBraille.push({
string: aState.contains(States.CHECKED) ?
this._getOutputName('stateChecked') :
this._getOutputName('stateUnchecked')
});
} }
if (aRole === Roles.TOGGLE_BUTTON) { if (aRole === Roles.TOGGLE_BUTTON) {
stateBraille.push(getResultMarker(aState.contains(States.PRESSED))); aBraille.push({
string: aState.contains(States.PRESSED) ?
this._getOutputName('statePressed') :
this._getOutputName('stateUnpressed')
});
} }
return stateBraille;
} }
}; };

Просмотреть файл

@ -130,7 +130,6 @@ Presenter.prototype = {
/** /**
* Visual presenter. Draws a box around the virtual cursor's position. * Visual presenter. Draws a box around the virtual cursor's position.
*/ */
this.VisualPresenter = function VisualPresenter() { this.VisualPresenter = function VisualPresenter() {
this._displayedAccessibles = new WeakMap(); this._displayedAccessibles = new WeakMap();
}; };
@ -161,7 +160,7 @@ VisualPresenter.prototype = {
return { return {
type: this.type, type: this.type,
details: { details: {
method: 'showBounds', eventType: 'viewport-change',
bounds: bounds, bounds: bounds,
padding: this.BORDER_PADDING padding: this.BORDER_PADDING
} }
@ -194,7 +193,7 @@ VisualPresenter.prototype = {
return { return {
type: this.type, type: this.type,
details: { details: {
method: 'showBounds', eventType: 'vc-change',
bounds: bounds, bounds: bounds,
padding: this.BORDER_PADDING padding: this.BORDER_PADDING
} }
@ -212,20 +211,9 @@ VisualPresenter.prototype = {
tabStateChanged: function VisualPresenter_tabStateChanged(aDocObj, tabStateChanged: function VisualPresenter_tabStateChanged(aDocObj,
aPageState) { aPageState) {
if (aPageState == 'newdoc') if (aPageState == 'newdoc')
return {type: this.type, details: {method: 'hideBounds'}}; return {type: this.type, details: {eventType: 'tabstate-change'}};
return null; return null;
},
announce: function VisualPresenter_announce(aAnnouncement) {
return {
type: this.type,
details: {
method: 'showAnnouncement',
text: aAnnouncement,
duration: 1000
}
};
} }
}; };
@ -297,7 +285,8 @@ AndroidPresenter.prototype = {
let state = Utils.getState(aContext.accessible); let state = Utils.getState(aContext.accessible);
androidEvents.push({eventType: (isExploreByTouch) ? androidEvents.push({eventType: (isExploreByTouch) ?
this.ANDROID_VIEW_HOVER_ENTER : focusEventType, this.ANDROID_VIEW_HOVER_ENTER : focusEventType,
text: UtteranceGenerator.genForContext(aContext).output, text: Utils.localize(UtteranceGenerator.genForContext(
aContext)),
bounds: aContext.bounds, bounds: aContext.bounds,
clickable: aContext.accessible.actionCount > 0, clickable: aContext.accessible.actionCount > 0,
checkable: state.contains(States.CHECKABLE), checkable: state.contains(States.CHECKABLE),
@ -323,7 +312,8 @@ AndroidPresenter.prototype = {
type: this.type, type: this.type,
details: [{ details: [{
eventType: this.ANDROID_VIEW_CLICKED, eventType: this.ANDROID_VIEW_CLICKED,
text: UtteranceGenerator.genForAction(aObject, aActionName), text: Utils.localize(UtteranceGenerator.genForAction(aObject,
aActionName)),
checked: state.contains(States.CHECKED) checked: state.contains(States.CHECKED)
}] }]
}; };
@ -337,7 +327,7 @@ AndroidPresenter.prototype = {
tabStateChanged: function AndroidPresenter_tabStateChanged(aDocObj, tabStateChanged: function AndroidPresenter_tabStateChanged(aDocObj,
aPageState) { aPageState) {
return this.announce( return this.announce(
UtteranceGenerator.genForTabStateChange(aDocObj, aPageState).join(' ')); UtteranceGenerator.genForTabStateChange(aDocObj, aPageState));
}, },
textChanged: function AndroidPresenter_textChanged(aIsInserted, aStart, textChanged: function AndroidPresenter_textChanged(aIsInserted, aStart,
@ -421,18 +411,18 @@ AndroidPresenter.prototype = {
}, },
editingModeChanged: function AndroidPresenter_editingModeChanged(aIsEditing) { editingModeChanged: function AndroidPresenter_editingModeChanged(aIsEditing) {
return this.announce( return this.announce(UtteranceGenerator.genForEditingMode(aIsEditing));
UtteranceGenerator.genForEditingMode(aIsEditing).join(' '));
}, },
announce: function AndroidPresenter_announce(aAnnouncement) { announce: function AndroidPresenter_announce(aAnnouncement) {
let localizedAnnouncement = Utils.localize(aAnnouncement).join(' ');
return { return {
type: this.type, type: this.type,
details: [{ details: [{
eventType: (Utils.AndroidSdkVersion >= 16) ? eventType: (Utils.AndroidSdkVersion >= 16) ?
this.ANDROID_ANNOUNCEMENT : this.ANDROID_VIEW_TEXT_CHANGED, this.ANDROID_ANNOUNCEMENT : this.ANDROID_VIEW_TEXT_CHANGED,
text: [aAnnouncement], text: [localizedAnnouncement],
addedCount: aAnnouncement.length, addedCount: localizedAnnouncement.length,
removedCount: 0, removedCount: 0,
fromIndex: 0 fromIndex: 0
}] }]
@ -442,118 +432,99 @@ AndroidPresenter.prototype = {
liveRegion: function AndroidPresenter_liveRegion(aContext, aIsPolite, liveRegion: function AndroidPresenter_liveRegion(aContext, aIsPolite,
aIsHide, aModifiedText) { aIsHide, aModifiedText) {
return this.announce( return this.announce(
UtteranceGenerator.genForLiveRegion(aContext, aIsHide, UtteranceGenerator.genForLiveRegion(aContext, aIsHide, aModifiedText));
aModifiedText).join(' '));
} }
}; };
/** /**
* A speech presenter for direct TTS output * A B2G presenter for Gaia.
*/ */
this.B2GPresenter = function B2GPresenter() {};
this.SpeechPresenter = function SpeechPresenter() {}; B2GPresenter.prototype = {
SpeechPresenter.prototype = {
__proto__: Presenter.prototype, __proto__: Presenter.prototype,
type: 'Speech', type: 'B2G',
pivotChanged: function SpeechPresenter_pivotChanged(aContext, aReason) { /**
if (!aContext.accessible) * A pattern used for haptic feedback.
* @type {Array}
*/
PIVOT_CHANGE_HAPTIC_PATTERN: [40],
/**
* Pivot move reasons.
* @type {Array}
*/
pivotChangedReasons: ['none', 'next', 'prev', 'first', 'last', 'text',
'point'],
pivotChanged: function B2GPresenter_pivotChanged(aContext, aReason) {
if (!aContext.accessible) {
return null; return null;
}
return { return {
type: this.type, type: this.type,
details: { details: {
actions: [ eventType: 'vc-change',
{method: 'playEarcon', data: UtteranceGenerator.genForContext(aContext),
data: aContext.accessible.role === Roles.KEY ? options: {
'virtual_cursor_key' : 'virtual_cursor_move', pattern: this.PIVOT_CHANGE_HAPTIC_PATTERN,
options: {}}, isKey: aContext.accessible.role === Roles.KEY,
{method: 'speak', reason: this.pivotChangedReasons[aReason]
data: UtteranceGenerator.genForContext(aContext).output.join(' '), }
options: {enqueue: true}}
]
} }
}; };
}, },
valueChanged: function SpeechPresenter_valueChanged(aAccessible) { valueChanged: function B2GPresenter_valueChanged(aAccessible) {
return { return {
type: this.type, type: this.type,
details: { details: {
actions: [ eventType: 'value-change',
{ method: 'speak', data: aAccessible.value
data: aAccessible.value,
options: { enqueue: false } }
]
}
} }
};
}, },
actionInvoked: function SpeechPresenter_actionInvoked(aObject, aActionName) { actionInvoked: function B2GPresenter_actionInvoked(aObject, aActionName) {
let actions = [];
if (aActionName === 'click') {
actions.push({method: 'playEarcon',
data: 'clicked',
options: {}});
} else {
actions.push({method: 'speak',
data: UtteranceGenerator.genForAction(aObject, aActionName).join(' '),
options: {enqueue: false}});
}
return { type: this.type, details: { actions: actions } };
},
liveRegion: function SpeechPresenter_liveRegion(aContext, aIsPolite, aIsHide,
aModifiedText) {
return { return {
type: this.type, type: this.type,
details: { details: {
actions: [{ eventType: 'action',
method: 'speak', data: UtteranceGenerator.genForAction(aObject, aActionName)
}
};
},
liveRegion: function
B2GPresenter_liveRegion(aContext, aIsPolite, aIsHide, aModifiedText) {
return {
type: this.type,
details: {
eventType: 'liveregion-change',
data: UtteranceGenerator.genForLiveRegion(aContext, aIsHide, data: UtteranceGenerator.genForLiveRegion(aContext, aIsHide,
aModifiedText).join(' '), aModifiedText),
options: {enqueue: aIsPolite} options: {enqueue: aIsPolite}
}]
} }
}; };
}, },
announce: function SpeechPresenter_announce(aAnnouncement) { announce: function B2GPresenter_announce(aAnnouncement) {
return { return {
type: this.type, type: this.type,
details: { details: {
actions: [{ eventType: 'announcement',
method: 'speak', data: aAnnouncement, options: { enqueue: false } data: aAnnouncement
}]
} }
}; };
} }
}; };
/**
* A haptic presenter
*/
this.HapticPresenter = function HapticPresenter() {};
HapticPresenter.prototype = {
__proto__: Presenter.prototype,
type: 'Haptic',
PIVOT_CHANGE_PATTERN: [40],
pivotChanged: function HapticPresenter_pivotChanged(aContext, aReason) {
return { type: this.type, details: { pattern: this.PIVOT_CHANGE_PATTERN } };
}
};
/** /**
* A braille presenter * A braille presenter
*/ */
this.BraillePresenter = function BraillePresenter() {}; this.BraillePresenter = function BraillePresenter() {};
BraillePresenter.prototype = { BraillePresenter.prototype = {
@ -566,23 +537,28 @@ BraillePresenter.prototype = {
return null; return null;
} }
let brailleOutput = BrailleGenerator.genForContext(aContext); return {
brailleOutput.output = brailleOutput.output.join(' '); type: this.type,
brailleOutput.selectionStart = 0; details: {
brailleOutput.selectionEnd = 0; output: Utils.localize(BrailleGenerator.genForContext(aContext)).join(
' '),
return { type: this.type, details: brailleOutput }; selectionStart: 0,
selectionEnd: 0
}
};
}, },
textSelectionChanged: function BraillePresenter_textSelectionChanged(aText, aStart, textSelectionChanged: function BraillePresenter_textSelectionChanged(aText, aStart,
aEnd, aOldStart, aEnd, aOldStart,
aOldEnd, aIsFromUser) { aOldEnd, aIsFromUser) {
return { type: this.type, return {
details: { selectionStart: aStart, type: this.type,
selectionEnd: aEnd } }; details: {
}, selectionStart: aStart,
selectionEnd: aEnd
}
};
}
}; };
this.Presentation = { this.Presentation = {
@ -590,9 +566,8 @@ this.Presentation = {
delete this.presenters; delete this.presenters;
let presenterMap = { let presenterMap = {
'mobile/android': [VisualPresenter, AndroidPresenter], 'mobile/android': [VisualPresenter, AndroidPresenter],
'b2g': [VisualPresenter, SpeechPresenter, HapticPresenter], 'b2g': [VisualPresenter, B2GPresenter],
'browser': [VisualPresenter, SpeechPresenter, HapticPresenter, 'browser': [VisualPresenter, B2GPresenter, AndroidPresenter]
AndroidPresenter]
}; };
this.presenters = [new P() for (P of presenterMap[Utils.MozBuildApp])]; this.presenters = [new P() for (P of presenterMap[Utils.MozBuildApp])];
return this.presenters; return this.presenters;
@ -648,7 +623,7 @@ this.Presentation = {
announce: function Presentation_announce(aAnnouncement) { announce: function Presentation_announce(aAnnouncement) {
// XXX: Typically each presenter uses the UtteranceGenerator, // XXX: Typically each presenter uses the UtteranceGenerator,
// but there really isn't a point here. // but there really isn't a point here.
return [p.announce(UtteranceGenerator.genForAnnouncement(aAnnouncement)[0]) return [p.announce(UtteranceGenerator.genForAnnouncement(aAnnouncement))
for each (p in this.presenters)]; for each (p in this.presenters)];
}, },

Просмотреть файл

@ -21,6 +21,8 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Relations',
'resource://gre/modules/accessibility/Constants.jsm'); 'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'States', XPCOMUtils.defineLazyModuleGetter(this, 'States',
'resource://gre/modules/accessibility/Constants.jsm'); 'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'PluralForm',
'resource://gre/modules/PluralForm.jsm');
this.EXPORTED_SYMBOLS = ['Utils', 'Logger', 'PivotContext', 'PrefCache', 'SettingCache']; this.EXPORTED_SYMBOLS = ['Utils', 'Logger', 'PivotContext', 'PrefCache', 'SettingCache'];
@ -189,10 +191,49 @@ this.Utils = {
return this.isContentProcess; return this.isContentProcess;
}, },
localize: function localize(aOutput) {
let outputArray = Array.isArray(aOutput) ? aOutput : [aOutput];
let localized =
[this.stringBundle.get(details) for (details of outputArray)]; // jshint ignore:line
// Clean up the white space.
let trimmed;
return [trimmed for (word of localized) if (word && // jshint ignore:line
(trimmed = word.trim()))]; // jshint ignore:line
},
get stringBundle() { get stringBundle() {
delete this.stringBundle; delete this.stringBundle;
this.stringBundle = Services.strings.createBundle( let bundle = Services.strings.createBundle(
'chrome://global/locale/AccessFu.properties'); 'chrome://global/locale/AccessFu.properties');
this.stringBundle = {
get: function stringBundle_get(aDetails = {}) {
if (!aDetails || typeof aDetails === 'string') {
return aDetails;
}
let str = '';
let string = aDetails.string;
if (!string) {
return str;
}
try {
let args = aDetails.args;
let count = aDetails.count;
if (args) {
str = bundle.formatStringFromName(string, args, args.length);
} else {
str = bundle.GetStringFromName(string);
}
if (count) {
str = PluralForm.get(count, str);
str = str.replace('#1', count);
}
} catch (e) {
Logger.debug('Failed to get a string from a bundle for', string);
} finally {
return str;
}
}
};
return this.stringBundle; return this.stringBundle;
}, },

Просмотреть файл

@ -78,7 +78,7 @@ var AccessFuTest = {
if (!data) { if (!data) {
return; return;
} }
isDeeply(data.details.actions, aWaitForData, "Data is correct"); isDeeply(data.details, aWaitForData, "Data is correct");
aListener.apply(listener); aListener.apply(listener);
}; };
Services.obs.addObserver(listener, 'accessfu-output', false); Services.obs.addObserver(listener, 'accessfu-output', false);
@ -288,8 +288,9 @@ AccessFuContentTest.prototype = {
var android = this.extractAndroid(aMessage.json, expected.android); var android = this.extractAndroid(aMessage.json, expected.android);
if ((speech && expected.speak) || (android && expected.android)) { if ((speech && expected.speak) || (android && expected.android)) {
if (expected.speak) { if (expected.speak) {
(SimpleTest[expected.speak_checkFunc] || is)(speech, expected.speak, var checkFunc = SimpleTest[expected.speak_checkFunc] || isDeeply;
'"' + speech + '" spoken'); checkFunc.apply(SimpleTest, [speech, expected.speak,
'"' + JSON.stringify(speech) + '" spoken']);
} }
if (expected.android) { if (expected.android) {
@ -332,11 +333,9 @@ AccessFuContentTest.prototype = {
} }
for (var output of aData) { for (var output of aData) {
if (output && output.type === 'Speech') { if (output && output.type === 'B2G') {
for (var action of output.details.actions) { if (output.details && output.details.data[0].string !== 'clickAction') {
if (action && action.method == 'speak') { return output.details.data;
return action.data;
}
} }
} }
} }
@ -345,6 +344,10 @@ AccessFuContentTest.prototype = {
}, },
extractAndroid: function(aData, aExpectedEvents) { extractAndroid: function(aData, aExpectedEvents) {
if (!aData) {
return null;
}
for (var output of aData) { for (var output of aData) {
if (output && output.type === 'Android') { if (output && output.type === 'Android') {
for (var i in output.details) { for (var i in output.details) {

Просмотреть файл

@ -22,7 +22,7 @@ function testContextOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aGenerator
var oldAccessible = aOldAccOrElmOrID !== null ? var oldAccessible = aOldAccOrElmOrID !== null ?
getAccessible(aOldAccOrElmOrID || 'root') : null; getAccessible(aOldAccOrElmOrID || 'root') : null;
var context = new PivotContext(accessible, oldAccessible); var context = new PivotContext(accessible, oldAccessible);
var output = aGenerator.genForContext(context).output; var output = aGenerator.genForContext(context);
// Create a version of the output that has null members where we have // Create a version of the output that has null members where we have
// null members in the expected output. Those are indexes that are not testable // null members in the expected output. Those are indexes that are not testable
@ -33,14 +33,15 @@ function testContextOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aGenerator
if (expected[i] === null) { if (expected[i] === null) {
masked_output.push(null); masked_output.push(null);
} else { } else {
masked_output[i] = output[i]; masked_output[i] = typeof output[i] === "string" ? output[i].trim() :
output[i];
} }
} }
isDeeply(masked_output, expected, isDeeply(masked_output, expected,
"Context output is correct for " + aAccOrElmOrID + "Context output is correct for " + aAccOrElmOrID +
" (output: " + output.join(", ") + ") ==" + " (output: " + JSON.stringify(output) + ") ==" +
" (expected: " + expected.join(", ") + ")"); " (expected: " + JSON.stringify(expected) + ")");
} }
/** /**
@ -53,6 +54,9 @@ function testContextOutput(expected, aAccOrElmOrID, aOldAccOrElmOrID, aGenerator
*/ */
function testObjectOutput(aAccOrElmOrID, aGenerator) { function testObjectOutput(aAccOrElmOrID, aGenerator) {
var accessible = getAccessible(aAccOrElmOrID); var accessible = getAccessible(aAccOrElmOrID);
if (!accessible.name || !accessible.name.trim()) {
return;
}
var context = new PivotContext(accessible); var context = new PivotContext(accessible);
var output = aGenerator.genForObject(accessible, context); var output = aGenerator.genForObject(accessible, context);
var outputOrder; var outputOrder;

Просмотреть файл

@ -23,13 +23,10 @@
function settingsStart() { function settingsStart() {
ok(true, "EventManager was stopped."); ok(true, "EventManager was stopped.");
isnot(AccessFu._enabled, true, "AccessFu was disabled."); isnot(AccessFu._enabled, true, "AccessFu was disabled.");
AccessFuTest.once([{ AccessFuTest.once({
"method": "speak", "eventType": "announcement",
"data": "Screen reader started", "data": [{string: "screenReaderStarted"}]
"options": { }, AccessFuTest.nextTest);
"enqueue": false
}
}], AccessFuTest.nextTest);
// XXX: Bug 978076 - test start with SettingsManager. // XXX: Bug 978076 - test start with SettingsManager.
//navigator.mozSettings.createLock().set( //navigator.mozSettings.createLock().set(
// {'accessibility.screenreader': false}); // {'accessibility.screenreader': false});
@ -39,13 +36,10 @@
// Make sure EventManager is started again. // Make sure EventManager is started again.
function settingsStop() { function settingsStop() {
ok(AccessFu._enabled, "AccessFu was enabled again."); ok(AccessFu._enabled, "AccessFu was enabled again.");
AccessFuTest.once([{ AccessFuTest.once({
"method": "speak", "eventType": "announcement",
"data": "Screen reader stopped", "data": [{string: "screenReaderStopped"}]
"options": { }, AccessFuTest.finish);
"enqueue": false
}
}], AccessFuTest.finish);
// XXX: Bug 978076 - test stop with SettingsManager. // XXX: Bug 978076 - test stop with SettingsManager.
//navigator.mozSettings.createLock().set( //navigator.mozSettings.createLock().set(
// {'accessibility.screenreader': false}); // {'accessibility.screenreader': false});

Просмотреть файл

@ -23,68 +23,72 @@
<script type="application/javascript"> <script type="application/javascript">
function doTest() { function doTest() {
var doc = currentTabDocument(); var doc = currentTabDocument();
var iframe = doc.createElement("iframe"); var iframe = doc.createElement('iframe');
iframe.mozbrowser = true; iframe.mozbrowser = true;
iframe.addEventListener("mozbrowserloadend", function () { iframe.addEventListener('mozbrowserloadend', function () {
var contentTest = new AccessFuContentTest( var contentTest = new AccessFuContentTest(
[ [
// Simple traversal forward // Simple traversal forward
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document' speak: ['Phone status bar', 'Traversal Rule test document']
}], }],
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'wow heading level 1 such app' speak: ['wow', {'string': 'headingLevel', 'args': [1]} ,'such app']
}], }],
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'many option not checked check button First item list 1 item' speak: ['many option', {'string': 'stateNotChecked'},
{'string': 'checkbutton'}, {'string': 'listStart'},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}]
}], }],
// check checkbox // check checkbox
[ContentMessages.activateCurrent(), { [ContentMessages.activateCurrent(), {
speak: 'checked' speak: [{'string': 'checkAction'}]
}], }],
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'much range label' speak: ['much range', {'string': 'label'}]
}], }],
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'much range 5 slider' speak: ['much range', '5', {'string': 'slider'}]
}], }],
[ContentMessages.adjustRangeUp, [ContentMessages.adjustRangeUp,
{ speak: '6'}], { speak: ['6']}],
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'Home button' speak: ['Home', {'string': 'pushbutton'}]
}], }],
// Simple traversal backward // Simple traversal backward
[ContentMessages.simpleMovePrevious, { [ContentMessages.simpleMovePrevious, {
speak: 'much range 6 slider such app' speak: ['much range', '6', {'string': 'slider'}, 'such app']
}], }],
[ContentMessages.adjustRangeDown, [ContentMessages.adjustRangeDown,
{ speak: '5'}], { speak: ['5']}],
[ContentMessages.simpleMovePrevious, { [ContentMessages.simpleMovePrevious, {
speak: 'much range label' speak: ['much range', {'string': 'label'}]
}], }],
[ContentMessages.simpleMovePrevious, { [ContentMessages.simpleMovePrevious, {
speak: 'many option checked check button First item list 1 item' speak: ['many option', {'string': 'stateChecked'},
{'string': 'checkbutton'}, {'string': 'listStart'},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}]
}], }],
// uncheck checkbox // uncheck checkbox
[ContentMessages.activateCurrent(), { [ContentMessages.activateCurrent(), {
speak: 'unchecked' speak: [{'string': 'uncheckAction'}]
}], }],
[ContentMessages.simpleMovePrevious, { [ContentMessages.simpleMovePrevious, {
speak: 'wow heading level 1' speak: ['wow', {'string': 'headingLevel', 'args': [1]}]
}], }],
[ContentMessages.simpleMovePrevious, { [ContentMessages.simpleMovePrevious, {
speak: 'Phone status bar' speak: ['Phone status bar']
}], }],
// Moving to the absolute last item from an embedded document // Moving to the absolute last item from an embedded document
// fails. Bug 972035. // fails. Bug 972035.
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'wow heading level 1 such app' speak: ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app']
}], }],
// Move from an inner frame to the last element in the parent doc // Move from an inner frame to the last element in the parent doc
[ContentMessages.simpleMoveLast, { [ContentMessages.simpleMoveLast, {
speak: 'Home button', speak: ['Home', {'string': 'pushbutton'}],
speak_checkFunc: 'todo_is' speak_checkFunc: 'todo_is'
}], }],
@ -93,16 +97,18 @@
// Moving to the absolute first item from an embedded document // Moving to the absolute first item from an embedded document
// fails. Bug 972035. // fails. Bug 972035.
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document' speak: ['Phone status bar', 'Traversal Rule test document']
}], }],
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'wow heading level 1 such app' speak: ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app']
}], }],
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'many option not checked check button First item list 1 item' speak: ['many option', {'string': 'stateNotChecked'},
{'string': 'checkbutton'}, {'string': 'listStart'},
{'string': 'list'}, {'string': 'listItemsCount', 'count': 1}]
}], }],
[ContentMessages.simpleMoveFirst, { [ContentMessages.simpleMoveFirst, {
speak: 'Phone status bar', speak: ['Phone status bar'],
speak_checkFunc: 'todo_is' speak_checkFunc: 'todo_is'
}], }],
@ -111,10 +117,10 @@
// Move cursor with focus in outside document // Move cursor with focus in outside document
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document' speak: ['Phone status bar', 'Traversal Rule test document']
}], }],
[ContentMessages.focusSelector('button#home', false), { [ContentMessages.focusSelector('button#home', false), {
speak: 'Home button' speak: ['Home', {'string': 'pushbutton'}]
}], }],
// Blur button and reset cursor // Blur button and reset cursor
@ -124,13 +130,13 @@
// Set focus on element outside of embedded frame while // Set focus on element outside of embedded frame while
// cursor is in frame // cursor is in frame
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document' speak: ['Phone status bar', 'Traversal Rule test document']
}], }],
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'wow heading level 1 such app' speak: ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app']
}], }],
[ContentMessages.focusSelector('button#home', false), { [ContentMessages.focusSelector('button#home', false), {
speak: 'Home button' speak: ['Home button']
}] }]
// Blur button and reset cursor // Blur button and reset cursor
@ -143,51 +149,52 @@
// Open dialog in outer doc, while cursor is also in outer doc // Open dialog in outer doc, while cursor is also in outer doc
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document' speak: ['Phone status bar', 'Traversal Rule test document']
}], }],
[doc.defaultView.showAlert, { [doc.defaultView.showAlert, {
speak: 'This is an alert! heading level 1 dialog' speak: ['This is an alert! heading level 1 dialog']
}], }],
[function() { [function() {
doc.defaultView.hideAlert() doc.defaultView.hideAlert()
}, { }, {
speak: 'wow heading level 1 such app' speak: ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app']
}], }],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Open dialog in outer doc, while cursor is in inner frame // Open dialog in outer doc, while cursor is in inner frame
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document' speak: ['Phone status bar', 'Traversal Rule test document']
}], }],
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'wow heading level 1 such app' speak: ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app']
}], }],
[doc.defaultView.showAlert, { [doc.defaultView.showAlert, {
speak: 'This is an alert! heading level 1 dialog' speak: ['This is an alert! heading level 1 dialog']
}], }],
// XXX: Place cursor back where it was. // XXX: Place cursor back where it was.
[doc.defaultView.hideAlert, { [doc.defaultView.hideAlert, {
speak: 'many option not checked check button such app' speak: ['many option not checked check button such app']
}], }],
[ContentMessages.clearCursor, 'AccessFu:CursorCleared'], [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
// Open dialog, then focus on something when closing // Open dialog, then focus on something when closing
[ContentMessages.simpleMoveNext, { [ContentMessages.simpleMoveNext, {
speak: 'Phone status bar Traversal Rule test document' speak: ['Phone status bar', 'Traversal Rule test document']
}], }],
[doc.defaultView.showAlert, { [doc.defaultView.showAlert, {
speak: 'This is an alert! heading level 1 dialog' speak: ['This is an alert! heading level 1 dialog']
}], }],
[function() { [function() {
doc.defaultView.hideAlert(); doc.defaultView.hideAlert();
doc.querySelector('button#home').focus(); doc.querySelector('button#home').focus();
}, { }, {
speak: 'Home button Traversal Rule test document' speak: ['Home', {'string': 'pushbutton'},
'Traversal Rule test document']
}] }]
]); ]);
@ -207,17 +214,17 @@
openBrowserWindow( openBrowserWindow(
function () { function () {
SpecialPowers.pushPrefEnv({ SpecialPowers.pushPrefEnv({
"set": [ 'set': [
// TODO: remove this as part of bug 820712 // TODO: remove this as part of bug 820712
["network.disable.ipc.security", true], ['network.disable.ipc.security', true],
["dom.ipc.browser_frames.oop_by_default", true], ['dom.ipc.browser_frames.oop_by_default', true],
["dom.mozBrowserFramesEnabled", true], ['dom.mozBrowserFramesEnabled', true],
["browser.pagethumbnails.capturing_disabled", true] ['browser.pagethumbnails.capturing_disabled', true]
] ]
}, doTest) }, }, doTest) },
getRootDirectory(window.location.href) + "doc_content_integration.html"); getRootDirectory(window.location.href) + 'doc_content_integration.html');
}); });
</script> </script>
</head> </head>

Просмотреть файл

@ -27,9 +27,9 @@
[ [
// Read-only text tests // Read-only text tests
[ContentMessages.simpleMoveFirst, { [ContentMessages.simpleMoveFirst, {
speak: 'These are my awards, Mother. From Army. ' + speak: ['These are my awards, Mother. From Army. ' +
'The seal is for marksmanship, and the gorilla is ' + 'The seal is for marksmanship, and the gorilla is ' +
'for sand racing. Text content test document' 'for sand racing.', 'Text content test document']
}], }],
[ContentMessages.moveNextBy('word'), { [ContentMessages.moveNextBy('word'), {
speak: 'These', speak: 'These',
@ -142,8 +142,8 @@
// Editable text tests. // Editable text tests.
[ContentMessages.focusSelector('textarea'), { [ContentMessages.focusSelector('textarea'), {
speak: 'Please refrain from Mayoneggs during this ' + speak: ['Please refrain from Mayoneggs during this ' +
'salmonella scare. text area' 'salmonella scare.', {string: 'textarea'}]
}], }],
[null, { // When we first focus, caret is at 0. [null, { // When we first focus, caret is at 0.
android: [{ android: [{

Просмотреть файл

@ -16,80 +16,99 @@
// Test the following accOrElmOrID. // Test the following accOrElmOrID.
var tests = [{ var tests = [{
accOrElmOrID: "anchor1", accOrElmOrID: "anchor1",
expected: ["link", "title"] expected: [{"string": "link"}, "title"]
}, { }, {
accOrElmOrID: "anchor2", accOrElmOrID: "anchor2",
expected: ["link", "This is a link"] expected: [{"string": "link"}, "This is a link"]
}, { }, {
accOrElmOrID: "button1", accOrElmOrID: "button1",
expected: ["button", "Press me"] expected: [{"string": "pushbutton"}, "Press me"]
}, { }, {
accOrElmOrID: "button2", accOrElmOrID: "button2",
expected: ["button", "Press me"] expected: [{"string": "pushbutton"}, "Press me"]
}, { }, {
accOrElmOrID: "textarea1", accOrElmOrID: "textarea1",
expected: ["text area", "This is the text area text.", "Test Text Area"] expected: [{"string": "textarea"}, "This is the text area text.",
"Test Text Area"]
}, { }, {
accOrElmOrID: "textarea2", accOrElmOrID: "textarea2",
expected: ["text area", "This is the text area text."] expected: [{"string": "textarea"}, "This is the text area text."]
}, { }, {
accOrElmOrID: "heading1", accOrElmOrID: "heading1",
expected: ["heading level 1", "Test heading", "This is the heading."] expected: [{"string": "headingLevel", "args": [1]}, "Test heading",
"This is the heading."]
}, { }, {
accOrElmOrID: "heading1", accOrElmOrID: "heading1",
oldAccOrElmOrID: null, oldAccOrElmOrID: null,
expected: [null /* parent doc title */, document.title, expected: [null /* parent doc title */, document.title,
"heading level 1", "Test heading", "This is the heading."] {"string": "headingLevel", "args": [1]}, "Test heading",
"This is the heading."]
}, { }, {
accOrElmOrID: "heading2", accOrElmOrID: "heading2",
expected: ["heading level 1", "This is the heading."] expected: [{"string": "headingLevel", "args": [1]},
"This is the heading."]
}, { }, {
accOrElmOrID: "list", accOrElmOrID: "list",
expected: ["list 2 items", "Test List", "First item", "Top of the list", expected: [{"string": "list"}, {"string": "listItemsCount", "count": 2},
"Last item", "2.", "list two"] "Test List", {"string": "listStart"}, "Top of the list",
{"string": "listEnd"}, "2.", "list two"]
}, { }, {
accOrElmOrID: "dlist", accOrElmOrID: "dlist",
expected: ["definition list 0.5 items", "Test Definition List", expected: [{"string": "definitionlist"},
{"string": "listItemsCount", "count": 0.5}, "Test Definition List",
"dd one"] "dd one"]
}, { }, {
accOrElmOrID: "li_one", accOrElmOrID: "li_one",
expected: ["list 2 items", "Test List", "First item", "Top of the list"] expected: [{"string": "list"}, {"string": "listItemsCount", "count": 2},
"Test List", {"string": "listStart"}, "Top of the list"]
}, { }, {
accOrElmOrID: "li_two", accOrElmOrID: "li_two",
expected: ["list 2 items", "Test List", "Last item", "2.", "list two"] expected: [{"string": "list"}, {"string": "listItemsCount", "count": 2},
"Test List", {"string": "listEnd"}, "2.", "list two"]
}, { }, {
accOrElmOrID: "cell", accOrElmOrID: "cell",
expected: ["table with 1 column and 1 row", "Fruits and vegetables", expected: [{"string": "table"},
"Column 1 Row 1", "List of Fruits", "list 4 items", "First item", {"string": "tblColumnInfo", "count": 1},
"link", "Apples", "link", "Bananas", "link", "Peaches", "Last item", {"string": "tblRowInfo", "count": 1}, "Fruits and vegetables",
"link", "Plums"] {"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [1]}, "List of Fruits",
{"string": "list"}, {"string": "listItemsCount", "count": 4},
{"string": "listStart"}, {"string": "link"}, "Apples",
{"string": "link"}, "Bananas",
{"string": "link"}, "Peaches", {"string": "listEnd"},
{"string": "link"}, "Plums"]
}, { }, {
accOrElmOrID: "app.net", accOrElmOrID: "app.net",
expected: ["list 2 items", "First item", "link", "star", "Last item", expected: [{"string": "list"}, {"string": "listItemsCount", "count": 2},
"link", "repost"] {"string": "listStart"}, {"string": "link"}, "star",
{"string": "listEnd"}, {"string": "link"}, "repost"]
}, { }, {
// Test pivot to list from li_one. // Test pivot to list from li_one.
accOrElmOrID: "list", accOrElmOrID: "list",
oldAccOrElmOrID: "li_one", oldAccOrElmOrID: "li_one",
expected: ["list 2 items", "Test List", "First item", "Top of the list", expected: [{"string": "list"}, {"string": "listItemsCount", "count": 2},
"Last item", "2.", "list two"] "Test List", {"string": "listStart"}, "Top of the list",
{"string": "listEnd"}, "2.", "list two"]
}, { }, {
// Test pivot to li_one from list. // Test pivot to li_one from list.
accOrElmOrID: "li_one", accOrElmOrID: "li_one",
oldAccOrElmOrID: "list", oldAccOrElmOrID: "list",
expected: ["First item", "Top of the list"] expected: [{"string": "listStart"}, "Top of the list"]
}, { }, {
// Test pivot to "apples" link from the table cell. // Test pivot to "apples" link from the table cell.
accOrElmOrID: "apples", accOrElmOrID: "apples",
oldAccOrElmOrID: "cell", oldAccOrElmOrID: "cell",
expected: ["list 4 items", "First item", "link", "Apples"] expected: [{"string": "list"}, {"string": "listItemsCount", "count": 4},
{"string": "listStart"}, {"string": "link"}, "Apples"]
}, { }, {
// Test pivot to the table cell from the "apples" link. // Test pivot to the table cell from the "apples" link.
accOrElmOrID: "cell", accOrElmOrID: "cell",
oldAccOrElmOrID: "apples", oldAccOrElmOrID: "apples",
expected: ["List of Fruits", "list 4 items", "First item", "link", expected: ["List of Fruits", {"string": "list"},
"Apples", "link", "Bananas", "link", "Peaches", "Last item", "link", {"string": "listItemsCount", "count": 4}, {"string": "listStart"},
"Plums"] {"string": "link"}, "Apples", {"string": "link"}, "Bananas",
{"string": "link"}, "Peaches", {"string": "listEnd"},
{"string": "link"}, "Plums"]
}]; }];
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, 0); SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, 0);

Просмотреть файл

@ -16,81 +16,104 @@
// Test the following accOrElmOrID. // Test the following accOrElmOrID.
var tests = [{ var tests = [{
accOrElmOrID: "nav", accOrElmOrID: "nav",
expectedUtterance: [["navigation", "a nav"], ["a nav", "navigation"]], expectedUtterance: [[{"string": "navigation"}, "a nav"],
expectedBraille: [["navigation", "a nav"], ["a nav", "navigation"]] ["a nav", {"string": "navigation"}]],
expectedBraille: [[{"string": "navigation"}, "a nav"],
["a nav", {"string": "navigation"}]]
}, { }, {
accOrElmOrID: "main", accOrElmOrID: "main",
expectedUtterance: [["main", "a main area"], ["a main area", "main"]], expectedUtterance: [[{"string": "main"}, "a main area"],
expectedBraille: [["main", "a main area"], ["a main area", "main"]] ["a main area", {"string": "main"}]],
expectedBraille: [[{"string": "main"}, "a main area"],
["a main area", {"string": "main"}]]
}, { }, {
accOrElmOrID: "header", accOrElmOrID: "header",
expectedUtterance: [["banner", "header", "a header"], ["a header", expectedUtterance: [
"header", "banner"]], [{"string": "banner"}, {"string": "header"}, "a header"],
expectedBraille: [["banner", "header", "a header"], ["a header", ["a header", {"string": "header"}, {"string": "banner"}]],
"header", "banner"]] expectedBraille: [
[{"string": "banner"}, {"string": "headerAbbr"}, "a header"],
["a header", {"string": "headerAbbr"}, {"string": "banner"}]]
}, { }, {
accOrElmOrID: "footer", accOrElmOrID: "footer",
expectedUtterance: [["content info", "footer", "a footer"], [ expectedUtterance: [
"a footer", "footer", "content info"]], [{"string": "contentinfo"}, {"string": "footer"}, "a footer"],
expectedBraille: [["content info", "footer", "a footer"], ["a footer", ["a footer", {"string": "footer"}, {"string": "contentinfo"}]],
"footer", "content info"]] expectedBraille: [
[{"string": "contentinfo"}, {"string": "footerAbbr"}, "a footer"],
["a footer", {"string": "footerAbbr"}, {"string": "contentinfo"}]]
}, { }, {
accOrElmOrID: "article_header", accOrElmOrID: "article_header",
expectedUtterance: [["header", "a header within an article"], [ expectedUtterance: [
"a header within an article", "header"]], [{"string": "header"}, "a header within an article"],
expectedBraille: [["header", "a header within an article"], [ ["a header within an article", {"string": "header"}]],
"a header within an article", "header"]], expectedBraille: [
[{"string": "headerAbbr"}, "a header within an article"],
["a header within an article", {"string": "headerAbbr"}]],
}, { }, {
accOrElmOrID: "article_footer", accOrElmOrID: "article_footer",
expectedUtterance: [["footer", "a footer within an article"], [ expectedUtterance: [
"a footer within an article", "footer"]], [{"string": "footer"}, "a footer within an article"],
expectedBraille: [["footer", "a footer within an article"], [ ["a footer within an article", {"string": "footer"}]],
"a footer within an article", "footer"]] expectedBraille: [
[{"string": "footerAbbr"}, "a footer within an article"],
["a footer within an article", {"string": "footerAbbr"}]]
}, { }, {
accOrElmOrID: "section_header", accOrElmOrID: "section_header",
expectedUtterance: [["header", "a header within a section"], [ expectedUtterance: [[{"string":"header"}, "a header within a section"],
"a header within a section", "header"]], ["a header within a section", {"string":"header"}]],
expectedBraille: [["header", "a header within a section"], [ expectedBraille: [
"a header within a section", "header"]] [{"string":"headerAbbr"}, "a header within a section"],
["a header within a section", {"string":"headerAbbr"}]]
}, { }, {
accOrElmOrID: "section_footer", accOrElmOrID: "section_footer",
expectedUtterance: [["footer", "a footer within a section"], [ expectedUtterance: [
"a footer within a section", "footer"]], [{"string": "footer"}, "a footer within a section"],
expectedBraille: [["footer", "a footer within a section"], [ ["a footer within a section", {"string": "footer"}]],
"a footer within a section", "footer"]] expectedBraille: [
[{"string": "footerAbbr"}, "a footer within a section"],
["a footer within a section", {"string": "footerAbbr"}]]
}, { }, {
accOrElmOrID: "aside", accOrElmOrID: "aside",
expectedUtterance: [["complementary", "by the way I am an aside"], [ expectedUtterance: [
"by the way I am an aside", "complementary"]], [{"string": "complementary"}, "by the way I am an aside"],
expectedBraille: [["complementary", "by the way I am an aside"], [ ["by the way I am an aside", {"string": "complementary"}]],
"by the way I am an aside", "complementary"]] expectedBraille: [
[{"string": "complementary"}, "by the way I am an aside"],
["by the way I am an aside", {"string": "complementary"}]]
}, { }, {
accOrElmOrID: "main_element", accOrElmOrID: "main_element",
expectedUtterance: [["main", "another main area"], [ expectedUtterance: [[{"string": "main"}, "another main area"],
"another main area", "main"]], ["another main area", {"string": "main"}]],
expectedBraille: [["main", "another main area"], ["another main area", expectedBraille: [[{"string": "main"}, "another main area"],
"main"]] ["another main area", {"string": "main"}]]
}, { }, {
accOrElmOrID: "complementary", accOrElmOrID: "complementary",
expectedUtterance: [["list 1 item", "complementary", "First item", expectedUtterance: [[{"string": "list"},
"A complementary"], ["A complementary", "First item", {"string": "listItemsCount", "count": 1}, {"string": "complementary"},
"complementary", "list 1 item"]], {"string": "listStart"}, "A complementary"], ["A complementary",
expectedBraille: [["*", "complementary", "A complementary"], ["*", {"string": "listStart"}, {"string": "complementary"},
"A complementary", "complementary"]] {"string": "list"}, {"string": "listItemsCount", "count": 1}]],
expectedBraille: [["*", {"string": "complementary"}, "A complementary"],
["*", "A complementary", {"string": "complementary"}]]
}, { }, {
accOrElmOrID: "parent_main", accOrElmOrID: "parent_main",
expectedUtterance: [["main", "a parent main", "complementary", expectedUtterance: [[{"string": "main"}, "a parent main",
"a child complementary"], ["a parent main", "a child complementary", {"string": "complementary"}, "a child complementary"],
"complementary", "main"]], ["a parent main", "a child complementary",
expectedBraille: [["main", "a parent main", "complementary", {"string": "complementary"}, {"string": "main"}]],
"a child complementary"], ["a parent main", "a child complementary", expectedBraille: [[{"string": "main"}, "a parent main",
"complementary", "main"]] {"string": "complementary"}, "a child complementary"],
["a parent main", "a child complementary",
{"string": "complementary"}, {"string": "main"}]]
}, { }, {
accOrElmOrID: "child_complementary", accOrElmOrID: "child_complementary",
expectedUtterance: [["main", "complementary", "a child complementary"], expectedUtterance: [[{"string": "main"}, {"string": "complementary"},
["a child complementary", "complementary", "main"]], "a child complementary"], ["a child complementary",
expectedBraille: [["complementary", "a child complementary"], {"string": "complementary"}, {"string": "main"}]],
["a child complementary", "complementary"]] expectedBraille: [[{"string": "complementary"},
"a child complementary"], ["a child complementary",
{"string": "complementary"}]]
}]; }];
// Test outputs (utterance and braille) for landmarks. // Test outputs (utterance and braille) for landmarks.

Просмотреть файл

@ -47,204 +47,204 @@
} }
var tests = [{ var tests = [{
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "hidden I will be hidden", "data": [{"string": "hidden"}, "I will be hidden"],
"options": { "options": {
"enqueue": true "enqueue": true
} }
}], },
action: function action() { action: function action() {
[hide(id) for (id of ["to_hide1", "to_hide2", "to_hide3", "to_hide4"])]; [hide(id) for (id of ["to_hide1", "to_hide2", "to_hide3", "to_hide4"])];
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "hidden I will be hidden", "data": [{"string": "hidden"},"I will be hidden"],
"options": { "options": {
"enqueue": true "enqueue": true
} }
}], },
action: function action() { action: function action() {
[hide(id) for (id of ["to_hide_descendant1", "to_hide_descendant2", [hide(id) for (id of ["to_hide_descendant1", "to_hide_descendant2",
"to_hide_descendant3", "to_hide_descendant4"])]; "to_hide_descendant3", "to_hide_descendant4"])];
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "I will be shown", "data": ["I will be shown"],
"options": { "options": {
"enqueue": true "enqueue": true
} }
}], },
action: function action() { action: function action() {
[show(id) for (id of ["to_show1", "to_show2", "to_show3", "to_show4"])]; [show(id) for (id of ["to_show1", "to_show2", "to_show3", "to_show4"])];
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "I will be shown", "data": ["I will be shown"],
"options": { "options": {
"enqueue": true "enqueue": true
} }
}], },
action: function action() { action: function action() {
[show(id) for (id of ["to_show_descendant1", "to_show_descendant2", [show(id) for (id of ["to_show_descendant1", "to_show_descendant2",
"to_show_descendant3", "to_show_descendant4"])]; "to_show_descendant3", "to_show_descendant4"])];
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "hidden I will be hidden", "data": [{"string": "hidden"}, "I will be hidden"],
"options": { "options": {
"enqueue": false "enqueue": false
} }
}], },
action: function action() { action: function action() {
hide("to_hide_live_assertive"); hide("to_hide_live_assertive");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "I will be shown", "data": ["I will be shown"],
"options": { "options": {
"enqueue": false "enqueue": false
} }
}], },
action: function action() { action: function action() {
[show(id) for (id of ["to_show_live_off", "to_show_live_assertive"])]; [show(id) for (id of ["to_show_live_off", "to_show_live_assertive"])];
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "Text Added", "data": ["Text Added"],
"options": { "options": {
"enqueue": false "enqueue": false
} }
}], },
action: function action() { action: function action() {
updateText("text_add", "Text Added"); updateText("text_add", "Text Added");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "Text Added", "data": ["Text Added"],
"options": { "options": {
"enqueue": false "enqueue": false
} }
}], },
action: function action() { action: function action() {
updateHTML("text_add", "Text Added"); updateHTML("text_add", "Text Added");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "hidden Text Removed", "data": [{"string": "hidden"}, "Text Removed"],
"options": { "options": {
"enqueue": true "enqueue": true
} }
}], },
action: function action() { action: function action() {
updateText("text_remove", ""); updateText("text_remove", "");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "Descendant Text Added", "data": ["Descendant Text Added"],
"options": { "options": {
"enqueue": false "enqueue": false
} }
}], },
action: function action() { action: function action() {
updateText("text_add_descendant", "Descendant Text Added"); updateText("text_add_descendant", "Descendant Text Added");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "Descendant Text Added", "data": ["Descendant Text Added"],
"options": { "options": {
"enqueue": false "enqueue": false
} }
}], },
action: function action() { action: function action() {
updateHTML("text_add_descendant", "Descendant Text Added"); updateHTML("text_add_descendant", "Descendant Text Added");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "hidden Descendant Text Removed", "data": [{"string": "hidden"}, "Descendant Text Removed"],
"options": { "options": {
"enqueue": true "enqueue": true
} }
}], },
action: function action() { action: function action() {
updateText("text_remove_descendant", ""); updateText("text_remove_descendant", "");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "Descendant Text Added", "data": ["Descendant Text Added"],
"options": { "options": {
"enqueue": false "enqueue": false
} }
}], },
action: function action() { action: function action() {
updateText("text_add_descendant2", "Descendant Text Added"); updateText("text_add_descendant2", "Descendant Text Added");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "Descendant Text Added", "data": ["Descendant Text Added"],
"options": { "options": {
"enqueue": false "enqueue": false
} }
}], },
action: function action() { action: function action() {
updateHTML("text_add_descendant2", "Descendant Text Added"); updateHTML("text_add_descendant2", "Descendant Text Added");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "hidden Descendant Text Removed", "data": [{"string": "hidden"}, "Descendant Text Removed"],
"options": { "options": {
"enqueue": true "enqueue": true
} }
}], },
action: function action() { action: function action() {
updateText("text_remove_descendant2", ""); updateText("text_remove_descendant2", "");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "I am replaced main", "data": ["I am replaced", {"string": "main"}],
"options": { "options": {
"enqueue": true "enqueue": true
} }
}], },
action: function action() { action: function action() {
var region = document.getElementById("to_replace_region"); var region = document.getElementById("to_replace_region");
var child = document.getElementById("to_replace"); var child = document.getElementById("to_replace");
child.setAttribute("role", "main"); child.setAttribute("role", "main");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "I am a replaced text", "data": ["I am a replaced text"],
"options": { "options": {
"enqueue": false "enqueue": false
} }
}], },
action: function action() { action: function action() {
updateText("to_replace_text", "I am a replaced text"); updateText("to_replace_text", "I am a replaced text");
} }
}, { }, {
expected: [{ expected: {
"method": "speak", "eventType": "liveregion-change",
"data": "I am a replaced text", "data": ["I am a replaced text"],
"options": { "options": {
"enqueue": false "enqueue": false
} }
}], },
action: function action() { action: function action() {
updateHTML("to_replace_text", "I am a replaced text"); updateHTML("to_replace_text", "I am a replaced text");
} }

Просмотреть файл

@ -22,340 +22,372 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
// generator function within the UtteranceGenerator. // generator function within the UtteranceGenerator.
var tests = [{ var tests = [{
accOrElmOrID: "anchor", accOrElmOrID: "anchor",
expectedUtterance: [["link", "title"], ["title", "link"]], expectedUtterance: [[{"string": "link"}, "title"],
expectedBraille: [["lnk", "title"], ["title", "lnk"]] ["title", {"string": "link"}]],
expectedBraille: [[{"string": "linkAbbr"}, "title"],
["title", {"string": "linkAbbr"}]]
}, { }, {
accOrElmOrID: "anchor_titleandtext", accOrElmOrID: "anchor_titleandtext",
expectedUtterance: [["link", "goes to the tests -", "Tests"], expectedUtterance: [[{"string": "link"}, "goes to the tests -",
["Tests", "- goes to the tests", "link"]], "Tests"], ["Tests", "- goes to the tests", {"string": "link"}]],
expectedBraille: [["lnk", "goes to the tests -", "Tests"], expectedBraille: [[{"string": "linkAbbr"}, "goes to the tests -",
["Tests", "- goes to the tests", "lnk"]], "Tests"], ["Tests", "- goes to the tests", {"string": "linkAbbr"}]],
}, { }, {
accOrElmOrID: "anchor_duplicatedtitleandtext", accOrElmOrID: "anchor_duplicatedtitleandtext",
expectedUtterance: [["link", "Tests"], ["Tests", "link"]], expectedUtterance: [[{"string": "link"}, "Tests"],
expectedBraille: [["lnk", "Tests"], ["Tests", "lnk"]] ["Tests", {"string": "link"}]],
expectedBraille: [[{"string": "linkAbbr"}, "Tests"],
["Tests", {"string": "linkAbbr"}]]
}, { }, {
accOrElmOrID: "anchor_arialabelandtext", accOrElmOrID: "anchor_arialabelandtext",
expectedUtterance: [["link", "goes to the tests - Tests"], expectedUtterance: [[{"string": "link"}, "goes to the tests - Tests"],
["Tests - goes to the tests", "link"]], ["Tests - goes to the tests", {"string": "link"}]],
expectedBraille: [["lnk", "goes to the tests - Tests"], expectedBraille: [[{"string": "linkAbbr"},
["Tests - goes to the tests", "lnk"]], "goes to the tests - Tests"], ["Tests - goes to the tests",
{"string": "linkAbbr"}]],
}, { }, {
accOrElmOrID: "textarea", accOrElmOrID: "textarea",
expectedUtterance: [[ expectedUtterance: [[{"string": "textarea"},
"text area", "This is the text area text." "This is the text area text."], ["This is the text area text.",
], [ {"string": "textarea"}]],
"This is the text area text.", "text area" expectedBraille: [[{"string": "textareaAbbr"},
],], "This is the text area text."], ["This is the text area text.",
expectedBraille: [[ {"string": "textareaAbbr"}]],
"txtarea", "This is the text area text."
], [
"This is the text area text.", "txtarea"
],],
}, { }, {
accOrElmOrID: "heading", accOrElmOrID: "heading",
expectedUtterance: [ expectedUtterance: [[{"string": "headingLevel", "args": [1]},
["heading level 1", "Test heading"], "Test heading"], ["Test heading",
["Test heading", "heading level 1"] {"string": "headingLevel", "args": [1]}]],
], expectedBraille: [[{"string": "headingAbbr"}, "Test heading"],
expectedBraille: [ ["Test heading", {"string": "headingAbbr"}]]
["heading", "Test heading"],
["Test heading", "heading"]
]
}, { }, {
accOrElmOrID: "list", accOrElmOrID: "list",
expectedUtterance: [ expectedUtterance: [[{"string": "list"},
["list 1 item", "First item", "1.", "list one"], {"string": "listItemsCount", "count":1}, {"string": "listStart"},
["1.", "list one", "First item", "list 1 item"] "1.", "list one"], ["1.", "list one", {"string": "listStart"},
{"string": "list"}, {"string": "listItemsCount", "count":1}]
], ],
expectedBraille: [ expectedBraille: [[{"string": "listAbbr"}, "list one"],
["list", "list one"], ["list one", {"string": "listAbbr"}]]
["list one", "list"]
]
}, { }, {
accOrElmOrID: "dlist", accOrElmOrID: "dlist",
expectedUtterance: [ expectedUtterance: [[{"string": "definitionlist"},
["definition list 0.5 items", "dd one"], {"string": "listItemsCount", "count": 0.5}, "dd one"], ["dd one",
["dd one", "definition list 0.5 items"] {"string": "definitionlist"},
{"string": "listItemsCount", "count": 0.5}]
], ],
expectedBraille: [ expectedBraille: [[{"string": "definitionlistAbbr"}, "dd one"],
["definition list", "dd one"], ["dd one", {"string": "definitionlistAbbr"}]]
["dd one", "definition list"]
]
}, { }, {
accOrElmOrID: "li_one", accOrElmOrID: "li_one",
expectedUtterance: [ expectedUtterance: [[{"string": "list"},
["list 1 item", "First item", "1.", "list one"], {"string": "listItemsCount", "count": 1}, {"string": "listStart"},
["1.", "list one", "First item", "list 1 item"] "1.", "list one"], ["1.", "list one", {"string": "listStart"},
{"string": "list"}, {"string": "listItemsCount", "count": 1}]
], ],
expectedBraille: [ expectedBraille: [["1.", "list one"], ["1.", "list one"]]
["1.", "list one"],
["1.", "list one"]
]
}, },
{ {
accOrElmOrID: "li_two", accOrElmOrID: "li_two",
expectedUtterance: [ expectedUtterance: [[{"string": "list"},
["list 1 item", "First item", "list two"], {"string": "listItemsCount", "count": 1}, {"string": "listStart"},
["list two", "First item", "list 1 item"] "list two"], ["list two", {"string": "listStart"},
{"string": "list"}, {"string": "listItemsCount", "count": 1}]
], ],
expectedBraille: [ expectedBraille: [["*", "list two"], ["*", "list two"]]
["*", "list two"],
["*", "list two"]
]
}, { }, {
accOrElmOrID: "cell", accOrElmOrID: "cell",
expectedUtterance: [[ expectedUtterance: [[{"string":"table"},
"table with 1 column and 1 row", "Fruits and vegetables", {"string": "tblColumnInfo", "count": 1},
"Column 1 Row 1", "list 4 items", "First item", "link", "Apples", {"string": "tblRowInfo", "count": 1}, "Fruits and vegetables",
"link", "Bananas", "link", "Peaches", "Last item", "link", "Plums" {"string": "columnInfo", "args": [1]},
], [ {"string": "rowInfo", "args": [1]}, {"string": "list"},
"Apples", "link", "First item", "Bananas", "link", "Peaches", {"string": "listItemsCount", "count": 4}, {"string": "listStart"},
"link", "Plums", "link", "Last item", "list 4 items", {"string": "link"}, "Apples", {"string": "link"}, "Bananas",
"Column 1 Row 1", "Fruits and vegetables", {"string": "link"}, "Peaches", {"string": "listEnd"},
"table with 1 column and 1 row" {"string": "link"}, "Plums"], ["Apples", {"string": "link"},
]], {"string": "listStart"}, "Bananas", {"string": "link"}, "Peaches",
expectedBraille: [[ {"string": "link"}, "Plums", {"string": "link"},
"c1r1", "list", "lnk", "Apples", "lnk", "Bananas", "lnk", {"string": "listEnd"}, {"string": "list"},
"Peaches", "lnk", "Plums" {"string": "listItemsCount", "count": 4},
], [ {"string": "columnInfo", "args": [1]},
"Apples", "lnk", "Bananas", "lnk", "Peaches", "lnk", "Plums", {"string": "rowInfo", "args": [1]}, "Fruits and vegetables",
"lnk", "list", "c1r1" {"string":"table"}, {"string": "tblColumnInfo", "count": 1},
]] {"string": "tblRowInfo", "count": 1}]],
expectedBraille: [[{"string": "cellInfoAbbr", "args": [ 1, 1]},
{"string": "listAbbr"}, {"string": "linkAbbr"}, "Apples",
{"string": "linkAbbr"}, "Bananas", {"string": "linkAbbr"},
"Peaches", {"string": "linkAbbr"}, "Plums"], ["Apples",
{"string": "linkAbbr"}, "Bananas", {"string": "linkAbbr"},
"Peaches", {"string": "linkAbbr"}, "Plums", {"string": "linkAbbr"},
{"string": "listAbbr"},
{"string": "cellInfoAbbr", "args": [ 1, 1]}]]
}, { }, {
accOrElmOrID: "date", accOrElmOrID: "date",
expectedUtterance: [["date entry", "2011-09-29"], ["2011-09-29", "date entry"]], expectedUtterance: [[{"string": "textInputType_date"},
expectedBraille: [["date entry", "2011-09-29"], ["2011-09-29", "date entry"]] {"string": "entry"}, "2011-09-29"], ["2011-09-29",
{"string": "textInputType_date"}, {"string": "entry"}]],
expectedBraille: [[{"string": "textInputType_date"},
{"string": "entryAbbr"}, "2011-09-29"], ["2011-09-29",
{"string": "textInputType_date"}, {"string": "entryAbbr"}]]
}, { }, {
accOrElmOrID: "email", accOrElmOrID: "email",
expectedUtterance: [ expectedUtterance: [[{"string": "textInputType_email"},
["e-mail entry", "test@example.com"], {"string": "entry"}, "test@example.com"], ["test@example.com",
["test@example.com", "e-mail entry"] {"string": "textInputType_email"}, {"string": "entry"}]],
], expectedBraille: [[{"string": "textInputType_email"},
expectedBraille: [ {"string": "entryAbbr"}, "test@example.com"], ["test@example.com",
["e-mail entry", "test@example.com"], {"string": "textInputType_email"}, {"string": "entryAbbr"}]]
["test@example.com", "e-mail entry"]
]
}, { }, {
accOrElmOrID: "search", accOrElmOrID: "search",
expectedUtterance: [ expectedUtterance: [[{"string": "textInputType_search"},
["search entry", "This is a search"], {"string": "entry"}, "This is a search"], ["This is a search",
["This is a search", "search entry"] {"string": "textInputType_search"}, {"string": "entry"}]],
], expectedBraille: [[{"string": "textInputType_search"},
expectedBraille: [ {"string": "entryAbbr"}, "This is a search"], ["This is a search",
["search entry", "This is a search"], {"string": "textInputType_search"}, {"string": "entryAbbr"}]]
["This is a search", "search entry"]
]
}, { }, {
accOrElmOrID: "tel", accOrElmOrID: "tel",
expectedUtterance: [ expectedUtterance: [[{"string": "textInputType_tel"},
["telephone entry", "555-5555"], ["555-5555", "telephone entry"] {"string": "entry"}, "555-5555"], ["555-5555",
], {"string": "textInputType_tel"}, {"string": "entry"}]],
expectedBraille: [ expectedBraille: [[{"string": "textInputType_tel"},
["telephone entry", "555-5555"], ["555-5555", "telephone entry"] {"string": "entryAbbr"}, "555-5555"], ["555-5555",
] {"string": "textInputType_tel"}, {"string": "entryAbbr"}]]
}, { }, {
accOrElmOrID: "url", accOrElmOrID: "url",
expectedUtterance: [ expectedUtterance: [[{"string": "textInputType_url"},
["URL entry", "http://example.com"], {"string": "entry"}, "http://example.com"], ["http://example.com",
["http://example.com", "URL entry"] {"string": "textInputType_url"}, {"string": "entry"}]],
], expectedBraille: [[{"string": "textInputType_url"},
expectedBraille: [ {"string": "entryAbbr"}, "http://example.com"],
["URL entry", "http://example.com"], ["http://example.com", {"string": "textInputType_url"},
["http://example.com", "URL entry"] {"string": "entryAbbr"}]]
]
}, { }, {
accOrElmOrID: "textInput", accOrElmOrID: "textInput",
expectedUtterance: [["entry", "This is text."], ["This is text.", "entry"]], expectedUtterance: [[{"string": "entry"}, "This is text."],
expectedBraille: [["entry", "This is text."], ["This is text.", "entry"]] ["This is text.", {"string": "entry"}]],
expectedBraille: [[{"string": "entryAbbr"}, "This is text."],
["This is text.", {"string": "entryAbbr"}]]
}, { }, {
// Test pivot to list from li_one. // Test pivot to list from li_one.
accOrElmOrID: "list", accOrElmOrID: "list",
oldAccOrElmOrID: "li_one", oldAccOrElmOrID: "li_one",
expectedUtterance: [ expectedUtterance: [[{"string": "list"},
["list 1 item", "First item", "1.", "list one"], {"string": "listItemsCount", "count": 1}, {"string": "listStart"},
["1.", "list one", "First item", "list 1 item"] "1.", "list one"], ["1.", "list one", {"string": "listStart"},
{"string": "list"}, {"string": "listItemsCount", "count": 1}]
], ],
expectedBraille: [ expectedBraille: [[{"string": "listAbbr"}, "list one"],
["list", "list one"], ["list one", {"string": "listAbbr"}]]
["list one", "list"]
]
}, { }, {
// Test pivot to "apples" link from the table cell. // Test pivot to "apples" link from the table cell.
accOrElmOrID: "apples", accOrElmOrID: "apples",
oldAccOrElmOrID: "cell", oldAccOrElmOrID: "cell",
expectedUtterance: [ expectedUtterance: [[{"string": "list"},
["list 4 items", "First item", "link", "Apples"], {"string": "listItemsCount", "count": 4}, {"string": "listStart"},
["Apples", "link", "First item", "list 4 items"] {"string": "link"}, "Apples"], ["Apples", {"string": "link"},
{"string": "listStart"}, {"string": "list"},
{"string": "listItemsCount", "count": 4}]
], ],
expectedBraille: [ expectedBraille: [["*", {"string": "linkAbbr"}, "Apples"],
["*", "lnk", "Apples"], ["*", "Apples", {"string": "linkAbbr"}]]
["*", "Apples", "lnk"]
]
}, { }, {
// Test pivot to 'bananas' link from 'apples' link. // Test pivot to "bananas" link from "apples" link.
accOrElmOrID: "bananas", accOrElmOrID: "bananas",
oldAccOrElmOrID: "apples", oldAccOrElmOrID: "apples",
expectedUtterance: [["link", "Bananas"], ["Bananas", "link"]], expectedUtterance: [[{"string": "link"}, "Bananas"],
expectedBraille: [["*", "lnk", "Bananas"], ["*", "Bananas", "lnk"]] ["Bananas", {"string": "link"}]],
expectedBraille: [["*", {"string": "linkAbbr"}, "Bananas"],
["*", "Bananas", {"string": "linkAbbr"}]]
}, { }, {
// test unavailable state utterance // test unavailable state utterance
accOrElmOrID: 'unavailableButton', accOrElmOrID: "unavailableButton",
expectedUtterance: [["unavailable button", "I am unavailable"], expectedUtterance: [[{"string": "stateUnavailable"},
["I am unavailable", "unavailable button"]], {"string": "pushbutton"}, "I am unavailable"], ["I am unavailable",
expectedBraille: [["btn", "I am unavailable"], {"string": "stateUnavailable"}, {"string": "pushbutton"}]],
["I am unavailable", "btn"]] expectedBraille: [[{"string": "pushbuttonAbbr"}, "I am unavailable"],
["I am unavailable", {"string": "pushbuttonAbbr"}]]
}, { }, {
// test expanded state utterance // test expanded state utterance
accOrElmOrID: 'expandedButton', accOrElmOrID: "expandedButton",
expectedUtterance: [["expanded button", "I am expanded"], expectedUtterance: [[{"string": "stateExpanded"},
["I am expanded", "expanded button"]], {"string": "pushbutton"}, "I am expanded"], ["I am expanded",
expectedBraille: [["btn", "I am expanded"], {"string": "stateExpanded"}, {"string": "pushbutton"}]],
["I am expanded", "btn"]] expectedBraille: [[{"string": "pushbuttonAbbr"}, "I am expanded"],
["I am expanded", {"string": "pushbuttonAbbr"}]]
}, { }, {
// test collapsed state utterance // test collapsed state utterance
accOrElmOrID: 'collapsedButton', accOrElmOrID: "collapsedButton",
expectedUtterance: [["collapsed button", "I am collapsed"], expectedUtterance: [[{"string": "stateCollapsed"},
["I am collapsed", "collapsed button"]], {"string": "pushbutton"}, "I am collapsed"], ["I am collapsed",
expectedBraille: [["btn", "I am collapsed"], {"string": "stateCollapsed"}, {"string": "pushbutton"}]],
["I am collapsed", "btn"]] expectedBraille: [[{"string": "pushbuttonAbbr"}, "I am collapsed"],
["I am collapsed", {"string": "pushbuttonAbbr"}]]
}, { }, {
// test required state utterance // test required state utterance
accOrElmOrID: 'requiredInput', accOrElmOrID: "requiredInput",
expectedUtterance: [["required entry", "I am required"], expectedUtterance: [[{"string": "stateRequired"}, {"string": "entry"},
["I am required", "required entry"]], "I am required"], ["I am required", {"string": "stateRequired"},
expectedBraille: [["entry", "I am required"], {"string": "entry"}]],
["I am required", "entry"]] expectedBraille: [[{"string": "entryAbbr"}, "I am required"],
["I am required", {"string": "entryAbbr"}]]
}, { }, {
// test has popup state utterance // test has popup state utterance
accOrElmOrID: 'hasPopupButton', accOrElmOrID: "hasPopupButton",
expectedUtterance: [["has pop up button menu", "I have a popup"], expectedUtterance: [[{"string": "stateHasPopup"},
["I have a popup", "has pop up button menu"]], {"string": "buttonmenu"}, "I have a popup"], ["I have a popup",
expectedBraille: [["button menu", "I have a popup"], {"string": "stateHasPopup"}, {"string": "buttonmenu"}]],
["I have a popup", "button menu"]] expectedBraille: [[{"string": "buttonmenuAbbr"}, "I have a popup"],
["I have a popup", {"string": "buttonmenuAbbr"}]]
}, { }, {
// Test selected tab // Test selected tab
accOrElmOrID: 'tab1', accOrElmOrID: "tab1",
expectedUtterance: [['tab list', 'selected tab 1 of 2', 'Account'], expectedUtterance: [[{"string": "pagetablist"},
['Account', 'selected tab 1 of 2', 'tab list']], {"string": "stateSelected"}, {"string": "pagetab"},
expectedBraille: [['tab 1 of 2', 'Account'], {"string": "objItemOfN", "args": [1, 2]}, "Account"], ["Account",
['Account', 'tab 1 of 2']] {"string": "stateSelected"}, {"string": "pagetab"},
{"string": "objItemOfN", "args": [1, 2]}, {"string": "pagetablist"}]
],
expectedBraille: [[{"string": "pagetabAbbr"},
{"string": "objItemOfN", "args": [1, 2]}, "Account"], ["Account",
{"string": "pagetabAbbr"},
{"string": "objItemOfN", "args": [1, 2]}]]
}, { }, {
// Test unselected tab // Test unselected tab
accOrElmOrID: 'tab2', accOrElmOrID: "tab2",
expectedUtterance: [['tab list', 'tab 2 of 2', 'Advanced'], expectedUtterance: [[{"string": "pagetablist"}, {"string": "pagetab"},
['Advanced', 'tab 2 of 2', 'tab list']], {"string": "objItemOfN", "args": [2, 2]}, "Advanced"], ["Advanced",
expectedBraille: [['tab 2 of 2', 'Advanced'], {"string": "pagetab"}, {"string": "objItemOfN", "args": [2, 2]},
['Advanced', 'tab 2 of 2']] {"string": "pagetablist"}]],
}, expectedBraille: [[{"string": "pagetabAbbr"},
{"string": "objItemOfN", "args": [2, 2]}, "Advanced"], ["Advanced",
{ {"string": "pagetabAbbr"},
{"string": "objItemOfN", "args": [2, 2]}]]
}, {
// Landing on this label should mimic landing on the checkbox. // Landing on this label should mimic landing on the checkbox.
accOrElmOrID: "label1", accOrElmOrID: "label1",
expectedUtterance: [['not checked check button', 'Orange'], expectedUtterance: [[{"string": "stateNotChecked"},
['Orange', 'not checked check button']], {"string": "checkbutton"}, "Orange"], ["Orange",
expectedBraille: [['( )', 'Orange'], {"string": "stateNotChecked"}, {"string": "checkbutton"}]],
['Orange', '( )']] expectedBraille: [[{"string": "stateUncheckedAbbr"}, "Orange"],
}, ["Orange", {"string": "stateUncheckedAbbr"}]]
{ }, {
// Here we get a top-level view of the form. // Here we get a top-level view of the form.
accOrElmOrID: "form1", accOrElmOrID: "form1",
expectedUtterance: [['label', 'not checked check button', 'Orange', 'Orange', expectedUtterance: [[{"string": "label"},
'not checked check button', 'Blue', 'label', 'Blue'], {"string": "stateNotChecked"}, {"string": "checkbutton"}, "Orange",
['Orange', 'not checked check button', 'Orange', 'label', "Orange", {"string": "stateNotChecked"}, {"string": "checkbutton"},
'Blue', 'not checked check button', 'Blue', 'label']], "Blue", {"string": "label"}, "Blue"], ["Orange",
expectedBraille: [['label', '( )', 'Orange', 'Orange', {"string": "stateNotChecked"}, {"string": "checkbutton"}, "Orange",
'( )', 'Blue', 'label', 'Blue'], {"string": "label"}, "Blue", {"string": "stateNotChecked"},
['Orange', '( )', 'Orange', 'label', {"string": "checkbutton"}, "Blue", {"string": "label"}]],
'Blue', '( )', 'Blue', 'label']] expectedBraille: [[{"string": "labelAbbr"},
}, {"string": "stateUncheckedAbbr"}, "Orange", "Orange",
{ {"string": "stateUncheckedAbbr"}, "Blue", {"string": "labelAbbr"},
"Blue"], ["Orange", {"string": "stateUncheckedAbbr"}, "Orange",
{"string": "labelAbbr"}, "Blue", {"string": "stateUncheckedAbbr"},
"Blue", {"string": "labelAbbr"}]]
}, {
// This is a non-nesting label. // This is a non-nesting label.
accOrElmOrID: "label2", accOrElmOrID: "label2",
expectedUtterance: [['label', 'Blue'], ['Blue', 'label']], expectedUtterance: [[{"string": "label"}, "Blue"],
expectedBraille: [['label', 'Blue'], ['Blue', 'label']] ["Blue", {"string": "label"}]],
}, expectedBraille: [[{"string": "labelAbbr"}, "Blue"],
{ ["Blue", {"string": "labelAbbr"}]]
}, {
// This is a distinct control. // This is a distinct control.
accOrElmOrID: "input2", accOrElmOrID: "input2",
expectedUtterance: [['not checked check button', 'Blue'], expectedUtterance: [[{"string": "stateNotChecked"},
['Blue', 'not checked check button']], {"string": "checkbutton"}, "Blue"], ["Blue",
expectedBraille: [['( )', 'Blue'], {"string": "stateNotChecked"}, {"string": "checkbutton"}]],
['Blue', '( )']] expectedBraille: [[{"string": "stateUncheckedAbbr"}, "Blue"], ["Blue",
}, {"string": "stateUncheckedAbbr"}]]
{ }, {
// This is a nested control. // This is a nested control.
accOrElmOrID: "input1", accOrElmOrID: "input1",
expectedUtterance: [['not checked check button', 'Orange'], expectedUtterance: [[{"string": "stateNotChecked"},
['Orange', 'not checked check button']], {"string": "checkbutton"}, "Orange"], ["Orange",
expectedBraille: [['( )', 'Orange'], {"string": "stateNotChecked"}, {"string": "checkbutton"}]],
['Orange', '( )']] expectedBraille: [[{"string": "stateUncheckedAbbr"}, "Orange"],
}, ["Orange", {"string": "stateUncheckedAbbr"}]]
{ }, {
// Landing on this label should mimic landing on the entry. // Landing on this label should mimic landing on the entry.
accOrElmOrID: "label3", accOrElmOrID: "label3",
expectedUtterance: [['entry', 'Joe', 'First name:'], expectedUtterance: [[{"string": "entry"}, "Joe", "First name:"],
['First name:', 'Joe', 'entry']], ["First name:", "Joe", {"string": "entry"}]],
expectedBraille: [['entry', 'Joe', 'First name:'], expectedBraille: [[{"string": "entryAbbr"}, "Joe", "First name:"],
['First name:', 'Joe', 'entry']] ["First name:", "Joe", {"string": "entryAbbr"}]]
}, }, {
{
// This is a nested control with a value. // This is a nested control with a value.
accOrElmOrID: "input3", accOrElmOrID: "input3",
expectedUtterance: [['entry', 'Joe', 'First name:'], expectedUtterance: [[{"string": "entry"}, "Joe", "First name:"],
['First name:', 'Joe', 'entry']], ["First name:", "Joe", {"string": "entry"}]],
expectedBraille: [['entry', 'Joe', 'First name:'], expectedBraille: [[{"string": "entryAbbr"}, "Joe", "First name:"],
['First name:', 'Joe', 'entry']] ["First name:", "Joe", {"string": "entryAbbr"}]]
}, }, {
{
// This is a nested control with a value. // This is a nested control with a value.
accOrElmOrID: "input4", accOrElmOrID: "input4",
expectedUtterance: [['slider', '3', 'Points:'], expectedUtterance: [[{"string": "slider"}, "3", "Points:"],
['Points:', '3', 'slider']], ["Points:", "3", {"string": "slider"}]],
expectedBraille: [['slider', '3', 'Points:'], expectedBraille: [[{"string": "sliderAbbr"}, "3", "Points:"],
['Points:', '3', 'slider']] ["Points:", "3", {"string": "sliderAbbr"}]]
},{ }, {
accOrElmOrID: "password", accOrElmOrID: "password",
expectedUtterance: [["password text", "Secret Password"], expectedUtterance: [[{"string": "passwordtext"}, "Secret Password"],
["Secret Password", "password text"]], ["Secret Password", {"string": "passwordtext"}]],
expectedBraille: [["passwdtxt", "Secret Password"], expectedBraille: [[{"string": "passwordtextAbbr"}, "Secret Password"],
["Secret Password", "passwdtxt"]] ["Secret Password", {"string": "passwordtextAbbr"}]]
},{ }, {
accOrElmOrID: "input5", accOrElmOrID: "input5",
expectedUtterance: [["checked check button", "Boring label"], expectedUtterance: [[{"string": "stateChecked"},
["Boring label", "checked check button"]], {"string": "checkbutton"}, "Boring label"], ["Boring label",
expectedBraille: [["(x)", "Boring label"], {"string": "stateChecked"}, {"string": "checkbutton"}]],
["Boring label", "(x)"]] expectedBraille: [[{"string": "stateCheckedAbbr"}, "Boring label"],
},{ ["Boring label", {"string": "stateCheckedAbbr"}]]
}, {
accOrElmOrID: "radio_unselected", accOrElmOrID: "radio_unselected",
expectedUtterance: [["not checked radio button", "any old radio button"], expectedUtterance: [[{"string": "stateNotChecked"},
["any old radio button", "not checked radio button"]], {"string": "radiobutton"}, "any old radio button"],
expectedBraille: [["( )", "any old radio button"], ["any old radio button", {"string": "stateNotChecked"},
["any old radio button", "( )"]] {"string": "radiobutton"}]
},{ ],
expectedBraille: [
[{"string": "stateUncheckedAbbr"}, "any old radio button"],
["any old radio button", {"string": "stateUncheckedAbbr"}]]
}, {
accOrElmOrID: "radio_selected", accOrElmOrID: "radio_selected",
expectedUtterance: [["checked radio button", "a unique radio button"], expectedUtterance: [[{"string": "stateChecked"},
["a unique radio button", "checked radio button"]], {"string": "radiobutton"}, "a unique radio button"],
expectedBraille: [["(x)", "a unique radio button"], ["a unique radio button", {"string": "stateChecked"},
["a unique radio button", "(x)"]] {"string": "radiobutton"}]],
},{ expectedBraille: [
[{"string": "stateCheckedAbbr"}, "a unique radio button"],
["a unique radio button", {"string": "stateCheckedAbbr"}]]
}, {
accOrElmOrID: "togglebutton_notpressed", accOrElmOrID: "togglebutton_notpressed",
expectedUtterance: [["toggle button", "I ain't pressed"], expectedUtterance: [[{"string": "togglebutton"}, "I am not pressed"],
["I ain't pressed", "toggle button"]], ["I am not pressed", {"string": "togglebutton"}]],
expectedBraille: [["( )", "I ain't pressed"], expectedBraille: [
["I ain't pressed", "( )"]] [{"string": "stateUnpressedAbbr"}, "I am not pressed"],
},{ ["I am not pressed", {"string": "stateUnpressedAbbr"}]]
}, {
accOrElmOrID: "togglebutton_pressed", accOrElmOrID: "togglebutton_pressed",
expectedUtterance: [["pressed toggle button", "I am pressed!"], expectedUtterance: [[{"string": "statePressed"},
["I am pressed!", "pressed toggle button"]], {"string": "togglebutton"}, "I am pressed!"], ["I am pressed!",
expectedBraille: [["(x)", "I am pressed!"], {"string": "statePressed"}, {"string": "togglebutton"}]],
["I am pressed!", "(x)"]] expectedBraille: [[{"string": "statePressedAbbr"}, "I am pressed!"],
["I am pressed!", {"string": "statePressedAbbr"}]]
}, { }, {
accOrElmOrID: "listbox-option", accOrElmOrID: "listbox-option",
expectedUtterance: [["list box", "option", "Search suggestion"], expectedUtterance: [[{"string": "listbox"},
["Search suggestion", "option", "list box"]], {"string": "listboxoption"}, "Search suggestion"],
expectedBraille: [["option", "Search suggestion"], ["Search suggestion", {"string": "listboxoption"},
["Search suggestion", "option"]] {"string": "listbox"}]
],
expectedBraille: [
[{"string": "listboxoptionAbbr"}, "Search suggestion"],
["Search suggestion", {"string": "listboxoptionAbbr"}]]
}]; }];
// Test all possible utterance order preference values. // Test all possible utterance order preference values.
@ -471,7 +503,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
<input id="url" type="url" value="http://example.com" /> <input id="url" type="url" value="http://example.com" />
<input id="textInput" type="text" value="This is text." /> <input id="textInput" type="text" value="This is text." />
<label>Points: <input id="range" type="range" name="points" min="1" max="10" value="3"></label> <label>Points: <input id="range" type="range" name="points" min="1" max="10" value="3"></label>
<div id="togglebutton_notpressed" aria-pressed="false" role="button" tabindex="-1">I ain't pressed</div> <div id="togglebutton_notpressed" aria-pressed="false" role="button" tabindex="-1">I am not pressed</div>
<div id="togglebutton_pressed" aria-pressed="true" role="button" tabindex="-1">I am pressed!</div> <div id="togglebutton_pressed" aria-pressed="true" role="button" tabindex="-1">I am pressed!</div>
<ul role="listbox" style="list-style-type: none;"> <ul role="listbox" style="list-style-type: none;">
<li role="option" id="listbox-option">Search suggestion</li> <li role="option" id="listbox-option">Search suggestion</li>

Просмотреть файл

@ -16,63 +16,219 @@
// Test the following accOrElmOrID. // Test the following accOrElmOrID.
var tests = [{ var tests = [{
accOrElmOrID: "table1", accOrElmOrID: "table1",
expectedUtterance: [["table with 2 columns and 2 rows", expectedUtterance: [[
"Column 1 Row 1", "col1", "Column 2 Row 1", "col2", {"string": "table"},
"Column 1 Row 2 col1", "cell1", "Column 2 Row 2 col2", "cell2"], [ {"string": "tblColumnInfo", "count": 2},
"col1", "Column 1 Row 1", "col2", "Column 2 Row 1", "cell1", {"string": "tblRowInfo", "count": 2},
"Column 1 Row 2 col1", "cell2", "Column 2 Row 2 col2", {"string": "columnInfo", "args": [1]},
"table with 2 columns and 2 rows"]], {"string": "rowInfo", "args": [1]}, "col1",
expectedBraille: [["tbl 2c 2r", "c1r1", "col1", "c2r1", "col2", {"string": "columnInfo", "args": [2]},
"c1r2 col1", "cell1", "c2r2 col2", "cell2"], ["col1", "c1r1", "col2", {"string": "rowInfo", "args": [1]}, "col2",
"c2r1", "cell1", "c1r2 col1", "cell2", "c2r2 col2", "tbl 2c 2r"]] {"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "col1", "cell1",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [2]}, "col2", "cell2"], ["col1",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [1]}, "col2",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [1]}, "cell1",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "col1", "cell2",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [2]}, "col2", {"string": "table"},
{"string": "tblColumnInfo", "count": 2},
{"string": "tblRowInfo", "count": 2}]],
expectedBraille: [[
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 2},
{"string": "tblRowInfoAbbr", "count": 2},
{"string": "cellInfoAbbr", "args": [1, 1]}, "col1",
{"string": "cellInfoAbbr", "args": [2, 1]}, "col2",
{"string": "cellInfoAbbr", "args": [1, 2]}, "col1", "cell1",
{"string": "cellInfoAbbr", "args": [2, 2]}, "col2", "cell2"], ["col1",
{"string": "cellInfoAbbr", "args": [1, 1]}, "col2",
{"string": "cellInfoAbbr", "args": [2, 1]}, "cell1",
{"string": "cellInfoAbbr", "args": [1, 2]}, "col1", "cell2",
{"string": "cellInfoAbbr", "args": [2, 2]}, "col2",
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 2},
{"string": "tblRowInfoAbbr", "count": 2}]]
}, { }, {
accOrElmOrID: "table2", accOrElmOrID: "table2",
expectedUtterance: [["table with 2 columns and 2 rows", expectedUtterance: [[
"Column 1 Row 1 col1", "cell1", "Column 2 Row 1 col2", {"string": "table"},
"table with 1 column and 2 rows", "Column 1 Row 1", "colheader", {"string": "tblColumnInfo", "count": 2},
"Column 1 Row 2 colheader", "bla", "Column 1 Row 2", "col1", {"string": "tblRowInfo", "count": 2},
"Column 2 Row 2", "col2"], ["cell1", "Column 1 Row 1 col1", {"string": "columnInfo", "args": [1]},
"colheader", "Column 1 Row 1", "bla", "Column 1 Row 2 colheader", {"string": "rowInfo", "args": [1]}, "col1", "cell1",
"table with 1 column and 2 rows", "Column 2 Row 1 col2", "col1", {"string": "columnInfo", "args": [2]},
"Column 1 Row 2", "col2", "Column 2 Row 2", {"string": "rowInfo", "args": [1]}, "col2",
"table with 2 columns and 2 rows"]], {"string": "table"},
expectedBraille: [["tbl 2c 2r", "c1r1 col1", "cell1", "c2r1 col2", {"string": "tblColumnInfo", "count": 1},
"tbl 1c 2r", "c1r1", "colheader", "c1r2 colheader", "bla", "c1r2", {"string": "tblRowInfo", "count": 2},
"col1", "c2r2", "col2"], ["cell1", "c1r1 col1", "colheader", "c1r1", {"string": "columnInfo", "args": [1]},
"bla", "c1r2 colheader", "tbl 1c 2r", "c2r1 col2", "col1", "c1r2", {"string": "rowInfo", "args": [1]}, "colheader",
"col2", "c2r2", "tbl 2c 2r"]] {"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader", "bla",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "col1",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [2]}, "col2"], ["cell1",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [1]}, "col1", "colheader",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [1]}, "bla",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader",
{"string": "table"},
{"string": "tblColumnInfo", "count": 1},
{"string": "tblRowInfo", "count": 2},
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [1]}, "col2", "col1",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "col2",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [2]}, {"string": "table"},
{"string": "tblColumnInfo", "count": 2},
{"string": "tblRowInfo", "count": 2}]],
expectedBraille: [[{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 2},
{"string": "tblRowInfoAbbr", "count": 2},
{"string": "cellInfoAbbr", "args": [1, 1]}, "col1", "cell1",
{"string": "cellInfoAbbr", "args": [2, 1]}, "col2",
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 1},
{"string": "tblRowInfoAbbr", "count": 2},
{"string": "cellInfoAbbr", "args": [1, 1]}, "colheader",
{"string": "cellInfoAbbr", "args": [1, 2]}, "colheader", "bla",
{"string": "cellInfoAbbr", "args": [1, 2]}, "col1",
{"string": "cellInfoAbbr", "args": [2, 2]}, "col2"], ["cell1",
{"string": "cellInfoAbbr", "args": [1, 1]}, "col1", "colheader",
{"string": "cellInfoAbbr", "args": [1, 1]}, "bla",
{"string": "cellInfoAbbr", "args": [1, 2]}, "colheader",
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 1},
{"string": "tblRowInfoAbbr", "count": 2},
{"string": "cellInfoAbbr", "args": [2, 1]}, "col2", "col1",
{"string": "cellInfoAbbr", "args": [1, 2]}, "col2",
{"string": "cellInfoAbbr", "args": [2, 2]},
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 2},
{"string": "tblRowInfoAbbr", "count": 2}]]
}, { }, {
accOrElmOrID: "table3", accOrElmOrID: "table3",
expectedUtterance: [["table with 2 columns and 2 rows", expectedUtterance: [[
"Column 2 Row 1 col2", "table with 1 column and 2 rows", {"string": "table"},
"Column 1 Row 1", "colheader", "Column 1 Row 2 colheader", "bla"], [ {"string": "tblColumnInfo", "count": 2},
"colheader", "Column 1 Row 1", "bla", "Column 1 Row 2 colheader", {"string": "tblRowInfo", "count": 2},
"table with 1 column and 2 rows", "Column 2 Row 1 col2", {"string": "columnInfo", "args": [2]},
"table with 2 columns and 2 rows"]], {"string": "rowInfo", "args": [1]}, "col2",
expectedBraille: [["tbl 1c 2r", "c1r1", "colheader", "c1r2 colheader", {"string": "table"},
"bla"], ["colheader", "c1r1", "bla", "c1r2 colheader", "tbl 1c 2r"]] {"string": "tblColumnInfo", "count": 1},
{"string": "tblRowInfo", "count": 2},
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [1]}, "colheader",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader", "bla"], ["colheader",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [1]}, "bla",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader",
{"string": "table"},
{"string": "tblColumnInfo", "count": 1},
{"string": "tblRowInfo", "count": 2},
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [1]}, "col2",
{"string": "table"},
{"string": "tblColumnInfo", "count": 2},
{"string": "tblRowInfo", "count": 2}]],
expectedBraille: [[
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 1},
{"string": "tblRowInfoAbbr", "count": 2},
{"string": "cellInfoAbbr", "args": [1, 1]}, "colheader",
{"string": "cellInfoAbbr", "args": [1, 2]}, "colheader", "bla"],
["colheader",
{"string": "cellInfoAbbr", "args": [1, 1]}, "bla",
{"string": "cellInfoAbbr", "args": [1, 2]}, "colheader",
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 1},
{"string": "tblRowInfoAbbr", "count": 2}]]
}, { }, {
accOrElmOrID: "table4", accOrElmOrID: "table4",
expectedUtterance: [["table with 4 columns and 3 rows", expectedUtterance: [[
"Column 1 Row 1", "col1", "Column 2 Row 1", "col2", "Column 3 Row 1", {"string": "table"},
"col3", "Column 1 Row 2 spans 2 columns col1", "row1", {"string": "tblColumnInfo", "count": 4},
"Column 3 Row 2 col3 row1", "cell1", {"string": "tblRowInfo", "count": 3},
"Column 4 Row 2 spans 2 rows row1", "cell2", "Column 1 Row 3 col1", {"string": "columnInfo", "args": [1]},
"row2", "Column 2 Row 3 col2 row2", "cell3", {"string": "rowInfo", "args": [1]}, "col1",
"Column 3 Row 3 col3 row2", "cell4"], ["col1", "Column 1 Row 1", {"string": "columnInfo", "args": [2]},
"col2", "Column 2 Row 1", "col3", "Column 3 Row 1", "row1", {"string": "rowInfo", "args": [1]}, "col2",
"Column 1 Row 2 spans 2 columns col1", "cell1", {"string": "columnInfo", "args": [3]},
"Column 3 Row 2 col3 row1", "cell2", {"string": "rowInfo", "args": [1]}, "col3",
"Column 4 Row 2 spans 2 rows row1", "row2", "Column 1 Row 3 col1", {"string": "columnInfo", "args": [1]},
"cell3", "Column 2 Row 3 col2 row2", "cell4", {"string": "rowInfo", "args": [2]},
"Column 3 Row 3 col3 row2", "table with 4 columns and 3 rows"]], {"string": "spansColumns", "args": [2]}, "col1", "row1",
expectedBraille: [["tbl 4c 3r", "c1r1", "col1", "c2r1", "col2", "c3r1", {"string": "columnInfo", "args": [3]},
"col3", "c1r2 col1", "row1", "c3r2 col3 row1", "cell1", "c4r2 row1", {"string": "rowInfo", "args": [2]}, "col3", "row1", "cell1",
"cell2", "c1r3 col1", "row2", "c2r3 col2 row2", "cell3", {"string": "columnInfo", "args": [4]},
"c3r3 col3 row2", "cell4"], ["col1", "c1r1", "col2", "c2r1", "col3", {"string": "rowInfo", "args": [2]},
"c3r1", "row1", "c1r2 col1", "cell1", "c3r2 col3 row1", "cell2", {"string": "spansRows", "args": [2]}, "row1", "cell2",
"c4r2 row1", "row2", "c1r3 col1", "cell3", "c2r3 col2 row2", "cell4", {"string": "columnInfo", "args": [1]},
"c3r3 col3 row2", "tbl 4c 3r"]] {"string": "rowInfo", "args": [3]}, "col1", "row2",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [3]}, "col2", "row2", "cell3",
{"string": "columnInfo", "args": [3]},
{"string": "rowInfo", "args": [3]}, "col3", "row2", "cell4"], ["col1",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [1]}, "col2",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [1]}, "col3",
{"string": "columnInfo", "args": [3]},
{"string": "rowInfo", "args": [1]}, "row1",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]},
{"string": "spansColumns", "args": [2]}, "col1", "cell1",
{"string": "columnInfo", "args": [3]},
{"string": "rowInfo", "args": [2]}, "col3", "row1", "cell2",
{"string": "columnInfo", "args": [4]},
{"string": "rowInfo", "args": [2]},
{"string": "spansRows", "args": [2]}, "row1", "row2",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [3]}, "col1", "cell3",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [3]}, "col2", "row2", "cell4",
{"string": "columnInfo", "args": [3]},
{"string": "rowInfo", "args": [3]}, "col3", "row2",
{"string": "table"},
{"string": "tblColumnInfo", "count": 4},
{"string": "tblRowInfo", "count": 3}]],
expectedBraille: [[
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 4},
{"string": "tblRowInfoAbbr", "count": 3},
{"string": "cellInfoAbbr", "args": [1, 1]}, "col1",
{"string": "cellInfoAbbr", "args": [2, 1]}, "col2",
{"string": "cellInfoAbbr", "args": [3, 1]}, "col3",
{"string": "cellInfoAbbr", "args": [1, 2]}, "col1", "row1",
{"string": "cellInfoAbbr", "args": [3, 2]}, "col3", "row1", "cell1",
{"string": "cellInfoAbbr", "args": [4, 2]}, "row1", "cell2",
{"string": "cellInfoAbbr", "args": [1, 3]}, "col1", "row2",
{"string": "cellInfoAbbr", "args": [2, 3]}, "col2", "row2", "cell3",
{"string": "cellInfoAbbr", "args": [3, 3]}, "col3", "row2", "cell4"],
["col1",
{"string": "cellInfoAbbr", "args": [1, 1]}, "col2",
{"string": "cellInfoAbbr", "args": [2, 1]}, "col3",
{"string": "cellInfoAbbr", "args": [3, 1]}, "row1",
{"string": "cellInfoAbbr", "args": [1, 2]}, "col1", "cell1",
{"string": "cellInfoAbbr", "args": [3, 2]}, "col3", "row1", "cell2",
{"string": "cellInfoAbbr", "args": [4, 2]}, "row1", "row2",
{"string": "cellInfoAbbr", "args": [1, 3]}, "col1", "cell3",
{"string": "cellInfoAbbr", "args": [2, 3]}, "col2", "row2", "cell4",
{"string": "cellInfoAbbr", "args": [3, 3]}, "col3", "row2",
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 4},
{"string": "tblRowInfoAbbr", "count": 3}]]
}, { }, {
accOrElmOrID: "table5", accOrElmOrID: "table5",
expectedUtterance: [["Row1", "Row2"], ["Row1", "Row2"]], expectedUtterance: [["Row1", "Row2"], ["Row1", "Row2"]],
@ -81,119 +237,239 @@
// Test pivot to table1_th1 from table1. // Test pivot to table1_th1 from table1.
accOrElmOrID: "table1_th1", accOrElmOrID: "table1_th1",
oldAccOrElmOrID: "table1", oldAccOrElmOrID: "table1",
expectedUtterance: [["Column 1 Row 1", "col1"], ["col1", expectedUtterance: [[
"Column 1 Row 1"]], {"string": "columnInfo", "args": [1]},
expectedBraille: [["c1r1", "col1"], ["col1", "c1r1"]] {"string": "rowInfo", "args": [1]}, "col1"], ["col1",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [1]}]],
expectedBraille: [[
{"string": "cellInfoAbbr", "args": [1, 1]}, "col1"], ["col1",
{"string": "cellInfoAbbr", "args": [1, 1]}]]
}, { }, {
// Test pivot to table1_td2 from table1. // Test pivot to table1_td2 from table1.
accOrElmOrID: "table1_td2", accOrElmOrID: "table1_td2",
oldAccOrElmOrID: "table1", oldAccOrElmOrID: "table1",
expectedUtterance: [["Column 2 Row 2 col2", "cell2"], ["cell2", expectedUtterance: [[
"Column 2 Row 2 col2"]], {"string": "columnInfo", "args": [2]},
expectedBraille: [["c2r2 col2", "cell2"], ["cell2", "c2r2 col2"]] {"string": "rowInfo", "args": [2]}, "col2", "cell2"], ["cell2",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [2]}, "col2"]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [2, 2]}, "col2", "cell2"],
["cell2", {"string": "cellInfoAbbr", "args": [2, 2]}, "col2"]]
}, { }, {
// Test pivot to table1_td2 from table1_th1. // Test pivot to table1_td2 from table1_th1.
accOrElmOrID: "table1_td2", accOrElmOrID: "table1_td2",
oldAccOrElmOrID: "table1_th1", oldAccOrElmOrID: "table1_th1",
expectedUtterance: [["Column 2 Row 2 col2", "cell2"], ["cell2", expectedUtterance: [[
"Column 2 Row 2 col2"]], {"string": "columnInfo", "args": [2]},
expectedBraille: [["c2r2 col2", "cell2"], ["cell2", "c2r2 col2"]] {"string": "rowInfo", "args": [2]}, "col2", "cell2"], ["cell2",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [2]}, "col2"]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [2, 2]}, "col2", "cell2"],
["cell2", {"string": "cellInfoAbbr", "args": [2, 2]}, "col2"]]
}, { }, {
// Test pivot to table1_td2 from table1_td1. // Test pivot to table1_td2 from table1_td1.
accOrElmOrID: "table1_td2", accOrElmOrID: "table1_td2",
oldAccOrElmOrID: "table1_td1", oldAccOrElmOrID: "table1_td1",
expectedUtterance: [["Column 2 col2", "cell2"], ["cell2", expectedUtterance: [[
"Column 2 col2"]], {"string": "columnInfo", "args": [2]}, "col2", "cell2"], ["cell2",
expectedBraille: [["c2r2 col2", "cell2"], ["cell2", "c2r2 col2"]] {"string": "columnInfo", "args": [2]}, "col2"]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [2, 2]}, "col2", "cell2"],
["cell2", {"string": "cellInfoAbbr", "args": [2, 2]}, "col2"]]
}, { }, {
// Test pivot to table2_cell_1 from table2. // Test pivot to table2_cell_1 from table2.
accOrElmOrID: "table2_cell_1", accOrElmOrID: "table2_cell_1",
oldAccOrElmOrID: "table2", oldAccOrElmOrID: "table2",
expectedUtterance: [["Column 1 Row 1 col1", "cell1"], ["cell1", expectedUtterance: [[
"Column 1 Row 1 col1"]], {"string": "columnInfo", "args": [1]},
expectedBraille: [["c1r1 col1", "cell1"], ["cell1", "c1r1 col1"]] {"string": "rowInfo", "args": [1]}, "col1", "cell1"], ["cell1",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [1]}, "col1"]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [1, 1]}, "col1", "cell1"],
["cell1", {"string": "cellInfoAbbr", "args": [1, 1]}, "col1"]]
}, { }, {
// Test pivot to table2_cell_2 from table2. // Test pivot to table2_cell_2 from table2.
accOrElmOrID: "table2_cell_2", accOrElmOrID: "table2_cell_2",
oldAccOrElmOrID: "table2", oldAccOrElmOrID: "table2",
expectedUtterance: [["Column 2 Row 1 col2", expectedUtterance: [[
"table with 1 column and 2 rows", "Column 1 Row 1", "colheader", {"string": "columnInfo", "args": [2]},
"Column 1 Row 2 colheader", "bla"], ["colheader", "Column 1 Row 1", {"string": "rowInfo", "args": [1]}, "col2",
"bla", "Column 1 Row 2 colheader", "table with 1 column and 2 rows", {"string": "table"},
"Column 2 Row 1 col2"]], {"string": "tblColumnInfo", "count": 1},
expectedBraille: [["c2r1 col2", "tbl 1c 2r", "c1r1", "colheader", {"string": "tblRowInfo", "count": 2},
"c1r2 colheader", "bla"], ["colheader", "c1r1", "bla", {"string": "columnInfo", "args": [1]},
"c1r2 colheader", "tbl 1c 2r", "c2r1 col2"]] {"string": "rowInfo", "args": [1]}, "colheader",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader", "bla"], ["colheader",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [1]}, "bla",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader",
{"string": "table"},
{"string": "tblColumnInfo", "count": 1},
{"string": "tblRowInfo", "count": 2},
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [1]}, "col2"]],
expectedBraille: [[
{"string": "cellInfoAbbr", "args": [2, 1]}, "col2",
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 1},
{"string": "tblRowInfoAbbr", "count": 2},
{"string": "cellInfoAbbr", "args": [1, 1]}, "colheader",
{"string": "cellInfoAbbr", "args": [1, 2]}, "colheader", "bla"],
["colheader",
{"string": "cellInfoAbbr", "args": [1, 1]}, "bla",
{"string": "cellInfoAbbr", "args": [1, 2]}, "colheader",
{"string": "tableAbbr"},
{"string": "tblColumnInfoAbbr", "count": 1},
{"string": "tblRowInfoAbbr", "count": 2},
{"string": "cellInfoAbbr", "args": [2, 1]}, "col2"]]
}, { }, {
// Test pivot to table2_cell_1 from table2_cell_2. // Test pivot to table2_cell_1 from table2_cell_2.
accOrElmOrID: "table2_cell_1", accOrElmOrID: "table2_cell_1",
oldAccOrElmOrID: "table2_cell_2", oldAccOrElmOrID: "table2_cell_2",
expectedUtterance: [["Column 1 col1", "cell1"], ["cell1", expectedUtterance: [[
"Column 1 col1"]], {"string": "columnInfo", "args": [1]}, "col1", "cell1"], ["cell1",
expectedBraille: [["c1r1 col1", "cell1"], ["cell1", "c1r1 col1"]] {"string": "columnInfo", "args": [1]}, "col1"]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [1, 1]}, "col1", "cell1"],
["cell1", {"string": "cellInfoAbbr", "args": [1, 1]}, "col1"]]
}, { }, {
// Test pivot to table3_cell from table2. // Test pivot to table3_cell from table2.
accOrElmOrID: "table3_cell", accOrElmOrID: "table3_cell",
oldAccOrElmOrID: "table2", oldAccOrElmOrID: "table2",
expectedUtterance: [["Column 2 Row 1 col2", expectedUtterance: [[
"table with 1 column and 2 rows", "Column 1 Row 2 colheader", {"string": "columnInfo", "args": [2]},
"bla"], ["bla", "Column 1 Row 2 colheader", {"string": "rowInfo", "args": [1]}, "col2",
"table with 1 column and 2 rows", "Column 2 Row 1 col2"]], {"string": "table"},
expectedBraille: [["c1r2 colheader", "bla"], ["bla", "c1r2 colheader"]] {"string": "tblColumnInfo", "count": 1},
{"string": "tblRowInfo", "count": 2},
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader", "bla"], ["bla",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader",
{"string": "table"},
{"string": "tblColumnInfo", "count": 1},
{"string": "tblRowInfo", "count": 2},
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [1]}, "col2"]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [1, 2]}, "colheader", "bla"],
["bla", {"string": "cellInfoAbbr", "args": [1, 2]}, "colheader"]]
}, { }, {
// Test pivot to table3_cell from table2_cell_1. // Test pivot to table3_cell from table2_cell_1.
accOrElmOrID: "table3_cell", accOrElmOrID: "table3_cell",
oldAccOrElmOrID: "table2_cell_1", oldAccOrElmOrID: "table2_cell_1",
expectedUtterance: [["Column 2 col2", "table with 1 column and 2 rows", expectedUtterance: [[
"Column 1 Row 2 colheader", "bla"], ["bla", {"string": "columnInfo", "args": [2]}, "col2",
"Column 1 Row 2 colheader", "table with 1 column and 2 rows", {"string": "table"},
"Column 2 Row 1 col2"]], {"string": "tblColumnInfo", "count": 1},
expectedBraille: [["c1r2 colheader", "bla"], ["bla", "c1r2 colheader"]] {"string": "tblRowInfo", "count": 2},
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader", "bla"], ["bla",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader",
{"string": "table"},
{"string": "tblColumnInfo", "count": 1},
{"string": "tblRowInfo", "count": 2},
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [1]}, "col2"]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [1, 2]}, "colheader", "bla"],
["bla", {"string": "cellInfoAbbr", "args": [1, 2]}, "colheader"]]
}, { }, {
// Test pivot to table3_cell from table3_ch. // Test pivot to table3_cell from table3_ch.
accOrElmOrID: "table3_cell", accOrElmOrID: "table3_cell",
oldAccOrElmOrID: "table3_ch", oldAccOrElmOrID: "table3_ch",
expectedUtterance: [["Row 2", "bla"], ["bla", "Row 2"]], expectedUtterance: [[
expectedBraille: [["c1r2", "bla"], ["bla", "c1r2"]] {"string": "rowInfo", "args": [2]}, "bla"], ["bla",
{"string": "rowInfo", "args": [2]}]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [1, 2]}, "bla"],
["bla", {"string": "cellInfoAbbr", "args": [1, 2]}]]
}, { }, {
// Test pivot to table3_cell from table1_td1. // Test pivot to table3_cell from table1_td1.
accOrElmOrID: "table3_cell", accOrElmOrID: "table3_cell",
oldAccOrElmOrID: "table1_td1", oldAccOrElmOrID: "table1_td1",
expectedUtterance: [["table with 2 columns and 2 rows", expectedUtterance: [[
"Column 2 Row 1 col2", "table with 1 column and 2 rows", {"string": "table"},
"Column 1 Row 2 colheader", "bla"], ["bla", {"string": "tblColumnInfo", "count": 2},
"Column 1 Row 2 colheader", "table with 1 column and 2 rows", {"string": "tblRowInfo", "count": 2},
"Column 2 Row 1 col2", "table with 2 columns and 2 rows"]], {"string": "columnInfo", "args": [2]},
expectedBraille: [["c1r2 colheader", "bla"], ["bla", "c1r2 colheader"]] {"string": "rowInfo", "args": [1]}, "col2",
{"string": "table"},
{"string": "tblColumnInfo", "count": 1},
{"string": "tblRowInfo", "count": 2},
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader", "bla"], ["bla",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]}, "colheader",
{"string": "table"},
{"string": "tblColumnInfo", "count": 1},
{"string": "tblRowInfo", "count": 2},
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [1]}, "col2",
{"string": "table"},
{"string": "tblColumnInfo", "count": 2},
{"string": "tblRowInfo", "count": 2}]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [1, 2]}, "colheader", "bla"],
["bla", {"string": "cellInfoAbbr", "args": [1, 2]}, "colheader"]]
}, { }, {
// Test pivot to table4_ch_3 from table4. // Test pivot to table4_ch_3 from table4.
accOrElmOrID: "table4_ch_3", accOrElmOrID: "table4_ch_3",
oldAccOrElmOrID: "table4", oldAccOrElmOrID: "table4",
expectedUtterance: [["Column 3 Row 1", "col3"], ["col3", expectedUtterance: [[
"Column 3 Row 1"]], {"string": "columnInfo", "args": [3]},
expectedBraille: [["c3r1", "col3"], ["col3", "c3r1"]] {"string": "rowInfo", "args": [1]}, "col3"], ["col3",
{"string": "columnInfo", "args": [3]},
{"string": "rowInfo", "args": [1]}]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [3, 1]}, "col3"],
["col3", {"string": "cellInfoAbbr", "args": [3, 1]}]]
}, { }, {
// Test pivot to table4_rh_1 from table4_ch_3. // Test pivot to table4_rh_1 from table4_ch_3.
accOrElmOrID: "table4_rh_1", accOrElmOrID: "table4_rh_1",
oldAccOrElmOrID: "table4_ch_3", oldAccOrElmOrID: "table4_ch_3",
expectedUtterance: [["Column 1 Row 2 spans 2 columns col1", "row1"], [ expectedUtterance: [[
"row1", "Column 1 Row 2 spans 2 columns col1"]], {"string": "columnInfo", "args": [1]},
expectedBraille: [["c1r2 col1", "row1"], ["row1", "c1r2 col1"]] {"string": "rowInfo", "args": [2]},
{"string": "spansColumns", "args": [2]}, "col1", "row1"], ["row1",
{"string": "columnInfo", "args": [1]},
{"string": "rowInfo", "args": [2]},
{"string": "spansColumns", "args": [2]}, "col1"]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [1, 2]}, "col1", "row1"],
["row1", {"string": "cellInfoAbbr", "args": [1, 2]}, "col1"]]
}, { }, {
// Test pivot to table4_cell_3 from table4_rh_1. // Test pivot to table4_cell_3 from table4_rh_1.
accOrElmOrID: "table4_cell_3", accOrElmOrID: "table4_cell_3",
oldAccOrElmOrID: "table4_rh_1", oldAccOrElmOrID: "table4_rh_1",
expectedUtterance: [["Column 4 spans 2 rows", "cell2"], ["cell2", expectedUtterance: [[
"Column 4 spans 2 rows"]], {"string": "columnInfo", "args": [4]},
expectedBraille: [["c4r2", "cell2"], ["cell2", "c4r2"]] {"string": "spansRows", "args": [2]}, "cell2"], ["cell2",
{"string": "columnInfo", "args": [4]},
{"string": "spansRows", "args": [2]}]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [4, 2]}, "cell2"],
["cell2", {"string": "cellInfoAbbr", "args": [4, 2]}]]
}, { }, {
// Test pivot to table4_cell_5 from table4_cell_3. // Test pivot to table4_cell_5 from table4_cell_3.
accOrElmOrID: "table4_cell_5", accOrElmOrID: "table4_cell_5",
oldAccOrElmOrID: "table4_cell_3", oldAccOrElmOrID: "table4_cell_3",
expectedUtterance: [["Column 2 Row 3 col2 row2", "cell3"], ["cell3", expectedUtterance: [[
"Column 2 Row 3 col2 row2"]], {"string": "columnInfo", "args": [2]},
expectedBraille: [["c2r3 col2 row2", "cell3"], ["cell3", {"string": "rowInfo", "args": [3]}, "col2", "row2", "cell3"],
"c2r3 col2 row2"]] ["cell3",
{"string": "columnInfo", "args": [2]},
{"string": "rowInfo", "args": [3]}, "col2", "row2"]],
expectedBraille: [
[{"string": "cellInfoAbbr", "args": [2, 3]}, "col2", "row2", "cell3"],
["cell3", {"string": "cellInfoAbbr", "args": [2, 3]}, "col2", "row2"]]
}]; }];
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, 0); SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, 0);

Просмотреть файл

@ -94,11 +94,10 @@ listEnd = Last item
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
listItemsCount = 1 item;#1 items listItemsCount = 1 item;#1 items
# LOCALIZATION NOTE: %1$S is the item's role name (e.g. "tab"), # LOCALIZATION NOTE: # %1$S is the position of the item n the set.
# %2$S is the position of the item n the set. # %2$S is the total number of such items in the set.
# %3$S is the total number of such items in the set. # An expanded example would read "2 of 5".
# An expanded example would read "tab 2 of 5". objItemOfN = %1$S of %2$S
objItemOf = %1$S %2$S of %3$S
# Landmark announcements # Landmark announcements
banner = banner banner = banner
@ -108,17 +107,14 @@ main = main
navigation = navigation navigation = navigation
search = search search = search
# Description of a table or grid: # LOCALIZATION NOTE (tblColumnInfo): Semi-colon list of plural forms.
# 1 is a dynamically retrieved localized role of either 'table' or 'grid'. # Number of columns within the table.
# 2 is the number of columns within the table.
# 3 is the number of rows within the table or grid.
tableInfo = %S with %S and %S
# LOCALIZATION NOTE (tableColumnInfo): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
tableColumnInfo = 1 column;#1 columns tblColumnInfo = with 1 column;with #1 columns
# LOCALIZATION NOTE (tableRowInfo): Semi-colon list of plural forms. # LOCALIZATION NOTE (tblRowInfo): Semi-colon list of plural forms.
# Number of rows within the table or grid.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
tableRowInfo = 1 row;#1 rows tblRowInfo = and 1 row;and #1 rows
# table or grid cell information # table or grid cell information
columnInfo = Column %S columnInfo = Column %S
@ -190,18 +186,85 @@ quicknav_Table = Tables
quicknav_Checkbox = Check boxes quicknav_Checkbox = Check boxes
# Shortened role names for braille # Shortened role names for braille
linkAbbr = lnk menubarAbbr = menu bar
pushbuttonAbbr = btn scrollbarAbbr = scroll bar
passwordtextAbbr = passwdtxt gripAbbr = grip
imagemapAbbr = imgmap alertAbbr = alert
figureAbbr = fig menupopupAbbr = menu popup
textareaAbbr = txtarea documentAbbr = document
paneAbbr = pane
dialogAbbr = dialog
separatorAbbr = separator
toolbarAbbr = toolbar
statusbarAbbr = status bar
tableAbbr = tbl tableAbbr = tbl
tableInfoAbbr = %S %S %S columnheaderAbbr = column header
# LOCALIZATION NOTE (tableColumnInfoAbbr): Semi-colon list of plural forms. rowheaderAbbr = row header
columnAbbr = column
rowAbbr = row
cellAbbr = cell
linkAbbr = lnk
listAbbr = list
listitemAbbr = list item
outlineAbbr = outline
outlineitemAbbr = outline item
pagetabAbbr = tab
propertypageAbbr = property page
graphicAbbr = graphic
pushbuttonAbbr = btn
checkbuttonAbbr = check button
radiobuttonAbbr = radio button
comboboxAbbr = combo box
progressbarAbbr = progress bar
sliderAbbr = slider
spinbuttonAbbr = spin button
diagramAbbr = diagram
animationAbbr = animation
equationAbbr = equation
buttonmenuAbbr = button menu
whitespaceAbbr = white space
pagetablistAbbr = tab list
canvasAbbr = canvas
checkmenuitemAbbr = check menu item
labelAbbr = label
passwordtextAbbr = passwdtxt
radiomenuitemAbbr = radio menu item
textcontainerAbbr = text container
togglebuttonAbbr = toggle button
treetableAbbr = tree table
headerAbbr = header
footerAbbr = footer
paragraphAbbr = paragraph
entryAbbr = entry
captionAbbr = caption
headingAbbr = heading
sectionAbbr = section
formAbbr = form
comboboxlistAbbr = combo box list
comboboxoptionAbbr = combo box option
imagemapAbbr = imgmap
listboxoptionAbbr = option
listboxAbbr = list box
flatequationAbbr = flat equation
gridcellAbbr = gridcell
noteAbbr = note
figureAbbr = fig
definitionlistAbbr = definition list
termAbbr = term
definitionAbbr = definition
textareaAbbr = txtarea
# LOCALIZATION NOTE (tblColumnInfoAbbr): Semi-colon list of plural forms.
# Number of columns within the table.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
tableColumnInfoAbbr = #1c;#1c tblColumnInfoAbbr = #1c;#1c
# LOCALIZATION NOTE (tableRowInfoAbbr): Semi-colon list of plural forms. # LOCALIZATION NOTE (tblRowInfoAbbr): Semi-colon list of plural forms.
# Number of rows within the table or grid.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals # See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
tableRowInfoAbbr = #1r;#1r tblRowInfoAbbr = #1r;#1r
cellInfoAbbr = c%Sr%S cellInfoAbbr = c%Sr%S
stateCheckedAbbr = (x)
stateUncheckedAbbr = ( )
statePressedAbbr = (x)
stateUnpressedAbbr = ( )