(function() { module("tinymce.plugins.Autolink", { setupModule: function() { QUnit.stop(); tinymce.init({ selector: "textarea", add_unload_trigger: false, skin: false, plugins: 'autolink', autosave_ask_before_unload: false, indent: false, init_instance_callback: function(ed) { window.editor = ed; QUnit.start(); } }); } }); function typeUrl(url) { editor.setContent('
' + url + '
'); Utils.setSelection('p', url.length); Utils.type(' '); return editor.getContent(); } function typeAnEclipsedURL(url) { url = "(" + url; editor.setContent('' + url + '
'); Utils.setSelection('p', url.length); Utils.type(')'); return editor.getContent(); } function typeNewlineURL(url) { editor.setContent('' + url + '
'); Utils.setSelection('p', url.length); Utils.type('\n'); return editor.getContent(); } if (tinymce.Env.ie) { test("Skipped on IE since it has built in logic for autolink", function() { ok(true); }); return; } test("Urls ended with space", function() { equal(typeUrl('http://www.domain.com'), ''); equal(typeUrl('https://www.domain.com'), ''); equal(typeUrl('ssh://www.domain.com'), ''); equal(typeUrl('ftp://www.domain.com'), ''); equal(typeUrl('www.domain.com'), ''); equal(typeUrl('www.domain.com.'), ''); equal(typeUrl('user@domain.com'), ''); equal(typeUrl('mailto:user@domain.com'), ''); equal(typeUrl('first-last@domain.com'), ''); }); test("Urls ended with )", function() { equal(typeAnEclipsedURL('http://www.domain.com'), ''); equal(typeAnEclipsedURL('https://www.domain.com'), ''); equal(typeAnEclipsedURL('ssh://www.domain.com'), ''); equal(typeAnEclipsedURL('ftp://www.domain.com'), ''); equal(typeAnEclipsedURL('www.domain.com'), ''); equal(typeAnEclipsedURL('www.domain.com.'), ''); }); test("Urls ended with new line", function() { equal(typeNewlineURL('http://www.domain.com'), ''); equal(typeNewlineURL('https://www.domain.com'), '
'); equal(typeNewlineURL('ssh://www.domain.com'), '
'); equal(typeNewlineURL('ftp://www.domain.com'), '
'); equal(typeNewlineURL('www.domain.com'), '
'); equal(typeNewlineURL('www.domain.com.'), '
'); }); })();