|
1 | | -'use strict'; |
| 1 | +'use strict' |
2 | 2 |
|
3 | | -var test = require('tape'); |
4 | | -var remark = require('remark')(); |
5 | | -var style = require('.'); |
| 3 | +var test = require('tape') |
| 4 | +var remark = require('remark')() |
| 5 | +var style = require('.') |
6 | 6 |
|
7 | | -test('mdast-util-heading-style', function (t) { |
8 | | - t.throws( |
9 | | - function () { |
10 | | - style(); |
11 | | - }, |
12 | | - 'should fail without node' |
13 | | - ); |
| 7 | +test('mdast-util-heading-style', function(t) { |
| 8 | + t.throws(function() { |
| 9 | + style() |
| 10 | + }, 'should fail without node') |
14 | 11 |
|
15 | 12 | t.equal( |
16 | 13 | style({ |
17 | 14 | type: 'heading', |
18 | | - children: [ |
19 | | - {type: 'text', value: 'foo'} |
20 | | - ] |
| 15 | + children: [{type: 'text', value: 'foo'}] |
21 | 16 | }), |
22 | 17 | null, |
23 | 18 | 'should NOT fail on undetectable nodes' |
24 | | - ); |
| 19 | + ) |
25 | 20 |
|
26 | | - t.equal( |
27 | | - style(remark.parse('# ATX').children[0]), |
28 | | - 'atx', |
29 | | - 'should detect atx' |
30 | | - ); |
| 21 | + t.equal(style(remark.parse('# ATX').children[0]), 'atx', 'should detect atx') |
31 | 22 |
|
32 | 23 | t.equal( |
33 | 24 | style(remark.parse('# ATX #').children[0]), |
34 | 25 | 'atx-closed', |
35 | 26 | 'should detect closed atx' |
36 | | - ); |
| 27 | + ) |
37 | 28 |
|
38 | 29 | t.equal( |
39 | 30 | style(remark.parse('ATX\n===').children[0]), |
40 | 31 | 'setext', |
41 | 32 | 'should detect closed setext' |
42 | | - ); |
| 33 | + ) |
43 | 34 |
|
44 | 35 | t.equal( |
45 | 36 | style(remark.parse('### ATX').children[0]), |
46 | 37 | null, |
47 | 38 | 'should work on ambiguous nodes' |
48 | | - ); |
| 39 | + ) |
49 | 40 |
|
50 | 41 | t.equal( |
51 | 42 | style(remark.parse('### ATX').children[0], 'atx'), |
52 | 43 | 'atx', |
53 | 44 | 'should work on ambiguous nodes (preference to atx)' |
54 | | - ); |
| 45 | + ) |
55 | 46 |
|
56 | 47 | t.equal( |
57 | 48 | style(remark.parse('### ATX').children[0], 'setext'), |
58 | 49 | 'setext', |
59 | 50 | 'should work on ambiguous nodes (preference to setext)' |
60 | | - ); |
| 51 | + ) |
61 | 52 |
|
62 | 53 | t.equal( |
63 | 54 | style(remark.parse('###### ######').children[0]), |
64 | 55 | 'atx-closed', |
65 | 56 | 'should work on empty nodes (#1)' |
66 | | - ); |
| 57 | + ) |
67 | 58 |
|
68 | 59 | t.equal( |
69 | 60 | style(remark.parse('### ###').children[0]), |
70 | 61 | 'atx-closed', |
71 | 62 | 'should work on empty nodes (#2)' |
72 | | - ); |
| 63 | + ) |
73 | 64 |
|
74 | 65 | t.equal( |
75 | 66 | style(remark.parse('# #').children[0]), |
76 | 67 | 'atx-closed', |
77 | 68 | 'should work on empty nodes (#3)' |
78 | | - ); |
| 69 | + ) |
79 | 70 |
|
80 | 71 | t.equal( |
81 | 72 | style(remark.parse('###### ').children[0], 'atx'), |
82 | 73 | 'atx', |
83 | 74 | 'should work on empty nodes (#4)' |
84 | | - ); |
| 75 | + ) |
85 | 76 |
|
86 | 77 | t.equal( |
87 | 78 | style(remark.parse('### ').children[0], 'atx'), |
88 | 79 | 'atx', |
89 | 80 | 'should work on empty nodes (#5)' |
90 | | - ); |
| 81 | + ) |
91 | 82 |
|
92 | 83 | t.equal( |
93 | 84 | style(remark.parse('## ').children[0]), |
94 | 85 | 'atx', |
95 | 86 | 'should work on empty nodes (#6)' |
96 | | - ); |
| 87 | + ) |
97 | 88 |
|
98 | 89 | t.equal( |
99 | 90 | style(remark.parse('###### ').children[0], 'setext'), |
100 | 91 | 'setext', |
101 | 92 | 'should work on empty nodes (#7)' |
102 | | - ); |
| 93 | + ) |
103 | 94 |
|
104 | 95 | t.equal( |
105 | 96 | style(remark.parse('### ').children[0], 'setext'), |
106 | 97 | 'setext', |
107 | 98 | 'should work on empty nodes (#8)' |
108 | | - ); |
| 99 | + ) |
109 | 100 |
|
110 | 101 | t.equal( |
111 | 102 | style(remark.parse('## ').children[0], 'setext'), |
112 | 103 | 'atx', |
113 | 104 | 'should work on empty nodes (#9)' |
114 | | - ); |
| 105 | + ) |
115 | 106 |
|
116 | | - t.end(); |
117 | | -}); |
| 107 | + t.end() |
| 108 | +}) |
0 commit comments