@@ -26,7 +26,7 @@ describe('htm', () => {
26
26
expect ( html `< div /> ` ) . toEqual ( { tag : 'div' , props : null , children : [ ] } ) ;
27
27
expect ( html `< span /> ` ) . toEqual ( { tag : 'span' , props : null , children : [ ] } ) ;
28
28
} ) ;
29
-
29
+
30
30
test ( 'multiple root elements' , ( ) => {
31
31
expect ( html `< a /> < b > </ b > < c > </ /> ` ) . toEqual ( [
32
32
{ tag : 'a' , props : null , children : [ ] } ,
@@ -64,7 +64,7 @@ describe('htm', () => {
64
64
test ( 'single prop with static value' , ( ) => {
65
65
expect ( html `< a href ="/hello " /> ` ) . toEqual ( { tag : 'a' , props : { href : '/hello' } , children : [ ] } ) ;
66
66
} ) ;
67
-
67
+
68
68
test ( 'single prop with static value followed by a single boolean prop' , ( ) => {
69
69
expect ( html `< a href ="/hello " b /> ` ) . toEqual ( { tag : 'a' , props : { href : '/hello' , b : true } , children : [ ] } ) ;
70
70
} ) ;
@@ -115,7 +115,7 @@ describe('htm', () => {
115
115
test ( 'multiple spread props in one element' , ( ) => {
116
116
expect ( html `< a ... ${ { foo : 'bar' } } ... ${ { quux : 'baz' } } /> ` ) . toEqual ( { tag : 'a' , props : { foo : 'bar' , quux : 'baz' } , children : [ ] } ) ;
117
117
} ) ;
118
-
118
+
119
119
test ( 'mixed spread + static props' , ( ) => {
120
120
expect ( html `< a b ... ${ { foo : 'bar' } } /> ` ) . toEqual ( { tag : 'a' , props : { b : true , foo : 'bar' } , children : [ ] } ) ;
121
121
expect ( html `< a b c ... ${ { foo : 'bar' } } /> ` ) . toEqual ( { tag : 'a' , props : { b : true , c : true , foo : 'bar' } , children : [ ] } ) ;
@@ -185,17 +185,17 @@ describe('htm', () => {
185
185
test ( 'hyphens (-) are allowed in attribute names' , ( ) => {
186
186
expect ( html `< a b-c > </ a > ` ) . toEqual ( h ( 'a' , { 'b-c' : true } ) ) ;
187
187
} ) ;
188
-
188
+
189
189
test ( 'NUL characters are allowed in attribute values' , ( ) => {
190
190
expect ( html `< a b ="\0"> </ a > ` ) . toEqual ( h ( 'a' , { b : '\0' } ) ) ;
191
191
expect ( html `< a b ="\0" c =${ 'foo' } > </ a > ` ) . toEqual ( h ( 'a' , { b : '\0' , c : 'foo' } ) ) ;
192
192
} ) ;
193
-
193
+
194
194
test ( 'NUL characters are allowed in text' , ( ) => {
195
195
expect ( html `< a > \0</ a > ` ) . toEqual ( h ( 'a' , null , '\0' ) ) ;
196
196
expect ( html `< a > \0${ 'foo' } </ a > ` ) . toEqual ( h ( 'a' , null , '\0' , 'foo' ) ) ;
197
197
} ) ;
198
-
198
+
199
199
test ( 'cache key should be unique' , ( ) => {
200
200
html `< a b ="${ 'foo' } " /> ` ;
201
201
expect ( html `< a b ="\0" /> ` ) . toEqual ( h ( 'a' , { b : '\0' } ) ) ;
@@ -215,4 +215,10 @@ describe('htm', () => {
215
215
expect ( html `< a > <!-- ${ 'Hello, world!' } --> </ a > ` ) . toEqual ( h ( 'a' , null ) ) ;
216
216
expect ( html `< a > <!--> Hello, world <!--> </ a > ` ) . toEqual ( h ( 'a' , null ) ) ;
217
217
} ) ;
218
+
219
+ test ( 'unclosed tag' , ( ) => {
220
+ expect ( ( ) => {
221
+ html `< div < div > </ div > </ div > ` ;
222
+ } ) . not . toThrow ( ) ;
223
+ } ) ;
218
224
} ) ;
0 commit comments