@@ -236,26 +236,36 @@ function! s:AngularRunSpecOrBlock(jasminekeyword) abort
236236 cal s: SearchUpForPattern (a: jasminekeyword . ' (' )
237237
238238 let l: wordundercursor = expand (' <cword>' )
239- let l: firstletter = s: FirstLetterOf (a: jasminekeyword )
239+ let l: jasmine1 = exists (' g:angular_jasmine_version' ) && g: angular_jasmine_version == 1
240+ if l: jasmine1
241+ let l: additionalletter = s: FirstLetterOf (a: jasminekeyword )
242+ else
243+ let l: additionalletter = ' f'
244+ end
240245
241246 if l: wordundercursor == a: jasminekeyword
242247 " if there was a spec (anywhere in the file) highlighted with "iit" before, revert it to "it"
243248 let l: positionofspectorun = getpos (' .' )
244249
245250 " this can move the cursor, hence setting the cursor back
246- % s /ddescribe/ describe/ge
247- % s /iit/ it/ge
251+ if l: jasmine1
252+ % s /ddescribe(/ describe (/ge
253+ % s /iit(/ it (/ge
254+ else
255+ % s /fdescribe(/ describe (/ge
256+ % s /fit(/ it (/ge
257+ end
248258
249259 " move cursor back to the spec we want to run
250260 call setpos (' .' , l: positionofspectorun )
251261
252262 " either change the current spec to "iit" or
253263 " the current block to "ddescribe"
254- execute ' silent normal! cw' . l: firstletter . a: jasminekeyword
255- elseif l: wordundercursor == l: firstletter . a: jasminekeyword
256- " either delete the second i in "iit" or
257- " the second d in "ddescribe"
258- execute ' silent normal! x '
264+ execute ' silent normal! cw' . l: additionalletter . a: jasminekeyword
265+ elseif l: wordundercursor == l: additionalletter . a: jasminekeyword
266+ " either delete the first i in "iit" or
267+ " the first d in "ddescribe"
268+ execute ' silent normal! hx '
259269 endif
260270
261271 update " write the file if modified
0 commit comments