Skip to content

Commit

Permalink
test: fix hr tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colomolo committed Jan 21, 2025
1 parent ae134b2 commit ecd1ab2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cypress/component/rich-text/RichTextEditor.HR.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('Rich Text Editor - HR', { viewportHeight: 2000, viewportWidth: 1000 },

function addBlockquote(content = '') {
richText.editor.click();
richText.editor.should('be.focused');
richText.editor.type(content);

richText.toolbar.quote.click();
Expand Down Expand Up @@ -59,8 +60,15 @@ describe('Rich Text Editor - HR', { viewportHeight: 2000, viewportWidth: 1000 },
richText.editor.type('some text');

richText.toolbar.hr.click();
richText.editor.find('[data-void-element="hr"]').should('have.lengthOf', 1);

richText.editor.should('be.focused');
richText.toolbar.hr.click();
richText.editor.find('[data-void-element="hr"]').should('have.lengthOf', 2);

richText.editor.should('be.focused');
richText.toolbar.hr.click();
richText.editor.find('[data-void-element="hr"]').should('have.lengthOf', 3);

const expectedValue = doc(
block(BLOCKS.PARAGRAPH, {}, text('some text', [])),
Expand All @@ -79,6 +87,7 @@ describe('Rich Text Editor - HR', { viewportHeight: 2000, viewportWidth: 1000 },
richText.editor.type('{enter}some text{uparrow}');

richText.toolbar.hr.click();
richText.editor.find('[data-void-element="hr"]').should('have.lengthOf', 1);

const expectedValue = doc(
block(BLOCKS.QUOTE, {}, block(BLOCKS.PARAGRAPH, {}, text('some text', []))),
Expand Down Expand Up @@ -120,8 +129,7 @@ describe('Rich Text Editor - HR', { viewportHeight: 2000, viewportWidth: 1000 },
richText.toolbar.hr.click();

richText.editor.click();
richText.editor.type('hey');
richText.editor.type('{selectall}{del}');
richText.editor.type('hey').type('{selectall}{del}');

// editor is empty
richText.expectValue(undefined);
Expand Down

0 comments on commit ecd1ab2

Please sign in to comment.