Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10931)

Unified Diff: chrome/test/data/webui/settings/site_data_test.js

Issue 2781703002: MD Settings: Fix case where 'REMOVE ALL SHOWN' button is erroneously shown. (Closed)
Patch Set: Add test. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/settings/site_data_test.js
diff --git a/chrome/test/data/webui/settings/site_data_test.js b/chrome/test/data/webui/settings/site_data_test.js
index bc6d9599a50b171a48da9588210f1e6358a43bd1..2ee006c0a5e1c1a624566170897bc4625c022643 100644
--- a/chrome/test/data/webui/settings/site_data_test.js
+++ b/chrome/test/data/webui/settings/site_data_test.js
@@ -26,4 +26,32 @@ suite('<site-data>', function() {
assertEquals(GOOGLE_ID, path);
});
});
+
+ test('remove button hidden when no search results', function() {
+ siteData.sites = [
+ {site: 'Hello', id: '1', localData: 'Cookiez!'},
+ {site: 'World', id: '2', localData: 'Cookiez!'},
+ ];
+
+ Polymer.dom.flush();
+ assertEquals(
+ siteData.sites.length,
+ siteData.shadowRoot.querySelectorAll('.list-item').length);
+
+ // Expecting one result, so the button should be shown.
+ siteData.$.filter.dispatchEvent(
+ new CustomEvent('search-changed', {detail: 'Hello'}));
+ Polymer.dom.flush();
+ assertEquals(
+ 1, siteData.shadowRoot.querySelectorAll('.list-item').length);
+ assertFalse(siteData.$.removeShowingSites.hidden);
+
+ // Expecting no results, so the button should be hidden.
+ siteData.$.filter.dispatchEvent(
+ new CustomEvent('search-changed', {detail: 'foo'}));
+ Polymer.dom.flush();
+ assertEquals(
+ 0, siteData.shadowRoot.querySelectorAll('.list-item').length);
+ assertTrue(siteData.$.removeShowingSites.hidden);
+ });
});

Powered by Google App Engine
This is Rietveld 408576698