Index: chrome/test/data/webui/settings/settings_main_test.js |
diff --git a/chrome/test/data/webui/settings/settings_main_test.js b/chrome/test/data/webui/settings/settings_main_test.js |
index 7d5b2812e249acb737ffeb317cfbe808b15dee23..a5a2637fe56f2f3e8857b6b45690e2b968263aaf 100644 |
--- a/chrome/test/data/webui/settings/settings_main_test.js |
+++ b/chrome/test/data/webui/settings/settings_main_test.js |
@@ -169,15 +169,20 @@ cr.define('settings_main_page', function() { |
* Asserts the visibility of the basic and advanced pages. |
* @param {string} Expected 'display' value for the basic page. |
* @param {string} Expected 'display' value for the advanced page. |
+ * @return {!Promise} |
*/ |
function assertPageVisibility(expectedBasic, expectedAdvanced) { |
Polymer.dom.flush(); |
var page = settingsMain.$$('settings-basic-page'); |
assertEquals( |
expectedBasic, page.$$('#basicPage').style.display); |
- assertEquals( |
- expectedAdvanced, |
- page.$$('#advancedPageTemplate').get().style.display); |
+ |
+ return page.$$('#advancedPageTemplate').get().then( |
+ function(advancedPage) { |
+ assertEquals( |
+ expectedAdvanced || 'block', |
michaelpg
2017/05/08 18:00:04
why the || 'block'? (is it related to callers invo
dpapad
2017/05/08 19:07:52
Updated all callers to pass 'block' instead of '',
michaelpg
2017/05/08 20:01:32
Oh, I see. Thanks for updating!
|
+ getComputedStyle(advancedPage).display); |
+ }); |
} |
// TODO(michaelpg): It would be better not to drill into |
@@ -199,7 +204,7 @@ cr.define('settings_main_page', function() { |
searchManager.setMatchesFound(false); |
return settingsMain.searchContents(''); |
}).then(function() { |
- assertPageVisibility(expectedBasic, expectedAdvanced); |
+ return assertPageVisibility(expectedBasic, expectedAdvanced); |
}); |
} |
@@ -235,7 +240,7 @@ cr.define('settings_main_page', function() { |
// Simulate clicking the left arrow to go back to the search results. |
settings.navigateTo(settings.Route.BASIC); |
- assertPageVisibility('', ''); |
+ return assertPageVisibility('', ''); |
}); |
}); |
@@ -244,14 +249,25 @@ cr.define('settings_main_page', function() { |
settings.navigateTo(settings.Route.PRIVACY); |
Polymer.dom.flush(); |
- var advancedToggle = |
- getToggleContainer().querySelector('#advancedToggle'); |
- assertTrue(!!advancedToggle); |
- |
- MockInteractions.tap(advancedToggle); |
- Polymer.dom.flush(); |
- |
- assertPageVisibility('', 'none'); |
+ var basicPage = settingsMain.$$('settings-basic-page'); |
+ var advancedPage = null; |
+ return basicPage.$$('#advancedPageTemplate').get().then( |
+ function(advanced) { |
+ advancedPage = advanced; |
+ return assertPageVisibility('', ''); |
+ }).then(function() { |
+ var whenHidden = test_util.whenAttributeIs( |
+ advancedPage, 'hidden', true); |
michaelpg
2017/05/08 18:00:03
The 'hidden' attribute can never be a boolean; it
dpapad
2017/05/08 19:07:52
Added TODO.
|
+ |
+ var advancedToggle = |
+ getToggleContainer().querySelector('#advancedToggle'); |
+ assertTrue(!!advancedToggle); |
+ MockInteractions.tap(advancedToggle); |
+ |
+ return whenHidden; |
+ }).then(function() { |
+ return assertPageVisibility('', 'none'); |
+ }); |
}); |
test('navigating to a basic page does not collapse advanced', function() { |
@@ -263,7 +279,7 @@ cr.define('settings_main_page', function() { |
settings.navigateTo(settings.Route.PEOPLE); |
Polymer.dom.flush(); |
- assertPageVisibility('', ''); |
+ return assertPageVisibility('', ''); |
}); |
}); |
} |