Skip to content

Commit

Permalink
De-flake document-write/051.html test
Browse files Browse the repository at this point in the history
The trailing \n was sometimes included and sometimes not,
depending on parse timing. Now it looks for the trailing
<div> and checks based on that.

Fixed: 1254934
Change-Id: Ic443fd587922c8af7ddde5496fb195a488e178fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3246461
Commit-Queue: Mason Freed <masonf@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#935259}
  • Loading branch information
Mason Freed authored and chromium-wpt-export-bot committed Oct 27, 2021
1 parent facfe02 commit d651830
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions html/webappapis/dynamic-markup-insertion/document-write/051.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
<!doctype html>
<title>document.write \r\n</title>
<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script>
<div id="log"></div><script>
var t = async_test()
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div id="log"></div>

<script>
var t = async_test();

t.step(function() {
document.write("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nA");
})

onload = function() {
t.step(function() {
assert_equals(document.body.lastChild.data, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nA\n");
const lastNode = document.getElementById('after');
assert_equals(lastNode.previousSibling.data, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nAB");
});
t.done();
};
</script>
</script>B<div id=after></div>

0 comments on commit d651830

Please sign in to comment.