mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Editor: wptextpattern: add back inline tests
See [37024]. See #33300. git-svn-id: https://develop.svn.wordpress.org/trunk@37080 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ea2590a6c4
commit
859d40bd24
@ -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,
|
'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,
|
'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,
|
'[': 219, ']': 221, '\'': 222, ';': 186, '=': 187, ')': 41,
|
||||||
'*': 48 // Anything will do.
|
'`': 48 // Anything will do.
|
||||||
};
|
};
|
||||||
|
|
||||||
return lookup[String.fromCharCode(charCode)];
|
return lookup[String.fromCharCode(charCode)];
|
||||||
@ -284,4 +284,29 @@
|
|||||||
assert.equal( editor.getContent(), '<hr />\n<p> </p>' );
|
assert.equal( editor.getContent(), '<hr />\n<p> </p>' );
|
||||||
}, assert.async() );
|
}, assert.async() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
QUnit.test( 'Inline: single.', function( assert ) {
|
||||||
|
type( '`test`', function() {
|
||||||
|
assert.equal( editor.getContent(), '<p><code>test</code></p>' );
|
||||||
|
assert.equal( editor.selection.getRng().startOffset, 1 );
|
||||||
|
}, assert.async() );
|
||||||
|
} );
|
||||||
|
|
||||||
|
QUnit.test( 'Inline: after typing.', function( assert ) {
|
||||||
|
editor.setContent( '<p>test test test</p>' );
|
||||||
|
editor.selection.setCursorLocation( editor.$( 'p' )[0].firstChild, 5 );
|
||||||
|
|
||||||
|
type( '`', function() {
|
||||||
|
editor.selection.setCursorLocation( editor.$( 'p' )[0].firstChild, 11 );
|
||||||
|
}, '`', function() {
|
||||||
|
assert.equal( editor.getContent(), '<p>test <code>test</code> test</p>' );
|
||||||
|
assert.equal( editor.selection.getRng().startOffset, 1 );
|
||||||
|
}, assert.async() );
|
||||||
|
} );
|
||||||
|
|
||||||
|
QUnit.test( 'Inline: no change.', function( assert ) {
|
||||||
|
type( 'test `````', function() {
|
||||||
|
assert.equal( editor.getContent(), '<p>test `````</p>' );
|
||||||
|
}, assert.async() );
|
||||||
|
} );
|
||||||
} )( window.jQuery, window.QUnit, window.tinymce, window.setTimeout );
|
} )( window.jQuery, window.QUnit, window.tinymce, window.setTimeout );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user