a454872630
Fixes #30079 git-svn-id: https://develop.svn.wordpress.org/trunk@29994 602fd350-edb4-49c9-b593-d223f7449a82
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
module("tinymce.Shortcuts", {
|
|
setupModule: function() {
|
|
QUnit.stop();
|
|
|
|
tinymce.init({
|
|
selector: "textarea",
|
|
plugins: wpPlugins,
|
|
add_unload_trigger: false,
|
|
disable_nodechange: true,
|
|
indent: false,
|
|
skin: false,
|
|
entities: 'raw',
|
|
schema: 'html5',
|
|
init_instance_callback: function(ed) {
|
|
window.editor = ed;
|
|
QUnit.start();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
test('Shortcuts formats', function() {
|
|
function assertShortcut(shortcut, args) {
|
|
var called;
|
|
|
|
editor.shortcuts.add(shortcut, '', function() {
|
|
called = true;
|
|
});
|
|
|
|
args = tinymce.extend({
|
|
ctrlKey: false,
|
|
altKey: false,
|
|
shiftKey: false
|
|
}, args);
|
|
|
|
if (tinymce.Env.mac && args.ctrlKey) {
|
|
args.metaKey = true;
|
|
args.ctrlKey = false;
|
|
}
|
|
|
|
editor.fire('keydown', args);
|
|
|
|
ok(called, 'Shortcut wasn\'t called: ' + shortcut);
|
|
}
|
|
|
|
assertShortcut('ctrl+d', {ctrlKey: true, keyCode: 68});
|
|
assertShortcut('ctrl+shift+d', {ctrlKey: true, shiftKey: true, keyCode: 68});
|
|
assertShortcut('ctrl+shift+alt+d', {ctrlKey: true, shiftKey: true, altKey: true, keyCode: 68});
|
|
assertShortcut('ctrl+221', {ctrlKey: true, keyCode: 221});
|
|
});
|