| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head> |
| 3 |
| 4 <link rel="stylesheet" href="resources/before.css"> |
| 5 <link rel="stylesheet" href="resources/after.css"> |
| 6 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 7 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 8 <script src="changes-test.js"></script> |
| 9 <script> |
| 10 |
| 11 function test() { |
| 12 InspectorTest.waitForUISourceCode("after.css").then(uiSourceCode => uiSource
Code.requestContent()).then(onAfterContent); |
| 13 |
| 14 function onAfterContent(content) { |
| 15 InspectorTest.waitForScriptSource("before.css", uiSourceCode => uiSourceCo
de.setWorkingCopy(content)); |
| 16 InspectorTest.addSniffer(Changes.ChangesView.prototype, "_renderDiffRows",
rowsRendered, true); |
| 17 UI.viewManager.showView("changes.changes"); |
| 18 } |
| 19 |
| 20 function rowsRendered() { |
| 21 var codeMirror = this._editor._codeMirror; |
| 22 for (var i = 0; i < codeMirror.lineCount(); i++) { |
| 23 codeMirror.scrollIntoView(i); // Ensure highlighting |
| 24 var lineInfo = codeMirror.lineInfo(i); |
| 25 var prefix = ""; |
| 26 if (lineInfo.handle.styleClasses.bgClass === "deletion") |
| 27 prefix = "-"; |
| 28 else if (lineInfo.handle.styleClasses.bgClass === "addition") |
| 29 prefix = "+"; |
| 30 else if (lineInfo.handle.styleClasses.bgClass === "equal") |
| 31 prefix = " "; |
| 32 InspectorTest.addResult(prefix + " " + lineInfo.text); |
| 33 |
| 34 } |
| 35 InspectorTest.completeTest(); |
| 36 } |
| 37 } |
| 38 </script> |
| 39 </head> |
| 40 <body onload="runTest()"> |
| 41 <p>Tests that the changes view highlights diffs correctly.</p> |
| 42 </body> |
| 43 </html> |
| OLD | NEW |