Commit 2e0721b4 authored by Alex Danilo's avatar Alex Danilo Committed by Commit Bot

Mark grid and list ARIA single selectable

Bug: 1110540
Tests: browser_tests --gtest_filter="*saveFileDialogAriaSingleSelect"
Change-Id: I1ec00b62daaa7e4e476380a1a0f3df8fa6acce5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2504753
Commit-Queue: Alex Danilo <adanilo@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822056}
parent 3000cdbe
......@@ -844,6 +844,8 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
TestCase("openFileDialogDownloads").WithBrowser().InGuestMode(),
TestCase("openFileDialogDownloads").WithBrowser().InIncognito(),
TestCase("openFileDialogPanelsDisabled").WithBrowser(),
TestCase("openFileDialogAriaMultipleSelect").WithBrowser(),
TestCase("saveFileDialogAriaSingleSelect").WithBrowser(),
TestCase("saveFileDialogDownloads").WithBrowser(),
TestCase("saveFileDialogDownloads").WithBrowser().InGuestMode(),
TestCase("saveFileDialogDownloads").WithBrowser().InIncognito(),
......
......@@ -127,8 +127,9 @@ function setUp() {
FileGrid.decorate(grid, metadataModel, volumeManager, historyLoader, a11y);
// Setup the ListContainer and its dependencies
listContainer =
new ListContainer(queryRequiredElement('#list-container'), table, grid);
listContainer = new ListContainer(
queryRequiredElement('#list-container'), table, grid,
DialogType.FULL_PAGE);
listContainer.dataModel = dataModel;
listContainer.selectionModel = new cr.ui.ListSelectionModel();
listContainer.setCurrentListType(ListContainer.ListType.DETAIL);
......
......@@ -421,6 +421,7 @@ js_library("list_container") {
":file_grid",
":file_table",
"//ui/file_manager/file_manager/common/js:util",
"//ui/file_manager/file_manager/foreground/js:dialog_type",
"//ui/webui/resources/js/cr/ui:list_item",
]
}
......
......@@ -439,7 +439,8 @@ class FileManagerUI {
initAdditionalUI(table, grid, volumeManager) {
// List container.
this.listContainer = new ListContainer(
queryRequiredElement('#list-container', this.element), table, grid);
queryRequiredElement('#list-container', this.element), table, grid,
this.dialogType_);
// Location line.
this.locationLine = new LocationLine(
......
......@@ -20,8 +20,9 @@ class ListContainer {
* @param {!HTMLElement} element Element of the container.
* @param {!FileTable} table File table.
* @param {!FileGrid} grid File grid.
* @param {DialogType} type The type of the main dialog.
*/
constructor(element, table, grid) {
constructor(element, table, grid, type) {
/**
* The container element of the file list.
* @type {!HTMLElement}
......@@ -144,6 +145,13 @@ class ListContainer {
e.stopPropagation();
}
}.bind(this), true);
// Ensure the list and grid are marked ARIA single select for save as.
if (type === DialogType.SELECT_SAVEAS_FILE) {
const list = table.querySelector('#file-list');
list.setAttribute('aria-multiselectable', 'false');
grid.setAttribute('aria-multiselectable', 'false');
}
}
/**
......
......@@ -257,7 +257,48 @@ testcase.openFileDialogDownloads = () => {
};
/**
* Tests opening save file dialog on Downloads and closing it with Ok button.
* Tests opening file dialog sets aria-multiselect true on grid and list.
*/
testcase.openFileDialogAriaMultipleSelect = async () => {
// Open File dialog.
chrome.fileSystem.chooseEntry({type: 'openFile'}, (entry) => {});
const appId = await remoteCall.waitForWindow('dialog#');
// Wait to finish initial load.
await remoteCall.waitFor('isFileManagerLoaded', appId, true);
// Check: <list> has aria-multiselect set to true.
const list = 'list#file-list[aria-multiselectable=true]';
await remoteCall.waitForElement(appId, list);
// Check: <grid> has aria-multiselect set to true.
const grid = 'grid#file-list[aria-multiselectable=true]';
await remoteCall.waitForElement(appId, grid);
};
/**
* Tests opening save file dialog sets aria-multiselect false on grid and list.
*/
testcase.saveFileDialogAriaSingleSelect = async () => {
// Open Save as dialog.
chrome.fileSystem.chooseEntry({type: 'saveFile'}, (entry) => {});
const appId = await remoteCall.waitForWindow('dialog#');
// Wait to finish initial load.
await remoteCall.waitFor('isFileManagerLoaded', appId, true);
// Check: <list> has aria-multiselect set to false.
const list = 'list#file-list[aria-multiselectable=false]';
await remoteCall.waitForElement(appId, list);
// Check: <grid> has aria-multiselect set to false.
const grid = 'grid#file-list[aria-multiselectable=false]';
await remoteCall.waitForElement(appId, grid);
};
/**
* Tests opening save file dialog on Downloads and closing it
* with Ok button.
*/
testcase.saveFileDialogDownloads = () => {
return saveFileDialogClickOkButton('downloads', TEST_LOCAL_FILE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment