USING: html.parser kernel tools.test ;
IN: html.parser.tests
{
    V{ T{ tag f "html" H{ } f f } }
} [ "" parse-html ] unit-test
{
    V{ T{ tag f "html" H{ } f t } }
} [ "" parse-html ] unit-test
{
    V{ T{ tag f "a" H{ { "href" "http://factorcode.org/" } } f f } }
} [ "" parse-html ] unit-test
{
    V{ T{ tag f "a" H{ { "href" "http://factorcode.org/" } } f f } }
} [ "" parse-html ] unit-test
{
V{
    T{
        tag
        f
        "a"
        H{ { "baz" "\"quux\"" } { "foo" "bar's" } }
        f
        f
    }
}
} [ "" parse-html ] unit-test
{
V{
    T{ tag f "a"
        H{
            { "a" "pirsqd" }
            { "foo" "bar" }
            { "href" "http://factorcode.org/" }
            { "baz" "quux" }
        } f f }
}
} [ "" parse-html ] unit-test
{
V{
    T{ tag f "a"
        H{
            { "a" "pirsqd" }
            { "foo" "bar" }
            { "href" "http://factorcode.org/" }
            { "baz" "quux" }
            { "nofollow" "nofollow" }
        } f f }
}
} [ "" parse-html ] unit-test
{
V{
    T{ tag f "html" H{ } f f }
    T{ tag f "head" H{ } f f }
    T{ tag f "head" H{ } f t }
    T{ tag f "html" H{ } f t }
}
} [ "Spagna"
    parse-html
] unit-test
{
V{
    T{ tag { name comment } { text "comment" } }
}
} [
    "" parse-html
] unit-test
! Issue #1233, trailing / in tags
{
    V{
        T{ tag
            { name "img" }
            { attributes H{ { "src" "http://factorcode.org" } } }
        }
    }
}
[ " " parse-html ] unit-test
{
    V{
        T{ tag
            { name "img" }
            { attributes H{ { "src" "http://factorcode.org" } } }
        }
    }
}
[ "
" parse-html ] unit-test
{
    V{
        T{ tag
            { name "img" }
            { attributes H{ { "src" "http://factorcode.org" } } }
        }
    }
}
[ " " parse-html ] unit-test
{
    V{
        T{ tag
            { name "img" }
            { attributes H{ { "src" "http://factorcode.org" } } }
        }
    }
}
[ "
" parse-html ] unit-test
{
    V{
        T{ tag
            { name "img" }
            { attributes H{ { "src" "http://factorcode.org" } } }
        }
    }
}
[ " " parse-html ] unit-test
" parse-html ] unit-test