File tree Expand file tree Collapse file tree
test/cypress/tests/inline-tools Expand file tree Collapse file tree Original file line number Diff line number Diff 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 : {
You can’t perform that action at this time.
0 commit comments