File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -370,3 +370,30 @@ test('should parse with input in button', t => {
370
370
] ;
371
371
t . deepEqual ( tree , expected ) ;
372
372
} ) ;
373
+
374
+ test ( 'should parse no value attribute as `true` when `recognizeNoValueAttribute` is `true` ' , t => {
375
+ const tree = parser (
376
+ '<div class="className" hasClass>Content</div>' ,
377
+ { recognizeNoValueAttribute : true }
378
+ ) ;
379
+ const expected = [
380
+ {
381
+ tag : 'div' ,
382
+ attrs : { class : 'className' , hasClass : true } ,
383
+ content : [ 'Content' ]
384
+ }
385
+ ] ;
386
+ t . deepEqual ( tree , expected ) ;
387
+ } ) ;
388
+
389
+ test ( 'should parse no value attribute as empty string when `recognizeNoValueAttribute` is `false` or not set ' , t => {
390
+ const tree = parser ( '<div class="className" hasClass>Content</div>' ) ;
391
+ const expected = [
392
+ {
393
+ tag : 'div' ,
394
+ attrs : { class : 'className' , hasClass : '' } ,
395
+ content : [ 'Content' ]
396
+ }
397
+ ] ;
398
+ t . deepEqual ( tree , expected ) ;
399
+ } ) ;
You can’t perform that action at this time.
0 commit comments