@astryxdesign/richtext 0.7.5 → 0.7.6-canary.bb18c81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/richtext",
|
|
3
3
|
"displayName": "Rich Text",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.6-canary.bb18c81",
|
|
5
5
|
"description": "Astryx rich text — a Lexical-based rich text editor and viewer, styled with Astryx design tokens.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
7
7
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@stylexjs/stylex": ">=0.10.0",
|
|
56
|
-
"@astryxdesign/core": "0.7.
|
|
56
|
+
"@astryxdesign/core": "0.7.6-canary.bb18c81",
|
|
57
57
|
"react": ">=19.0.0",
|
|
58
58
|
"react-dom": ">=19.0.0",
|
|
59
59
|
"lexical": "^0.52.0",
|
|
@@ -112,6 +112,8 @@
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
|
+
"@astryxdesign/a11y-spec": "0.7.6-canary.bb18c81",
|
|
116
|
+
"@astryxdesign/cli": "0.7.6-canary.bb18c81",
|
|
115
117
|
"@babel/cli": "^7.29.7",
|
|
116
118
|
"@babel/core": "^7.29.7",
|
|
117
119
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -130,9 +132,7 @@
|
|
|
130
132
|
"@lexical/utils": "^0.52.0",
|
|
131
133
|
"@stylexjs/babel-plugin": "^0.19.0",
|
|
132
134
|
"@testing-library/react": "^16.3.2",
|
|
133
|
-
"lexical": "^0.52.0"
|
|
134
|
-
"@astryxdesign/cli": "0.7.5",
|
|
135
|
-
"@astryxdesign/a11y-spec": "0.0.0"
|
|
135
|
+
"lexical": "^0.52.0"
|
|
136
136
|
},
|
|
137
137
|
"scripts": {
|
|
138
138
|
"build": "node ../../scripts/clean-dist.mjs && pnpm build:esm && tsc --project tsconfig.build.json && node ../../scripts/add-declaration-extensions.mjs && pnpm build:css && node ../../scripts/check-no-dev-jsx.mjs && node ../../scripts/check-fully-specified.mjs",
|
|
@@ -38,13 +38,14 @@ describe('code block headers (spec:AST-061 FR8)', () => {
|
|
|
38
38
|
const {container} = render(
|
|
39
39
|
<RichTextView value={markdownToEditorStateJSON('```\nplain\n```\n')} />,
|
|
40
40
|
);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
// The header's text ends with the copy button's tooltip, which its layer
|
|
42
|
+
// draws in a later render than the header itself: wait for the text, not
|
|
43
|
+
// only for the header.
|
|
44
|
+
await waitFor(() =>
|
|
45
|
+
expect(
|
|
46
|
+
container.querySelector('[data-richtext-code-header]')?.textContent,
|
|
47
|
+
).toBe('Copy code'),
|
|
48
|
+
);
|
|
48
49
|
expect(screen.getByRole('button', {name: 'Copy code'})).toBeTruthy();
|
|
49
50
|
});
|
|
50
51
|
|
|
@@ -56,19 +57,16 @@ describe('code block headers (spec:AST-061 FR8)', () => {
|
|
|
56
57
|
)}
|
|
57
58
|
/>,
|
|
58
59
|
);
|
|
60
|
+
// Exactly `plaintext` names nothing; core compares it case-sensitively.
|
|
61
|
+
// Each header's text ends with its copy button's tooltip, drawn in a later
|
|
62
|
+
// render than the header: wait for the text.
|
|
59
63
|
await waitFor(() =>
|
|
60
64
|
expect(
|
|
61
|
-
container.querySelectorAll('[data-richtext-code-header]')
|
|
62
|
-
|
|
65
|
+
[...container.querySelectorAll('[data-richtext-code-header]')].map(
|
|
66
|
+
header => header.textContent,
|
|
67
|
+
),
|
|
68
|
+
).toEqual(['Copy code', 'PlaintextCopy code']),
|
|
63
69
|
);
|
|
64
|
-
const headers = [
|
|
65
|
-
...container.querySelectorAll('[data-richtext-code-header]'),
|
|
66
|
-
];
|
|
67
|
-
// Exactly `plaintext` names nothing; core compares it case-sensitively.
|
|
68
|
-
expect(headers.map(header => header.textContent)).toEqual([
|
|
69
|
-
'Copy code',
|
|
70
|
-
'PlaintextCopy code',
|
|
71
|
-
]);
|
|
72
70
|
});
|
|
73
71
|
|
|
74
72
|
it('draws one header per code block in the editor, outside the editable text', async () => {
|
|
@@ -80,19 +78,18 @@ describe('code block headers (spec:AST-061 FR8)', () => {
|
|
|
80
78
|
)}
|
|
81
79
|
/>,
|
|
82
80
|
);
|
|
81
|
+
// Each header: its language label, then the copy button's tooltip, which
|
|
82
|
+
// its layer draws in a later render than the header: wait for the text.
|
|
83
83
|
await waitFor(() =>
|
|
84
84
|
expect(
|
|
85
|
-
container.querySelectorAll('[data-richtext-code-header]')
|
|
86
|
-
|
|
85
|
+
[...container.querySelectorAll('[data-richtext-code-header]')].map(
|
|
86
|
+
header => header.textContent,
|
|
87
|
+
),
|
|
88
|
+
).toEqual(['tsCopy code', 'jsCopy code']),
|
|
87
89
|
);
|
|
88
90
|
const headers = [
|
|
89
91
|
...container.querySelectorAll('[data-richtext-code-header]'),
|
|
90
92
|
];
|
|
91
|
-
// Each header: its language label, then the copy button's name.
|
|
92
|
-
expect(headers.map(header => header.textContent)).toEqual([
|
|
93
|
-
'tsCopy code',
|
|
94
|
-
'jsCopy code',
|
|
95
|
-
]);
|
|
96
93
|
for (const header of headers) {
|
|
97
94
|
expect(header.closest('[contenteditable]')).toBeNull();
|
|
98
95
|
}
|