Skip to content

Commit 8254a7f

Browse files
committed
Fix tests after version bumps
1 parent bd3d2be commit 8254a7f

File tree

10 files changed

+250
-202
lines changed

10 files changed

+250
-202
lines changed

packages/color-modes/test/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -903,12 +903,11 @@ test('colorMode accepts function from previous state to new one', () => {
903903
test('warns when localStorage is disabled', () => {
904904
const restoreConsole = mockConsole()
905905

906-
const localStorage = window.localStorage
907-
Object.defineProperty(window, 'localStorage', {
908-
get: jest.fn(() => {
906+
const spy = jest
907+
.spyOn(Storage.prototype, 'getItem')
908+
.mockImplementation(() => {
909909
throw new Error('SecurityError: The operation is insecure.')
910-
}),
911-
})
910+
})
912911

913912
let mode = ''
914913
const Consumer = () => {
@@ -927,8 +926,6 @@ test('warns when localStorage is disabled', () => {
927926

928927
expect(mode).toBe(undefined)
929928

930-
Object.defineProperty(window, 'localStorage', { value: localStorage })
931-
932929
expect((console.warn as jest.Mock).mock.calls[0]).toMatchInlineSnapshot(`
933930
[
934931
"localStorage is disabled and color mode might not work as expected.",
@@ -937,6 +934,7 @@ test('warns when localStorage is disabled', () => {
937934
]
938935
`)
939936

937+
spy.mockClear()
940938
restoreConsole()
941939
})
942940

packages/css/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
"access": "public"
3636
},
3737
"dependencies": {
38-
"csstype": "^3.0.10"
38+
"csstype": "3.0.10"
3939
},
4040
"peerDependencies": {
4141
"@emotion/react": "^11.11.1"
4242
},
4343
"devDependencies": {
44-
"@emotion/react": "^11.13.3",
44+
"@emotion/react": "^11.11.1",
4545
"@theme-ui/test-utils": "workspace:^",
4646
"@types/react": "^18.2.12"
4747
},

packages/css/test/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,11 @@ test('supports vendor properties', () => {
728728
test('omits empty values', () => {
729729
expect(
730730
css({
731+
// @ts-ignore TS2873
731732
color: false && 'blue',
733+
// @ts-ignore TS2873
732734
backgroundColor: undefined && 'whitesmoke',
735+
// @ts-ignore TS2873
733736
textDecoration: null && 'underline',
734737
border: '1px solid black',
735738
})(theme)

packages/global/test/__snapshots__/index.tsx.snap

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,6 @@ exports[`renders global styles 1`] = `
4949
data-s=""
5050
>
5151
52-
@font-face{font-family:some-name;}
53-
</style>
54-
<style
55-
data-emotion="css-global"
56-
data-s=""
57-
>
58-
59-
body{font-family:Georgia,serif;margin:0;}
60-
</style>
61-
<style
62-
data-emotion="css-global"
63-
data-s=""
64-
>
65-
66-
h1{color:salmon;}
6752
</style>
6853
</head>
6954
<body>

packages/prism/src/index.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,17 @@ export default function ThemeUIPrism({
131131
}
132132
return (
133133
<div {...lineProps}>
134-
{line.map((token, key) => (
135-
<span
136-
{...getTokenProps({ token, key })}
137-
sx={token.empty ? { display: 'inline-block' } : undefined}
138-
/>
139-
))}
134+
{line.map((token, key) => {
135+
return (
136+
<span
137+
{...getTokenProps({ token, key })}
138+
key={key}
139+
sx={
140+
token.empty ? { display: 'inline-block' } : undefined
141+
}
142+
/>
143+
)
144+
})}
140145
</div>
141146
)
142147
})}

packages/prism/test/__snapshots__/index.tsx.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`highlight start and end 1`] = `
44
<pre
5-
className="language-js prism-code language-javascript emotion-0"
5+
className="language-js prism-code language-javascript css-1avyp1d"
66
style={{}}
77
>
88
<div
@@ -88,7 +88,7 @@ exports[`highlight start and end 1`] = `
8888

8989
exports[`highlights inline comment 1`] = `
9090
<pre
91-
className="language-js prism-code language-javascript emotion-0"
91+
className="language-js prism-code language-javascript css-1avyp1d"
9292
style={{}}
9393
>
9494
<div
@@ -262,7 +262,7 @@ exports[`multiple highlights start and end 1`] = `
262262

263263
exports[`no highlight 1`] = `
264264
<pre
265-
className="language-js prism-code language-javascript emotion-0"
265+
className="language-js prism-code language-javascript css-1avyp1d"
266266
style={{}}
267267
>
268268
<div
@@ -309,7 +309,7 @@ exports[`no highlight 1`] = `
309309

310310
exports[`renders a code block 1`] = `
311311
<pre
312-
className="language-js prism-code language-javascript emotion-0"
312+
className="language-js prism-code language-javascript css-1avyp1d"
313313
style={{}}
314314
>
315315
<div
@@ -351,7 +351,7 @@ exports[`renders a code block 1`] = `
351351

352352
exports[`renders with no className 1`] = `
353353
<pre
354-
className=" prism-code language- emotion-0"
354+
className="prism-code language- css-1avyp1d"
355355
style={{}}
356356
>
357357
<div
@@ -368,7 +368,7 @@ exports[`renders with no className 1`] = `
368368

369369
exports[`renders with other languages 1`] = `
370370
<pre
371-
className="language-php prism-code language-php emotion-0"
371+
className="language-php prism-code language-php css-1avyp1d"
372372
style={{}}
373373
>
374374
<div

0 commit comments

Comments
 (0)