Commit f451f9ea authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

[Files app] Fix MyFiles expanding when isn't selected

Fix My files expanding when selecting or expanding entries in other
roots.

Change-Id: I5c87f371ef500608100b6e07ae118f84e71f0311
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1505744
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638461}
parent b975f61f
...@@ -931,7 +931,8 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P( ...@@ -931,7 +931,8 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
TestCase("myFilesFolderRename"), TestCase("myFilesFolderRename"),
TestCase("myFilesFolderRename").EnableMyFilesVolume(), TestCase("myFilesFolderRename").EnableMyFilesVolume(),
TestCase("myFilesUpdatesChildren"), TestCase("myFilesUpdatesChildren"),
TestCase("myFilesUpdatesChildren").EnableMyFilesVolume())); TestCase("myFilesUpdatesChildren").EnableMyFilesVolume(),
TestCase("myFilesExpandWhenSelected").EnableMyFilesVolume()));
WRAPPED_INSTANTIATE_TEST_SUITE_P( WRAPPED_INSTANTIATE_TEST_SUITE_P(
InstallLinuxPackageDialog, /* install_linux_package_dialog.js */ InstallLinuxPackageDialog, /* install_linux_package_dialog.js */
......
...@@ -918,7 +918,7 @@ EntryListItem.prototype.updateSubDirectories = function( ...@@ -918,7 +918,7 @@ EntryListItem.prototype.updateSubDirectories = function(
const onSuccess = (entries) => { const onSuccess = (entries) => {
this.entries_ = entries; this.entries_ = entries;
this.updateSubElementsFromList(recursive); this.updateSubElementsFromList(recursive);
if (this.entries_.length > 0) { if (this.entries_.length > 0 && this.selected) {
this.expanded = true; this.expanded = true;
} }
opt_successCallback && opt_successCallback(); opt_successCallback && opt_successCallback();
......
...@@ -121,7 +121,7 @@ testcase.metadataDrive = async () => { ...@@ -121,7 +121,7 @@ testcase.metadataDrive = async () => {
// Navigate 2 folders deep, because navigating in directory tree might // Navigate 2 folders deep, because navigating in directory tree might
// trigger further metadata fetches. // trigger further metadata fetches.
await remoteCall.navigateWithDirectoryTree( await remoteCall.navigateWithDirectoryTree(
appId, '/root/photos1/folder1', 'My Drive'); appId, '/root/photos1/folder1', 'My Drive', 'drive');
// Fetch the metadata stats. // Fetch the metadata stats.
const metadataStats = const metadataStats =
...@@ -216,11 +216,12 @@ testcase.metadataLargeDrive = async () => { ...@@ -216,11 +216,12 @@ testcase.metadataLargeDrive = async () => {
// Open Files app on Drive. // Open Files app on Drive.
const appId = await setupAndWaitUntilReady(RootPath.DRIVE, entries, entries); const appId = await setupAndWaitUntilReady(RootPath.DRIVE, entries, entries);
console.log('setupAndWaitUntilReady finished!');
// Navigate only 1 folder deep,which is slightly different from // Navigate only 1 folder deep,which is slightly different from
// metadatatDrive test. // metadatatDrive test.
await remoteCall.navigateWithDirectoryTree( await remoteCall.navigateWithDirectoryTree(
appId, '/root/folder1', 'My Drive'); appId, '/root/folder1', 'My Drive', 'drive');
// Wait for the metadata stats to reach the desired count. // Wait for the metadata stats to reach the desired count.
// File list component, doesn't display all files at once for performance // File list component, doesn't display all files at once for performance
...@@ -287,7 +288,7 @@ testcase.metadataTeamDrives = async () => { ...@@ -287,7 +288,7 @@ testcase.metadataTeamDrives = async () => {
// Navigate to Team Drives root. // Navigate to Team Drives root.
await remoteCall.navigateWithDirectoryTree( await remoteCall.navigateWithDirectoryTree(
appId, '/team_drives', 'Team Drives'); appId, '/team_drives', 'Team Drives', 'drive');
// Expand Team Drives, because expanding might need metadata. // Expand Team Drives, because expanding might need metadata.
const expandIcon = teamDriveTreeItem + ' > .tree-row > .expand-icon'; const expandIcon = teamDriveTreeItem + ' > .tree-row > .expand-icon';
......
...@@ -294,3 +294,40 @@ testcase.myFilesFolderRename = async () => { ...@@ -294,3 +294,40 @@ testcase.myFilesFolderRename = async () => {
appId, expectedRows2, appId, expectedRows2,
{ignoreFileSize: true, ignoreLastModifiedTime: true}); {ignoreFileSize: true, ignoreLastModifiedTime: true});
}; };
/**
* Tests that MyFiles doesn't expand when it isn't selected.
*/
testcase.myFilesExpandWhenSelected = async () => {
// Open Files app on local Downloads.
const appId = await setupAndWaitUntilReady(
RootPath.DOWNLOADS, [ENTRIES.photos], [ENTRIES.beautiful]);
// Collapse MyFiles.
const myFiles = '#directory-tree [entry-label="My files"]';
let expandIcon = myFiles + '[expanded] > .tree-row > .expand-icon';
await remoteCall.waitAndClickElement(appId, expandIcon);
await remoteCall.waitForElement(appId, myFiles + ':not([expanded])');
// Expand Google Drive.
const driveGrandRoot = '#directory-tree [entry-label="Google Drive"]';
expandIcon = driveGrandRoot + ' > .tree-row > .expand-icon';
await remoteCall.waitAndClickElement(appId, expandIcon);
// Wait for its subtree to expand and display its children.
const expandedSubItems =
driveGrandRoot + ' > .tree-children[expanded] > .tree-item';
await remoteCall.waitForElement(appId, expandedSubItems);
// Click on My Drive
const myDrive = '#directory-tree [entry-label="My Drive"]';
await remoteCall.waitAndClickElement(appId, myDrive);
// Wait for My Drive to selected.
await remoteCall.waitForFiles(
appId, [ENTRIES.beautiful.getExpectedRow()],
{ignoreFileSize: true, ignoreLastModifiedTime: true});
// Check that MyFiles is still collapsed.
await remoteCall.waitForElement(appId, myFiles + ':not([expanded])');
};
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