Page MenuHomeWickedGov Phorge

testrunner.test.js
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

testrunner.test.js

QUnit.module( 'testrunner', () => {
QUnit.test( 'assert.htmlEqual', ( assert ) => {
assert.htmlEqual(
'<div><p class="some classes" data-length="10">Child paragraph with <a href="http://example.com">A link</a></p>Regular text<span>A span</span></div>',
'<div><p data-length=\'10\' class=\'some classes\'>Child paragraph with <a href=\'http://example.com\' >A link</a></p>Regular text<span>A span</span></div>',
'Attribute order, spacing and quotation marks (equal)'
);
assert.notHtmlEqual(
'<div><p class="some classes" data-length="10">Child paragraph with <a href="http://example.com">A link</a></p>Regular text<span>A span</span></div>',
'<div><p data-length=\'10\' class=\'some more classes\'>Child paragraph with <a href=\'http://example.com\' >A link</a></p>Regular text<span>A span</span></div>',
'Attribute order, spacing and quotation marks (not equal)'
);
assert.htmlEqual(
'<label for="firstname" accesskey="f" class="important">First</label><input id="firstname" /><label for="lastname" accesskey="l" class="minor">Last</label><input id="lastname" />',
'<label for="firstname" accesskey="f" class="important">First</label><input id="firstname" /><label for="lastname" accesskey="l" class="minor">Last</label><input id="lastname" />',
'Multiple root nodes (equal)'
);
assert.notHtmlEqual(
'<label for="firstname" accesskey="f" class="important">First</label><input id="firstname" /><label for="lastname" accesskey="l" class="minor">Last</label><input id="lastname" />',
'<label for="firstname" accesskey="f" class="important">First</label><input id="firstname" /><label for="lastname" accesskey="l" class="important" >Last</label><input id="lastname" />',
'Multiple root nodes (not equal, last label node is different)'
);
assert.htmlEqual(
'fo&quot;o<br/>b&gt;ar',
'fo"o<br/>b>ar',
'Extra escaping is equal'
);
assert.notHtmlEqual(
'foo&lt;br/&gt;bar',
'foo<br/>bar',
'Text escaping (not equal)'
);
assert.htmlEqual(
'foo<a href="http://example.com">example</a>bar',
'foo<a href="http://example.com">example</a>bar',
'Outer text nodes are compared (equal)'
);
assert.notHtmlEqual(
'foo<a href="http://example.com">example</a>bar',
'foo<a href="http://example.com">example</a>quux',
'Outer text nodes are compared (last text node different)'
);
} );
} );

File Metadata

Mime Type
text/html
Expires
Oct 4 2026, 17:04 (5 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0c/2f/c85f5f804db571295d62b9f45956
Default Alt Text
testrunner.test.js (2 KB)

Event Timeline