Wordpress/tests/qunit/editor/plugins/js/autolink.actions.js
Andrew Ozz ce2dcccf86 Incorporate the TinyMCE tests into our JS tests:
- Modified the original tests so TinyMCE can be loaded from /src/wp-includes/js/tinymce.
- Added "WP" option to the UI to select only tests relevant to our integration (excludes most of the default plugins tests).
- Added tests for obsolete HTML elements and attributes (html4 back-compat).
See #27014.

git-svn-id: https://develop.svn.wordpress.org/trunk@27155 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-10 01:11:25 +00:00

53 lines
2.7 KiB
JavaScript

function fakeTypeAURL(url) {
return function(callback) {
// type the URL and then press the space bar
tinymce.execCommand('mceInsertContent', false, url);
window.robot.type(32, false, callback, editor.selection.getNode());
};
}
function fakeTypeAnEclipsedURL(url) {
return function(callback) {
// type the URL and then type ')'
tinymce.execCommand('mceInsertContent', false, '(' + url);
window.robot.typeSymbol(")", function() {
window.robot.type(32, false, callback, editor.selection.getNode());
}, editor.selection.getNode());
};
}
function fakeTypeANewlineURL(url) {
return function(callback) {
// type the URL and then press the enter key
tinymce.execCommand('mceInsertContent', false, url);
window.robot.type('\n', false, callback, editor.selection.getNode());
};
}
createAction('Typing HTTP URL', fakeTypeAURL('http://www.ephox.com'));
createAction('Typing HTTPS URL', fakeTypeAURL('https://www.ephox.com'));
createAction('Typing SSH URL', fakeTypeAURL('ssh://www.ephox.com'));
createAction('Typing FTP URL', fakeTypeAURL('ftp://www.ephox.com'));
createAction('Typing WWW URL', fakeTypeAURL('www.ephox.com'));
createAction('Typing WWW URL With End Dot', fakeTypeAURL('www.site.com.'));
createAction('Typing Mail Addr', fakeTypeAURL('user@domain.com'));
createAction('Typing Mail Addr With Protocol', fakeTypeAURL('mailto:user@domain.com'));
createAction('Typing Dashed Mail Addr', fakeTypeAURL('first-last@domain.com'));
createAction('Typing Eclipsed HTTP URL', fakeTypeAnEclipsedURL('http://www.ephox.com'));
createAction('Typing Eclipsed HTTPS URL', fakeTypeAnEclipsedURL('https://www.ephox.com'));
createAction('Typing Eclipsed SSH URL', fakeTypeAnEclipsedURL('ssh://www.ephox.com'));
createAction('Typing Eclipsed FTP URL', fakeTypeAnEclipsedURL('ftp://www.ephox.com'));
createAction('Typing Eclipsed WWW URL', fakeTypeAnEclipsedURL('www.ephox.com'));
createAction('Typing HTTP URL And Newline', fakeTypeANewlineURL('http://www.ephox.com'));
createAction('Typing HTTPS URL And Newline', fakeTypeANewlineURL('https://www.ephox.com'));
createAction('Typing SSH URL And Newline', fakeTypeANewlineURL('ssh://www.ephox.com'));
createAction('Typing FTP URL And Newline', fakeTypeANewlineURL('ftp://www.ephox.com'));
createAction('Typing WWW URL And Newline', fakeTypeANewlineURL('www.ephox.com'));
createAction('Applying OL', 'InsertOrderedList');
createAction('Applying UL', 'InsertUnorderedList');
createAction('Indenting', 'Indent');
createAction('Outdenting', 'Outdent');
createAction('Typing Enter', fakeKeyPressAction('\n'));
createAction('Typing Tab', fakeKeyPressAction('\t'));
createAction('Typing Shift Tab', fakeKeyPressAction('\t', true));