| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="highlighter-test.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 function test() | |
| 8 { | |
| 9 var textModel = new WebInspector.TextEditorModel(); | |
| 10 | |
| 11 var highlighter = new WebInspector.TextEditorHighlighter(textModel, function
() {}); | |
| 12 highlighter.mimeType = "text/javascript"; | |
| 13 highlighter.highlightChunkLimit = Number.MAX_VALUE; // Synchronous. | |
| 14 | |
| 15 function dumpTextModel(msg) { | |
| 16 InspectorTest.addResult("\n" + msg); | |
| 17 InspectorTest.dumpTextModel(textModel); | |
| 18 } | |
| 19 | |
| 20 var src = "/*\n\n1\n2\n3\n4\n5\n\n*/"; | |
| 21 textModel.setText(src); | |
| 22 | |
| 23 highlighter.highlight(textModel.linesCount); | |
| 24 dumpTextModel("After highlighting all lines"); | |
| 25 | |
| 26 var range = new WebInspector.TextRange(7, 0, 7, 0); | |
| 27 var newRange = textModel.editRange(range, "1\n2\n3\n4\n5\n"); | |
| 28 highlighter.updateHighlight(7, textModel.linesCount); | |
| 29 dumpTextModel("After update highlights"); | |
| 30 | |
| 31 highlighter.highlight(textModel.linesCount); | |
| 32 dumpTextModel("After highlighting up to the end"); | |
| 33 | |
| 34 // There was an actual bug with wrongly restored position after updating the
highlights. | |
| 35 var range = new WebInspector.TextRange(12, 0, 12, 0); | |
| 36 var newRange = textModel.editRange(range, "\n"); | |
| 37 highlighter.updateHighlight(12, textModel.linesCount); | |
| 38 highlighter.highlight(textModel.linesCount); | |
| 39 dumpTextModel("After inserting a new line"); | |
| 40 | |
| 41 InspectorTest.completeTest(); | |
| 42 } | |
| 43 | |
| 44 </script> | |
| 45 </head> | |
| 46 | |
| 47 <body onload="runTest()"> | |
| 48 <p> | |
| 49 This test checks against <a href="https://bugs.webkit.org/show_bug.cgi?id=54876"
>a bug</a> in the highlighter when pasting text inside a comment. | |
| 50 </p> | |
| 51 | |
| 52 </body> | |
| 53 </html> | |
| OLD | NEW |