Skip to content

Commit c55c8c5

Browse files
committed
convert test/Styles
1 parent cadf203 commit c55c8c5

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

packages/editor/test/Styles.js renamed to packages/editor/test/Styles.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,30 @@ import { Styles, EditorProvider } from '../src'
55

66
afterEach(cleanup)
77

8-
if (global.document) {
9-
document.createRange = () => ({
10-
setStart: () => {},
11-
setEnd: () => {},
12-
commonAncestorContainer: {
13-
nodeName: 'BODY',
14-
ownerDocument: document,
15-
},
16-
})
8+
if ((global as any).document) {
9+
document.createRange = () =>
10+
(({
11+
setStart: () => {},
12+
setEnd: () => {},
13+
commonAncestorContainer: {
14+
nodeName: 'BODY',
15+
ownerDocument: document,
16+
},
17+
} as unknown) as Range)
1718
}
1819

1920
const theme = {
2021
styles: {
2122
root: {},
2223
h1: {},
23-
}
24+
},
2425
}
2526

2627
test('edits styles.root.fontFamily', async () => {
2728
let context
2829
const GetContext = () => {
2930
context = useThemeUI()
30-
return false
31+
return null
3132
}
3233
const tree = render(
3334
<EditorProvider theme={theme}>
@@ -39,7 +40,7 @@ test('edits styles.root.fontFamily', async () => {
3940
fireEvent.change(input, {
4041
target: {
4142
value: 'system-ui',
42-
}
43+
},
4344
})
4445
expect(context.theme.styles.root.fontFamily).toBe('system-ui')
4546
})

0 commit comments

Comments
 (0)