Skip to content

Commit 70d8a73

Browse files
committed
Add a more complex positional info check
1 parent e08fd41 commit 70d8a73

File tree

1 file changed

+87
-14
lines changed

1 file changed

+87
-14
lines changed

test.js

Lines changed: 87 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,10 @@ test('gfmTableFromMarkdown', () => {
7575
)
7676

7777
assert.deepEqual(
78-
removePosition(
79-
fromMarkdown('| a | b | c | d |\n| - | :- | -: | :-: |', {
80-
extensions: [gfmTable],
81-
mdastExtensions: [gfmTableFromMarkdown]
82-
}),
83-
true
84-
),
78+
fromMarkdown('| a | b | c | d |\n| - | :- | -: | :-: |', {
79+
extensions: [gfmTable],
80+
mdastExtensions: [gfmTableFromMarkdown]
81+
}),
8582
{
8683
type: 'root',
8784
children: [
@@ -92,15 +89,91 @@ test('gfmTableFromMarkdown', () => {
9289
{
9390
type: 'tableRow',
9491
children: [
95-
{type: 'tableCell', children: [{type: 'text', value: 'a'}]},
96-
{type: 'tableCell', children: [{type: 'text', value: 'b'}]},
97-
{type: 'tableCell', children: [{type: 'text', value: 'c'}]},
98-
{type: 'tableCell', children: [{type: 'text', value: 'd'}]}
99-
]
92+
{
93+
type: 'tableCell',
94+
children: [
95+
{
96+
type: 'text',
97+
value: 'a',
98+
position: {
99+
start: {line: 1, column: 3, offset: 2},
100+
end: {line: 1, column: 4, offset: 3}
101+
}
102+
}
103+
],
104+
position: {
105+
start: {line: 1, column: 1, offset: 0},
106+
end: {line: 1, column: 5, offset: 4}
107+
}
108+
},
109+
{
110+
type: 'tableCell',
111+
children: [
112+
{
113+
type: 'text',
114+
value: 'b',
115+
position: {
116+
start: {line: 1, column: 7, offset: 6},
117+
end: {line: 1, column: 8, offset: 7}
118+
}
119+
}
120+
],
121+
position: {
122+
start: {line: 1, column: 5, offset: 4},
123+
end: {line: 1, column: 9, offset: 8}
124+
}
125+
},
126+
{
127+
type: 'tableCell',
128+
children: [
129+
{
130+
type: 'text',
131+
value: 'c',
132+
position: {
133+
start: {line: 1, column: 11, offset: 10},
134+
end: {line: 1, column: 12, offset: 11}
135+
}
136+
}
137+
],
138+
position: {
139+
start: {line: 1, column: 9, offset: 8},
140+
end: {line: 1, column: 13, offset: 12}
141+
}
142+
},
143+
{
144+
type: 'tableCell',
145+
children: [
146+
{
147+
type: 'text',
148+
value: 'd',
149+
position: {
150+
start: {line: 1, column: 15, offset: 14},
151+
end: {line: 1, column: 16, offset: 15}
152+
}
153+
}
154+
],
155+
position: {
156+
start: {line: 1, column: 13, offset: 12},
157+
end: {line: 1, column: 18, offset: 17}
158+
}
159+
}
160+
],
161+
position: {
162+
start: {line: 1, column: 1, offset: 0},
163+
end: {line: 1, column: 18, offset: 17}
164+
}
100165
}
101-
]
166+
],
167+
position: {
168+
start: {line: 1, column: 1, offset: 0},
169+
end: {line: 2, column: 22, offset: 39}
170+
}
102171
}
103-
]
172+
],
173+
position: {
174+
start: {line: 1, column: 1, offset: 0},
175+
end: {line: 2, column: 22, offset: 39}
176+
}
104177
},
105178
'should support alignment'
106179
)

0 commit comments

Comments
 (0)