@@ -19,63 +19,17 @@ describe('Link extension integrated in the editor', () => {
1919 )
2020 editor . commands . setTextSelection ( 3 )
2121 editor . commands . insertOrSetLink ( 'updated.de' , { href : 'updated.de' } )
22- expect ( editor . getJSON ( ) ) . toEqual ( {
23- content : [
24- {
25- content : [
26- {
27- marks : [
28- { attrs : { href : 'updated.de' , title : null } , type : 'link' } ,
29- ] ,
30- text : 'updated.de' ,
31- type : 'text' ,
32- } ,
33- { text : ' HELLO WORLD' , type : 'text' } ,
34- ] ,
35- type : 'paragraph' ,
36- } ,
37- ] ,
38- type : 'doc' ,
39- } )
22+ expect ( editor . getJSON ( ) ) . toMatchSnapshot ( )
4023 } )
4124
4225 it ( 'Should only update link the anchor is on' , ( ) => {
4326 const editor = createCustomEditor (
44- '<p><a href="nextcloud.com">Test</a><a href="not-nextcloud.com">second link</a></p>' ,
27+ '<p><a href="nextcloud.com">Test</a><a href="not-nextcloud.com">second link</a></p>' ,
4528 [ Link ] ,
4629 )
4730 editor . commands . setTextSelection ( 3 )
4831 editor . commands . insertOrSetLink ( 'updated.de' , { href : 'updated.de' } )
49- expect ( editor . getJSON ( ) ) . toEqual ( {
50- content : [
51- {
52- content : [
53- {
54- marks : [
55- { attrs : { href : 'updated.de' , title : null } , type : 'link' } ,
56- ] ,
57- text : 'updated.de' ,
58- type : 'text' ,
59- } ,
60- {
61- marks : [
62- {
63- attrs : {
64- href : 'not-nextcloud.com' ,
65- title : null ,
66- } ,
67- type : 'link' ,
68- } ,
69- ] ,
70- text : 'second link' ,
71- type : 'text' ,
72- } ,
73- ] ,
74- type : 'paragraph' ,
75- } ,
76- ] ,
77- type : 'doc' ,
78- } )
32+ expect ( editor . getJSON ( ) ) . toMatchSnapshot ( )
7933 } )
8034
8135 it ( 'should insert new link if none at anchor' , ( ) => {
@@ -84,23 +38,7 @@ describe('Link extension integrated in the editor', () => {
8438 [ Link ] ,
8539 )
8640 editor . commands . setTextSelection ( 10 )
87- expect ( editor . getJSON ( ) ) . toEqual ( {
88- content : [
89- {
90- content : [
91- {
92- marks : [
93- { attrs : { href : 'nextcloud.com' , title : null } , type : 'link' } ,
94- ] ,
95- text : 'Test' ,
96- type : 'text' ,
97- } ,
98- { text : ' HELLO WORLD' , type : 'text' } ,
99- ] ,
100- type : 'paragraph' ,
101- } ,
102- ] ,
103- type : 'doc' ,
104- } )
41+ editor . commands . insertOrSetLink ( 'new link' , { href : 'https://nextcloud.com' } )
42+ expect ( editor . getJSON ( ) ) . toMatchSnapshot ( )
10543 } )
10644} )
0 commit comments