Skip to content

Commit 70bd8ad

Browse files
update
1 parent c2d6944 commit 70bd8ad

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/generators/jsx-ast/utils/__tests__/buildContent.test.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ describe('transformHeadingNode (deprecation Type -> AlertBox level)', () => {
2929
transformHeadingNode(entry, {}, node, 0, parent);
3030

3131
const alert = parent.children[1];
32-
assert.equal(alert.name, 'AlertBox');
3332
const levelAttr = alert.attributes.find(a => a.name === 'level');
34-
assert.ok(levelAttr);
33+
34+
assert.equal(alert.name, 'AlertBox');
3535
assert.equal(levelAttr.value, 'info');
3636
});
3737

@@ -43,9 +43,9 @@ describe('transformHeadingNode (deprecation Type -> AlertBox level)', () => {
4343
transformHeadingNode(entry, {}, node, 0, parent);
4444

4545
const alert = parent.children[1];
46-
assert.equal(alert.name, 'AlertBox');
4746
const levelAttr = alert.attributes.find(a => a.name === 'level');
48-
assert.ok(levelAttr);
47+
48+
assert.equal(alert.name, 'AlertBox');
4949
assert.equal(levelAttr.value, 'warning');
5050
});
5151

src/generators/jsx-ast/utils/buildContent.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,10 @@ export const transformHeadingNode = (entry, remark, node, index, parent) => {
201201
{ textHandling: { boundaries: 'preserve' } }
202202
).node.children;
203203

204-
const typeText = sliced[0].value;
205-
206204
parent.children[index + 1] = createJSXElement(JSX_IMPORTS.AlertBox.name, {
207205
children: sliced,
208-
level: getLevelFromDeprecationType(typeText),
206+
// we assume sliced[0] is a text node here that contains the type text
207+
level: getLevelFromDeprecationType(sliced[0].value),
209208
title: 'Type',
210209
});
211210
}

0 commit comments

Comments
 (0)