Commit d270ec39 authored by Alexander Nohe's avatar Alexander Nohe Committed by Commit Bot

Hide filename edit field when there is no image

Hide |filenameEdit_| line edit box when there is no image to be displayed.
This fixes an undesired grey line appearing as the bottom of this edit box.
Changing the "disabled" state doesn't change the style of this box,
"disabled" state is only used for read-only behaviour not style.

R=fukino@chromium.org

Bug: 796503
Change-Id: I6fc9a4eb218231781325ba7a5af992b12610b929
Reviewed-on: https://chromium-review.googlesource.com/c/1212263Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Alexander Nohe <nohe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596972}
parent 370e46f7
...@@ -330,4 +330,9 @@ IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, ActivateVideoFromThumbnailMode) { ...@@ -330,4 +330,9 @@ IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, ActivateVideoFromThumbnailMode) {
StartTest(); StartTest();
} }
IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, DeleteSingleOpenPhotoOnDownloads) {
set_test_case_name("deleteSingleOpenPhotoOnDownloads");
StartTest();
}
} // namespace file_manager } // namespace file_manager
...@@ -814,6 +814,9 @@ Gallery.prototype.updateSelectionAndState_ = function() { ...@@ -814,6 +814,9 @@ Gallery.prototype.updateSelectionAndState_ = function() {
selectedItem.touch(); selectedItem.touch();
this.dataModel_.evictCache(); this.dataModel_.evictCache();
// Filename Edit field shows for anything selected.
this.filenameEdit_.hidden = false;
// Update the title and the display name. // Update the title and the display name.
if (numSelectedItems === 1) { if (numSelectedItems === 1) {
document.title = this.selectedEntry_.name; document.title = this.selectedEntry_.name;
...@@ -841,6 +844,7 @@ Gallery.prototype.updateSelectionAndState_ = function() { ...@@ -841,6 +844,7 @@ Gallery.prototype.updateSelectionAndState_ = function() {
} }
} else { } else {
document.title = ''; document.title = '';
this.filenameEdit_.hidden = true;
this.filenameEdit_.disabled = true; this.filenameEdit_.disabled = true;
this.filenameEdit_.value = ''; this.filenameEdit_.value = '';
this.resizeRenameField_(); this.resizeRenameField_();
...@@ -1100,4 +1104,4 @@ if (document.readyState === 'loading') { ...@@ -1100,4 +1104,4 @@ if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initializeGallery); document.addEventListener('DOMContentLoaded', initializeGallery);
} else { } else {
initializeGallery(); initializeGallery();
} }
\ No newline at end of file
...@@ -161,3 +161,29 @@ testcase.openMultipleImagesOnDrive = function() { ...@@ -161,3 +161,29 @@ testcase.openMultipleImagesOnDrive = function() {
testcase.openMultipleImagesAndChangeToSlideModeOnDownloads = function() { testcase.openMultipleImagesAndChangeToSlideModeOnDownloads = function() {
return openMultipleImagesAndChangeToSlideMode('local', 'downloads'); return openMultipleImagesAndChangeToSlideMode('local', 'downloads');
}; };
/**
* Runs a test to check whether the rename-input field is hidden after
* deleting the only selected image in the gallery.
* @return {Promise} Promise to be fulfilled with on success.
*/
testcase.deleteSingleOpenPhotoOnDownloads = function() {
const launchedPromise = launch('local', 'downloads', [ENTRIES.desktop]);
return launchedPromise.then(function(args) {
const appId = args.appId;
return gallery.waitForElement(appId, 'button.delete')
.then(function() {
// Click the delete button.
return gallery.waitAndClickElement(appId, 'button.delete');
})
.then(function(result) {
chrome.test.assertTrue(!!result);
// Wait and click delete button of confirmation dialog.
return gallery.waitAndClickElement(appId, '.cr-dialog-ok');
})
.then(function() {
// Check: The edit name field should hide.
return gallery.waitForElement(appId, '#rename-input[hidden]');
});
});
};
\ No newline at end of file
...@@ -118,6 +118,9 @@ function deleteAllImagesInThumbnailMode(testVolumeName, volumeType, operation) { ...@@ -118,6 +118,9 @@ function deleteAllImagesInThumbnailMode(testVolumeName, volumeType, operation) {
chrome.test.assertTrue(!!result); chrome.test.assertTrue(!!result);
// Wait until error banner is shown. // Wait until error banner is shown.
return gallery.waitForElement(appId, '.gallery[error] .error-banner'); return gallery.waitForElement(appId, '.gallery[error] .error-banner');
}).then(function() {
// Check: The edit name field should hide.
return gallery.waitForElement(appId, '#rename-input[hidden]');
}); });
} }
...@@ -160,6 +163,9 @@ function emptySpaceClickUnselectsInThumbnailMode(testVolumeName, volumeType) { ...@@ -160,6 +163,9 @@ function emptySpaceClickUnselectsInThumbnailMode(testVolumeName, volumeType) {
}).then(function(result) { }).then(function(result) {
// Confirm slideshow button is disabled. // Confirm slideshow button is disabled.
return gallery.waitForElement(appId, 'button.slideshow[disabled]'); return gallery.waitForElement(appId, 'button.slideshow[disabled]');
}).then(function() {
// Check: The edit name field should hide.
return gallery.waitForElement(appId, '#rename-input[hidden]');
}).then(function() { }).then(function() {
// Switch back to slide mode by clicking mode button. // Switch back to slide mode by clicking mode button.
return gallery.waitAndClickElement(appId, 'button.mode:not([disabled])'); return gallery.waitAndClickElement(appId, 'button.mode:not([disabled])');
......
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