fix iframe autoclosing

This commit is contained in:
Nazar Kanaev
2021-05-13 22:37:02 +01:00
parent 28f08ad42a
commit 37ed856d8b
2 changed files with 17 additions and 2 deletions

View File

@@ -163,6 +163,16 @@ func TestInvalidNestedTag(t *testing.T) {
}
}
func TestValidIFrame(t *testing.T) {
input := `<iframe src="http://example.org/"></iframe>`
expected := `<iframe src="http://example.org/" sandbox="allow-scripts allow-same-origin allow-popups" loading="lazy"></iframe>`
output := Sanitize("http://example.org/", input)
if expected != output {
t.Errorf("Wrong output:\nwant: %s\nhave: %s", expected, output)
}
}
func TestInvalidIFrame(t *testing.T) {
input := `<iframe src="http://example.org/"></iframe>`
expected := ``