Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference error document undefined #2623

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions src/components/__tests__/headings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@ beforeEach(createTestApp)
afterEach(cleanupTestApp)

it('headings should set font weight', async () => {
store.dispatch([
importText({
text: `
- Normal Text
- My Heading 1
- =heading1
- My Heading 2
- =heading2
- My Heading 3
- =heading3
- My Heading 4
- =heading4
- My Heading 5
- =heading5
`,
}),
])
act(() =>
store.dispatch([
importText({
text: `
- Normal Text
- My Heading 1
- =heading1
- My Heading 2
- =heading2
- My Heading 3
- =heading3
- My Heading 4
- =heading4
- My Heading 5
- =heading5
`,
}),
]),
)

await act(vi.runOnlyPendingTimersAsync)

Expand All @@ -50,7 +52,7 @@ it('headings should set font weight', async () => {
expect(thought5).toHaveStyle({ fontWeight: 600 })

// child should not be bold
store.dispatch(setCursor(['My Heading 1', '=heading1']))
act(() => store.dispatch(setCursor(['My Heading 1', '=heading1'])))

await act(vi.runOnlyPendingTimersAsync)

Expand Down
2 changes: 1 addition & 1 deletion src/redux-middleware/scrollCursorIntoView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const scrollCursorIntoView = () => {

setTimeout(
() => {
scrollIntoViewIfNeeded(document.querySelector('[data-editing=true]'))
if (document && document.querySelector) scrollIntoViewIfNeeded(document.querySelector('[data-editing=true]'))
},
// If this is the result of a navigation, wait for the layout animation to complete to not get false bounding rect values
userInteractedAfterNavigation ? 0 : durations.get('layoutNodeAnimationDuration'),
Expand Down
24 changes: 13 additions & 11 deletions src/shortcuts/__tests__/splitThought.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ beforeEach(createTestApp)
afterEach(cleanupTestApp)

it('split thought after non-word character', async () => {
store.dispatch([
newThought({
value: '*test',
}),
{
type: 'splitThought',
splitResult: {
left: '*',
right: 'test',
act(() =>
store.dispatch([
newThought({
value: '*test',
}),
{
type: 'splitThought',
splitResult: {
left: '*',
right: 'test',
},
},
},
])
]),
)

await act(vi.runOnlyPendingTimersAsync)

Expand Down