@@ -27,29 +27,6 @@ describe('markdown-toolbar-element', function () {
27
27
} )
28
28
29
29
describe ( 'after tree insertion' , function ( ) {
30
- function focus ( ) {
31
- const textarea = document . querySelector ( 'textarea' )
32
- const event = document . createEvent ( 'Event' )
33
- event . initEvent ( 'focus' , false , true )
34
- textarea . dispatchEvent ( event )
35
- }
36
-
37
- function pressHotkey ( hotkey , explicitShiftKey = false ) {
38
- const textarea = document . querySelector ( 'textarea' )
39
- const osx = navigator . userAgent . indexOf ( 'Macintosh' ) !== - 1
40
- const event = document . createEvent ( 'Event' )
41
- event . initEvent ( 'keydown' , true , true )
42
- event . metaKey = osx
43
- event . ctrlKey = ! osx
44
- event . shiftKey = ( hotkey === hotkey . toUpperCase ( ) && hotkey !== hotkey . toLowerCase ( ) ) || explicitShiftKey
45
-
46
- // emulate existing osx browser bug
47
- // https://bugs.webkit.org/show_bug.cgi?id=174782
48
- event . key = osx ? hotkey . toLowerCase ( ) : hotkey
49
-
50
- textarea . dispatchEvent ( event )
51
- }
52
-
53
30
function clickToolbar ( selector ) {
54
31
const toolbar = document . querySelector ( 'markdown-toolbar' )
55
32
toolbar . querySelector ( selector ) . click ( )
@@ -198,29 +175,13 @@ describe('markdown-toolbar-element', function () {
198
175
} )
199
176
} )
200
177
201
- describe ( 'hotkey case-sensitivity' , function ( ) {
202
- it ( 'does not bold selected text when using the uppercased hotkey' , function ( ) {
203
- focus ( )
204
- setVisualValue ( 'The |quick| brown fox jumps over the lazy dog' )
205
- pressHotkey ( 'B' ) // capital `B` instead of lowercase `b`
206
- assert . equal ( 'The |quick| brown fox jumps over the lazy dog' , visualValue ( ) )
207
- } )
208
- } )
209
-
210
178
describe ( 'bold' , function ( ) {
211
179
it ( 'bold selected text when you click the bold icon' , function ( ) {
212
180
setVisualValue ( 'The |quick| brown fox jumps over the lazy dog' )
213
181
clickToolbar ( 'md-bold' )
214
182
assert . equal ( 'The **|quick|** brown fox jumps over the lazy dog' , visualValue ( ) )
215
183
} )
216
184
217
- it ( 'bolds selected text with hotkey' , function ( ) {
218
- focus ( )
219
- setVisualValue ( 'The |quick| brown fox jumps over the lazy dog' )
220
- pressHotkey ( 'b' )
221
- assert . equal ( 'The **|quick|** brown fox jumps over the lazy dog' , visualValue ( ) )
222
- } )
223
-
224
185
it ( 'bold empty selection and textarea inserts ** with cursor ready to type inside' , function ( ) {
225
186
setVisualValue ( '|' )
226
187
clickToolbar ( 'md-bold' )
@@ -349,13 +310,6 @@ describe('markdown-toolbar-element', function () {
349
310
assert . equal ( 'The _|quick|_ brown fox jumps over the lazy dog' , visualValue ( ) )
350
311
} )
351
312
352
- it ( 'italicizes selected text with hotkey' , function ( ) {
353
- focus ( )
354
- setVisualValue ( 'The |quick| brown fox jumps over the lazy dog' )
355
- pressHotkey ( 'i' )
356
- assert . equal ( 'The _|quick|_ brown fox jumps over the lazy dog' , visualValue ( ) )
357
- } )
358
-
359
313
it ( 'italicize when there is leading whitespace in selection' , function ( ) {
360
314
setVisualValue ( '| \nHello world|' )
361
315
clickToolbar ( 'md-italic' )
@@ -468,15 +422,6 @@ describe('markdown-toolbar-element', function () {
468
422
assert . equal ( '> |' , visualValue ( ) )
469
423
} )
470
424
471
- it ( 'inserts selected quoted sample via hotkey, requiring shift' , function ( ) {
472
- focus ( )
473
- setVisualValue ( '' )
474
- pressHotkey ( '.' , false )
475
- assert . equal ( '|' , visualValue ( ) )
476
- pressHotkey ( '.' , true )
477
- assert . equal ( '> |' , visualValue ( ) )
478
- } )
479
-
480
425
it ( 'quotes the selected text when you click the quote icon' , function ( ) {
481
426
setVisualValue ( '|Butts|\n\nThe quick brown fox jumps over the lazy dog' )
482
427
clickToolbar ( 'md-quote' )
@@ -558,22 +503,6 @@ describe('markdown-toolbar-element', function () {
558
503
assert . equal ( 'One\n\n|- Two\n- Three|\n' , visualValue ( ) )
559
504
} )
560
505
561
- it ( 'turns multiple lines into unordered list via hotkey, requiring shift' , function ( ) {
562
- setVisualValue ( 'One\n|Two\nThree|\n' )
563
- pressHotkey ( '8' , false )
564
- assert . equal ( 'One\n|Two\nThree|\n' , visualValue ( ) )
565
- pressHotkey ( '8' , true )
566
- assert . equal ( 'One\n\n|- Two\n- Three|\n' , visualValue ( ) )
567
- } )
568
-
569
- it ( 'turns multiple lines into ordered list via hotkey, requiring shift' , function ( ) {
570
- setVisualValue ( 'One\n|Two\nThree|\n' )
571
- pressHotkey ( '7' , false )
572
- assert . equal ( 'One\n|Two\nThree|\n' , visualValue ( ) )
573
- pressHotkey ( '7' , true )
574
- assert . equal ( 'One\n\n|1. Two\n2. Three|\n' , visualValue ( ) )
575
- } )
576
-
577
506
it ( 'prefixes newlines when a list is created on the last line' , function ( ) {
578
507
setVisualValue ( "Here's a list:|One|" )
579
508
clickToolbar ( 'md-unordered-list' )
@@ -644,13 +573,6 @@ describe('markdown-toolbar-element', function () {
644
573
assert . equal ( "`|puts 'Hello, world!'|`" , visualValue ( ) )
645
574
} )
646
575
647
- it ( 'surrounds a line with backticks via hotkey' , function ( ) {
648
- focus ( )
649
- setVisualValue ( "|puts 'Hello, world!'|" )
650
- pressHotkey ( 'e' )
651
- assert . equal ( "`|puts 'Hello, world!'|`" , visualValue ( ) )
652
- } )
653
-
654
576
it ( 'surrounds multiple lines with triple backticks if you click the code icon' , function ( ) {
655
577
setVisualValue ( '|class Greeter\n def hello_world\n "Hello World!"\n end\nend|' )
656
578
clickToolbar ( 'md-code' )
0 commit comments