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

Unified Diff: chrome/test/data/webui/md_bookmarks/reducers_test.js

Issue 2972963003: MD Bookmarks: Prevent flash of folder contents when changing search term (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « chrome/browser/resources/md_bookmarks/util.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/md_bookmarks/reducers_test.js
diff --git a/chrome/test/data/webui/md_bookmarks/reducers_test.js b/chrome/test/data/webui/md_bookmarks/reducers_test.js
index 15fae4d3f548592df6c48a2b4ba6569d50ea5cbe..e8cfc37ee6c39aa5d3e85fb7dbafc0a0ecafe720 100644
--- a/chrome/test/data/webui/md_bookmarks/reducers_test.js
+++ b/chrome/test/data/webui/md_bookmarks/reducers_test.js
@@ -436,7 +436,7 @@ suite('search state', function() {
assertFalse(bookmarks.util.isShowingSearch(clearedState));
assertDeepEquals(['3'], bookmarks.util.getDisplayedList(clearedState));
assertEquals('', clearedState.search.term);
- assertDeepEquals([], clearedState.search.results);
+ assertDeepEquals(null, clearedState.search.results);
// Case 2: Clear search by selecting a new folder.
action = bookmarks.actions.selectFolder('1');
@@ -446,7 +446,36 @@ suite('search state', function() {
assertFalse(bookmarks.util.isShowingSearch(selectedState));
assertDeepEquals(['2'], bookmarks.util.getDisplayedList(selectedState));
assertEquals('', selectedState.search.term);
- assertDeepEquals([], selectedState.search.results);
+ assertDeepEquals(null, selectedState.search.results);
+ });
+
+ test('results do not clear while performing a second search', function() {
+ action = bookmarks.actions.setSearchTerm('te');
+ state = bookmarks.reduceAction(state, action);
+
+ assertFalse(bookmarks.util.isShowingSearch(state));
+
+ action = bookmarks.actions.setSearchResults(['2', '3']);
+ state = bookmarks.reduceAction(state, action);
+
+ assertFalse(state.search.inProgress);
+ assertTrue(bookmarks.util.isShowingSearch(state));
+
+ // Continuing the search should not clear the previous results, which should
+ // continue to show until the new results arrive.
+ action = bookmarks.actions.setSearchTerm('test');
+ state = bookmarks.reduceAction(state, action);
+
+ assertTrue(state.search.inProgress);
+ assertTrue(bookmarks.util.isShowingSearch(state));
+ assertDeepEquals(['2', '3'], bookmarks.util.getDisplayedList(state));
+
+ action = bookmarks.actions.setSearchResults(['3']);
+ state = bookmarks.reduceAction(state, action);
+
+ assertFalse(state.search.inProgress);
+ assertTrue(bookmarks.util.isShowingSearch(state));
+ assertDeepEquals(['3'], bookmarks.util.getDisplayedList(state));
});
test('removes deleted nodes', function() {
« no previous file with comments | « chrome/browser/resources/md_bookmarks/util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698