diff --git a/src/browser/dump.zig b/src/browser/dump.zig
index 375952ca7..ca7736211 100644
--- a/src/browser/dump.zig
+++ b/src/browser/dump.zig
@@ -368,3 +368,60 @@ fn writeEscapedByte(input: []const u8, index: usize, writer: *std.Io.Writer) ![]
}
return input[index + 1 ..];
}
+
+const testing = @import("../testing.zig");
+
+// A fresh page per assertion: `with_base` mutates the document (it inserts a
+//
secret
visible & well
+ ); +} + +test "dump: with_base injects asecret
visible & well
+ ); +} + +test "dump: strip.js removes script and noscript" { + try expectDump(.{ .strip = .{ .js = true } }, + \\ + \\secret
visible & well
+ ); +} + +test "dump: strip.css removes style and stylesheet links" { + try expectDump(.{ .strip = .{ .css = true } }, + \\ + \\secret
visible & well
+ ); +} + +test "dump: strip.ui removes css plus visual elements" { + try expectDump(.{ .strip = .{ .ui = true } }, + \\ + \\secret
visible & well
+ ); +} + +test "dump: strip.invisible removes author display:none elements" { + try expectDump(.{ .strip = .{ .invisible = true } }, + \\ + \\visible & well
+ ); +} diff --git a/src/browser/tests/dump.html b/src/browser/tests/dump.html new file mode 100644 index 000000000..462a2e1f1 --- /dev/null +++ b/src/browser/tests/dump.html @@ -0,0 +1 @@ +secret
visible & well
\ No newline at end of file