Skip to content

Commit c9517af

Browse files
committed
Add tests for svg tag names
Depends on: lightpanda-io/libdom#46
1 parent 71e7aa5 commit c9517af

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

src/tests/html/svg.html

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,38 @@
11
<!DOCTYPE html>
22
<script src="../testing.js"></script>
33

4-
<svg width="200" height="100" style="border:1px solid #ccc" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 100">
4+
<svg id=lower width="200" height="100" style="border:1px solid #ccc" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 100">
55
<rect></rect>
66
<text x="100" y="95" font-size="14" text-anchor="middle">OVER 9000!!</text>
77
</svg>
88

9+
<SVG ID=UPPER WIDTH="200" HEIGHT="100" STYLE="BORDER:1PX SOLID #CCC" XMLNS="http://www.w3.org/2000/svg" VIEWBOX="0 0 200 100">
10+
<RECT></RECT>
11+
<TEXT X="100" Y="95" FONT-SIZE="14" TEXT-ANCHOR="MIDDLE">OVER 9000!!!</TEXT>
12+
</SVG>
13+
914
<script id=svg>
1015
testing.expectEqual(false, 'AString' instanceof SVGElement);
1116

12-
const svg = document.querySelector('svg');
13-
testing.expectEqual('http://www.w3.org/2000/svg', svg.getAttribute('xmlns'));
14-
testing.expectEqual('http://www.w3.org/2000/svg', svg.getAttributeNode('xmlns').value);
15-
testing.expectEqual('http://www.w3.org/2000/svg', svg.attributes.getNamedItem('xmlns').value);
16-
testing.expectEqual('0 0 200 100', svg.getAttribute('viewBox'));
17-
testing.expectEqual('viewBox', svg.getAttributeNode('viewBox').name);
18-
testing.expectEqual(true, svg.outerHTML.includes('viewBox'));
17+
const svg1 = $('#lower');
18+
testing.expectEqual('http://www.w3.org/2000/svg', svg1.getAttribute('xmlns'));
19+
testing.expectEqual('http://www.w3.org/2000/svg', svg1.getAttributeNode('xmlns').value);
20+
testing.expectEqual('http://www.w3.org/2000/svg', svg1.attributes.getNamedItem('xmlns').value);
21+
testing.expectEqual('0 0 200 100', svg1.getAttribute('viewBox'));
22+
testing.expectEqual('viewBox', svg1.getAttributeNode('viewBox').name);
23+
testing.expectEqual(true, svg1.outerHTML.includes('viewBox'));
24+
testing.expectEqual('svg', svg1.tagName);
25+
testing.expectEqual('rect', svg1.querySelector('rect').tagName);
26+
testing.expectEqual('text', svg1.querySelector('text').tagName);
27+
28+
const svg2 = $('#UPPER');
29+
testing.expectEqual('http://www.w3.org/2000/svg', svg2.getAttribute('xmlns'));
30+
testing.expectEqual('http://www.w3.org/2000/svg', svg2.getAttributeNode('xmlns').value);
31+
testing.expectEqual('http://www.w3.org/2000/svg', svg2.attributes.getNamedItem('xmlns').value);
32+
testing.expectEqual('0 0 200 100', svg2.getAttribute('viewBox'));
33+
testing.expectEqual('viewBox', svg2.getAttributeNode('viewBox').name);
34+
testing.expectEqual(true, svg2.outerHTML.includes('viewBox'));
35+
testing.expectEqual('svg', svg2.tagName);
36+
testing.expectEqual('rect', svg2.querySelector('rect').tagName);
37+
testing.expectEqual('text', svg2.querySelector('text').tagName);
1938
</script>

vendor/netsurf/libdom

0 commit comments

Comments
 (0)