@@ -32,15 +32,32 @@ test("valid baseURL", (t) => {
3232} ) ;
3333
3434test ( "invalid baseURL" , ( t ) => {
35- const error = t . throws (
36- ( ) => {
37- inline (
38- "<html><head><style>h1 { color:red; }</style></head><body><h1>Test</h1></body></html>" ,
39- { baseUrl : "invalid" } ,
40- ) ;
41- } ,
42- undefined ,
43- "relative URL without a base" ,
44- ) ;
35+ const error = t . throws ( ( ) => {
36+ inline (
37+ "<html><head><style>h1 { color:red; }</style></head><body><h1>Test</h1></body></html>" ,
38+ { baseUrl : "foo" } ,
39+ ) ;
40+ } ) ;
4541 t . is ( error . code , "InvalidArg" ) ;
42+ t . is ( error . message , "relative URL without a base: foo" ) ;
43+ } ) ;
44+
45+ test ( "invalid href" , ( t ) => {
46+ const error = t . throws ( ( ) => {
47+ inline (
48+ "<html><head><link href='http:' rel='stylesheet' type='text/css'></head><body></body></html>" ,
49+ ) ;
50+ } ) ;
51+ t . is ( error . code , "GenericFailure" ) ;
52+ t . is ( error . message , "Invalid base URL: http:" ) ;
53+ } ) ;
54+
55+ test ( "invalid style" , ( t ) => {
56+ const error = t . throws ( ( ) => {
57+ inline (
58+ "<html><head><style>h1, h2 { color:red; }</style></head><body><h1 style='@wrong { color: --- }'>Hello world!</h1></body></html>" ,
59+ ) ;
60+ } ) ;
61+ t . is ( error . code , "GenericFailure" ) ;
62+ t . is ( error . message , "Invalid @ rule: wrong" ) ;
4663} ) ;
0 commit comments