Web Inspector: create helper InspectorTest method to dump editor HTML
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2013 15:26:14 +0000 (15:26 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2013 15:26:14 +0000 (15:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107007

Patch by Andrey Lushnikov <lushnikov@chromium.org> on 2013-01-16
Reviewed by Pavel Feldman.

Add helper method to dump textEditor HTML.

* inspector/editor/editor-test.js:
(initialize_EditorTests.InspectorTest.dumpEditorHTML): Added.
* inspector/editor/text-editor-highlight-regexp.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139881 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/editor/editor-test.js
LayoutTests/inspector/editor/text-editor-highlight-regexp.html

index 52c22b5..9ce9cbf 100644 (file)
@@ -1,3 +1,16 @@
+2013-01-16  Andrey Lushnikov  <lushnikov@chromium.org>
+
+        Web Inspector: create helper InspectorTest method to dump editor HTML
+        https://bugs.webkit.org/show_bug.cgi?id=107007
+
+        Reviewed by Pavel Feldman.
+
+        Add helper method to dump textEditor HTML.
+
+        * inspector/editor/editor-test.js:
+        (initialize_EditorTests.InspectorTest.dumpEditorHTML): Added.
+        * inspector/editor/text-editor-highlight-regexp.html:
+
 2013-01-16  Andrey Kosyakov  <caseq@chromium.org>
 
         Web Inspector: [Extensions API] remove inspectedWindow.onReset event
index 2588c16..c71efb8 100644 (file)
@@ -69,6 +69,13 @@ InspectorTest.dumpEditorDOM = function(textEditor)
     }
 };
 
+InspectorTest.dumpEditorHTML = function(textEditor, mainPanelOnly)
+{
+    var element = mainPanelOnly ? textEditor._mainPanel.element : textEditor.element;
+    var dumpedHTML = element.innerHTML.replace(/<div/g, "\n<div");
+    InspectorTest.addResult(dumpedHTML);
+};
+
 InspectorTest.getLineElement = function(textEditor, lineNumber)
 {
     return textEditor._mainPanel.chunkForLine(lineNumber).expandedLineRow(lineNumber);
index c4c0720..d603d3f 100644 (file)
@@ -20,13 +20,13 @@ function test()
             var textEditor = InspectorTest.createTestEditor();
             textEditor.setText(text.join("\n"));
             InspectorTest.addResult("\nBefore highlight");
-            InspectorTest.addResult(textEditor._mainPanel.element.innerHTML.replace(/<div/g, "\n<div"));
+            InspectorTest.dumpEditorHTML(textEditor, true);
             textEditor.highlightRegex(/foo_./, "some-css-class");
             InspectorTest.addResult("\nAdd highlight for regexp /foo_./");
-            InspectorTest.addResult(textEditor._mainPanel.element.innerHTML.replace(/<div/g, "\n<div"));
+            InspectorTest.dumpEditorHTML(textEditor, true);
             InspectorTest.addResult("\nRemove highlight for regexp /foo_./");
             textEditor.removeRegexHighlight(/foo_./);
-            InspectorTest.addResult(textEditor._mainPanel.element.innerHTML.replace(/<div/g, "\n<div"));
+            InspectorTest.dumpEditorHTML(textEditor, true);
             next();
         },
     ]);