Skip to content

Commit fe008b0

Browse files
authored
Merge pull request #1128 from lightpanda-io/console_trace_svg_test
Add console.trace and svg attribute test
2 parents a65aa9f + 4ad10d0 commit fe008b0

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/browser/console/console.zig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ pub const Console = struct {
7171
});
7272
}
7373

74+
pub fn _trace(values: []js.Object, page: *Page) !void {
75+
if (values.len == 0) {
76+
return;
77+
}
78+
log.debug(.console, "debug", .{
79+
.stack = page.js.stackTrace() catch "???",
80+
.args = try serializeValues(values, page),
81+
});
82+
}
83+
7484
pub fn _clear() void {}
7585

7686
pub fn _count(self: *Console, label_: ?[]const u8, page: *Page) !void {

src/tests/html/svg.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
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">
5+
<rect></rect>
6+
<text x="100" y="95" font-size="14" text-anchor="middle">OVER 9000!!</text>
7+
</svg>
8+
49
<script id=svg>
510
testing.expectEqual(false, 'AString' instanceof SVGElement);
11+
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'));
619
</script>

vendor/netsurf/libdom

0 commit comments

Comments
 (0)