@@ -391,6 +391,62 @@ describe('markdown-toolbar-element', function () {
391
391
} )
392
392
} )
393
393
394
+ describe ( 'strikethrough' , function ( ) {
395
+ it ( 'strikes through selected text when you click the strikethrough icon' , function ( ) {
396
+ setVisualValue ( 'The |quick| brown fox jumps over the lazy dog' )
397
+ clickToolbar ( 'md-strikethrough' )
398
+ assert . equal ( 'The ~~|quick|~~ brown fox jumps over the lazy dog' , visualValue ( ) )
399
+ } )
400
+
401
+ it ( 'strikes through when there is leading whitespace in selection' , function ( ) {
402
+ setVisualValue ( '| \nHello world|' )
403
+ clickToolbar ( 'md-strikethrough' )
404
+ assert . equal ( ' \n~~|Hello world|~~' , visualValue ( ) )
405
+ } )
406
+
407
+ it ( 'strikes through when there is trailing whitespace in selection' , function ( ) {
408
+ setVisualValue ( '|Hello world\n \t|' )
409
+ clickToolbar ( 'md-strikethrough' )
410
+ assert . equal ( '~~|Hello world|~~\n \t' , visualValue ( ) )
411
+ } )
412
+
413
+ it ( 'strikes through empty selection and textarea inserts ~~ with cursor ready to type inside' , function ( ) {
414
+ setVisualValue ( '|' )
415
+ clickToolbar ( 'md-strikethrough' )
416
+ assert . equal ( '~~|~~' , visualValue ( ) )
417
+ } )
418
+
419
+ it ( 'strikes through empty selection with previous text inserts ~~ with cursor ready to type inside' , function ( ) {
420
+ setVisualValue ( 'The |' )
421
+ clickToolbar ( 'md-strikethrough' )
422
+ assert . equal ( 'The ~~|~~' , visualValue ( ) )
423
+ } )
424
+
425
+ it ( 'strikes through selected word when cursor is at the start of the word' , function ( ) {
426
+ setVisualValue ( 'The |quick brown fox jumps over the lazy dog' )
427
+ clickToolbar ( 'md-strikethrough' )
428
+ assert . equal ( 'The ~~|quick~~ brown fox jumps over the lazy dog' , visualValue ( ) )
429
+ } )
430
+
431
+ it ( 'strikes through selected word when cursor is in the middle of the word' , function ( ) {
432
+ setVisualValue ( 'The qui|ck brown fox jumps over the lazy dog' )
433
+ clickToolbar ( 'md-strikethrough' )
434
+ assert . equal ( 'The ~~qui|ck~~ brown fox jumps over the lazy dog' , visualValue ( ) )
435
+ } )
436
+
437
+ it ( 'strikes through selected word when cursor is at the end of the word' , function ( ) {
438
+ setVisualValue ( 'The quick| brown fox jumps over the lazy dog' )
439
+ clickToolbar ( 'md-strikethrough' )
440
+ assert . equal ( 'The ~~quick|~~ brown fox jumps over the lazy dog' , visualValue ( ) )
441
+ } )
442
+
443
+ it ( 'un-strikes through selected struck-through text when you click the strikethrough icon' , function ( ) {
444
+ setVisualValue ( 'The ~~|quick|~~ brown fox jumps over the lazy dog' )
445
+ clickToolbar ( 'md-strikethrough' )
446
+ assert . equal ( 'The |quick| brown fox jumps over the lazy dog' , visualValue ( ) )
447
+ } )
448
+ } )
449
+
394
450
describe ( 'quote level' , function ( ) {
395
451
it ( 'inserts selected quoted sample if you click the quote icon' , function ( ) {
396
452
setVisualValue ( '' )
0 commit comments