aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader/sanitizer/sanitizer_test.go
diff options
context:
space:
mode:
authorGravatar dzaikos <you@example.com>2018-06-24 13:16:07 -0400
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-06-24 19:53:23 -0700
commitc9131b0e89db2989dd5e2e6894d6bec6c0075cb6 (patch)
tree773163ade06cf30c864642a9bd30c80082c53887 /reader/sanitizer/sanitizer_test.go
parentd847b10e32270c3cf7bafe6e2914e82bda39a924 (diff)
Improve sanitizer to remove style tag contents.
See #157. Refactored how blacklisted tags are handled so they're easier manage in the future.
Diffstat (limited to 'reader/sanitizer/sanitizer_test.go')
-rw-r--r--reader/sanitizer/sanitizer_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/reader/sanitizer/sanitizer_test.go b/reader/sanitizer/sanitizer_test.go
index fa7dd6d..374c107 100644
--- a/reader/sanitizer/sanitizer_test.go
+++ b/reader/sanitizer/sanitizer_test.go
@@ -232,3 +232,13 @@ func TestReplaceScript(t *testing.T) {
t.Errorf(`Wrong output: "%s" != "%s"`, expected, output)
}
}
+
+func TestReplaceStyle(t *testing.T) {
+ input := `<p>Before paragraph.</p><style>body { background-color: #ff0000; }</style><p>After paragraph.</p>`
+ expected := `<p>Before paragraph.</p><p>After paragraph.</p>`
+ output := Sanitize("http://example.org/", input)
+
+ if expected != output {
+ t.Errorf(`Wrong output: "%s" != "%s"`, expected, output)
+ }
+}