Skip to content

Commit 029d377

Browse files
committed
add test
1 parent f3875ae commit 029d377

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

test/cypress/tests/inline-tools/link.cy.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,34 @@ describe('Inline Tool Link', () => {
192192
.should('have.attr', 'href', 'https://editorjs.io')
193193
.should('contain', 'Bold and italic text');
194194
});
195+
196+
it('should open formatted link in the same tab', () => {
197+
cy.createEditor({
198+
data: {
199+
blocks: [
200+
{
201+
type: 'paragraph',
202+
data: {
203+
text: 'Link text',
204+
},
205+
},
206+
],
207+
},
208+
});
209+
210+
const editor = '[data-cy=editorjs]';
211+
212+
cy.get(`${editor} .ce-paragraph`).selectText('Link text');
213+
cy.get(`${editor} [data-item-name=link]`).click();
214+
cy.get(`${editor} .ce-inline-tool-input`).type('https://test.io{enter}');
215+
216+
cy.get(`${editor} a`).selectText('Link text');
217+
cy.get(`${editor} [data-item-name=italic]`).click();
218+
219+
cy.window().then((win) => cy.stub(win, 'open').as('open'));
220+
221+
cy.contains(`${editor} i`, 'Link text').click({ ctrlKey: true });
222+
223+
cy.get('@open').should('have.been.calledWith', 'https://test.io/');
224+
})
195225
});

0 commit comments

Comments
 (0)