package postcard
import (
"context"
"errors"
"strings"
"testing"
)
// schemeFiller surrounds a case's markup, so a snippet that points at the
// offending markup is told apart from one that starts the document.
var schemeFiller = strings.Repeat("plain words here ", 6)
// TestURLSchemeCheck covers the anchored, decoded URL-scheme check of
// rendered HTML (WR-05): prose and URLs that merely contain a scheme word
// pass; every URL-bearing attribute, CSS, meta refresh and every
// character-reference or whitespace-split spelling of a script or data URL
// is refused, on a send with inlining on and off and in the editor.
func TestURLSchemeCheck(t *testing.T) {
t.Parallel()
accepts := []struct{ name, html string }{
{"prose_metadata", `
See the metadata: field
`},
{"prose_big_data", `
Big Data: Summit
`},
{"img_alt", ``},
{"title_text", `
Tips
`},
{"scheme_in_query", `x`},
// Escaped markup in a raw-text element is text to every reader.
{"textarea_escaped_link", ``},
{"title_escaped_link", ``},
{"noscript_safe_link", ``},
// Text shaped like an event handler is text (WR-02).
{"prose_handler_shaped", `