| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../inspector-test.js"></script> | 3 <script src="../inspector-test.js"></script> |
| 4 <script src="../network-test.js"></script> | 4 <script src="../network-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 function testSearches(view, searches) | 8 function testSearches(view, searches) |
| 9 { | 9 { |
| 10 for (var search of searches) { | 10 for (var search of searches) { |
| 11 view._searchInputElement.value = search; | 11 view._searchInputElement.value = search; |
| 12 view._regexButton.setToggled(false); | 12 view._regexButton.setToggled(false); |
| 13 view._caseSensitiveButton.setToggled(false); | 13 view._caseSensitiveButton.setToggled(false); |
| 14 view.showSearchField(); | 14 view.showSearchField(); |
| 15 InspectorTest.addResult("Should have found and highlighted all: " +
search); | 15 InspectorTest.addResult("Should have found and highlighted all: " +
search); |
| 16 | 16 |
| 17 var foundItems = view.element.querySelectorAll("* /deep/ .highlighte
d-search-result"); | 17 var foundItems = view.element.childTextNodes().filter(node => node.p
arentElement.classList.contains("highlighted-search-result")).map(node => node.p
arentElement); |
| 18 InspectorTest.addResult("Normal search found " + foundItems.length +
" results in dom."); | 18 InspectorTest.addResult("Normal search found " + foundItems.length +
" results in dom."); |
| 19 | 19 |
| 20 foundItems = view.element.querySelectorAll("* /deep/ .cm-search-high
light-start"); | 20 foundItems = view.element.childTextNodes().filter(node => node.paren
tElement.classList.contains("cm-search-highlight-start")).map(node => node.paren
tElement); |
| 21 InspectorTest.addResult("CodeMirror search found " + foundItems.leng
th + " results in dom."); | 21 InspectorTest.addResult("CodeMirror search found " + foundItems.leng
th + " results in dom."); |
| 22 InspectorTest.addResult(""); | 22 InspectorTest.addResult(""); |
| 23 } | 23 } |
| 24 } | 24 } |
| 25 | 25 |
| 26 function previewViewHandled(searches, callback, view) | 26 function previewViewHandled(searches, callback, view) |
| 27 { | 27 { |
| 28 var isSearchable = (view instanceof UI.SearchableView); | 28 var isSearchable = (view instanceof UI.SearchableView); |
| 29 var compontentView = view; | 29 var compontentView = view; |
| 30 var typeName = "unknown"; | 30 var typeName = "unknown"; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 testType("text/xml", "{foo0: 'barr', 'barr': 'fooo'}", ["fooo", "bar
"], next); | 113 testType("text/xml", "{foo0: 'barr', 'barr': 'fooo'}", ["fooo", "bar
"], next); |
| 114 } | 114 } |
| 115 ]); | 115 ]); |
| 116 } | 116 } |
| 117 </script> | 117 </script> |
| 118 </head> | 118 </head> |
| 119 <body onload="runTest()"> | 119 <body onload="runTest()"> |
| 120 <p>Tests that resources with JSON MIME types are previewed with the JSON viewer.
</p> | 120 <p>Tests that resources with JSON MIME types are previewed with the JSON viewer.
</p> |
| 121 </body> | 121 </body> |
| 122 </html> | 122 </html> |
| OLD | NEW |