@@ -27,29 +27,6 @@ describe('markdown-toolbar-element', function () {
2727 } )
2828
2929 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-
5330 function clickToolbar ( selector ) {
5431 const toolbar = document . querySelector ( 'markdown-toolbar' )
5532 toolbar . querySelector ( selector ) . click ( )
@@ -198,29 +175,13 @@ describe('markdown-toolbar-element', function () {
198175 } )
199176 } )
200177
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-
210178 describe ( 'bold' , function ( ) {
211179 it ( 'bold selected text when you click the bold icon' , function ( ) {
212180 setVisualValue ( 'The |quick| brown fox jumps over the lazy dog' )
213181 clickToolbar ( 'md-bold' )
214182 assert . equal ( 'The **|quick|** brown fox jumps over the lazy dog' , visualValue ( ) )
215183 } )
216184
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-
224185 it ( 'bold empty selection and textarea inserts ** with cursor ready to type inside' , function ( ) {
225186 setVisualValue ( '|' )
226187 clickToolbar ( 'md-bold' )
@@ -349,13 +310,6 @@ describe('markdown-toolbar-element', function () {
349310 assert . equal ( 'The _|quick|_ brown fox jumps over the lazy dog' , visualValue ( ) )
350311 } )
351312
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-
359313 it ( 'italicize when there is leading whitespace in selection' , function ( ) {
360314 setVisualValue ( '| \nHello world|' )
361315 clickToolbar ( 'md-italic' )
@@ -468,15 +422,6 @@ describe('markdown-toolbar-element', function () {
468422 assert . equal ( '> |' , visualValue ( ) )
469423 } )
470424
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-
480425 it ( 'quotes the selected text when you click the quote icon' , function ( ) {
481426 setVisualValue ( '|Butts|\n\nThe quick brown fox jumps over the lazy dog' )
482427 clickToolbar ( 'md-quote' )
@@ -558,22 +503,6 @@ describe('markdown-toolbar-element', function () {
558503 assert . equal ( 'One\n\n|- Two\n- Three|\n' , visualValue ( ) )
559504 } )
560505
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-
577506 it ( 'prefixes newlines when a list is created on the last line' , function ( ) {
578507 setVisualValue ( "Here's a list:|One|" )
579508 clickToolbar ( 'md-unordered-list' )
@@ -644,13 +573,6 @@ describe('markdown-toolbar-element', function () {
644573 assert . equal ( "`|puts 'Hello, world!'|`" , visualValue ( ) )
645574 } )
646575
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-
654576 it ( 'surrounds multiple lines with triple backticks if you click the code icon' , function ( ) {
655577 setVisualValue ( '|class Greeter\n def hello_world\n "Hello World!"\n end\nend|' )
656578 clickToolbar ( 'md-code' )
0 commit comments