Changes between Version 1 and Version 2 of Writing DumpAsMarkup Tests
- Timestamp:
- Aug 3, 2010, 2:29:36 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Writing DumpAsMarkup Tests
v1 v2 15 15 }}} 16 16 17 dump-as-markup.js then replace the document body by the DOM tree on the page load. If your test requires the test to be continued after the page load (e.g. uses setTimeout), then call Markup.waitUntilDone() before the page loads and Markup.notifyDone() to output the results and finish the test. Markup's waitUntilDone and notifyDone automatically calls layoutTestController's counterparts.17 dump-as-markup.js then outputs the DOM tree on the page load on DRT. If your test requires the test to be continued after the page load (e.g. uses setTimeout), then call Markup.waitUntilDone() before the page loads and Markup.notifyDone() to output the results and finish the test. Markup's waitUntilDone and notifyDone automatically calls layoutTestController's counterparts. 18 18 19 19 For example, if I have: … … 26 26 I get: 27 27 {{{ 28 29 <HTML> 30 <HEAD> 31 <SCRIPT src="../../resources/dump-as-markup.js"></SCRIPT> 32 <#text> 33 </#text> 34 </HEAD> 35 <BODY> 36 <DIV id="foo"> 37 <#text><selection-anchor>This is a dumpAsMarkup test.<selection-focus></#text> 38 </DIV> 39 <#text> 40 </#text> 41 <SCRIPT> window.getSelection().selectAllChildren(foo); </SCRIPT> 42 <#text> 43 </#text> 44 </BODY> 45 </HTML> 28 | <html> 29 | <head> 30 | <script> 31 | src="../../resources/dump-as-markup.js" 32 | " 33 " 34 | <body> 35 | <div> 36 | id="foo" 37 | "<#selection-anchor>This is a dumpAsMarkup test.<#selection-focus>" 38 | " 39 " 40 | <script> 41 | " window.getSelection().selectAllChildren(foo); " 42 | " 43 " 46 44 }}} 47 45 48 Notice < #text> and <selection-*> annotates the document.46 Notice <selection-*> shows where the selection / caret is and double quotation wraps each text node on the page. 49 47 50 48 == Output Subtree ==