Commit 43083f01 authored by dpapad's avatar dpapad Committed by Commit Bot

WebUI Polymer 2: Fix a few Bookmarks tests.

Specifically fixing the following tests:
MaterialBookmarksActionsTest.All
MaterialBookmarksAppTest.All
MaterialBookmarksCommandManagerTest.All
MaterialBookmarksFolderNodeTest.All
MaterialBookmarksItemTest.All
MaterialBookmarksListTest.All
MaterialBookmarksPolicyTest.All
MaterialBookmarksReducersTest.All
MaterialBookmarksToastManagerTest.All
MaterialBookmarksToolbarTest.All
MaterialBookmarksUtilTest.All

Remaining bookmarks tests will be fixed in a follow up.

Bug: 738611
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I62bd58f80208e024953b7f44a110a28db07d7cb4
Reviewed-on: https://chromium-review.googlesource.com/1100108
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarcalamity <calamity@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567437}
parent 96195371
...@@ -23,9 +23,7 @@ cr.define('bookmarks', function() { ...@@ -23,9 +23,7 @@ cr.define('bookmarks', function() {
}, },
/** @private {Set<string>} */ /** @private {Set<string>} */
menuIds_: { menuIds_: Object,
type: Object,
},
/** @private */ /** @private */
hasAnySublabel_: { hasAnySublabel_: {
...@@ -40,7 +38,10 @@ cr.define('bookmarks', function() { ...@@ -40,7 +38,10 @@ cr.define('bookmarks', function() {
* or elsewhere in the UI. * or elsewhere in the UI.
* @private {MenuSource} * @private {MenuSource}
*/ */
menuSource_: MenuSource.NONE, menuSource_: {
type: Number,
value: MenuSource.NONE,
},
/** @private */ /** @private */
globalCanEdit_: Boolean, globalCanEdit_: Boolean,
...@@ -702,7 +703,7 @@ cr.define('bookmarks', function() { ...@@ -702,7 +703,7 @@ cr.define('bookmarks', function() {
* @private * @private
*/ */
computeHasAnySublabel_: function() { computeHasAnySublabel_: function() {
if (!this.menuIds_) if (this.menuIds_ == undefined || this.menuCommands_ == undefined)
return false; return false;
return this.menuCommands_.some( return this.menuCommands_.some(
......
...@@ -476,7 +476,7 @@ TEST_F('MaterialBookmarksFocusTest', 'All', function() { ...@@ -476,7 +476,7 @@ TEST_F('MaterialBookmarksFocusTest', 'All', function() {
focusedItem.focus(); focusedItem.focus();
assertEquals(focusedItem, dialogFocusManager.getFocusedElement_()); assertEquals(focusedItem, dialogFocusManager.getFocusedElement_());
commandManager.openCommandMenuAtPosition(0, 0); commandManager.openCommandMenuAtPosition(0, 0, MenuSource.ITEM);
const dropdown = commandManager.$.dropdown.getIfExists(); const dropdown = commandManager.$.dropdown.getIfExists();
assertTrue(dropdown.open); assertTrue(dropdown.open);
...@@ -495,7 +495,7 @@ TEST_F('MaterialBookmarksFocusTest', 'All', function() { ...@@ -495,7 +495,7 @@ TEST_F('MaterialBookmarksFocusTest', 'All', function() {
focusedItem.focus(); focusedItem.focus();
assertEquals(focusedItem, dialogFocusManager.getFocusedElement_()); assertEquals(focusedItem, dialogFocusManager.getFocusedElement_());
commandManager.openCommandMenuAtPosition(0, 0); commandManager.openCommandMenuAtPosition(0, 0, MenuSource.ITEM);
const dropdown = commandManager.$.dropdown.getIfExists(); const dropdown = commandManager.$.dropdown.getIfExists();
dropdown.close(); dropdown.close();
assertNotEquals(focusedItem, dialogFocusManager.getFocusedElement_()); assertNotEquals(focusedItem, dialogFocusManager.getFocusedElement_());
...@@ -521,14 +521,14 @@ TEST_F('MaterialBookmarksFocusTest', 'All', function() { ...@@ -521,14 +521,14 @@ TEST_F('MaterialBookmarksFocusTest', 'All', function() {
focusedItem.focus(); focusedItem.focus();
assertEquals(focusedItem, dialogFocusManager.getFocusedElement_()); assertEquals(focusedItem, dialogFocusManager.getFocusedElement_());
commandManager.openCommandMenuAtPosition(0, 0); commandManager.openCommandMenuAtPosition(0, 0, MenuSource.ITEM);
assertNotEquals(focusedItem, dialogFocusManager.getFocusedElement_()); assertNotEquals(focusedItem, dialogFocusManager.getFocusedElement_());
const dropdown = commandManager.$.dropdown.getIfExists(); const dropdown = commandManager.$.dropdown.getIfExists();
dropdown.close(); dropdown.close();
focusedItem = items[3]; focusedItem = items[3];
focusedItem.focus(); focusedItem.focus();
commandManager.openCommandMenuAtPosition(0, 0); commandManager.openCommandMenuAtPosition(0, 0, MenuSource.ITEM);
return waitForClose(dropdown) return waitForClose(dropdown)
.then(() => { .then(() => {
......
...@@ -113,6 +113,7 @@ function customClick(element, config, eventName) { ...@@ -113,6 +113,7 @@ function customClick(element, config, eventName) {
const props = { const props = {
bubbles: true, bubbles: true,
cancelable: true, cancelable: true,
composed: true,
button: 0, button: 0,
buttons: 1, buttons: 1,
shiftKey: false, shiftKey: false,
......
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