Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit bd9afb5

Browse files
normalizing list items in numberLines tests
1 parent c3c6178 commit bd9afb5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

js-modules/numberLines_test.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ <h1>Number Lines Test</h1>
7878
}
7979

8080
setTimeout(function () {
81+
function normListItems(html) {
82+
// IE likes to leave out </li>s before <li>s.
83+
return html.replace(/<\/li>(<li\b)/g, '$1');
84+
}
85+
8186
var testInputs = Array.prototype.slice.call(
8287
document.body.getElementsByClassName('testinput'), 0);
8388
for (var i = 0, n = testInputs.length; i < n; ++i) {
@@ -92,9 +97,12 @@ <h1>Number Lines Test</h1>
9297
testInputClone.removeAttribute('class'); // Not IE.
9398
actual.appendChild(testInputClone);
9499
numberLines(testInputClone);
95-
var passed = testResult.innerHTML === actual.innerHTML;
100+
var goldenNorm = normListItems(testResult.innerHTML);
101+
var actualNorm = normListItems(actual.innerHTML);
102+
var passed = goldenNorm === actualNorm;
96103
if (!passed) {
97-
console.log(JSON.stringify(testResult.innerHTML) + ' !==\n' + JSON.stringify(actual.innerHTML));
104+
console.log(JSON.stringify(goldenNorm)
105+
+ ' !==\n' + JSON.stringify(actualNorm));
98106
}
99107
actual.className = passed ? 'ok' : 'failure';
100108
} catch (ex) {
@@ -107,5 +115,5 @@ <h1>Number Lines Test</h1>
107115

108116
<hr>
109117
<address></address>
110-
<!-- hhmts start --> Last modified: Tue Mar 29 15:52:29 PDT 2011 <!-- hhmts end -->
118+
<!-- hhmts start --> Last modified: Tue Mar 29 16:42:02 PDT 2011 <!-- hhmts end -->
111119
</body> </html>

0 commit comments

Comments
 (0)