Index: chrome/test/data/webui/settings/search_settings_test.js |
diff --git a/chrome/test/data/webui/settings/search_settings_test.js b/chrome/test/data/webui/settings/search_settings_test.js |
index 9653441b2605fad96299beb66b9ef9922faf5c6b..38f2f159a8592bbf5ab36c667be27f1bef3c47a2 100644 |
--- a/chrome/test/data/webui/settings/search_settings_test.js |
+++ b/chrome/test/data/webui/settings/search_settings_test.js |
@@ -98,5 +98,36 @@ cr.define('settings_test', function() { |
assertEquals('Baz', options[2].textContent); |
}); |
}); |
+ |
+ // Test that multiple requests for the same text correctly highlight their |
+ // corresponding part of the tree without affecting other parts of the tree. |
+ test('multiple simultaneous requests for the same text', function() { |
+ document.body.innerHTML = |
+ `<settings-section hidden-by-search> |
+ <div><span>Hello there</span></div> |
+ </settings-section> |
+ <settings-section hidden-by-search> |
+ <div><span>Hello over there</span></div> |
+ </settings-section> |
+ <settings-section hidden-by-search> |
+ <div><span>Nothing</span></div> |
+ </settings-section>`; |
+ |
+ var sections = Array.prototype.slice.call( |
+ document.querySelectorAll('settings-section')); |
+ |
+ return Promise.all( |
+ sections.map(function(section) { |
+ return searchManager.search('there', section); |
+ }), |
+ ).then(function(requests) { |
+ assertTrue(requests[0].didFindMatches()); |
+ assertFalse(sections[0].hiddenBySearch); |
+ assertTrue(requests[1].didFindMatches()); |
+ assertFalse(sections[1].hiddenBySearch); |
+ assertFalse(requests[2].didFindMatches()); |
+ assertTrue(sections[2].hiddenBySearch); |
+ }); |
+ }); |
}); |
}); |