@@ -16,29 +16,29 @@ var toH = require('.')
16
16
17
17
var processor = rehype ( ) . data ( 'settings' , { fragment : true , position : false } )
18
18
19
- test ( 'hast-to-hyperscript' , function ( t ) {
19
+ test ( 'hast-to-hyperscript' , function ( t ) {
20
20
var hast
21
21
22
22
t . equal ( typeof toH , 'function' , 'should expose a function' )
23
23
24
- t . test ( 'should throw if not given h' , function ( st ) {
25
- t . throws ( function ( ) {
24
+ t . test ( 'should throw if not given h' , function ( st ) {
25
+ t . throws ( function ( ) {
26
26
toH ( null , u ( 'element' ) )
27
27
} , / h i s n o t a f u n c t i o n / )
28
28
29
29
st . end ( )
30
30
} )
31
31
32
- t . test ( 'should throw if not given a node' , function ( st ) {
33
- t . throws ( function ( ) {
32
+ t . test ( 'should throw if not given a node' , function ( st ) {
33
+ t . throws ( function ( ) {
34
34
toH ( h )
35
35
} , / E x p e c t e d r o o t o r e l e m e n t , n o t ` u n d e f i n e d ` / )
36
36
37
- t . throws ( function ( ) {
37
+ t . throws ( function ( ) {
38
38
toH ( h , u ( 'text' , 'Alpha' ) )
39
39
} , / E r r o r : E x p e c t e d r o o t o r e l e m e n t , n o t ` t e x t ` / )
40
40
41
- t . throws ( function ( ) {
41
+ t . throws ( function ( ) {
42
42
toH ( h , u ( 'text' , 'value' ) )
43
43
} , / E x p e c t e d r o o t o r e l e m e n t / )
44
44
@@ -147,7 +147,7 @@ test('hast-to-hyperscript', function(t) {
147
147
'</div>'
148
148
] . join ( '' )
149
149
150
- t . test ( 'should support `hyperscript`' , function ( st ) {
150
+ t . test ( 'should support `hyperscript`' , function ( st ) {
151
151
// `hyperscript` does not support SVG (camelcased props).
152
152
var baseline = doc . replace ( / v i e w B o x / , 'viewbox' )
153
153
var actual = toH ( h , hast )
@@ -185,7 +185,7 @@ test('hast-to-hyperscript', function(t) {
185
185
st . end ( )
186
186
} )
187
187
188
- t . test ( 'should support `virtual-dom/h`' , function ( st ) {
188
+ t . test ( 'should support `virtual-dom/h`' , function ( st ) {
189
189
var baseline = doc . replace ( / c o l o r : r e d ; / , 'color: red' )
190
190
var actual = toH ( v , hast )
191
191
var expected = v ( 'div' , { key : 'h-1' } , [
@@ -253,7 +253,9 @@ test('hast-to-hyperscript', function(t) {
253
253
st . end ( )
254
254
} )
255
255
256
- t . test ( 'should support `React.createElement` in `development`' , function ( st ) {
256
+ t . test ( 'should support `React.createElement` in `development`' , function (
257
+ st
258
+ ) {
257
259
var currentEnv = process . env . NODE_ENV
258
260
var baseline = doc . replace ( / c o l o r : r e d ; / , 'color:red' )
259
261
process . env . NODE_ENV = 'development'
@@ -321,7 +323,7 @@ test('hast-to-hyperscript', function(t) {
321
323
st . end ( )
322
324
} )
323
325
324
- t . test ( 'should support `React.createElement` in `production`' , function ( st ) {
326
+ t . test ( 'should support `React.createElement` in `production`' , function ( st ) {
325
327
var currentEnv = process . env . NODE_ENV
326
328
var baseline = doc . replace ( / c o l o r : r e d ; / , 'color:red' )
327
329
process . env . NODE_ENV = 'production'
@@ -388,15 +390,15 @@ test('hast-to-hyperscript', function(t) {
388
390
st . end ( )
389
391
} )
390
392
391
- t . test ( 'should support `Vue`' , function ( st ) {
393
+ t . test ( 'should support `Vue`' , function ( st ) {
392
394
var baseline = doc . replace ( / < d i v > / , '<div data-server-rendered="true">' )
393
395
var actual
394
396
var expected
395
397
396
398
st . plan ( 3 )
397
399
398
400
Promise . all ( [ vueToString ( actualRender ) , vueToString ( expectedRender ) ] )
399
- . then ( function ( all ) {
401
+ . then ( function ( all ) {
400
402
var actualString = all [ 0 ]
401
403
var expectedString = all [ 0 ]
402
404
@@ -409,7 +411,7 @@ test('hast-to-hyperscript', function(t) {
409
411
'equal output baseline'
410
412
)
411
413
} )
412
- . catch ( function ( error ) {
414
+ . catch ( function ( error ) {
413
415
st . ifErr ( error , 'did not expect an error' )
414
416
} )
415
417
@@ -501,7 +503,7 @@ test('hast-to-hyperscript', function(t) {
501
503
}
502
504
} )
503
505
504
- t . test ( 'should support keys' , function ( st ) {
506
+ t . test ( 'should support keys' , function ( st ) {
505
507
st . equal (
506
508
toH ( h , u ( 'element' , { tagName : 'div' } ) ) . key ,
507
509
undefined ,
@@ -561,7 +563,7 @@ test('hast-to-hyperscript', function(t) {
561
563
)
562
564
563
565
st . throws (
564
- function ( ) {
566
+ function ( ) {
565
567
toH (
566
568
r ,
567
569
u ( 'element' , {
@@ -570,7 +572,7 @@ test('hast-to-hyperscript', function(t) {
570
572
} )
571
573
)
572
574
} ,
573
- / ^ E r r o r : d i v \[ s t y l e \ ]: 1 : 1 2 : E n d o f c o m m e n t m i s s i n g $ / ,
575
+ / ^ E r r o r : d i v \[ s t y l e ] :1 : 1 2 : E n d o f c o m m e n t m i s s i n g $ / ,
574
576
'react: should ignore invalid style declarations'
575
577
)
576
578
@@ -601,7 +603,7 @@ test('hast-to-hyperscript', function(t) {
601
603
st . end ( )
602
604
} )
603
605
604
- t . test ( 'should support space' , function ( st ) {
606
+ t . test ( 'should support space' , function ( st ) {
605
607
st . equal (
606
608
toH ( v , u ( 'element' , { tagName : 'div' } ) ) . namespace ,
607
609
null ,
@@ -623,7 +625,7 @@ test('hast-to-hyperscript', function(t) {
623
625
st . end ( )
624
626
} )
625
627
626
- t . test ( 'flattens a `root` with one element to that child' , function ( st ) {
628
+ t . test ( 'flattens a `root` with one element to that child' , function ( st ) {
627
629
var actual = toH (
628
630
h ,
629
631
u ( 'root' , [ u ( 'element' , { tagName : 'h1' , properties : { id : 'a' } } , [ ] ) ] )
@@ -636,7 +638,7 @@ test('hast-to-hyperscript', function(t) {
636
638
st . end ( )
637
639
} )
638
640
639
- t . test ( 'flattens a `root` without children to a `div`' , function ( st ) {
641
+ t . test ( 'flattens a `root` without children to a `div`' , function ( st ) {
640
642
var actual = toH ( h , u ( 'root' , [ ] ) )
641
643
var expected = h ( 'div' )
642
644
var doc = '<div></div>'
@@ -646,7 +648,7 @@ test('hast-to-hyperscript', function(t) {
646
648
st . end ( )
647
649
} )
648
650
649
- t . test ( 'flattens a `root` with a text child to a `div`' , function ( st ) {
651
+ t . test ( 'flattens a `root` with a text child to a `div`' , function ( st ) {
650
652
var actual = toH ( h , u ( 'root' , [ u ( 'text' , 'Alpha' ) ] ) )
651
653
var expected = h ( 'div' , 'Alpha' )
652
654
var doc = '<div>Alpha</div>'
@@ -656,7 +658,7 @@ test('hast-to-hyperscript', function(t) {
656
658
st . end ( )
657
659
} )
658
660
659
- t . test ( 'flattens a `root` with more children to a `div`' , function ( st ) {
661
+ t . test ( 'flattens a `root` with more children to a `div`' , function ( st ) {
660
662
var actual = toH (
661
663
h ,
662
664
u ( 'root' , [
@@ -672,7 +674,7 @@ test('hast-to-hyperscript', function(t) {
672
674
st . end ( )
673
675
} )
674
676
675
- t . test ( 'should support mapping to React properties' , function ( st ) {
677
+ t . test ( 'should support mapping to React properties' , function ( st ) {
676
678
var actual = toH (
677
679
r ,
678
680
u (
@@ -707,7 +709,7 @@ test('hast-to-hyperscript', function(t) {
707
709
st . end ( )
708
710
} )
709
711
710
- t . test ( 'should use a node as a rendering context' , function ( st ) {
712
+ t . test ( 'should use a node as a rendering context' , function ( st ) {
711
713
function mockR ( ) {
712
714
return {
713
715
node : this
0 commit comments