Merge pull request #1146 from lightpanda-io/test_normalized_text_nodes

add a test for the changes to parsing adjascent text ndoes
This commit is contained in:
Karl Seguin
2025-10-15 08:13:52 +08:00
committed by GitHub
3 changed files with 21 additions and 2 deletions

View File

@@ -224,3 +224,22 @@ let first_child = content.firstChild.nextSibling; // nextSibling because of line
testing.expectEqual(6, Node.ENTITY_NODE); testing.expectEqual(6, Node.ENTITY_NODE);
testing.expectEqual(12, Node.NOTATION_NODE); testing.expectEqual(12, Node.NOTATION_NODE);
</script> </script>
<span id=token class="token" style="color:#ce9178">&quot;puppeteer &quot;</span>
<h3 id=name>Leto
<!-- -->
<!-- -->
Atreides</h3>
<script id=normalize>
const token = $('#token');
testing.expectEqual('"puppeteer "', token.firstChild.nodeValue);
const name = $('#name');
testing.expectEqual([
"Leto\n ",
" ",
"\n ",
" ",
"\n Atreides"
], Array.from(name.childNodes).map((n) => n.nodeValue));
</script>