Changes between Version 3 and Version 4 of Writing DumpAsMarkup Tests
- Timestamp:
- Aug 3, 2010, 2:40:26 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Writing DumpAsMarkup Tests
v3 v4 72 72 }}} 73 73 74 Note "This is a dumpAsMarkup test." is added by Markup.description. The sentence will not be printed on DRT if we had it in a div like the earlier example because the document body is replaced by the output. 74 Note "This is a dumpAsMarkup test." is added by Markup.description. The sentence will not be printed on DRT if we had it in a div like the earlier example because the document body is replaced by the output. Also note that the auto dump on the page load is disabled but you can still call Markup.waitUntilDone() and Markup.notifyDone() to avoid DRT finishing the test prematurely. 75 75 76 76 == Dump Multiple Times == … … 85 85 <script> 86 86 Markup.description('This test calls dump twice.') 87 Markup.setNodeToDump('test')88 87 Markup.dump('test', 'before change') 89 88 document.getElementById('test').lastChild.innerText += ' because of you!' 90 Markup.dump( null, 'after change')89 Markup.dump('test', 'after change') 91 90 </script> 92 91 }}} … … 97 96 98 97 before change: 99 <DIV id="test"> 100 <A href="http://webkit.org/"> 101 <#text>WebKit</#text> 102 </A> 103 <#text> is </#text> 104 <STRONG> 105 <#text>awesome</#text> 106 </STRONG> 107 </DIV> 98 | <a> 99 | href="http://webkit.org/" 100 | "WebKit" 101 | " is " 102 | <strong> 103 | "awesome" 108 104 109 105 after change: 110 <DIV id="test"> 111 <A href="http://webkit.org/"> 112 <#text>WebKit</#text> 113 </A> 114 <#text> is </#text> 115 <STRONG> 116 <#text>awesome because of you!</#text> 117 </STRONG> 118 </DIV> 106 | <a> 107 | href="http://webkit.org/" 108 | "WebKit" 109 | " is " 110 | <strong> 111 | "awesome because of you!" 119 112 }}} 120 121 Notice that I call dump twice and the DOM is dumped exactly twice (onload didn't dump). You may still use Markup.waitUntilDone() and Markup.notifyDone() to avoid DRT finishing the test prematurely.122 123 '''Note''': as is implemented, the script adds pre element at the end of the document temporarily when you call dump and your script should not interfere with those pre tags.