Skip to content

Commit 25aacb6

Browse files
apply changes
1 parent 914e536 commit 25aacb6

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ import { describe, it } from 'node:test';
33

44
import { transformHeadingNode } from '../buildContent.mjs';
55

6-
describe('transformHeadingNode (deprecation Type -> AlertBox level)', () => {
7-
const makeHeading = () => ({
8-
type: 'heading',
9-
depth: 3,
10-
data: { type: 'misc', slug: 's', text: 'Heading' },
11-
children: [{ type: 'text', value: 'Heading' }],
12-
});
6+
const heading = {
7+
type: 'heading',
8+
depth: 3,
9+
data: { type: 'misc', slug: 's', text: 'Heading' },
10+
children: [{ type: 'text', value: 'Heading' }],
11+
};
1312

14-
const makeParent = typeText => ({
15-
children: [
16-
makeHeading(),
17-
{
18-
type: 'paragraph',
19-
children: [{ type: 'text', value: `Type: ${typeText}` }],
20-
},
21-
],
22-
});
13+
const makeParent = typeText => ({
14+
children: [
15+
heading,
16+
{
17+
type: 'paragraph',
18+
children: [{ type: 'text', value: `Type: ${typeText}` }],
19+
},
20+
],
21+
});
2322

23+
describe('transformHeadingNode (deprecation Type -> AlertBox level)', () => {
2424
it('maps documentation/compilation to info', () => {
2525
const entry = { api: 'deprecations' };
2626
const parent = makeParent('Documentation');
@@ -57,9 +57,9 @@ describe('transformHeadingNode (deprecation Type -> AlertBox level)', () => {
5757
transformHeadingNode(entry, {}, node, 0, parent);
5858

5959
const alert = parent.children[1];
60-
assert.equal(alert.name, 'AlertBox');
6160
const levelAttr = alert.attributes.find(a => a.name === 'level');
62-
assert.ok(levelAttr);
61+
62+
assert.equal(alert.name, 'AlertBox');
6363
assert.equal(levelAttr.value, 'danger');
6464
});
6565
});

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
TYPE_PREFIX_LENGTH,
2121
} from '../constants.mjs';
2222
import insertSignature, { getFullName } from './buildSignature.mjs';
23-
import { transformNodesToString } from '../../../utils/unist.mjs';
2423

2524
/**
2625
* Processes lifecycle and change history data into a sorted array of change entries.
@@ -211,7 +210,7 @@ export const transformHeadingNode = (entry, remark, node, index, parent) => {
211210
{ textHandling: { boundaries: 'preserve' } }
212211
).node.children;
213212

214-
const typeText = transformNodesToString(sliced);
213+
const typeText = sliced[0].value;
215214

216215
parent.children[index + 1] = createJSXElement(JSX_IMPORTS.AlertBox.name, {
217216
children: sliced,

0 commit comments

Comments
 (0)