Skip to content

Commit 74b1a99

Browse files
Merge branch 'next'
2 parents 00f7e7d + 69ead5c commit 74b1a99

24 files changed

+149
-100
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- lts/-1
1212
- lts/*
1313
- latest
14-
react: [16, 17, 18]
14+
react: [18, 19]
1515
steps:
1616
- uses: actions/checkout@v4
1717

@@ -36,7 +36,7 @@ jobs:
3636
runs-on: ubuntu-latest
3737
strategy:
3838
matrix:
39-
node-version: [20.x, 22.x]
39+
node-version: [22.x]
4040
react: [18]
4141

4242
steps:
@@ -51,6 +51,7 @@ jobs:
5151
with:
5252
name: snapshots-diffs
5353
path: __tests__/browser/__image_snapshots__/__diff_output__
54+
overwrite: true
5455

5556
- name: Update regression test snapshots
5657
if: ${{ failure() }}
Loading
Loading
Loading
Loading
Loading

__tests__/browser/markdown.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,15 @@ describe('visual regression tests', () => {
4747
},
4848
10000,
4949
);
50+
51+
it('renders callout-tests in legacy mode without surprises', async () => {
52+
const uri = 'http://localhost:9966/#/calloutTests?ci=true&darkModeDataAttribute=true&legacy=true';
53+
await page.goto(uri, { waitUntil: 'networkidle0' });
54+
await sleep(5000);
55+
56+
const image = await page.screenshot({ fullPage: true });
57+
58+
expect(image).toMatchImageSnapshot();
59+
}, 10000);
5060
});
5161
});

__tests__/transformers/callouts.test.ts

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('callouts transformer', () => {
6060

6161
it('can parse callouts with markdown in the heading immediately following the emoji', () => {
6262
const md = `
63-
> 🚧 **It works!**
63+
> 🚧**It works!**
6464
>
6565
> And, it no longer deletes your content!
6666
`;
@@ -70,6 +70,61 @@ describe('callouts transformer', () => {
7070
expect(tree.children[0].children[0].children[1].type).toBe('strong');
7171
});
7272

73+
it('can parse callouts with a link in the heading', () => {
74+
const md = `
75+
> 🚧 [It works!](https://example.com)
76+
>
77+
> And, it no longer deletes your content!
78+
`;
79+
const tree = mdast(md);
80+
removePosition(tree, { force: true });
81+
82+
expect(tree.children[0]).toMatchInlineSnapshot(`
83+
{
84+
"children": [
85+
{
86+
"children": [
87+
{
88+
"type": "text",
89+
"value": "",
90+
},
91+
{
92+
"children": [
93+
{
94+
"type": "text",
95+
"value": "It works!",
96+
},
97+
],
98+
"title": null,
99+
"type": "link",
100+
"url": "https://example.com",
101+
},
102+
],
103+
"depth": 3,
104+
"type": "heading",
105+
},
106+
{
107+
"children": [
108+
{
109+
"type": "text",
110+
"value": "And, it no longer deletes your content!",
111+
},
112+
],
113+
"type": "paragraph",
114+
},
115+
],
116+
"data": {
117+
"hName": "Callout",
118+
"hProperties": {
119+
"icon": "🚧",
120+
"theme": "warn",
121+
},
122+
},
123+
"type": "rdme-callout",
124+
}
125+
`);
126+
});
127+
73128
it('can parse a jsx callout into a rdme-callout', () => {
74129
const md = `
75130
<Callout icon="📘" theme="info">

__tests__/transformers/readme-to-mdx.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('readme-to-mdx transformer', () => {
1818
};
1919

2020
expect(mdx(ast)).toMatchInlineSnapshot(`
21-
"<TutorialTile backgroundColor="red" emoji="🦉" id="test-id" link="http://example.com" slug="test-id" title="Test" />
21+
"<Recipe slug="test-id" title="Test" />
2222
"
2323
`);
2424
});

components/Callout/style.scss

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
border-color: var(--Callout-border);
1717
color: var(--text, var(--color-text-default));
1818
padding: $l-offset;
19+
position: relative;
1920

2021
@include dark-mode {
2122
--Callout-bg: rgba(var(--gray100-rgb), 0.05);
@@ -71,7 +72,6 @@
7172

7273
> * {
7374
margin-left: $l-offset;
74-
position: relative;
7575
}
7676

7777
ul,
@@ -130,10 +130,15 @@
130130
}
131131

132132
.callout-icon {
133-
font-size: 1.25em; // match h3
134-
left: -0.25em;
133+
font-size: 17.5px; // match h3—CANNOT BE EM due to bg compatibility (heading size varies)
135134
line-height: 1.25; // match h3
135+
margin-left: 0; // unset wildcard margin
136136
position: absolute;
137+
transform: translateX(-50%);
138+
}
139+
140+
.callout-heading > .callout-icon {
141+
transform: translateX(-150%);
137142
}
138143

139144
.callout-icon + .heading.heading {

0 commit comments

Comments
 (0)