Skip to content

Instantly share code, notes, and snippets.

@brendancarney
Created July 3, 2019 15:59
Show Gist options
  • Save brendancarney/b59a32e159f03c827091a98e075cf547 to your computer and use it in GitHub Desktop.
Save brendancarney/b59a32e159f03c827091a98e075cf547 to your computer and use it in GitHub Desktop.
import { html } from "../../packages/editor/src/utils/htm";
context("Focusing on placeholder", () => {
beforeEach(() => {
cy.visit("http://localhost:3000/");
});
// We had a bug where trying to change the first line in an empty editor to
// a heading would crash the editor. This is because Slate was trying to
// resolve the selection before the editor has focus. See `change-block`
// plugin for more information.
it("should focus correctly on the placeholder when the value is empty", () => {
cy.setEditorValue(html`
<value>
<document>
<paragraph></paragraph>
</document>
</value>
`);
cy.focusEditor();
cy.getByText("Open Block Toolbar")
.click({ force: true })
.getByText("Heading")
.click({ force: true });
cy.getByText("Heading 1").should("exist");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment