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

Side by Side Diff: chrome/test/data/webui/settings/search_settings_test.js

Issue 2774003002: MD Settings: Don't search inside <dialog> elements. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('settings_test', function() { 5 cr.define('settings_test', function() {
6 6
7 suite('SearchSettingsTest', function() { 7 suite('SearchSettingsTest', function() {
8 var searchManager; 8 var searchManager;
9 9
10 // Don't import script if already imported (happens in Vulcanized mode). 10 // Don't import script if already imported (happens in Vulcanized mode).
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return searchManager.search('', section); 92 return searchManager.search('', section);
93 }).then(function() { 93 }).then(function() {
94 var options = select.querySelectorAll('option'); 94 var options = select.querySelectorAll('option');
95 assertEquals(3, options.length); 95 assertEquals(3, options.length);
96 assertEquals('Foo', options[0].textContent); 96 assertEquals('Foo', options[0].textContent);
97 assertEquals('Settings', options[1].textContent); 97 assertEquals('Settings', options[1].textContent);
98 assertEquals('Baz', options[2].textContent); 98 assertEquals('Baz', options[2].textContent);
99 }); 99 });
100 }); 100 });
101 101
102 test('ignored elements are ignored', function() {
103 var text = 'hello';
104 document.body.innerHTML =
105 `<settings-section hidden-by-search>
106 <cr-events>${text}</cr-events>
107 <dialog>${text}</dialog>
108 <iron-icon>${text}</iron-icon>
109 <iron-list>${text}</iron-list>
110 <paper-icon-button>${text}</paper-icon-button>
111 <paper-ripple>${text}</paper-ripple>
112 <paper-slider>${text}</paper-slider>
113 <paper-spinner>${text}</paper-spinner>
114 <style>${text}</style>
115 <template>${text}</template>
116 </settings-section>`;
117
118 var section = document.querySelector('settings-section');
119 assertTrue(section.hiddenBySearch);
120
121 return searchManager.search(text, section).then(function() {
122 assertTrue(section.hiddenBySearch);
123 });
124 });
125
102 // Test that multiple requests for the same text correctly highlight their 126 // Test that multiple requests for the same text correctly highlight their
103 // corresponding part of the tree without affecting other parts of the tree. 127 // corresponding part of the tree without affecting other parts of the tree.
104 test('multiple simultaneous requests for the same text', function() { 128 test('multiple simultaneous requests for the same text', function() {
105 document.body.innerHTML = 129 document.body.innerHTML =
106 `<settings-section hidden-by-search> 130 `<settings-section hidden-by-search>
107 <div><span>Hello there</span></div> 131 <div><span>Hello there</span></div>
108 </settings-section> 132 </settings-section>
109 <settings-section hidden-by-search> 133 <settings-section hidden-by-search>
110 <div><span>Hello over there</span></div> 134 <div><span>Hello over there</span></div>
111 </settings-section> 135 </settings-section>
(...skipping 12 matching lines...) Expand all
124 assertTrue(requests[0].didFindMatches()); 148 assertTrue(requests[0].didFindMatches());
125 assertFalse(sections[0].hiddenBySearch); 149 assertFalse(sections[0].hiddenBySearch);
126 assertTrue(requests[1].didFindMatches()); 150 assertTrue(requests[1].didFindMatches());
127 assertFalse(sections[1].hiddenBySearch); 151 assertFalse(sections[1].hiddenBySearch);
128 assertFalse(requests[2].didFindMatches()); 152 assertFalse(requests[2].didFindMatches());
129 assertTrue(sections[2].hiddenBySearch); 153 assertTrue(sections[2].hiddenBySearch);
130 }); 154 });
131 }); 155 });
132 }); 156 });
133 }); 157 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698