From 1a289c00d196abe743b68b5211f908b3af44a20f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:43:22 +0000 Subject: [PATCH] build(deps): bump prosemirror-view from 1.33.1 to 1.33.3 (#294) * build(deps): bump prosemirror-view from 1.33.1 to 1.33.3 Bumps [prosemirror-view](https://github.com/prosemirror/prosemirror-view) from 1.33.1 to 1.33.3. - [Changelog](https://github.com/ProseMirror/prosemirror-view/blob/master/CHANGELOG.md) - [Commits](https://github.com/prosemirror/prosemirror-view/compare/1.33.1...1.33.3) --- updated-dependencies: - dependency-name: prosemirror-view dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * test(e2e): properly cleanup state on clearEditor helper --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Giamir Buoncristiani --- package-lock.json | 12 ++++++------ test/e2e-helpers.ts | 20 +++++++++++++++----- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index be0a1fe5..67b1a0bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10833,9 +10833,9 @@ } }, "node_modules/prosemirror-view": { - "version": "1.33.1", - "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.33.1.tgz", - "integrity": "sha512-62qkYgSJIkwIMMCpuGuPzc52DiK1Iod6TWoIMxP4ja6BTD4yO8kCUL64PZ/WhH/dJ9fW0CDO39FhH1EMyhUFEg==", + "version": "1.33.3", + "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.33.3.tgz", + "integrity": "sha512-P4Ao/bc4OrU/2yLIf8dL4lJaEtjLR3QjIvQHgJYp2jUS7kYM4bSR6okbBjkqzOs/FwUon6UGjTLdKMnPL1MZqw==", "dependencies": { "prosemirror-model": "^1.16.0", "prosemirror-state": "^1.0.0", @@ -21582,9 +21582,9 @@ } }, "prosemirror-view": { - "version": "1.33.1", - "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.33.1.tgz", - "integrity": "sha512-62qkYgSJIkwIMMCpuGuPzc52DiK1Iod6TWoIMxP4ja6BTD4yO8kCUL64PZ/WhH/dJ9fW0CDO39FhH1EMyhUFEg==", + "version": "1.33.3", + "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.33.3.tgz", + "integrity": "sha512-P4Ao/bc4OrU/2yLIf8dL4lJaEtjLR3QjIvQHgJYp2jUS7kYM4bSR6okbBjkqzOs/FwUon6UGjTLdKMnPL1MZqw==", "requires": { "prosemirror-model": "^1.16.0", "prosemirror-state": "^1.0.0", diff --git a/test/e2e-helpers.ts b/test/e2e-helpers.ts index 7650c89e..60b6b14a 100644 --- a/test/e2e-helpers.ts +++ b/test/e2e-helpers.ts @@ -1,4 +1,5 @@ import type { Page } from "@playwright/test"; +import { StacksEditor } from "../src"; export const editorSelector = ".js-editor"; export const menuSelector = ".js-editor-menu"; @@ -39,11 +40,14 @@ export async function switchMode(page: Page, mode: Mode): Promise { } } -export async function clearEditor(page: Page): Promise { - return await page.$eval( - editorSelector, - (editor: HTMLElement) => (editor.innerText = "") - ); +export async function clearEditor(page: Page): Promise { + return page.evaluate(() => { + const view = window.editorInstance.editorView; + const state = view.state; + view.updateState( + state.apply(state.tr.delete(0, state.doc.content.size)) + ); + }); } /** @@ -105,3 +109,9 @@ export async function tab( const tabKey = browserName === "webkit" ? "Alt+Tab" : "Tab"; await page.keyboard.press(tabKey); } + +declare global { + interface Window { + editorInstance: StacksEditor; + } +}