Skip to content

Commit c45b668

Browse files
committed
Add test case
1 parent b35f22e commit c45b668

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,53 @@ describe('Inline Tool Link', () => {
193193
.should('contain', 'Bold and italic text');
194194
});
195195

196+
it('should unlink a linked text when clicking the unlink button', () => {
197+
cy.createEditor({
198+
data: {
199+
blocks: [
200+
{
201+
type: 'paragraph',
202+
data: {
203+
text: 'Link to remove',
204+
},
205+
},
206+
],
207+
},
208+
});
209+
210+
cy.get('[data-cy=editorjs]')
211+
.find('.ce-paragraph')
212+
.selectText('Link to remove');
213+
214+
cy.get('[data-cy=editorjs]')
215+
.find('[data-item-name=link]')
216+
.click();
217+
218+
cy.get('[data-cy=editorjs]')
219+
.find('.ce-inline-tool-input')
220+
.type('https://editorjs.io')
221+
.type('{enter}');
222+
223+
cy.get('[data-cy=editorjs]')
224+
.find('div.ce-block')
225+
.find('a')
226+
.should('have.attr', 'href', 'https://editorjs.io');
227+
228+
cy.get('[data-cy=editorjs]')
229+
.find('div.ce-block')
230+
.find('a')
231+
.selectText('Link to remove');
232+
233+
cy.get('[data-cy=editorjs]')
234+
.find('[data-item-name=link]')
235+
.click();
236+
237+
cy.get('[data-cy=editorjs]')
238+
.find('div.ce-block')
239+
.find('a')
240+
.should('not.exist');
241+
});
242+
196243
it('should open a link if it is wrapped in another formatting', () => {
197244
cy.createEditor({
198245
data: {

0 commit comments

Comments
 (0)