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 @@ -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} ) ;
You can’t perform that action at this time.
0 commit comments