diff --git a/tests/qunit/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js b/tests/qunit/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js index b04d6b486b..edcb629876 100644 --- a/tests/qunit/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js +++ b/tests/qunit/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js @@ -15,7 +15,7 @@ 'd': 68, 'e': 69, 'f': 70, 'g': 71, 'h': 72, 'i': 73, 'j': 74, 'k': 75, 'l': 76, 'm': 77, 'n': 78, 'o': 79, 'p': 80, 'q': 81, 'r': 82, 's': 83, 't': 84, 'u': 85, 'v': 86, 'w': 87, 'x': 88, 'y': 89, ' ': 32, ',': 188, '-': 189, '.': 190, '/': 191, '\\': 220, '[': 219, ']': 221, '\'': 222, ';': 186, '=': 187, ')': 41, - '*': 48 // Anything will do. + '`': 48 // Anything will do. }; return lookup[String.fromCharCode(charCode)]; @@ -284,4 +284,29 @@ assert.equal( editor.getContent(), '
\n

 

' ); }, assert.async() ); } ); + + QUnit.test( 'Inline: single.', function( assert ) { + type( '`test`', function() { + assert.equal( editor.getContent(), '

test

' ); + assert.equal( editor.selection.getRng().startOffset, 1 ); + }, assert.async() ); + } ); + + QUnit.test( 'Inline: after typing.', function( assert ) { + editor.setContent( '

test test test

' ); + editor.selection.setCursorLocation( editor.$( 'p' )[0].firstChild, 5 ); + + type( '`', function() { + editor.selection.setCursorLocation( editor.$( 'p' )[0].firstChild, 11 ); + }, '`', function() { + assert.equal( editor.getContent(), '

test test test

' ); + assert.equal( editor.selection.getRng().startOffset, 1 ); + }, assert.async() ); + } ); + + QUnit.test( 'Inline: no change.', function( assert ) { + type( 'test `````', function() { + assert.equal( editor.getContent(), '

test `````

' ); + }, assert.async() ); + } ); } )( window.jQuery, window.QUnit, window.tinymce, window.setTimeout );