@@ -8,12 +8,12 @@ import { randUser } from '../utils/index.js'
88const user = randUser ( )
99const fileName = 'empty.md'
1010
11- describe ( 'test link marks' , function ( ) {
12- before ( function ( ) {
11+ describe ( 'test link marks' , function ( ) {
12+ before ( function ( ) {
1313 cy . createUser ( user )
1414 } )
1515
16- beforeEach ( function ( ) {
16+ beforeEach ( function ( ) {
1717 cy . login ( user )
1818 cy . isolateTest ( {
1919 sourceFile : fileName ,
@@ -24,7 +24,7 @@ describe('test link marks', function () {
2424 cy . openFile ( fileName , { force : true } )
2525 } )
2626
27- describe ( 'link bubble' , function ( ) {
27+ describe ( 'link bubble' , function ( ) {
2828 /**
2929 * Find link and click on it
3030 *
@@ -134,14 +134,12 @@ describe('test link marks', function () {
134134 cy . insertLine ( `[text](${ link } )` )
135135 cy . getContent ( ) . find ( `a[href*="${ link } "]` ) . should ( 'not.exist' )
136136 clickLink ( '#' )
137- cy . get ( '.link-view-bubble__title' , { timeout : 10000 } ) . contains (
138- 'other://protocol' ,
139- )
137+ cy . get ( '.link-view-bubble__title' , { timeout : 10000 } ) . contains ( 'other://protocol' )
140138 cy . get ( '.link-view-bubble a' ) . should ( 'not.exist' )
141139 } )
142140 } )
143141
144- describe ( 'autolink' , function ( ) {
142+ describe ( 'autolink' , function ( ) {
145143 it ( 'with protocol to files app and fileId' , ( ) => {
146144 cy . getFile ( fileName ) . then ( ( $el ) => {
147145 const id = $el . data ( 'cyFilesListRowFileid' )
@@ -167,17 +165,17 @@ describe('test link marks', function () {
167165 } )
168166 } )
169167
170- describe ( 'link menu' , function ( ) {
168+ describe ( 'link menu' , function ( ) {
171169 beforeEach ( ( ) => cy . clearContent ( ) )
172170 const text = 'some text'
173171
174- describe ( 'link to website' , function ( ) {
172+ describe ( 'link to website' , function ( ) {
175173 const url = 'https://example.org/'
176174 // Helper to reduce duplicated code, checking inserting with and without selected text
177175 const checkLinkWebsite = ( url , text ) => {
178176 cy . getSubmenuEntry ( 'insert-link' , 'insert-link-website' ) . click ( )
179177 cy . getActionSubEntry ( 'insert-link-input' )
180- . find ( 'input[type="text"]' )
178+ . click ( )
181179 . type ( `${ url } {enter}` )
182180 cy . getContent ( )
183181 . find ( `a[href*="${ url } "]` )
@@ -187,27 +185,26 @@ describe('test link marks', function () {
187185
188186 beforeEach ( cy . clearContent )
189187 it ( 'Link website without selection' , ( ) => {
190- cy . getFile ( fileName ) . then ( ( $el ) => {
188+ cy . getFile ( fileName ) . then ( ( ) => {
191189 checkLinkWebsite ( url , url )
192190 } )
193191 } )
194192
195193 it ( 'Link website with selection' , ( ) => {
196- cy . getFile ( fileName ) . then ( ( $el ) => {
194+ cy . getFile ( fileName ) . then ( ( ) => {
197195 cy . getContent ( ) . type ( `${ text } {selectAll}` )
198196 checkLinkWebsite ( url , text )
199197 } )
200198 } )
201199 } )
202200
203- describe ( 'link to local file' , function ( ) {
201+ describe ( 'link to local file' , function ( ) {
202+ let fileId = null
204203 // Helper to reduce duplicated code, checking inserting with and without selected text
205204 const checkLinkFile = ( filename , text , isFolder = false ) => {
206205 cy . getSubmenuEntry ( 'insert-link' , 'insert-link-file' ) . click ( )
207206 cy . get ( '.file-picker' ) . within ( ( ) => {
208- cy . get (
209- `[data-testid="file-list-row"][data-filename="${ filename } "]` ,
210- ) . click ( )
207+ cy . get ( `[data-testid="file-list-row"][data-filename="${ filename } "]` ) . click ( )
211208 cy . get ( isFolder ? '.empty-content__name' : '.file-picker__files' )
212209 cy . contains (
213210 'button' ,
@@ -221,15 +218,13 @@ describe('test link marks', function () {
221218 . should ( 'have.text' , text === undefined ? filename : text )
222219 }
223220
224- let fileId = null
225-
226221 beforeEach ( ( ) => cy . clearContent ( ) )
227222
228223 it ( 'without text' , ( ) => {
229224 cy . getFileId ( fileName ) . then ( ( id ) => {
230225 fileId = id
231226 } )
232- cy . getFile ( fileName ) . then ( ( $el ) => {
227+ cy . getFile ( fileName ) . then ( ( ) => {
233228 checkLinkFile ( fileName )
234229 cy . get ( '.modal-header__name' ) . should ( 'include.text' , fileName )
235230 } )
@@ -238,19 +233,17 @@ describe('test link marks', function () {
238233 cy . getFileId ( fileName ) . then ( ( id ) => {
239234 fileId = id
240235 } )
241- cy . getFile ( fileName ) . then ( ( $el ) => {
236+ cy . getFile ( fileName ) . then ( ( ) => {
242237 cy . getContent ( ) . type ( `${ text } {selectAll}` )
243238 checkLinkFile ( fileName , text )
244239 cy . get ( '.modal-header__name' ) . should ( 'include.text' , fileName )
245240 } )
246241 } )
247242 it ( 'link to directory' , ( ) => {
248- cy . createFolder ( `${ window . __currentDirectory } /dummy folder` ) . then (
249- ( folderId ) => {
250- fileId = folderId
251- } ,
252- )
253- cy . getFile ( fileName ) . then ( ( $el ) => {
243+ cy . createFolder ( `${ window . __currentDirectory } /dummy folder` ) . then ( ( folderId ) => {
244+ fileId = folderId
245+ } )
246+ cy . getFile ( fileName ) . then ( ( ) => {
254247 cy . getContent ( ) . type ( `${ text } {selectAll}` )
255248 checkLinkFile ( 'dummy folder' , text , true )
256249 } )
0 commit comments