@@ -9,17 +9,17 @@ var tree = remark().parse('Some *emphasis*, **importance**, and `code`.')
9
9
var paragraph = tree . children [ 0 ]
10
10
var children = paragraph . children
11
11
12
- test ( 'unist-util-find-before' , function ( t ) {
12
+ test ( 'unist-util-find-before' , function ( t ) {
13
13
t . throws (
14
- function ( ) {
14
+ function ( ) {
15
15
findBefore ( )
16
16
} ,
17
17
/ E x p e c t e d p a r e n t n o d e / ,
18
18
'should fail without parent'
19
19
)
20
20
21
21
t . throws (
22
- function ( ) {
22
+ function ( ) {
23
23
findBefore ( {
24
24
type : 'foo'
25
25
} )
@@ -28,22 +28,22 @@ test('unist-util-find-before', function(t) {
28
28
'should fail without parent node'
29
29
)
30
30
31
- t . doesNotThrow ( function ( ) {
32
- assert . throws ( function ( ) {
31
+ t . doesNotThrow ( function ( ) {
32
+ assert . throws ( function ( ) {
33
33
findBefore ( { type : 'foo' , children : [ ] } )
34
34
} , / E x p e c t e d p o s i t i v e f i n i t e i n d e x o r c h i l d n o d e / )
35
35
36
- assert . throws ( function ( ) {
36
+ assert . throws ( function ( ) {
37
37
findBefore ( { type : 'foo' , children : [ ] } , - 1 )
38
38
} , / E x p e c t e d p o s i t i v e f i n i t e i n d e x o r c h i l d n o d e / )
39
39
40
- assert . throws ( function ( ) {
40
+ assert . throws ( function ( ) {
41
41
findBefore ( { type : 'foo' , children : [ ] } , { type : 'bar' } )
42
42
} , / E x p e c t e d p o s i t i v e f i n i t e i n d e x o r c h i l d n o d e / )
43
43
} , 'should fail without index' )
44
44
45
- t . doesNotThrow ( function ( ) {
46
- assert . throws ( function ( ) {
45
+ t . doesNotThrow ( function ( ) {
46
+ assert . throws ( function ( ) {
47
47
findBefore (
48
48
{
49
49
type : 'foo' ,
@@ -54,7 +54,7 @@ test('unist-util-find-before', function(t) {
54
54
)
55
55
} , / E x p e c t e d f u n c t i o n , s t r i n g , o r o b j e c t a s t e s t / )
56
56
57
- assert . throws ( function ( ) {
57
+ assert . throws ( function ( ) {
58
58
findBefore (
59
59
{
60
60
type : 'foo' ,
@@ -66,13 +66,13 @@ test('unist-util-find-before', function(t) {
66
66
} , / E x p e c t e d f u n c t i o n , s t r i n g , o r o b j e c t a s t e s t / )
67
67
} , 'should fail for invalid `test`' )
68
68
69
- t . doesNotThrow ( function ( ) {
69
+ t . doesNotThrow ( function ( ) {
70
70
assert . strictEqual ( findBefore ( paragraph , children [ 1 ] ) , children [ 0 ] )
71
71
assert . strictEqual ( findBefore ( paragraph , 1 ) , children [ 0 ] )
72
72
assert . strictEqual ( findBefore ( paragraph , 0 ) , null )
73
73
} , 'should return the preceding node when without `test`' )
74
74
75
- t . doesNotThrow ( function ( ) {
75
+ t . doesNotThrow ( function ( ) {
76
76
assert . strictEqual ( findBefore ( paragraph , 100 , children [ 0 ] ) , children [ 0 ] )
77
77
assert . strictEqual (
78
78
findBefore ( paragraph , children [ 1 ] , children [ 0 ] ) ,
@@ -84,7 +84,7 @@ test('unist-util-find-before', function(t) {
84
84
assert . strictEqual ( findBefore ( paragraph , 1 , children [ 1 ] ) , null )
85
85
} , 'should return `node` when given a `node` and existing' )
86
86
87
- t . doesNotThrow ( function ( ) {
87
+ t . doesNotThrow ( function ( ) {
88
88
assert . strictEqual ( findBefore ( paragraph , 100 , 'strong' ) , children [ 3 ] )
89
89
assert . strictEqual ( findBefore ( paragraph , 3 , 'strong' ) , null )
90
90
assert . strictEqual (
@@ -94,7 +94,7 @@ test('unist-util-find-before', function(t) {
94
94
assert . strictEqual ( findBefore ( paragraph , children [ 3 ] , 'strong' ) , null )
95
95
} , 'should return a child when given a `type` and existing' )
96
96
97
- t . doesNotThrow ( function ( ) {
97
+ t . doesNotThrow ( function ( ) {
98
98
assert . strictEqual ( findBefore ( paragraph , 100 , test ) , children [ 3 ] )
99
99
assert . strictEqual ( findBefore ( paragraph , 3 , test ) , null )
100
100
assert . strictEqual ( findBefore ( paragraph , children [ 4 ] , test ) , children [ 3 ] )
0 commit comments