From ce2dcccf861445fc5ded2612c73769f34a34207f Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 10 Feb 2014 01:11:25 +0000 Subject: [PATCH] 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 --- Gruntfile.js | 13 +- tests/qunit/editor/coverage/index.html | 29 + .../qunit/editor/coverage/js/JSCovReporter.js | 194 ++ .../qunit/editor/coverage/js/backbone-min.js | 4 + tests/qunit/editor/coverage/js/reporter.css | 310 +++ tests/qunit/editor/coverage/js/reporter.js | 31 + .../editor/coverage/js/underscore-min.js | 1 + .../external-plugins/noneditable/plugin.js | 539 ++++ .../noneditable/plugin.min.js | 1 + .../editor/external-plugins/table/plugin.js | 2170 +++++++++++++++++ .../external-plugins/table/plugin.min.js | 1 + tests/qunit/editor/index.html | 22 + tests/qunit/editor/js/qunit/QUnit.LICENSE | 20 + tests/qunit/editor/js/qunit/qunit.css | 119 + tests/qunit/editor/js/qunit/qunit.js | 1265 ++++++++++ tests/qunit/editor/js/qunit/reporter.js | 13 + tests/qunit/editor/js/qunit/testrunner.css | 151 ++ tests/qunit/editor/js/qunit/testrunner.js | 540 ++++ tests/qunit/editor/js/tinymce_loader.js | 17 + tests/qunit/editor/js/utils.js | 299 +++ tests/qunit/editor/plugins/autolink.html | 170 ++ tests/qunit/editor/plugins/autosave.html | 104 + tests/qunit/editor/plugins/fullpage.html | 154 ++ tests/qunit/editor/plugins/jquery_plugin.html | 126 + .../editor/plugins/js/autolink.actions.js | 52 + tests/qunit/editor/plugins/js/dsl.js | 138 ++ tests/qunit/editor/plugins/js/states.js | 176 ++ tests/qunit/editor/plugins/legacyoutput.html | 130 + tests/qunit/editor/plugins/lists.html | 1770 ++++++++++++++ tests/qunit/editor/plugins/media.html | 180 ++ tests/qunit/editor/plugins/noneditable.html | 237 ++ tests/qunit/editor/plugins/paste.html | 440 ++++ .../plugins/plugin_dependency_chain.html | 59 + .../plugin_dependency_chain_legacy.html | 59 + .../plugin_dependency_init_call_order.html | 69 + .../plugins/plugin_dependency_simple.html | 50 + .../plugin_dependency_specific_location.html | 58 + tests/qunit/editor/plugins/searchreplace.html | 132 + tests/qunit/editor/plugins/spellchecker.html | 108 + tests/qunit/editor/plugins/table.html | 348 +++ tests/qunit/editor/plugins/table_robot.html | 189 ++ tests/qunit/editor/plugins/tests.js | 24 + tests/qunit/editor/plugins/wordcount.html | 122 + tests/qunit/editor/test.gif | Bin 0 -> 43 bytes tests/qunit/editor/tinymce/Editor.html | 221 ++ .../qunit/editor/tinymce/EditorCommands.html | 765 ++++++ tests/qunit/editor/tinymce/EnterKey.html | 1018 ++++++++ tests/qunit/editor/tinymce/ForceBlocks.html | 116 + .../qunit/editor/tinymce/Formatter_apply.html | 1228 ++++++++++ .../qunit/editor/tinymce/Formatter_check.html | 271 ++ .../editor/tinymce/Formatter_remove.html | 401 +++ .../qunit/editor/tinymce/Formatter_robot.html | 94 + tests/qunit/editor/tinymce/UndoManager.html | 189 ++ .../editor/tinymce/UndoManager_robot.html | 115 + tests/qunit/editor/tinymce/dom/DOMUtils.html | 27 + tests/qunit/editor/tinymce/dom/DOMUtils.js | 680 ++++++ .../editor/tinymce/dom/DOMUtils_jquery.html | 29 + .../qunit/editor/tinymce/dom/EventUtils.html | 459 ++++ tests/qunit/editor/tinymce/dom/Range.html | 606 +++++ tests/qunit/editor/tinymce/dom/Selection.html | 878 +++++++ .../qunit/editor/tinymce/dom/Serializer.html | 515 ++++ .../editor/tinymce/dom/TridentSelection.html | 586 +++++ tests/qunit/editor/tinymce/dom/test.css | 120 + tests/qunit/editor/tinymce/dom/tests.js | 12 + .../qunit/editor/tinymce/html/DomParser.html | 506 ++++ tests/qunit/editor/tinymce/html/Entities.html | 98 + tests/qunit/editor/tinymce/html/Node.html | 466 ++++ .../qunit/editor/tinymce/html/SaxParser.html | 616 +++++ tests/qunit/editor/tinymce/html/Schema.html | 374 +++ .../qunit/editor/tinymce/html/Serializer.html | 46 + tests/qunit/editor/tinymce/html/Styles.html | 176 ++ tests/qunit/editor/tinymce/html/Writer.html | 174 ++ tests/qunit/editor/tinymce/html/obsolete.html | 294 +++ tests/qunit/editor/tinymce/html/tests.js | 14 + tests/qunit/editor/tinymce/tests.js | 15 + .../editor/tinymce/ui/AbsoluteLayout.html | 63 + tests/qunit/editor/tinymce/ui/Button.html | 133 + .../qunit/editor/tinymce/ui/ButtonGroup.html | 43 + tests/qunit/editor/tinymce/ui/Checkbox.html | 43 + tests/qunit/editor/tinymce/ui/Collection.html | 273 +++ .../qunit/editor/tinymce/ui/ColorButton.html | 132 + tests/qunit/editor/tinymce/ui/ComboBox.html | 49 + tests/qunit/editor/tinymce/ui/Container.html | 43 + tests/qunit/editor/tinymce/ui/Control.html | 229 ++ tests/qunit/editor/tinymce/ui/DragHelper.html | 43 + .../qunit/editor/tinymce/ui/ElementPath.html | 43 + tests/qunit/editor/tinymce/ui/Factory.html | 43 + tests/qunit/editor/tinymce/ui/FieldSet.html | 43 + tests/qunit/editor/tinymce/ui/FilePicker.html | 43 + tests/qunit/editor/tinymce/ui/FitLayout.html | 87 + tests/qunit/editor/tinymce/ui/FlexLayout.html | 915 +++++++ tests/qunit/editor/tinymce/ui/FloatPanel.html | 43 + tests/qunit/editor/tinymce/ui/FlowLayout.html | 43 + tests/qunit/editor/tinymce/ui/Form.html | 43 + tests/qunit/editor/tinymce/ui/FormItem.html | 43 + tests/qunit/editor/tinymce/ui/GridLayout.html | 244 ++ tests/qunit/editor/tinymce/ui/Iframe.html | 43 + .../editor/tinymce/ui/KeyboardNavigation.html | 43 + tests/qunit/editor/tinymce/ui/Label.html | 43 + tests/qunit/editor/tinymce/ui/Layout.html | 43 + tests/qunit/editor/tinymce/ui/ListBox.html | 43 + tests/qunit/editor/tinymce/ui/Menu.html | 43 + tests/qunit/editor/tinymce/ui/MenuBar.html | 43 + tests/qunit/editor/tinymce/ui/MenuButton.html | 139 ++ tests/qunit/editor/tinymce/ui/MenuItem.html | 43 + tests/qunit/editor/tinymce/ui/MessageBox.html | 43 + tests/qunit/editor/tinymce/ui/Movable.html | 43 + tests/qunit/editor/tinymce/ui/Panel.html | 67 + .../qunit/editor/tinymce/ui/PanelButton.html | 43 + tests/qunit/editor/tinymce/ui/Path.html | 43 + tests/qunit/editor/tinymce/ui/Radio.html | 43 + tests/qunit/editor/tinymce/ui/Resizable.html | 43 + .../qunit/editor/tinymce/ui/ResizeHandle.html | 43 + tests/qunit/editor/tinymce/ui/Scrollable.html | 43 + tests/qunit/editor/tinymce/ui/Selector.html | 148 ++ tests/qunit/editor/tinymce/ui/Spacer.html | 43 + .../qunit/editor/tinymce/ui/SplitButton.html | 131 + .../qunit/editor/tinymce/ui/StackLayout.html | 43 + tests/qunit/editor/tinymce/ui/TabPanel.html | 164 ++ tests/qunit/editor/tinymce/ui/TextBox.html | 59 + tests/qunit/editor/tinymce/ui/Throbber.html | 43 + tests/qunit/editor/tinymce/ui/Toolbar.html | 43 + tests/qunit/editor/tinymce/ui/Tooltip.html | 43 + tests/qunit/editor/tinymce/ui/Widget.html | 43 + tests/qunit/editor/tinymce/ui/Window.html | 118 + .../editor/tinymce/ui/css/ui-overrides.css | 30 + tests/qunit/editor/tinymce/ui/img/raster.gif | Bin 0 -> 56 bytes tests/qunit/editor/tinymce/ui/tests.js | 55 + tests/qunit/editor/tinymce/util/JSON.html | 39 + .../editor/tinymce/util/JSONRequest.html | 77 + .../editor/tinymce/util/LocalStorage.html | 118 + .../qunit/editor/tinymce/util/Quirks_all.html | 76 + .../editor/tinymce/util/Quirks_firefox.html | 75 + .../qunit/editor/tinymce/util/Quirks_ie8.html | 82 + .../editor/tinymce/util/Quirks_remove.html | 270 ++ .../editor/tinymce/util/Quirks_webkit.html | 132 + .../tinymce/util/Quirks_webkit_jsrobot.html | 205 ++ tests/qunit/editor/tinymce/util/URI.html | 111 + tests/qunit/editor/tinymce/util/XHR.html | 53 + .../editor/tinymce/util/json_rpc_error.js | 1 + .../qunit/editor/tinymce/util/json_rpc_ok.js | 1 + tests/qunit/editor/tinymce/util/test.xml | 6 + tests/qunit/editor/tinymce/util/tests.js | 16 + tests/qunit/index.html | 1 + 144 files changed, 27501 insertions(+), 3 deletions(-) create mode 100644 tests/qunit/editor/coverage/index.html create mode 100644 tests/qunit/editor/coverage/js/JSCovReporter.js create mode 100644 tests/qunit/editor/coverage/js/backbone-min.js create mode 100644 tests/qunit/editor/coverage/js/reporter.css create mode 100644 tests/qunit/editor/coverage/js/reporter.js create mode 100644 tests/qunit/editor/coverage/js/underscore-min.js create mode 100644 tests/qunit/editor/external-plugins/noneditable/plugin.js create mode 100644 tests/qunit/editor/external-plugins/noneditable/plugin.min.js create mode 100644 tests/qunit/editor/external-plugins/table/plugin.js create mode 100644 tests/qunit/editor/external-plugins/table/plugin.min.js create mode 100644 tests/qunit/editor/index.html create mode 100644 tests/qunit/editor/js/qunit/QUnit.LICENSE create mode 100644 tests/qunit/editor/js/qunit/qunit.css create mode 100644 tests/qunit/editor/js/qunit/qunit.js create mode 100644 tests/qunit/editor/js/qunit/reporter.js create mode 100644 tests/qunit/editor/js/qunit/testrunner.css create mode 100644 tests/qunit/editor/js/qunit/testrunner.js create mode 100644 tests/qunit/editor/js/tinymce_loader.js create mode 100644 tests/qunit/editor/js/utils.js create mode 100644 tests/qunit/editor/plugins/autolink.html create mode 100644 tests/qunit/editor/plugins/autosave.html create mode 100644 tests/qunit/editor/plugins/fullpage.html create mode 100644 tests/qunit/editor/plugins/jquery_plugin.html create mode 100644 tests/qunit/editor/plugins/js/autolink.actions.js create mode 100644 tests/qunit/editor/plugins/js/dsl.js create mode 100644 tests/qunit/editor/plugins/js/states.js create mode 100644 tests/qunit/editor/plugins/legacyoutput.html create mode 100644 tests/qunit/editor/plugins/lists.html create mode 100644 tests/qunit/editor/plugins/media.html create mode 100644 tests/qunit/editor/plugins/noneditable.html create mode 100644 tests/qunit/editor/plugins/paste.html create mode 100644 tests/qunit/editor/plugins/plugin_dependency_chain.html create mode 100644 tests/qunit/editor/plugins/plugin_dependency_chain_legacy.html create mode 100644 tests/qunit/editor/plugins/plugin_dependency_init_call_order.html create mode 100644 tests/qunit/editor/plugins/plugin_dependency_simple.html create mode 100644 tests/qunit/editor/plugins/plugin_dependency_specific_location.html create mode 100644 tests/qunit/editor/plugins/searchreplace.html create mode 100644 tests/qunit/editor/plugins/spellchecker.html create mode 100644 tests/qunit/editor/plugins/table.html create mode 100644 tests/qunit/editor/plugins/table_robot.html create mode 100644 tests/qunit/editor/plugins/tests.js create mode 100644 tests/qunit/editor/plugins/wordcount.html create mode 100644 tests/qunit/editor/test.gif create mode 100644 tests/qunit/editor/tinymce/Editor.html create mode 100644 tests/qunit/editor/tinymce/EditorCommands.html create mode 100644 tests/qunit/editor/tinymce/EnterKey.html create mode 100644 tests/qunit/editor/tinymce/ForceBlocks.html create mode 100644 tests/qunit/editor/tinymce/Formatter_apply.html create mode 100644 tests/qunit/editor/tinymce/Formatter_check.html create mode 100644 tests/qunit/editor/tinymce/Formatter_remove.html create mode 100644 tests/qunit/editor/tinymce/Formatter_robot.html create mode 100644 tests/qunit/editor/tinymce/UndoManager.html create mode 100644 tests/qunit/editor/tinymce/UndoManager_robot.html create mode 100644 tests/qunit/editor/tinymce/dom/DOMUtils.html create mode 100644 tests/qunit/editor/tinymce/dom/DOMUtils.js create mode 100644 tests/qunit/editor/tinymce/dom/DOMUtils_jquery.html create mode 100644 tests/qunit/editor/tinymce/dom/EventUtils.html create mode 100644 tests/qunit/editor/tinymce/dom/Range.html create mode 100644 tests/qunit/editor/tinymce/dom/Selection.html create mode 100644 tests/qunit/editor/tinymce/dom/Serializer.html create mode 100644 tests/qunit/editor/tinymce/dom/TridentSelection.html create mode 100644 tests/qunit/editor/tinymce/dom/test.css create mode 100644 tests/qunit/editor/tinymce/dom/tests.js create mode 100644 tests/qunit/editor/tinymce/html/DomParser.html create mode 100644 tests/qunit/editor/tinymce/html/Entities.html create mode 100644 tests/qunit/editor/tinymce/html/Node.html create mode 100644 tests/qunit/editor/tinymce/html/SaxParser.html create mode 100644 tests/qunit/editor/tinymce/html/Schema.html create mode 100644 tests/qunit/editor/tinymce/html/Serializer.html create mode 100644 tests/qunit/editor/tinymce/html/Styles.html create mode 100644 tests/qunit/editor/tinymce/html/Writer.html create mode 100644 tests/qunit/editor/tinymce/html/obsolete.html create mode 100644 tests/qunit/editor/tinymce/html/tests.js create mode 100644 tests/qunit/editor/tinymce/tests.js create mode 100644 tests/qunit/editor/tinymce/ui/AbsoluteLayout.html create mode 100644 tests/qunit/editor/tinymce/ui/Button.html create mode 100644 tests/qunit/editor/tinymce/ui/ButtonGroup.html create mode 100644 tests/qunit/editor/tinymce/ui/Checkbox.html create mode 100644 tests/qunit/editor/tinymce/ui/Collection.html create mode 100644 tests/qunit/editor/tinymce/ui/ColorButton.html create mode 100644 tests/qunit/editor/tinymce/ui/ComboBox.html create mode 100644 tests/qunit/editor/tinymce/ui/Container.html create mode 100644 tests/qunit/editor/tinymce/ui/Control.html create mode 100644 tests/qunit/editor/tinymce/ui/DragHelper.html create mode 100644 tests/qunit/editor/tinymce/ui/ElementPath.html create mode 100644 tests/qunit/editor/tinymce/ui/Factory.html create mode 100644 tests/qunit/editor/tinymce/ui/FieldSet.html create mode 100644 tests/qunit/editor/tinymce/ui/FilePicker.html create mode 100644 tests/qunit/editor/tinymce/ui/FitLayout.html create mode 100644 tests/qunit/editor/tinymce/ui/FlexLayout.html create mode 100644 tests/qunit/editor/tinymce/ui/FloatPanel.html create mode 100644 tests/qunit/editor/tinymce/ui/FlowLayout.html create mode 100644 tests/qunit/editor/tinymce/ui/Form.html create mode 100644 tests/qunit/editor/tinymce/ui/FormItem.html create mode 100644 tests/qunit/editor/tinymce/ui/GridLayout.html create mode 100644 tests/qunit/editor/tinymce/ui/Iframe.html create mode 100644 tests/qunit/editor/tinymce/ui/KeyboardNavigation.html create mode 100644 tests/qunit/editor/tinymce/ui/Label.html create mode 100644 tests/qunit/editor/tinymce/ui/Layout.html create mode 100644 tests/qunit/editor/tinymce/ui/ListBox.html create mode 100644 tests/qunit/editor/tinymce/ui/Menu.html create mode 100644 tests/qunit/editor/tinymce/ui/MenuBar.html create mode 100644 tests/qunit/editor/tinymce/ui/MenuButton.html create mode 100644 tests/qunit/editor/tinymce/ui/MenuItem.html create mode 100644 tests/qunit/editor/tinymce/ui/MessageBox.html create mode 100644 tests/qunit/editor/tinymce/ui/Movable.html create mode 100644 tests/qunit/editor/tinymce/ui/Panel.html create mode 100644 tests/qunit/editor/tinymce/ui/PanelButton.html create mode 100644 tests/qunit/editor/tinymce/ui/Path.html create mode 100644 tests/qunit/editor/tinymce/ui/Radio.html create mode 100644 tests/qunit/editor/tinymce/ui/Resizable.html create mode 100644 tests/qunit/editor/tinymce/ui/ResizeHandle.html create mode 100644 tests/qunit/editor/tinymce/ui/Scrollable.html create mode 100644 tests/qunit/editor/tinymce/ui/Selector.html create mode 100644 tests/qunit/editor/tinymce/ui/Spacer.html create mode 100644 tests/qunit/editor/tinymce/ui/SplitButton.html create mode 100644 tests/qunit/editor/tinymce/ui/StackLayout.html create mode 100644 tests/qunit/editor/tinymce/ui/TabPanel.html create mode 100644 tests/qunit/editor/tinymce/ui/TextBox.html create mode 100644 tests/qunit/editor/tinymce/ui/Throbber.html create mode 100644 tests/qunit/editor/tinymce/ui/Toolbar.html create mode 100644 tests/qunit/editor/tinymce/ui/Tooltip.html create mode 100644 tests/qunit/editor/tinymce/ui/Widget.html create mode 100644 tests/qunit/editor/tinymce/ui/Window.html create mode 100644 tests/qunit/editor/tinymce/ui/css/ui-overrides.css create mode 100644 tests/qunit/editor/tinymce/ui/img/raster.gif create mode 100644 tests/qunit/editor/tinymce/ui/tests.js create mode 100644 tests/qunit/editor/tinymce/util/JSON.html create mode 100644 tests/qunit/editor/tinymce/util/JSONRequest.html create mode 100644 tests/qunit/editor/tinymce/util/LocalStorage.html create mode 100644 tests/qunit/editor/tinymce/util/Quirks_all.html create mode 100644 tests/qunit/editor/tinymce/util/Quirks_firefox.html create mode 100644 tests/qunit/editor/tinymce/util/Quirks_ie8.html create mode 100644 tests/qunit/editor/tinymce/util/Quirks_remove.html create mode 100644 tests/qunit/editor/tinymce/util/Quirks_webkit.html create mode 100644 tests/qunit/editor/tinymce/util/Quirks_webkit_jsrobot.html create mode 100644 tests/qunit/editor/tinymce/util/URI.html create mode 100644 tests/qunit/editor/tinymce/util/XHR.html create mode 100644 tests/qunit/editor/tinymce/util/json_rpc_error.js create mode 100644 tests/qunit/editor/tinymce/util/json_rpc_ok.js create mode 100644 tests/qunit/editor/tinymce/util/test.xml create mode 100644 tests/qunit/editor/tinymce/util/tests.js diff --git a/Gruntfile.js b/Gruntfile.js index e8e1bc8dcb..b9b1169190 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -160,7 +160,8 @@ module.exports = function(grunt) { tests: { src: [ 'tests/qunit/**/*.js', - '!tests/qunit/vendor/qunit.js' + '!tests/qunit/vendor/qunit.js', + '!tests/qunit/editor/**' ], options: grunt.file.readJSON('tests/qunit/.jshintrc') }, @@ -228,7 +229,10 @@ module.exports = function(grunt) { } }, qunit: { - files: ['tests/qunit/**/*.html'] + files: [ + 'tests/qunit/**/*.html', + '!tests/qunit/editor/**' + ] }, phpunit: { 'default': { @@ -340,7 +344,10 @@ module.exports = function(grunt) { } }, test: { - files: ['tests/qunit/**'], + files: [ + 'tests/qunit/**', + '!tests/qunit/editor/**' + ], tasks: ['qunit'] } } diff --git a/tests/qunit/editor/coverage/index.html b/tests/qunit/editor/coverage/index.html new file mode 100644 index 0000000000..dd632bb9c6 --- /dev/null +++ b/tests/qunit/editor/coverage/index.html @@ -0,0 +1,29 @@ + + + + +Code Coverage + + + + + + + + + + + + + +
+ + + + + diff --git a/tests/qunit/editor/coverage/js/JSCovReporter.js b/tests/qunit/editor/coverage/js/JSCovReporter.js new file mode 100644 index 0000000000..4f530019d8 --- /dev/null +++ b/tests/qunit/editor/coverage/js/JSCovReporter.js @@ -0,0 +1,194 @@ +JSCovFileReporter = Backbone.View.extend({ + initialize: function () { + _.bindAll(this); + this.open = '{line_number}{count}'; + this.close = ''; + + this.coverObject = this.options.coverObject; + + this.error = 0; + this.pass = 0; + this.total = 0; + }, + + // substitute credits: MooTools + substitute: function(string, object){ + return string.replace(/\\?\{([^{}]+)\}/g, function(match, name){ + if (match.charAt(0) == '\\') return match.slice(1); + return (object[name] !== null) ? object[name] : ''; + }); + }, + + generateClose: function(count){ + return this.substitute(this.close, { + count: count + }); + }, + + generateOpen: function(hit_count, line_number){ + return this.substitute(this.open, { + 'count': hit_count, + 'line_number': line_number, + 'class': hit_count ? 'hit' : 'miss' + }); + }, + + report: function () { + var thisview = this; + var i, l, k; + + var code = this.coverObject.__code; + + // generate array of all tokens + var codez = []; + for (i = 0, l = code.length; i < l; i++){ + codez.push({ + pos: i, + value: code.slice(i, i + 1) + }); + } + + // CoverObject has keys like "12:200" which means from char 12 to 200 + // This orders all first gaps in a list of dictionaries to ease drawing table lines + var gaps = Object.keys(this.coverObject); + gaps = _.without(gaps, '__code'); + var first_gaps = _.map(gaps, function ( gap ) { + return { + gap: parseInt(gap.split(':')[0], 10), + hit_count: thisview.coverObject[gap] + }; + }).sort(function (a, b) { + if (a['gap'] > b['gap']) return 1; + if (b['gap'] > a['gap']) return -1; + return 0; + }); + + var second_gaps = _.map(gaps, function ( gap ) { + return { + gap: parseInt(gap.split(':')[1], 10), + hit_count: thisview.coverObject[gap] + }; + }).sort(function (a, b) { + if (a['gap'] > b['gap']) return 1; + if (b['gap'] > a['gap']) return -1; + return 0; + }); + + + // If it doesn't start from 0 it's because there are comments in the beginning + // We add a initial gap with one hit + if (first_gaps[0] !== 0) { + first_gaps.splice(0, 0, {gap: 0, hit_count: 1}); + } + + var result = ''; + var number_trailing_whitespaces = 0; + var trailing_whitespaces = ''; + + + // We will go from one gap to the next wrapping them in table lines + for (i=0, l = first_gaps.length; i < l; i++){ + + var hit_count = first_gaps[i]['hit_count']; + + this.total++; + if (hit_count) this.pass++; + else this.error++; + + var limit = null; + if (i+1 >= l) { + limit = codez.length; + } + else { + limit = first_gaps[i+1]['gap']; + } + + // Table line opening + result += this.generateOpen(hit_count, this.total); + + // Add trailing white space if it existed from previous line without carriage returns + if (number_trailing_whitespaces > 0 ) { + result += trailing_whitespaces.replace(/(\r\n|\n|\r)/gm,""); + } + + // Add lines of code without initial white spaces, and replacing conflictive chars + result += _.map(codez.slice(first_gaps[i]['gap'], limit), function (loc) { + return loc['value']; + }).join('').trimLeft().replace(//g, '>'); + + // Count trailing white spaces for future line, then remove them + var matches = result.match(/(\s+)$/); + result = result.trimRight(); + + if (matches !== null) { + number_trailing_whitespaces = matches[0].length; + trailing_whitespaces = matches[0]; + } + else { + number_trailing_whitespaces = 0; + } + + // Generate table line closing + result += this.generateClose(hit_count); + } + + return result; + } +}); + + +JSCovReporter = Backbone.View.extend({ + initialize: function () { + this.coverObject = this.options.coverObject; + + // Generate the report + this.report(); + + // Activate reporter.js scrolling UX + onload(); + }, + + report: function () { + var result = ''; + var index = ''; + + for (var file in this.coverObject) { + var fileReporter = new JSCovFileReporter({ coverObject: this.coverObject[file] }); + + var fileReport = fileReporter.report(); + var percentage = Math.round(fileReporter.pass / fileReporter.total * 100); + + this.error += fileReporter.error; + this.pass += fileReporter.pass; + this.total += fileReporter.total; + + var type_coverage = "high"; + if (percentage < 75 && percentage >= 50) { + type_coverage = 'medium'; + } + else if (percentage < 50 && percentage >= 25) { + type_coverage = 'low'; + } + else if (percentage < 25) { + type_coverage = 'terrible'; + } + + // Title + result += '

' + file + '

'; + // Stats + result += '
'+ percentage + '%
'; + result += '
' + fileReporter.total + '
' + fileReporter.pass + '
'; + result += '
' + fileReporter.error + '
'; + // Report + result += '
'; + result += '' + fileReport + '
'; + result += '
'; + + // Menu index + index += '
  • ' + percentage + '' + file + '
  • '; + } + + $('#coverage').html(result); + $('#menu').html(''); + } +}); diff --git a/tests/qunit/editor/coverage/js/backbone-min.js b/tests/qunit/editor/coverage/js/backbone-min.js new file mode 100644 index 0000000000..3541019c58 --- /dev/null +++ b/tests/qunit/editor/coverage/js/backbone-min.js @@ -0,0 +1,4 @@ +(function(){var t=this;var e=t.Backbone;var i=[];var r=i.push;var s=i.slice;var n=i.splice;var a;if(typeof exports!=="undefined"){a=exports}else{a=t.Backbone={}}a.VERSION="1.0.0";var h=t._;if(!h&&typeof require!=="undefined")h=require("underscore");a.$=t.jQuery||t.Zepto||t.ender||t.$;a.noConflict=function(){t.Backbone=e;return this};a.emulateHTTP=false;a.emulateJSON=false;var o=a.Events={on:function(t,e,i){if(!l(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,i){if(!l(this,"once",t,[e,i])||!e)return this;var r=this;var s=h.once(function(){r.off(t,s);e.apply(this,arguments)});s._callback=e;return this.on(t,s,i)},off:function(t,e,i){var r,s,n,a,o,u,c,f;if(!this._events||!l(this,"off",t,[e,i]))return this;if(!t&&!e&&!i){this._events={};return this}a=t?[t]:h.keys(this._events);for(o=0,u=a.length;o").attr(t);this.setElement(e,false)}else{this.setElement(h.result(this,"el"),false)}}});a.sync=function(t,e,i){var r=k[t];h.defaults(i||(i={}),{emulateHTTP:a.emulateHTTP,emulateJSON:a.emulateJSON});var s={type:r,dataType:"json"};if(!i.url){s.url=h.result(e,"url")||U()}if(i.data==null&&e&&(t==="create"||t==="update"||t==="patch")){s.contentType="application/json";s.data=JSON.stringify(i.attrs||e.toJSON(i))}if(i.emulateJSON){s.contentType="application/x-www-form-urlencoded";s.data=s.data?{model:s.data}:{}}if(i.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){s.type="POST";if(i.emulateJSON)s.data._method=r;var n=i.beforeSend;i.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",r);if(n)return n.apply(this,arguments)}}if(s.type!=="GET"&&!i.emulateJSON){s.processData=false}if(s.type==="PATCH"&&window.ActiveXObject&&!(window.external&&window.external.msActiveXFilteringEnabled)){s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var o=i.xhr=a.ajax(h.extend(s,i));e.trigger("request",e,o,i);return o};var k={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};a.ajax=function(){return a.$.ajax.apply(a.$,arguments)};var S=a.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var $=/\((.*?)\)/g;var T=/(\(\?)?:\w+/g;var H=/\*\w+/g;var A=/[\-{}\[\]+?.,\\\^$|#\s]/g;h.extend(S.prototype,o,{initialize:function(){},route:function(t,e,i){if(!h.isRegExp(t))t=this._routeToRegExp(t);if(h.isFunction(e)){i=e;e=""}if(!i)i=this[e];var r=this;a.history.route(t,function(s){var n=r._extractParameters(t,s);i&&i.apply(r,n);r.trigger.apply(r,["route:"+e].concat(n));r.trigger("route",e,n);a.history.trigger("route",r,e,n)});return this},navigate:function(t,e){a.history.navigate(t,e);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=h.result(this,"routes");var t,e=h.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(A,"\\$&").replace($,"(?:$1)?").replace(T,function(t,e){return e?t:"([^/]+)"}).replace(H,"(.*?)");return new RegExp("^"+t+"$")},_extractParameters:function(t,e){var i=t.exec(e).slice(1);return h.map(i,function(t){return t?decodeURIComponent(t):null})}});var I=a.History=function(){this.handlers=[];h.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var N=/^[#\/]|\s+$/g;var P=/^\/+|\/+$/g;var O=/msie [\w.]+/;var C=/\/$/;I.started=false;h.extend(I.prototype,o,{interval:50,getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=this.location.pathname;var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.substr(i.length)}else{t=this.getHash()}}return t.replace(N,"")},start:function(t){if(I.started)throw new Error("Backbone.history has already been started");I.started=true;this.options=h.extend({},{root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var e=this.getFragment();var i=document.documentMode;var r=O.exec(navigator.userAgent.toLowerCase())&&(!i||i<=7);this.root=("/"+this.root+"/").replace(P,"/");if(r&&this._wantsHashChange){this.iframe=a.$(''; + + // coverage + html += '
    '; + html += '
    '; + html += 'x'; + html += ''; + html += '
    '; + + div.innerHTML = html; + document.body.appendChild(div); + + get('sidebar').onclick = function(e) { + var target; + + e = e || event; + target = e.target || e.srcElement; + + if ((action = actions[target.getAttribute("data-action")])) { + action(target); + } + + statesToHash(); + }; + } + + function addSuites(urls) { + suiteUrls.push.apply(suiteUrls, urls); + } + + function loadSuite(url, callback) { + var xhr; + + function ready() { + if (xhr.readyState == 4) { + callback(eval("(" + xhr.responseText + ")"), url); + xhr = null; + } else { + setTimeout(ready, 10); + } + } + + xhr = new XMLHttpRequest(); + + if (xhr) { + xhr.open('GET', url, true); + xhr.send(); + setTimeout(ready, 10); + } + } + + function reflow() { + var viewPortW, viewPortH, sideBarWidth, controlsHeight; + + function rect(id, x, y, w, h) { + var style, elm; + + if ((elm = get(id))) { + style = elm.style; + style.left = x + "px"; + style.top = y + "px"; + style.width = w + "px"; + style.height = h + "px"; + } + } + + viewPortW = window.innerWidth || document.documentElement.clientWidth; + viewPortH = window.innerHeight || document.documentElement.clientHeight; + + sideBarWidth = 300; + controlsHeight = 60; + + rect('testview', sideBarWidth, 0, viewPortW - sideBarWidth, viewPortH); + rect('sidebar', 0, 0, sideBarWidth, viewPortH); + rect('controls', 0, 0, sideBarWidth, controlsHeight); + rect('tests', 0, controlsHeight, sideBarWidth, viewPortH - controlsHeight); + } + + function reset() { + var si, tests, ti; + + stop(); + get('gstatus').innerHTML = ''; + removeClass(get("controls"), "failed"); + + for (si = 0; si < suites.length; si++) { + tests = suites[si].tests; + for (ti = 0; ti < tests.length; ti++) { + removeClass(get('t' + si + '-' + ti), "passed"); + removeClass(get('t' + si + '-' + ti), "failed"); + removeClass(get('t' + si + '-' + ti), "running"); + } + } + } + + function updateGlobalStatus() { + get('gstatus').innerHTML = 'Total: ' + globalStats.total + ", Failed: " + globalStats.failed; + addClass(get("controls"), globalStats.failed > 0 ? "failed" : ""); + } + + function done(failed, total) { + var nextTest, currentTestElm; + + function runNextTest() { + if ((nextTest = testUrls.shift())) { + currentTest = nextTest; + currentTestElm = get('t' + currentTest.suiteIndex + '-' + currentTest.testIndex); + currentTestElm.scrollIntoView(false); + + if (nextTest.jsrobot === true && !get('jsrobot').checked) { + get('s' + currentTest.suiteIndex + '-' + currentTest.testIndex).innerHTML = 'Skipped'; + addClass(currentTestElm, "skipped"); + runNextTest(); + } else { + addClass(currentTestElm, "running"); + get('testview').src = nextTest.url + "?min=" + get('min').checked; + } + } else { + stop(); + } + } + + if (started) { + currentTest.failed = failed; + currentTest.total = total; + + globalStats.total += total; + globalStats.failed += failed; + updateGlobalStatus(); + + get('s' + currentTest.suiteIndex + '-' + currentTest.testIndex).innerHTML = ( + '(' + failed + ', ' + + '' + (total - failed) + ', ' + + '' + total + ')' + ); + + addClass(get('t' + currentTest.suiteIndex + '-' + currentTest.testIndex), failed > 0 ? 'failed' : 'passed'); + removeClass(currentTestElm, "running"); + + runNextTest(); + } + } + + + function addCoverObject(coverObject) { + coverObjects.push(coverObject); + } + + + // this is going to be called from the coverage iframe + function getCoverObject() { + var coverObject = {}, fileName, gaps, gap, count; + + for (var i = 0, length = coverObjects.length; i < length; i++) { + for (fileName in coverObjects[i]) { + gaps = coverObjects[i][fileName]; + + if (!coverObject.hasOwnProperty(fileName)) { + coverObject[fileName] = gaps; + } else { + for (gap in gaps) { + if (gap === '__code') { + continue; + } + count = gaps[gap]; + if (!coverObject[fileName].hasOwnProperty(gap)) { + coverObject[fileName][gap] = count; + } else { + coverObject[fileName][gap] += count; + } + } + } + } + } + + return coverObject; + } + + function showCoverage() { + var overlay, coverView, viewPortW, viewPortH; + + viewPortW = window.innerWidth || document.documentElement.clientWidth; + viewPortH = window.innerHeight || document.documentElement.clientHeight; + + overlay = get('overlay'); + overlay.style.display = 'block'; + + coverView = get('coverview'); + coverView.style.left = '30px'; + coverView.style.top = '30px'; + coverView.style.width = (viewPortW - 60) + 'px'; + coverView.style.height = (viewPortH - 60) + 'px'; + coverView.style.display = 'block'; + + coverView.getElementsByTagName('iframe')[0].src = 'coverage/index.html'; + } + + function hideCoverage() { + get('overlay').style.display = 'none'; + get('coverview').style.display = 'none'; + } + + return { + init: init, + addSuites: addSuites, + reflow: reflow, + done: done, + addCoverObject: addCoverObject, + getCoverObject: getCoverObject, + showCoverage: showCoverage, + hideCoverage: hideCoverage + }; + } + + var testRunner = new TestRunner(); + + self.onload = function() { + testRunner.init(); + }; + + self.onresize = function() { + testRunner.reflow(); + }; + + self.TestRunner = testRunner; +})(); diff --git a/tests/qunit/editor/js/tinymce_loader.js b/tests/qunit/editor/js/tinymce_loader.js new file mode 100644 index 0000000000..1c4a1a4dc6 --- /dev/null +++ b/tests/qunit/editor/js/tinymce_loader.js @@ -0,0 +1,17 @@ +// Edited for WordPress +(function() { + var baseURL; + + // Get base where the tinymce script is located + var scripts = document.getElementsByTagName('script'); + for ( var i = 0; i < scripts.length; i++ ) { + var src = scripts[i].src; + + if ( /tinymce_loader\.js/.test( src ) ) { + baseURL = src.substring( 0, src.indexOf('/tests/qunit/') ); + break; + } + } + + document.write(''); +})(); diff --git a/tests/qunit/editor/js/utils.js b/tests/qunit/editor/js/utils.js new file mode 100644 index 0000000000..f0c344ccac --- /dev/null +++ b/tests/qunit/editor/js/utils.js @@ -0,0 +1,299 @@ +function fontFace(face) { + if (tinymce.isOpera) { + return "'" + face + "'"; + } else { + return face; + } +} + +function findContainer(selector) { + var container; + if (tinymce.is(selector, 'string')) { + container = editor.dom.select(selector)[0]; + } else { + container = selector; + } + if (container.firstChild) { + container = container.firstChild; + } + return container; +} + +function setSelection(startSelector, startOffset, endSelector, endOffset) { + if (!endSelector) { + endSelector = startSelector; + endOffset = startOffset; + } + var startContainer = findContainer(startSelector); + var endContainer = findContainer(endSelector); + var rng = editor.dom.createRng(); + + function setRange(container, offset, start) { + offset = offset || 0; + + if (offset === 'after') { + if (start) { + rng.setStartAfter(container); + } else { + rng.setEndAfter(container); + } + return; + } else if (offset === 'afterNextCharacter') { + container = container.nextSibling; + offset = 1; + } + if (start) { + rng.setStart(container, offset); + } else { + rng.setEnd(container, offset); + } + } + + setRange(startContainer, startOffset, true); + setRange(endContainer, endOffset, false); + editor.selection.setRng(rng); +} + +function initWhenTinyAndRobotAreReady(initTinyFunction) { + function loaded() { + QUnit.start(); + } + + tinymce.on('AddEditor', function(e) { + e.editor.on('Init', function() { + loaded(); + }); + }); + + window.robot.onload(initTinyFunction); +} + +function trimContent(content) { + return content.replace(/^

     <\/p>\n?/, '').replace(/\n?

     <\/p>$/, ''); +} + +/** + * Fakes a key event. + * + * @param {Element/String} e DOM element object or element id to send fake event to. + * @param {String} na Event name to fake like "keydown". + * @param {Object} o Optional object with data to send with the event like keyCode and charCode. + */ +function fakeKeyEvent(e, na, o) { + var ev; + + o = tinymce.extend({ + keyCode : 13, + charCode : 0 + }, o); + + e = tinymce.DOM.get(e); + + if (e.fireEvent) { + ev = document.createEventObject(); + tinymce.extend(ev, o); + e.fireEvent('on' + na, ev); + return; + } + + if (document.createEvent) { + try { + // Fails in Safari + ev = document.createEvent('KeyEvents'); + ev.initKeyEvent(na, true, true, window, false, false, false, false, o.keyCode, o.charCode); + } catch (ex) { + ev = document.createEvent('Events'); + ev.initEvent(na, true, true); + + ev.keyCode = o.keyCode; + ev.charCode = o.charCode; + } + } else { + ev = document.createEvent('UIEvents'); + + if (ev.initUIEvent) + ev.initUIEvent(na, true, true, window, 1); + + ev.keyCode = o.keyCode; + ev.charCode = o.charCode; + } + + e.dispatchEvent(ev); +} + +function normalizeRng(rng) { + if (rng.startContainer.nodeType == 3) { + if (rng.startOffset == 0) + rng.setStartBefore(rng.startContainer); + else if (rng.startOffset >= rng.startContainer.nodeValue.length - 1) + rng.setStartAfter(rng.startContainer); + } + + if (rng.endContainer.nodeType == 3) { + if (rng.endOffset == 0) + rng.setEndBefore(rng.endContainer); + else if (rng.endOffset >= rng.endContainer.nodeValue.length - 1) + rng.setEndAfter(rng.endContainer); + } + + return rng; +} + +// TODO: Replace this with the new event logic in 3.5 +function type(chr) { + var editor = tinymce.activeEditor, keyCode, charCode, event = tinymce.dom.Event, evt, startElm, rng; + + function fakeEvent(target, type, evt) { + editor.dom.fire(target, type, evt); + } + + // Numeric keyCode + if (typeof(chr) == "number") { + charCode = keyCode = chr; + } else if (typeof(chr) == "string") { + // String value + if (chr == '\b') { + keyCode = 8; + charCode = chr.charCodeAt(0); + } else if (chr == '\n') { + keyCode = 13; + charCode = chr.charCodeAt(0); + } else { + charCode = chr.charCodeAt(0); + keyCode = charCode; + } + } else { + evt = chr; + } + + evt = evt || {keyCode: keyCode, charCode: charCode}; + + startElm = editor.selection.getStart(); + fakeEvent(startElm, 'keydown', evt); + fakeEvent(startElm, 'keypress', evt); + + if (!evt.isDefaultPrevented()) { + if (keyCode == 8) { + if (editor.getDoc().selection) { + rng = editor.getDoc().selection.createRange(); + + if (rng.text.length === 0) { + rng.moveStart('character', -1); + rng.select(); + } + + rng.execCommand('Delete', false, null); + } else { + rng = editor.selection.getRng(); + + if (rng.startContainer.nodeType == 1 && rng.collapsed) { + var nodes = rng.startContainer.childNodes, lastNode = nodes[nodes.length - 1]; + + // If caret is at

    abc|

    and after the abc text node then move it to the end of the text node + // Expand the range to include the last char

    ab[c]

    since IE 11 doesn't delete otherwise + if (rng.startOffset >= nodes.length - 1 && lastNode && lastNode.nodeType == 3 && lastNode.data.length > 0) { + rng.setStart(lastNode, lastNode.data.length - 1); + rng.setEnd(lastNode, lastNode.data.length); + editor.selection.setRng(rng); + } + } + + editor.getDoc().execCommand('Delete', false, null); + } + } else if (typeof(chr) == 'string') { + rng = editor.selection.getRng(true); + + if (rng.startContainer.nodeType == 3 && rng.collapsed) { + rng.startContainer.insertData(rng.startOffset, chr); + rng.setStart(rng.startContainer, rng.startOffset + 1); + rng.collapse(true); + editor.selection.setRng(rng); + } else { + rng.insertNode(editor.getDoc().createTextNode(chr)); + } + } + } + + fakeEvent(startElm, 'keyup', evt); +} + +function cleanHtml(html) { + html = html.toLowerCase().replace(/[\r\n]+/gi, ''); + html = html.replace(/ (sizcache[0-9]+|sizcache|nodeindex|sizset[0-9]+|sizset|data\-mce\-expando|data\-mce\-selected)="[^"]*"/gi, ''); + html = html.replace(/]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\/span>|]+data-mce-bogus[^>]+><\/div>/gi, ''); + + return html; +} + +function normalizeHtml(html) { + var writer = new tinymce.html.Writer(); + + new tinymce.html.SaxParser({ + validate: false, + comment: writer.comment, + cdata: writer.cdata, + text: writer.text, + end: writer.end, + pi: writer.pi, + doctype: writer.doctype, + + start: function(name, attrs, empty) { + attrs.sort(function(a, b) { + if (a.name === b.name) { + return 0; + } + + return a.name > b.name ? 1 : -1; + }); + + writer.start(name, attrs, empty); + } + }).parse(html); + + return writer.getContent(); +} + +/** + * Measures the x, y, w, h of the specified element/control relative to the view element. + */ +function rect(ctrl) { + var outerRect, innerRect; + + if (ctrl.nodeType) { + innerRect = ctrl.getBoundingClientRect(); + } else { + innerRect = ctrl.getEl().getBoundingClientRect(); + } + + outerRect = document.getElementById('view').getBoundingClientRect(); + + return [ + Math.round(innerRect.left - outerRect.left), + Math.round(innerRect.top - outerRect.top), + Math.round(innerRect.right - innerRect.left), + Math.round(innerRect.bottom - innerRect.top) + ]; +} + +function size(ctrl) { + return rect(ctrl).slice(2); +} + +function resetScroll(elm) { + elm.scrollTop = 0; + elm.scrollLeft = 0; +} + +// Needed since fonts render differently on different platforms +function nearlyEqualRects(rect1, rect2, diff) { + diff = diff || 1; + + for (var i = 0; i < 4; i++) { + if (Math.abs(rect1[i] - rect2[i]) > diff) { + deepEqual(rect1, rect2); + return; + } + } + + ok(true); +} diff --git a/tests/qunit/editor/plugins/autolink.html b/tests/qunit/editor/plugins/autolink.html new file mode 100644 index 0000000000..46a83cad63 --- /dev/null +++ b/tests/qunit/editor/plugins/autolink.html @@ -0,0 +1,170 @@ + + + +Automatic link tests + + + + + + + + + + + +

    Automatic link tests

    +

    +
    +

    +
      +
      + +
      + + + + diff --git a/tests/qunit/editor/plugins/autosave.html b/tests/qunit/editor/plugins/autosave.html new file mode 100644 index 0000000000..b167df586b --- /dev/null +++ b/tests/qunit/editor/plugins/autosave.html @@ -0,0 +1,104 @@ + + + +Unit tests for the Autosave plugin + + + + + + + + + + +

      Unit tests for the Table plugin

      +

      +
      +

      +
        + + +
        + [getRawContents] + [getContents] +
        + + diff --git a/tests/qunit/editor/plugins/fullpage.html b/tests/qunit/editor/plugins/fullpage.html new file mode 100644 index 0000000000..310db10496 --- /dev/null +++ b/tests/qunit/editor/plugins/fullpage.html @@ -0,0 +1,154 @@ + + + +Fullpage plugin tests + + + + + + + + +

        Fullpage plugin tests

        +

        +
        +

        +
          + + + diff --git a/tests/qunit/editor/plugins/jquery_plugin.html b/tests/qunit/editor/plugins/jquery_plugin.html new file mode 100644 index 0000000000..a2e3d6b2c1 --- /dev/null +++ b/tests/qunit/editor/plugins/jquery_plugin.html @@ -0,0 +1,126 @@ + + + +jQuery Plugin tests + + + + + + + + + + +

          TinyMCE jQuery plugin tests

          +

          +
          +

          +
            +
            + + + +
            + + diff --git a/tests/qunit/editor/plugins/js/autolink.actions.js b/tests/qunit/editor/plugins/js/autolink.actions.js new file mode 100644 index 0000000000..53d50e32c8 --- /dev/null +++ b/tests/qunit/editor/plugins/js/autolink.actions.js @@ -0,0 +1,52 @@ +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)); diff --git a/tests/qunit/editor/plugins/js/dsl.js b/tests/qunit/editor/plugins/js/dsl.js new file mode 100644 index 0000000000..742321572e --- /dev/null +++ b/tests/qunit/editor/plugins/js/dsl.js @@ -0,0 +1,138 @@ +var editor; + +function getFunctionName(func) { + if (func.name && func.name != "") { + return func.name; + } else if (typeof func == "function" || typeof func == "object") { + var fName = ("" + func).match(/function\s*([\w\$]+)\s*\(/); + if (fName !== null && fName != "") { + return fName[1]; + } else { + for (var v in window) { + if (window[v] === func) { + func.name = v; + return v; + } + } + } + } +} + +function assertState(expected, message) { + var content = editor.getContent().replace(/[\n\r]/g, ''); + if (expected && expected.replace) expected = expected.replace(/[\n\r]/g, ''); + // Safari reports "function", while Firefox and IE report "object" + if (typeof expected == "function" || typeof expected == "object") { + if (expected.test(content)) + equal(content, content, message); + else + equal(content, expected.toString(), message); + } else { + equal(content, expected, message); + } +} + +tinymce.create('dsl.Queue', { + Queue: function() { + this.queue = []; + }, + + add: function(task) { + this.queue.push(task); + }, + + next: function() { + if (this.queue.length > 0) { + var task = this.queue.shift(); + task(); + return true; + } else { + QUnit.start(); + return false; + } + }, + + done: function() { + expect(this.queue.length); + this.next(); + } +}); + +tinymce.create('dsl.Action', { + Action: function(name, action) { + this.name = name; + this.a = this.curryPreposition('a'); + this.inA = this.curryPreposition('in a'); + this.to = this.curryPreposition('to'); + if (tinymce.is(action, 'string')) { + this.action = function(callback) { + editor.execCommand(action); + callback(); + }; + } else { + this.action = action; + } + }, + + curryPreposition: function(preposition) { + return function(state) { + return this.go(state, preposition); + }; + }, + + go: function(state, preposition) { + var message = this.name + " " + preposition + " " + getFunctionName(state); + var action = this.action; + var actionPerformed = false; + function defer(callback) { + return function() { + var args = arguments; + queue.add(function() { + if (actionPerformed) { + callback.apply(undefined, args); + queue.next(); + return; + } + editor.focus(); + state(); + action(function() { + actionPerformed = true; + callback.apply(undefined, args); + queue.next(); + }); + }); + return this; + }; + } + + var dslState = { + gives: defer(function(expected) { + assertState(expected, message); + }), + + enablesState: defer(function(state) { + ok(editor.queryCommandState(state), message + " enables " + state + " command"); + }), + + disablesState: defer(function(state) { + ok(!editor.queryCommandState(state), message + " disables " + state + " command"); + }) + }; + dslState.andGives = dslState.gives; + return dslState; + } +}); + + +// Action Utilities +function fakeKeyPressAction(keyCode, shiftKey) { + return function(callback) { + setTimeout(function() { + window.robot.type(keyCode, shiftKey, callback, editor.selection.getNode()); + }, 1); + }; +} + +function createAction(name, action) { + window[name.replace(/\s+/g, '')] = new dsl.Action(name, action); +} \ No newline at end of file diff --git a/tests/qunit/editor/plugins/js/states.js b/tests/qunit/editor/plugins/js/states.js new file mode 100644 index 0000000000..611ffdee8e --- /dev/null +++ b/tests/qunit/editor/plugins/js/states.js @@ -0,0 +1,176 @@ +function createState(content, startSelector, startOffset, endSelector, endOffset) { + return function() { + editor.setContent(content); + setSelection(startSelector, startOffset, endSelector, endOffset); + }; +} + +/** Collapsed Selection States **/ +function EmptyParagraph() { + var body = editor.getBody(); + while (body.firstChild) { + editor.dom.remove(body.firstChild); + } + var p = body.ownerDocument.createElement('p'); + p.appendChild(body.ownerDocument.createTextNode('')); + body.appendChild(p, body); + setSelection(p.firstChild, 0); +} + +function EmptyHeading() { + EmptyParagraph(); + editor.dom.rename(editor.getBody().firstChild, 'h1'); + setSelection(editor.getBody().firstChild.firstChild, 0); +} + +function TextAfterUL() { + editor.setContent('
            • Item
            Test'); + setSelection(editor.dom.getRoot().lastChild, 2); +} + +function TextAfterOL() { + editor.setContent('
            1. Item
            Test'); + setSelection(editor.dom.getRoot().lastChild, 2); +} + +EmptyContent = createState('', 'body', 0); +PlainText = createState('Test', 'body', 0); +NonEmptyParagraph = createState('

            Test

            ', 'p', 0); +ParagraphWithMarginLeft = createState('

            Test

            ', 'p', 0); +ParagraphWithPaddingLeft = createState('

            Test

            ', 'p', 0); +ParagraphWithMarginAndPaddingLeft = createState('

            Test

            ', 'p', 0); + +CenteredListItem = createState('
            • Item1
            • Item2
            ', 'li:nth-child(1)', 2); +ItemInCenteredList = createState('
            • Item1
            • Item2
            ', 'li:nth-child(1)', 2); +RightAlignedListItem = createState('
            • Item1
            • Item2
            ', 'li:nth-child(1)', 2); +ItemInRightAlignedList = createState('
            • Item1
            • Item2
            ', 'li:nth-child(1)', 2); + +ParagraphBetweenOrderedLists = createState('
            1. Item1

            Test

            1. Item2
            ', 'p', 2); +ParagraphBetweenUnorderedLists = createState('
            • Item1

            Test

            • Item2
            ', 'p', 2); +ParagraphBetweenMixedLists = createState('
            1. Item1

            Test

            • Item2
            ', 'p', 2); + +NonEmptyHeading = createState('

            Test

            ', 'h1', 0); +TableCellWithoutBrs = createState('
            Test 
            ', 'td', 4); +TableCellWithoutBrs2 = createState('
            Test 
            ', 'td', 0); +TableCellWithBrsFirstLine = createState('
            Test
            Line 2
             
            ', 'td', 1); +TableCellWithBrsFirstLine2 = createState('
            Test
            Line 2
             
            ', 'td', 0); +TableCellWithBrsMiddleLine = createState('
            Test
            Line 2
            Line 3
             
            ', 'td br:nth-child(1)', 'afterNextCharacter'); +TableCellWithBrsLastLine = createState('
            Test
            Line 2
             
            ', 'td br:nth-child(1)', 'afterNextCharacter'); +TableCellWithAdjacentBrsFirstLine = createState('
            Test

            Line 2
             
            ', 'td', 1); + +HeadingInOrderedList = createState('
            1. Test

            ', 'h2', '2'); +HeadingInUnorderedList = createState('
            • Test

            ', 'h2', '2'); +HeadingInOrderedListBeforeParagraph = createState('
            1. Test

            Content
            After

            ', 'h2', '2'); + +DefinitionListDescription = createState('
            Term
            Description
            ', 'dd', 2); +DefinitionListTerm = createState('
            Term
            Description
            ', 'dt', 2); +EndOfParagraphBeforeOL = createState('

            Test

            1. Item
            ', 'p', 4); +EndOfParagraphBeforeOLWithListType = createState('

            Test

            1. Item
            ', 'p', 4); +EndOfParagraphBeforeUL = createState('

            Test

            • Item
            ', 'p', 4); +StartOfParagraphAfterOL = createState('
            1. Item

            Test

            ', 'p', 1); +StartOfParagraphAfterUL = createState('
            • Item

            Test

            ', 'p', 1); +StartOfParagraphAfterOLWithListType = createState('
            1. Item

            Test

            ', 'p', 1); +EmptyOrderedListItem = createState('
            1. Before
            2.  
            3. After
            ', 'li:nth-child(2)', 0); +EmptyUnorderedListItem = createState('
            • Before
            •  
            • After
            ', 'li:nth-child(2)', 0); +NonEmptyOrderedListItem = createState('
            1. Before
            2. Test
            3. After
            ', 'li:nth-child(2)', 0); +NonEmptyUnorderedListItem = createState('
            • Before
            • Test
            • After
            ', 'li:nth-child(2)', 0); +NestedEmptyOrderedListItem = createState('
            1. Before
              1.  
            2. After
            ', 'li ol li', 0); +NestedEmptyUnorderedListItem = createState('
            • Before
              •  
            • After
            ', 'li ul li', 0); +NestedNonEmptyOrderedListItem = createState('
            1. Before
              1. Test
            2. After
            ', 'li ol li', 0); +NestedNonEmptyUnorderedListItem = createState('
            • Before
              • Test
            • After
            ', 'li ul li', 0); +NestedOrderedListWithMultipleItems = createState('
            1. Before
              1. Item1
              2. Item2
            ', 'li ol li', 0); +NestedUnorderedListWithMultipleItems = createState('
            • Before
              • Item1
              • Item2
            ', 'li ul li', 0); +OrderedLowerAlphaListItem = createState('
            1. Item 1
            2. Item 2
            ', 'li:nth-child(2)', 0); +UnorderedSquareListItem = createState('
            • Item 1
            • Item 2
            ', 'li:nth-child(2)', 0); + +OrderedListItemWithNestedChild = createState('
            1. Item1
              1. Nested
            ', 'li:nth-child(1)', 2); +UnorderedListItemWithNestedChild = createState('
            • Item1
              • Nested
            ', 'li:nth-child(1)', 2); + +OrderedListWithAdjacentNestedLists = createState('
              1. Item 1
            1. Item 2
              1. Item 3
            ', 'li:nth-child(2)', 4); +UnorderedListWithAdjacentNestedLists = createState('
              • Item 1
            • Item 2
              • Item 3
            ', 'li:nth-child(2)', 4); + +OrderedListItemWithMargin = createState('
            1. Test
            ', 'li', 0); +UnorderedListItemWithMargin = createState('
            • Test
            ', 'li', 0); + +OrderedListItemWithNestedAlphaList = createState('
            1. Item
              1. Nested
            ', 'li', 2); + +/** Collapsed DIV Tests **/ +OrderedListItemInsideDiv = createState('
              \n
            1. Item1
            2. Item2
            ', 'li:nth-child(1)', 2); +UnorderedListItemInsideDiv = createState('
              \n
            • Item1
            • Item2
            ', 'li:nth-child(1)', 2); + +ParagraphInDiv = createState('

            Item

            ', 'p', 2); +TextInDiv = createState('
            Item
            ', 'div', 2); +TextWithBrsInDivFirstLine = createState('
            Item1
            Item2
            ', 'div', 2); +TextWithBrsInDivMiddleLine = createState('
            Item1
            Item2
            Item3
            ', 'br:nth-child(1)', 'afterNextCharacter'); +TextWithBrsInDivLastLine = createState('
            Item1
            Item2
            ', 'br:nth-child(1)', 'afterNextCharacter'); +TextWithBrsInFormattingInDiv = function() { + var rng; + editor.setContent('
            Before
            Item1
            Item2
            Item3
            '); + rng = editor.dom.createRng(); + rng.setStart(editor.dom.select('div')[0].childNodes[1], 0); + rng.setEnd(editor.dom.select('div')[0], 6); + editor.selection.setRng(rng); +}; +TextWithBrInsideFormatting = function() { + var rng; + editor.setContent('
            Before
            Item1
            Item2
            Item3
            '); + rng = editor.dom.createRng(); + rng.setStart(editor.dom.select('span')[0].childNodes[0], 2); + rng.setEnd(editor.dom.select('div')[0], 4); + editor.selection.setRng(rng); +}; + +/** Expanded Selection States **/ +SingleParagraphSelection = createState('

            This is a test

            ', 'p', 5, 'p', 7); +MultipleParagraphSelection = createState('

            This is a test

            Second paragraph

            ', 'p:nth-child(1)', 5, 'p:nth-child(2)', 6); +SingleHeadingSelection = createState('

            This is a test

            ', 'h1', 5, 'h1', 7); +MultipleHeadingSelection = createState('

            This is a test

            Second paragraph

            ', 'h1:nth-child(1)', 5, 'h1:nth-child(2)', 6); +SingleBlockSelection = createState('
            This is a test
            ', 'div', 5, 'div', 7); +MultipleBlockSelection = createState('
            This is a test
            Second paragraph
            ', 'div:nth-child(1)', 5, 'div:nth-child(2)', 6); + +SingleBlockWithBrSelection = createState('
            Item1
            Item2
            ', 'div', 3, 'br', 'afterNextCharacter'); +MultipleBlockWithBrSelection = createState('
            Item1
            Item2
            Item3
            ', 'div:nth-child(1)', 2, 'div:nth-child(2)', 3); +MultipleBlockWithBrPartialSelection = createState('
            Item1
            Item2
            Item3
            Item4
            ', 'div:nth-child(1)', 2, 'div:nth-child(2)', 3); +MultipleBlockWithBrPartialSelectionAtEnd = createState('
            Item1
            Item2
            Item3
            Item4
            ', 'div:nth-child(1) br', 'afterNextCharacter', 'div:nth-child(2) br', 'afterNextCharacter'); +MultipleBlockWithEmptyDivsAllSelected = createState('
             
            a
            b
             
            ', '#start', 0, '#end', 0); + +CellWithoutBrSelection = createState('
            Cell 1
            ', 'td', 1, 'td', 1); //selection is a single point so it will avoid table selection bugs in ie9. +CellWithBrSingleLineSelection = createState('
            Cell 1
            Line 2
            ', 'td', 1, 'td', 4); +CellWithBrMultipleLineSelection = createState('
            Cell 1
            Line 2
            ', 'td', 1, 'td', 4); + +TableCellWithTextAfterUL = createState('
            • Existing
            Line1
            Line2
            Line3
            Line4
            ', '#start', 1, '#end', 'afterNextCharacter'); + +ParagraphToHeadingSelection = createState('

            This is a test

            Second paragraph

            ', 'p', 5, 'h1', 6); +ParagraphToBlockSelection = createState('

            This is a test

            Second paragraph
            ', 'p', 5, 'div', 6); +HeadingToParagraphSelection = createState('

            This is a test

            Second paragraph

            ', 'h1', 5, 'p', 6); +BlockToParagraphSelection = createState('
            This is a test

            Second paragraph

            ', 'div', 5, 'p', 6); +MultipleParagraphAndHeadingSelection = createState('

            This is a test

            Second paragraph

            Third paragraph
            ', 'p', 5, 'div', 5); +ThreeBoldDivsWithBrSelection = createState('
            One
            Two
            Three
            ', 'div:nth-child(1) strong', 2, 'div:nth-child(3) strong', 2); + +SingleLiOlSelection = createState('
            1. Item 1
            ', 'li', 1, 'li', 4); +MultiLiOlSelection = createState('
            1. Item 1
            2. Item 2
            ', 'li:nth-child(1)', 1, 'li:nth-child(2)', 4); +SingleLiUlSelection = createState('
            • Item 1
            ', 'li', 1, 'li', 4); +MultiLiUlSelection = createState('
            • Item 1
            • Item 2
            ', 'li:nth-child(1)', 1, 'li:nth-child(2)', 4); +MultiNestedLiUlSelection = createState('
              • Item 1
              • Item 2
            ', 'li li:nth-child(1)', 1, 'li li:nth-child(2)', 4); +MultiNestedLiOlSelection = createState('
              1. Item 1
              2. Item 2
            ', 'li li:nth-child(1)', 1, 'li li:nth-child(2)', 4); + +IndentedOlInOlCorrectSelection = createState('
            1. Item 1
              1. Indented
            ', 'li', 1, 'li li', 4); +IndentedUlInUlCorrectSelection = createState('
            • Item 1
              • Indented
            ', 'li', 1, 'li li', 4); +IndentedOlInOlIncorrectSelection = createState('
            1. Item 1
              1. Indented
            ', 'li', 1, 'ol ol li', 4); +IndentedUlInUlIncorrectSelection = createState('
            • Item 1
              • Indented
            ', 'li', 1, 'ul ul li', 4); + +IndentedOlInUlCorrectSelection = createState('
            • Item 1
              1. Indented
            ', 'li', 1, 'li li', 4); +IndentedUlInOlCorrectSelection = createState('
            1. Item 1
              • Indented
            ', 'li', 1, 'li li', 4); +IndentedOlInUlIncorrectSelection = createState('
            • Item 1
              1. Indented
            ', 'li', 1, 'ul ol li', 4); +IndentedUlInOlIncorrectSelection = createState('
            1. Item 1
              • Indented
            ', 'li', 1, 'ol ul li', 4); + +// TODO: Paragraph/heading to list combinations. +ParagraphBeforeOlSelection = createState('

            Before

            1. Item 1
            ', 'p', 3, 'li', 4); +ParagraphBeforeUlSelection = createState('

            Before

            • Item 1
            ', 'p', 3, 'li', 4); +ParagraphAfterOlSelection = createState('
            1. Item 1

            After

            ', 'li', 4, 'p', 3); +ParagraphAfterUlSelection = createState('
            • Item 1

            After

            ', 'li', 4, 'p', 3); +ParagraphBeforeAndAfterOlSelection = createState('

            Before

            1. Item 1

            After

            ', 'p', 4, '#after', 3); +ParagraphBeforeAndAfterUlSelection = createState('

            Before

            • Item 1

            After

            ', 'p', 4, '#after', 3); + +SelectionEndingAtBr = createState('

            Item
            After

            ', 'p', 2, 'br', 'after'); +SelectionStartingAtBr = createState('

            Before
            Item

            ', 'p', 'after', 'br', 'afterNextCharacter'); diff --git a/tests/qunit/editor/plugins/legacyoutput.html b/tests/qunit/editor/plugins/legacyoutput.html new file mode 100644 index 0000000000..cb5896e887 --- /dev/null +++ b/tests/qunit/editor/plugins/legacyoutput.html @@ -0,0 +1,130 @@ + + + +Unit tests for Media Plugin + + + + + + + + + +

            Unit tests for Legacyoutput Plugin

            +

            +
            +

            +
              + + +
              + [getRawContents] + [getContents] +
              + + diff --git a/tests/qunit/editor/plugins/lists.html b/tests/qunit/editor/plugins/lists.html new file mode 100644 index 0000000000..b96881324c --- /dev/null +++ b/tests/qunit/editor/plugins/lists.html @@ -0,0 +1,1770 @@ + + + +Unit tests for lists plugin + + + + + + + + + +

              Unit tests for lists plugin

              +

              +
              +

              +
                + + [Get raw] + +
                + [Get raw] + + diff --git a/tests/qunit/editor/plugins/media.html b/tests/qunit/editor/plugins/media.html new file mode 100644 index 0000000000..34b7d5bb11 --- /dev/null +++ b/tests/qunit/editor/plugins/media.html @@ -0,0 +1,180 @@ + + + +Unit tests for Media Plugin + + + + + + + + +

                Unit tests for Media Plugin

                +

                +
                +

                +
                  + + +
                  + [getRawContents] + [getContents] +
                  + + diff --git a/tests/qunit/editor/plugins/noneditable.html b/tests/qunit/editor/plugins/noneditable.html new file mode 100644 index 0000000000..c21b242b8a --- /dev/null +++ b/tests/qunit/editor/plugins/noneditable.html @@ -0,0 +1,237 @@ + + + +Unit tests for noneditable + + + + + + + + + +

                  Unit tests noneditable plugin

                  +

                  +
                  +

                  +
                    + +
                    + [getRawContents] + [getContents] +
                    + + diff --git a/tests/qunit/editor/plugins/paste.html b/tests/qunit/editor/plugins/paste.html new file mode 100644 index 0000000000..682fc4b691 --- /dev/null +++ b/tests/qunit/editor/plugins/paste.html @@ -0,0 +1,440 @@ + + + +Unit tests for the Paste plugin + + + + + + + + + + +

                    Unit tests for the Paste plugin

                    +

                    +
                    +

                    +
                      + + +
                      + [getRawContents] + [getContents] +
                      + + diff --git a/tests/qunit/editor/plugins/plugin_dependency_chain.html b/tests/qunit/editor/plugins/plugin_dependency_chain.html new file mode 100644 index 0000000000..748f201f9c --- /dev/null +++ b/tests/qunit/editor/plugins/plugin_dependency_chain.html @@ -0,0 +1,59 @@ + + + +Basic editor functionality tests + + + + + + + + + +

                      Plugin Dependency Functional tests

                      +

                      +
                      +

                      +
                        + + + diff --git a/tests/qunit/editor/plugins/plugin_dependency_chain_legacy.html b/tests/qunit/editor/plugins/plugin_dependency_chain_legacy.html new file mode 100644 index 0000000000..08cef239e5 --- /dev/null +++ b/tests/qunit/editor/plugins/plugin_dependency_chain_legacy.html @@ -0,0 +1,59 @@ + + + +Plugin Dependency Functional tests + + + + + + + + + +

                        Plugin Dependency Functional tests

                        +

                        +
                        +

                        +
                          + + + diff --git a/tests/qunit/editor/plugins/plugin_dependency_init_call_order.html b/tests/qunit/editor/plugins/plugin_dependency_init_call_order.html new file mode 100644 index 0000000000..7f87ed1473 --- /dev/null +++ b/tests/qunit/editor/plugins/plugin_dependency_init_call_order.html @@ -0,0 +1,69 @@ + + + +Basic editor functionality tests + + + + + + + + + +

                          Plugin Dependency Functional tests

                          +

                          +
                          +

                          +
                            + + + diff --git a/tests/qunit/editor/plugins/plugin_dependency_simple.html b/tests/qunit/editor/plugins/plugin_dependency_simple.html new file mode 100644 index 0000000000..60b484bb17 --- /dev/null +++ b/tests/qunit/editor/plugins/plugin_dependency_simple.html @@ -0,0 +1,50 @@ + + + +Basic editor functionality tests + + + + + + + + + +

                            Plugin Dependency Functional tests

                            +

                            +
                            +

                            +
                              + + + diff --git a/tests/qunit/editor/plugins/plugin_dependency_specific_location.html b/tests/qunit/editor/plugins/plugin_dependency_specific_location.html new file mode 100644 index 0000000000..1feef33c00 --- /dev/null +++ b/tests/qunit/editor/plugins/plugin_dependency_specific_location.html @@ -0,0 +1,58 @@ + + + +Basic editor functionality tests + + + + + + + + + +

                              Plugin Dependency Functional tests

                              +

                              +
                              +

                              +
                                + + + diff --git a/tests/qunit/editor/plugins/searchreplace.html b/tests/qunit/editor/plugins/searchreplace.html new file mode 100644 index 0000000000..a3fa93f2b3 --- /dev/null +++ b/tests/qunit/editor/plugins/searchreplace.html @@ -0,0 +1,132 @@ + + + +Unit tests for searchreplace plugin + + + + + + + + + +

                                Unit tests for lists plugin

                                +

                                +
                                +

                                +
                                  + + [Get raw] + + diff --git a/tests/qunit/editor/plugins/spellchecker.html b/tests/qunit/editor/plugins/spellchecker.html new file mode 100644 index 0000000000..3be00e2b72 --- /dev/null +++ b/tests/qunit/editor/plugins/spellchecker.html @@ -0,0 +1,108 @@ + + + +Unit tests for spellchecker plugin + + + + + + + + + +

                                  Unit tests for spellchecker plugin

                                  +

                                  +
                                  +

                                  +
                                    + + [Get raw] + + [Get raw] + + [Get raw] + + diff --git a/tests/qunit/editor/plugins/table.html b/tests/qunit/editor/plugins/table.html new file mode 100644 index 0000000000..9cbc3219c3 --- /dev/null +++ b/tests/qunit/editor/plugins/table.html @@ -0,0 +1,348 @@ + + + +Unit tests for the Table plugin + + + + + + + + + + +

                                    Unit tests for the Table plugin

                                    +

                                    +
                                    +

                                    +
                                      + + +
                                      + [getRawContents] + [getContents] +
                                      + + diff --git a/tests/qunit/editor/plugins/table_robot.html b/tests/qunit/editor/plugins/table_robot.html new file mode 100644 index 0000000000..351cea6f3b --- /dev/null +++ b/tests/qunit/editor/plugins/table_robot.html @@ -0,0 +1,189 @@ + + + +Table plugin tests + + + + + + + + + + +

                                      Table plugin tests

                                      +

                                      +
                                      +

                                      +
                                        + + + + diff --git a/tests/qunit/editor/plugins/tests.js b/tests/qunit/editor/plugins/tests.js new file mode 100644 index 0000000000..b2d4b40eb2 --- /dev/null +++ b/tests/qunit/editor/plugins/tests.js @@ -0,0 +1,24 @@ +{ + "title": "Plugins tests", + "tests": [ + {"title": "Media", "url": "media.html"}, + {"title": "Noneditable", "url": "noneditable.html"}, + {"title": "Paste", "url": "paste.html"}, + {"title": "Table", "url": "table.html"}, + {"title": "Table (robot)", "url": "table_robot.html", "jsrobot": true}, + {"title": "jQuery", "url": "jquery_plugin.html"}, + {"title": "Autolink (robot)", "url": "autolink.html", "jsrobot": true}, + {"title": "Autosave", "url": "autosave.html"}, + {"title": "Wordcount", "url": "wordcount.html"}, + {"title": "Fullpage", "url": "fullpage.html"}, + {"title": "Legacyoutput", "url": "legacyoutput.html"}, + {"title": "Plugin Dependencies", "url": "plugin_dependency_simple.html"}, + {"title": "Plugin Dependency Chain", "url": "plugin_dependency_chain.html"}, + {"title": "Plugin Dependency Chain Legacy", "url": "plugin_dependency_chain_legacy.html"}, + {"title": "Dependency Chain Init Call Order", "url": "plugin_dependency_init_call_order.html"}, + {"title": "Dependency With Specific Location", "url": "plugin_dependency_specific_location.html"}, + {"title": "Lists", "url": "lists.html"}, + {"title": "Searchreplace", "url": "searchreplace.html"}, + {"title": "Spellchecker", "url": "spellchecker.html"} + ] +} diff --git a/tests/qunit/editor/plugins/wordcount.html b/tests/qunit/editor/plugins/wordcount.html new file mode 100644 index 0000000000..cbfd201800 --- /dev/null +++ b/tests/qunit/editor/plugins/wordcount.html @@ -0,0 +1,122 @@ + + + +Unit tests for the Wordcount plugin + + + + + + + + + + +

                                        Unit tests for the Wordcount plugin

                                        +

                                        +
                                        +

                                        +
                                          + +
                                          + Current Count: +
                                          + + +
                                          + [getRawContents] + [getContents] +
                                          + + diff --git a/tests/qunit/editor/test.gif b/tests/qunit/editor/test.gif new file mode 100644 index 0000000000000000000000000000000000000000..e565824aafafe632011b281cba976baf8b3ba89a GIT binary patch literal 43 qcmZ?wbhEHbWMp7uXkcLY4+e@qSs1y10y+#p0Fq%~V)9{Rum%7ZWeN!Z literal 0 HcmV?d00001 diff --git a/tests/qunit/editor/tinymce/Editor.html b/tests/qunit/editor/tinymce/Editor.html new file mode 100644 index 0000000000..76ac3bd358 --- /dev/null +++ b/tests/qunit/editor/tinymce/Editor.html @@ -0,0 +1,221 @@ + + + +Unit tests for tinymce.Editor + + + + + + + + + +

                                          Unit tests for tinymce.Editor

                                          +

                                          +
                                          +

                                          +
                                            + +
                                            + [getRawContents] + [getContents] +
                                            + + \ No newline at end of file diff --git a/tests/qunit/editor/tinymce/EditorCommands.html b/tests/qunit/editor/tinymce/EditorCommands.html new file mode 100644 index 0000000000..e248528547 --- /dev/null +++ b/tests/qunit/editor/tinymce/EditorCommands.html @@ -0,0 +1,765 @@ + + + +Unit tests for tinymce.EditorCommands + + + + + + + + + +

                                            Unit tests for tinymce.EditorCommands

                                            +

                                            +
                                            +

                                            +
                                              + +
                                              + [getRawContents] + [getContents] +
                                              + + diff --git a/tests/qunit/editor/tinymce/EnterKey.html b/tests/qunit/editor/tinymce/EnterKey.html new file mode 100644 index 0000000000..2ed67a06f4 --- /dev/null +++ b/tests/qunit/editor/tinymce/EnterKey.html @@ -0,0 +1,1018 @@ + + + +Unit tests for EnterKey + + + + + + + + + +

                                              Unit tests for tinymce.EnterKey

                                              +

                                              +
                                              +

                                              +
                                                + + + diff --git a/tests/qunit/editor/tinymce/ForceBlocks.html b/tests/qunit/editor/tinymce/ForceBlocks.html new file mode 100644 index 0000000000..ea1bd32a3f --- /dev/null +++ b/tests/qunit/editor/tinymce/ForceBlocks.html @@ -0,0 +1,116 @@ + + + +Unit tests for tinymce.ForceBlocks + + + + + + + + + +

                                                Unit tests for tinymce.ForceBlocks

                                                +

                                                +
                                                +

                                                +
                                                  + + + diff --git a/tests/qunit/editor/tinymce/Formatter_apply.html b/tests/qunit/editor/tinymce/Formatter_apply.html new file mode 100644 index 0000000000..c4915351b2 --- /dev/null +++ b/tests/qunit/editor/tinymce/Formatter_apply.html @@ -0,0 +1,1228 @@ + + + +Unit tests for apply formatting + + + + + + + + + +

                                                  Unit tests for text formatting

                                                  +

                                                  +
                                                  +

                                                  +
                                                    + +
                                                    + [getRawContents] + [getContents] +
                                                    +
                                                    + + diff --git a/tests/qunit/editor/tinymce/Formatter_check.html b/tests/qunit/editor/tinymce/Formatter_check.html new file mode 100644 index 0000000000..93949751bc --- /dev/null +++ b/tests/qunit/editor/tinymce/Formatter_check.html @@ -0,0 +1,271 @@ + + + +Unit tests for check formatting + + + + + + + + + +

                                                    Unit tests for text formatting

                                                    +

                                                    +
                                                    +

                                                    +
                                                      + +
                                                      + [getRawContents] + [getContents] +
                                                      +
                                                      + + diff --git a/tests/qunit/editor/tinymce/Formatter_remove.html b/tests/qunit/editor/tinymce/Formatter_remove.html new file mode 100644 index 0000000000..20677a4e8d --- /dev/null +++ b/tests/qunit/editor/tinymce/Formatter_remove.html @@ -0,0 +1,401 @@ + + + +Unit tests for remove formatting + + + + + + + + + +

                                                      Unit tests for text formatting

                                                      +

                                                      +
                                                      +

                                                      +
                                                        + +
                                                        + [getRawContents] + [getContents] +
                                                        + + diff --git a/tests/qunit/editor/tinymce/Formatter_robot.html b/tests/qunit/editor/tinymce/Formatter_robot.html new file mode 100644 index 0000000000..34a6e8ffc0 --- /dev/null +++ b/tests/qunit/editor/tinymce/Formatter_robot.html @@ -0,0 +1,94 @@ + + + +Basic editor functionality tests + + + + + + + + + + +

                                                        Plugin Dependency Functional tests

                                                        + +

                                                        + +
                                                        +

                                                        +
                                                          + + + + diff --git a/tests/qunit/editor/tinymce/UndoManager.html b/tests/qunit/editor/tinymce/UndoManager.html new file mode 100644 index 0000000000..d5aab25b8f --- /dev/null +++ b/tests/qunit/editor/tinymce/UndoManager.html @@ -0,0 +1,189 @@ + + + +tinymce.UndoManager tests + + + + + + + + + +

                                                          tinymce.UndoManager tests

                                                          +

                                                          +
                                                          +

                                                          +
                                                            +
                                                            + + diff --git a/tests/qunit/editor/tinymce/UndoManager_robot.html b/tests/qunit/editor/tinymce/UndoManager_robot.html new file mode 100644 index 0000000000..8c7c285b0d --- /dev/null +++ b/tests/qunit/editor/tinymce/UndoManager_robot.html @@ -0,0 +1,115 @@ + + + +Undo Tests + + + + + + + + + +

                                                            Undo Tests

                                                            +

                                                            +
                                                            +

                                                            +
                                                              +
                                                              + +
                                                              + + + diff --git a/tests/qunit/editor/tinymce/dom/DOMUtils.html b/tests/qunit/editor/tinymce/dom/DOMUtils.html new file mode 100644 index 0000000000..11b85cad48 --- /dev/null +++ b/tests/qunit/editor/tinymce/dom/DOMUtils.html @@ -0,0 +1,27 @@ + + + +Unit tests for tinymce.dom.DOMUtils + + + + + + + + + + +

                                                              Unit tests for tinymce.dom.DOMUtils

                                                              +

                                                              +
                                                              +

                                                              +
                                                                +
                                                                + + diff --git a/tests/qunit/editor/tinymce/dom/DOMUtils.js b/tests/qunit/editor/tinymce/dom/DOMUtils.js new file mode 100644 index 0000000000..d5e180e690 --- /dev/null +++ b/tests/qunit/editor/tinymce/dom/DOMUtils.js @@ -0,0 +1,680 @@ +(function() { + var DOM = new tinymce.dom.DOMUtils(document, {keep_values : true, schema : new tinymce.html.Schema()}); + + test('parseStyle', 11, function() { + var dom; + + DOM.add(document.body, 'div', {id : 'test'}); + + dom = new tinymce.dom.DOMUtils(document, {hex_colors : true, keep_values : true, url_converter : function(u, n, e) { + return 'X' + u + 'Y'; + }}); + + equal( + dom.serializeStyle(dom.parseStyle('border: 1px solid red; color: green')), + 'border: 1px solid red; color: green;' + ); + + equal( + dom.serializeStyle(dom.parseStyle('border: 1px solid rgb(0, 255, 255); color: green')), + 'border: 1px solid #00ffff; color: green;' + ); + + equal( + dom.serializeStyle(dom.parseStyle('border-top: 1px solid red; border-left: 1px solid red; border-bottom: 1px solid red; border-right: 1px solid red;')), + 'border: 1px solid red;' + ); + + equal( + dom.serializeStyle(dom.parseStyle('border-width: 1pt 1pt 1pt 1pt; border-style: none none none none; border-color: black black black black;')), + 'border: 1pt none black;' + ); + + equal( + dom.serializeStyle(dom.parseStyle('border-width: 1pt 4pt 2pt 3pt; border-style: solid dashed dotted none; border-color: black red green blue;')), + 'border-width: 1pt 4pt 2pt 3pt; border-style: solid dashed dotted none; border-color: black red green blue;' + ); + + equal( + dom.serializeStyle(dom.parseStyle('background: transparent url(test.gif);')), + 'background: transparent url(\'Xtest.gifY\');' + ); + + equal( + dom.serializeStyle(dom.parseStyle('background: transparent url(http://www.site.com/test.gif?a=1&b=2);')), + 'background: transparent url(\'Xhttp://www.site.com/test.gif?a=1&b=2Y\');' + ); + + dom.setHTML('test', ''); + equal(dom.getAttrib('test2', 'style'), 'margin: 1px;'); + + dom.setHTML('test', ''); + equal(dom.getAttrib('test2', 'style'), 'background-image: url(\'Xtest.gifY\');'); + + dom.get('test').innerHTML = ''; + equal(dom.getAttrib('test2', 'style'), tinymce.isIE && !window.getSelection ? 'border: #00ff00 1px solid;' : 'border: 1px solid #00ff00;'); // IE has a separate output + + dom.get('test').innerHTML = ''; + equal(dom.getAttrib('test2', 'style'), 'background-image: url(\'Xhttp://www.site.com/test.gifY\');'); + + DOM.remove('test'); + }); + + test('addClass', 10, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.get('test').className = ''; + DOM.addClass('test', 'abc'); + equal(DOM.get('test').className, 'abc'); + + DOM.get('test').className = ''; + equal(DOM.addClass('test', 'abc'), 'abc'); + equal(DOM.addClass(null, 'abc'), false); + + DOM.addClass('test', '123'); + equal(DOM.get('test').className, 'abc 123'); + + DOM.get('test').innerHTML = ''; + DOM.addClass(DOM.select('span', 'test'), 'abc'); + equal(DOM.get('test2').className, 'abc'); + equal(DOM.get('test3').className, 'abc'); + equal(DOM.get('test4').className, 'abc'); + DOM.get('test').innerHTML = ''; + + DOM.get('test').innerHTML = ''; + DOM.addClass(['test2', 'test3', 'test4'], 'abc'); + equal(DOM.get('test2').className, 'abc'); + equal(DOM.get('test3').className, 'abc'); + equal(DOM.get('test4').className, 'abc'); + DOM.get('test').innerHTML = ''; + + DOM.remove('test'); + }); + + test('removeClass', 4, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.get('test').className = 'abc 123 xyz'; + DOM.removeClass('test', '123'); + equal(DOM.get('test').className, 'abc xyz'); + + DOM.get('test').innerHTML = ''; + DOM.removeClass(DOM.select('span', 'test'), 'test1'); + equal(DOM.get('test2').className, ''); + equal(DOM.get('test3').className, 'test test'); + equal(DOM.get('test4').className, 'test'); + DOM.get('test').innerHTML = ''; + + DOM.remove('test'); + }); + + test('hasClass', 7, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.get('test').className = 'abc 123 xyz'; + ok(DOM.hasClass('test', 'abc')); + ok(DOM.hasClass('test', '123')); + ok(DOM.hasClass('test', 'xyz')); + ok(!DOM.hasClass('test', 'aaa')); + + DOM.get('test').className = 'abc'; + ok(DOM.hasClass('test', 'abc')); + + DOM.get('test').className = 'aaa abc'; + ok(DOM.hasClass('test', 'abc')); + + DOM.get('test').className = 'abc aaa'; + ok(DOM.hasClass('test', 'abc')); + + DOM.remove('test'); + }); + + test('add', 5, function() { + var e; + + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.add('test', 'span', {'class' : 'abc 123'}, 'content abc'); + e = DOM.get('test').getElementsByTagName('span')[0]; + equal(e.className, 'abc 123'); + equal(e.innerHTML.toLowerCase(), 'content abc'); + DOM.remove(e); + + DOM.add('test', 'span', {'class' : 'abc 123'}); + e = DOM.get('test').getElementsByTagName('span')[0]; + equal(e.className, 'abc 123'); + DOM.remove(e); + + DOM.add('test', 'span'); + e = DOM.get('test').getElementsByTagName('span')[0]; + equal(e.nodeName, 'SPAN'); + DOM.remove(e); + + DOM.get('test').innerHTML = ''; + DOM.add(['test2', 'test3', 'test4'], 'span', {'class' : 'abc 123'}); + equal(DOM.select('span', 'test').length, 6); + + DOM.remove('test'); + }); + + test('create', 3, function() { + var e; + + e = DOM.create('span', {'class' : 'abc 123'}, 'content abc'); + + equal(e.nodeName, 'SPAN'); + equal(e.className, 'abc 123'); + equal(e.innerHTML.toLowerCase(), 'content abc'); + }); + + test('createHTML', 4, function() { + equal(DOM.createHTML('span', {'id' : 'id1', 'class' : 'abc 123'}, 'content abc'), 'content abc'); + equal(DOM.createHTML('span', {'id' : 'id1', 'class' : 'abc 123'}), ''); + equal(DOM.createHTML('span'), ''); + equal(DOM.createHTML('span', null, 'content abc'), 'content abc'); + }); + + test('uniqueId', 3, function() { + DOM.counter = 0; + + equal(DOM.uniqueId(), 'mce_0'); + equal(DOM.uniqueId(), 'mce_1'); + equal(DOM.uniqueId(), 'mce_2'); + }); + + test('showHide', 10, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.show('test'); + equal(DOM.get('test').style.display, 'block'); + ok(!DOM.isHidden('test')); + + DOM.hide('test'); + equal(DOM.get('test').style.display, 'none'); + ok(DOM.isHidden('test')); + + DOM.get('test').innerHTML = ''; + DOM.hide(['test2', 'test3', 'test4'], 'test'); + equal(DOM.get('test2').style.display, 'none'); + equal(DOM.get('test3').style.display, 'none'); + equal(DOM.get('test4').style.display, 'none'); + + DOM.get('test').innerHTML = ''; + DOM.show(['test2', 'test3', 'test4'], 'test'); + equal(DOM.get('test2').style.display, 'block'); + equal(DOM.get('test3').style.display, 'block'); + equal(DOM.get('test4').style.display, 'block'); + + // Cleanup + DOM.setAttrib('test', 'style', ''); + + DOM.remove('test'); + }); + + test('select', 4, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.setHTML('test', '
                                                                test 1
                                                                test 2
                                                                test 3
                                                                test 4
                                                                '); + equal(DOM.select('div', 'test').length, 4); + ok(DOM.select('div', 'test').reverse); + + DOM.setHTML('test', '
                                                                test 1
                                                                test 2
                                                                test 3
                                                                test 4
                                                                ') + equal(DOM.select('div.test2', 'test').length, 2); + + DOM.setHTML('test', '
                                                                test 1
                                                                test 2
                                                                test 3
                                                                test 4
                                                                ') + equal(DOM.select('div div', 'test').length, 1, null, tinymce.isWebKit); // Issue: http://bugs.webkit.org/show_bug.cgi?id=17461 + //alert(DOM.select('div div', 'test').length +","+DOM.get('test').querySelectorAll('div div').length); + + DOM.remove('test'); + }); + + test('is', 3, function() { + DOM.add(document.body, 'div', {id : 'test'}); + DOM.setHTML('test', '
                                                                test 1
                                                                '); + + ok(DOM.is(DOM.get('textX'), 'div')); + ok(DOM.is(DOM.get('textX'), 'div#textX.test')); + ok(!DOM.is(DOM.get('textX'), 'div#textX2')); + + DOM.remove('test'); + }); + + test('encode', 1, function() { + equal(DOM.encode('abc<>"&\'\u00e5\u00e4\u00f6'), 'abc<>"&'\u00e5\u00e4\u00f6'); + }); + + test('setGetAttrib', 16, function() { + var dom; + + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.setAttrib('test', 'class', 'test 123'); + equal(DOM.getAttrib('test', 'class'), 'test 123'); + + DOM.setAttrib('test', 'src', 'url'); + equal(DOM.getAttrib('test', 'src'), 'url'); + equal(DOM.getAttrib('test', 'data-mce-src'), 'url'); + equal(DOM.getAttrib('test', 'abc'), ''); + + DOM.setAttribs('test', {'class' : '123', title : 'abc'}); + equal(DOM.getAttrib('test', 'class'), '123'); + equal(DOM.getAttrib('test', 'title'), 'abc'); + + DOM.setAttribs('test'); + equal(DOM.getAttrib('test', 'class'), '123'); + equal(DOM.getAttrib('test', 'title'), 'abc'); + + dom = new tinymce.dom.DOMUtils(document, {keep_values : true, url_converter : function(u, n, e) { + return '&<>"' + u + '&<>"' + n; + }}); + + dom.setAttribs('test', {src : '123', href : 'abc'}); + equal(DOM.getAttrib('test', 'src'), '&<>"123&<>"src'); + equal(DOM.getAttrib('test', 'href'), '&<>"abc&<>"href'); + + DOM.get('test').innerHTML = ''; + DOM.setAttribs(['test2', 'test3', 'test4'], {test1 : "1", test2 : "2"}); + equal(DOM.getAttrib('test2', 'test1'), '1'); + equal(DOM.getAttrib('test3', 'test2'), '2'); + equal(DOM.getAttrib('test4', 'test1'), '1'); + + equal(DOM.getAttrib(document, 'test'), false); + equal(DOM.getAttrib(document, 'test', ''), ''); + equal(DOM.getAttrib(document, 'test', 'x'), 'x'); + + DOM.remove('test'); + }); + + test('getAttribs', 2, function() { + var dom; + + function check(obj, val) { + var count = 0; + + val = val.split(','); + + tinymce.each(obj, function(o) { + if (tinymce.inArray(val, o.nodeName.toLowerCase()) != -1 && o.specified) + count++; + }); + + return count == obj.length; + }; + + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.get('test').innerHTML = ''; + ok(check(DOM.getAttribs('test2'), 'id,class')); + + DOM.get('test').innerHTML = '
                                                                '; + ok(check(DOM.getAttribs('test2'), 'id,type,name,value,disabled,readonly,checked'), 'Expected attributed: type,name,disabled,readonly,checked'); + + DOM.remove('test'); + }); + + test('setGetStyles', 7, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.setStyle('test', 'font-size', '20px'); + equal(DOM.getStyle('test', 'font-size'), '20px', null, tinymce.isWebKit); + + DOM.setStyle('test', 'fontSize', '21px'); + equal(DOM.getStyle('test', 'fontSize'), '21px', null, tinymce.isWebKit); + + DOM.setStyles('test', {fontSize : '22px', display : 'inline'}); + equal(DOM.getStyle('test', 'fontSize'), '22px', null, tinymce.isWebKit); + equal(DOM.getStyle('test', 'display'), 'inline', null, tinymce.isWebKit); + + DOM.get('test').innerHTML = ''; + DOM.setStyles(['test2', 'test3', 'test4'], {fontSize : "22px"}); + equal(DOM.getStyle('test2', 'fontSize'), '22px'); + equal(DOM.getStyle('test3', 'fontSize'), '22px'); + equal(DOM.getStyle('test4', 'fontSize'), '22px'); + + DOM.setAttrib('test', 'style', ''); + + DOM.remove('test'); + }); + + test('getPos', 2, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.setStyles('test', {position : 'absolute', left : 100, top : 110}); + equal(DOM.getPos('test').x, 100); + equal(DOM.getPos('test').y, 110); + + DOM.setAttrib('test', 'style', ''); + + DOM.remove('test'); + }); + + test('getParent', 6, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.get('test').innerHTML = '
                                                                ababcc
                                                                '; + + equal(DOM.getParent('test2', function(n) {return n.nodeName == 'SPAN';}).nodeName, 'SPAN'); + equal(DOM.getParent('test2', function(n) {return n.nodeName == 'BODY';}).nodeName, 'BODY'); + equal(DOM.getParent('test2', function(n) {return n.nodeName == 'BODY';}, document.body), null); + equal(DOM.getParent('test2', function(n) {return false;}), null); + equal(DOM.getParent('test2', 'SPAN').nodeName, 'SPAN'); + equal(DOM.getParent('test2', 'body', DOM.get('test')), null); + + DOM.get('test').innerHTML = ''; + + DOM.remove('test'); + }); + + test('getParents', 4, function() { + DOM.add(document.body, 'div', {id : 'test'}); + DOM.get('test').innerHTML = '
                                                                ababcc
                                                                '; + + equal(DOM.getParents('test2', function(n) {return n.nodeName == 'SPAN';}).length, 2); + equal(DOM.getParents('test2', 'span').length, 2); + equal(DOM.getParents('test2', 'span.test').length, 1); + equal(DOM.getParents('test2', 'body', DOM.get('test')).length, 0); + + DOM.remove('test'); + }); + + test('is', 2, function() { + DOM.add(document.body, 'div', {id : 'test'}); + DOM.get('test').innerHTML = '
                                                                ababcc
                                                                '; + + ok(DOM.is(DOM.select('span', 'test'), 'span')); + ok(DOM.is(DOM.select('#test2', 'test'), '#test2')); + + DOM.remove('test'); + }); + + test('getViewPort', 4, function() { + var wp; + + wp = DOM.getViewPort(); + equal(wp.x, 0); + equal(wp.y, 0); + ok(wp.w > 0); + ok(wp.h > 0); + }); + + test('getRect', 5, function() { + var r; + + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.setStyles('test', {position : 'absolute', left : 100, top : 110, width : 320, height : 240}); + r = DOM.getRect('test'); + equal(r.x, 100); + equal(r.y, 110); + equal(r.w, 320); + equal(r.h, 240); + + DOM.setAttrib('test', 'style', ''); + + DOM.get('test').innerHTML = '
                                                                '; + r = DOM.getRect('test2'); + equal(r.w, 160); + + DOM.remove('test'); + }); + + test('getSize', 2, function() { + var r; + + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.get('test').innerHTML = '
                                                                '; + r = DOM.getSize('test2'); + equal(r.w, 160); + + DOM.get('test').innerHTML = '
                                                                '; + r = DOM.getSize('test2'); + equal(r.w, 100); + + DOM.remove('test'); + }); + + test('getNext', 5, function() { + var r; + + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.get('test').innerHTML = 'ABC'; + equal(DOM.getNext(DOM.get('test').firstChild, '*').nodeName, 'SPAN'); + equal(DOM.getNext(DOM.get('test').firstChild, 'em').nodeName, 'EM'); + equal(DOM.getNext(DOM.get('test').firstChild, 'div'), null); + equal(DOM.getNext(null, 'div'), null); + equal(DOM.getNext(DOM.get('test').firstChild, function(n) {return n.nodeName == 'EM'}).nodeName, 'EM'); + + DOM.remove('test'); + }); + + test('getPrev', 5, function() { + var r; + + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.get('test').innerHTML = 'ABC'; + equal(DOM.getPrev(DOM.get('test').lastChild, '*').nodeName, 'SPAN'); + equal(DOM.getPrev(DOM.get('test').lastChild, 'strong').nodeName, 'STRONG'); + equal(DOM.getPrev(DOM.get('test').lastChild, 'div'), null); + equal(DOM.getPrev(null, 'div'), null); + equal(DOM.getPrev(DOM.get('test').lastChild, function(n) {return n.nodeName == 'STRONG'}).nodeName, 'STRONG'); + + DOM.remove('test'); + }); + + test('loadCSS', 1, function() { + var c = 0; + + DOM.loadCSS('css/test.css?a=1,css/test.css?a=2,css/test.css?a=3'); + + tinymce.each(document.getElementsByTagName('link'), function(n) { + if (n.href.indexOf('test.css?a=') != -1) + c++; + }); + + equal(c, 3, null, tinymce.isOpera); + }); + + test('insertAfter', 2, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.setHTML('test', ''); + DOM.insertAfter(DOM.create('br'), 'test2'); + equal(DOM.get('test2').nextSibling.nodeName, 'BR'); + + DOM.setHTML('test', 'testtest'); + DOM.insertAfter(DOM.create('br'), 'test2'); + equal(DOM.get('test2').nextSibling.nodeName, 'BR'); + + DOM.remove('test'); + }); + + test('isBlock', 4, function() { + ok(DOM.isBlock(DOM.create('div'))); + ok(DOM.isBlock('DIV')); + ok(!DOM.isBlock('SPAN')); + ok(DOM.isBlock('div')); + }); + + test('remove', 3, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.setHTML('test', 'testtest2'); + DOM.remove('test2', 1); + equal(DOM.get('test').innerHTML.toLowerCase(), 'testtest2'); + + DOM.setHTML('test', 'testtest2'); + equal(DOM.remove('test2').nodeName, 'SPAN'); + + DOM.get('test').innerHTML = ''; + DOM.remove(['test2', 'test4']); + equal(DOM.select('span', 'test').length, 1); + + DOM.remove('test'); + }); + + test('replace', 2, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.setHTML('test', 'testtest2'); + DOM.replace(DOM.create('div', {id : 'test2'}), 'test2', 1); + equal(DOM.get('test2').innerHTML.toLowerCase(), 'testtest2'); + + DOM.setHTML('test', 'testtest2'); + DOM.replace(DOM.create('div', {id : 'test2'}), 'test2'); + equal(DOM.get('test2').innerHTML, ''); + + DOM.remove('test'); + }); + + test('toHex', 5, function() { + equal(DOM.toHex('rgb(0, 255, 255)'), '#00ffff'); + equal(DOM.toHex('rgb(255, 0, 0)'), '#ff0000'); + equal(DOM.toHex('rgb(0, 0, 255)'), '#0000ff'); + equal(DOM.toHex('rgb ( 0 , 0 , 255 ) '), '#0000ff'); + equal(DOM.toHex(' RGB ( 0 , 0 , 255 ) '), '#0000ff'); + }); + + test('getOuterHTML', 4, function() { + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.setHTML('test', 'testtest2'); + equal(DOM.getOuterHTML('test2').toLowerCase().replace(/\"/g, ''), 'testtest2'); + + DOM.setHTML('test', 'testtest2'); + DOM.setOuterHTML('test2', '
                                                                123
                                                                '); + equal(tinymce.trim(DOM.getOuterHTML('test2') || '').toLowerCase().replace(/\"/g, ''), '
                                                                123
                                                                '); + + DOM.setHTML('test', 'testtest2'); + DOM.setOuterHTML('test2', '
                                                                123
                                                                abc
                                                                '); + equal(tinymce.trim(DOM.get('test').innerHTML).toLowerCase().replace(/>\s+<').replace(/\"/g, ''), '
                                                                123
                                                                abc
                                                                '); + + DOM.setHTML('test', 'test'); + equal(tinymce.trim(DOM.getOuterHTML(DOM.get('test').firstChild)), 'test'); + + DOM.remove('test'); + }); + + test('encodeDecode', 2, function() { + equal(DOM.encode('\u00e5\u00e4\u00f6&<>"'), '\u00e5\u00e4\u00f6&<>"'); + equal(DOM.decode('åäö&<>"'), '\u00e5\u00e4\u00f6&<>"'); + }); + + test('split', 2, function() { + var point, parent; + DOM.add(document.body, 'div', {id : 'test'}); + + DOM.setHTML('test', '

                                                                text1innertext2

                                                                '); + parent = DOM.select('p', DOM.get('test'))[0]; + point = DOM.select('span', DOM.get('test'))[0]; + DOM.split(parent, point); + equal(DOM.get('test').innerHTML.toLowerCase().replace(/\s+/g, ''), '

                                                                text1

                                                                inner

                                                                text2

                                                                '); + + DOM.setHTML('test', '
                                                                • first line
                                                                  • second line
                                                                  • third line
                                                                '); + parent = DOM.select('li:nth-child(1)', DOM.get('test'))[0]; + point = DOM.select('ul li:nth-child(2)', DOM.get('test'))[0]; + DOM.split(parent, point); + equal(cleanHtml(DOM.get('test').innerHTML), '
                                                                • first line
                                                                  • second line
                                                                • third line
                                                                '); + + DOM.remove('test'); + }); + + test('nodeIndex', 5, function() { + DOM.add(document.body, 'div', {id : 'test'}, 'abcabcabc'); + + equal(DOM.nodeIndex(DOM.get('test').childNodes[0]), 0, 'Index of first child.'); + equal(DOM.nodeIndex(DOM.get('test').childNodes[1]), 1, 'Index of second child.'); + equal(DOM.nodeIndex(DOM.get('test').childNodes[2]), 2, 'Index of third child.'); + + DOM.get('test').insertBefore(DOM.doc.createTextNode('a'), DOM.get('test').firstChild); + DOM.get('test').insertBefore(DOM.doc.createTextNode('b'), DOM.get('test').firstChild); + + equal(DOM.nodeIndex(DOM.get('test').lastChild), 4, 'Index of last child with fragmented DOM.'); + equal(DOM.nodeIndex(DOM.get('test').lastChild, true), 2, 'Normalized index of last child with fragmented DOM.'); + + DOM.remove('test'); + }); + + test('isEmpty', 14, function() { + DOM.schema = new tinymce.html.Schema(); // A schema will be added when used within a editor instance + DOM.add(document.body, 'div', {id : 'test'}, ''); + + ok(DOM.isEmpty(DOM.get('test')), 'No children'); + + DOM.setHTML('test', '
                                                                '); + ok(DOM.isEmpty(DOM.get('test')), 'Br child'); + + DOM.setHTML('test', '

                                                                '); + ok(!DOM.isEmpty(DOM.get('test')), 'Br children'); + + DOM.setHTML('test', 'text'); + ok(!DOM.isEmpty(DOM.get('test')), 'Text child'); + + DOM.setHTML('test', 'text'); + ok(!DOM.isEmpty(DOM.get('test')), 'Text child in span'); + + DOM.setHTML('test', ''); + ok(DOM.isEmpty(DOM.get('test')), 'Empty span child'); + + DOM.setHTML('test', '
                                                                '); + ok(DOM.isEmpty(DOM.get('test')), 'Empty complex HTML'); + + DOM.setHTML('test', '
                                                                X
                                                                '); + ok(!DOM.isEmpty(DOM.get('test')), 'Non empty complex HTML'); + + DOM.setHTML('test', '
                                                                '); + ok(DOM.isEmpty(DOM.get('test')), 'Non empty complex HTML with space'); + + DOM.setHTML('test', '
                                                                '); + ok(!DOM.isEmpty(DOM.get('test')), 'Non empty complex HTML with achor name'); + + DOM.setHTML('test', ''); + ok(!DOM.isEmpty(DOM.get('test')), 'Non empty html with img element'); + + DOM.setHTML('test', ''); + ok(!DOM.isEmpty(DOM.get('test')), 'Span with bookmark attribute.'); + + DOM.setHTML('test', ''); + ok(DOM.isEmpty(DOM.get('test')), 'Span with data-mce attribute.'); + + DOM.setHTML('test', '
                                                                '); + ok(!DOM.isEmpty(DOM.get('test')), 'Element with comment.'); + + DOM.remove('test'); + }); + + test('isEmpty on P with BR in EM', function() { + var elm = DOM.create('p', null, '
                                                                '); + ok(DOM.isEmpty(elm, 'No children')); + }); + + test('isEmpty on P with two BR in EM', function() { + var elm = DOM.create('p', null, '

                                                                '); + equal(false, DOM.isEmpty(elm)); + }); + + test('bind/unbind/fire', function() { + var count = 0; + + DOM.bind(document, 'click', function() {count++;}); + DOM.fire(document, 'click'); + DOM.unbind(document, 'click'); + equal(count, 1); + + count = 0; + DOM.bind([document, window], 'click', function(e) {e.stopPropagation(); count++;}); + DOM.fire(document, 'click'); + DOM.fire(window, 'click'); + DOM.unbind([document, window], 'click'); + equal(count, 2); + + count = 0; + DOM.fire(document, 'click'); + DOM.fire(window, 'click'); + equal(count, 0); + }); + + DOM.remove('test'); +})(); diff --git a/tests/qunit/editor/tinymce/dom/DOMUtils_jquery.html b/tests/qunit/editor/tinymce/dom/DOMUtils_jquery.html new file mode 100644 index 0000000000..f9086822e6 --- /dev/null +++ b/tests/qunit/editor/tinymce/dom/DOMUtils_jquery.html @@ -0,0 +1,29 @@ + + + +Unit tests for tinymce.dom.DOMUtils + + + + + + + + + + + + +

                                                                Unit tests for tinymce.dom.DOMUtils

                                                                +

                                                                +
                                                                +

                                                                +
                                                                  +
                                                                  + + diff --git a/tests/qunit/editor/tinymce/dom/EventUtils.html b/tests/qunit/editor/tinymce/dom/EventUtils.html new file mode 100644 index 0000000000..b2d65be5fc --- /dev/null +++ b/tests/qunit/editor/tinymce/dom/EventUtils.html @@ -0,0 +1,459 @@ + + + +Unit tests for the EventUtils class + + + + + + + + + +

                                                                  Unit tests for DOM Selection IE implementation

                                                                  +

                                                                  +
                                                                  +

                                                                  +
                                                                    +
                                                                    +
                                                                    +
                                                                    + + diff --git a/tests/qunit/editor/tinymce/dom/Range.html b/tests/qunit/editor/tinymce/dom/Range.html new file mode 100644 index 0000000000..c8750377ea --- /dev/null +++ b/tests/qunit/editor/tinymce/dom/Range.html @@ -0,0 +1,606 @@ + + + +Unit tests for DOM Range IE implementation + + + + + + + + +

                                                                    Unit tests for DOM Range IE implementation

                                                                    +

                                                                    +
                                                                    +

                                                                    +
                                                                      +
                                                                      +

                                                                      first strong strong second em strong.

                                                                      +

                                                                      bar

                                                                      +

                                                                      some textem textmore text

                                                                      + + + + + + + + + +
                                                                      1abc
                                                                      34
                                                                      +

                                                                      textabcspan

                                                                      +
                                                                      + + diff --git a/tests/qunit/editor/tinymce/dom/Selection.html b/tests/qunit/editor/tinymce/dom/Selection.html new file mode 100644 index 0000000000..b004f884af --- /dev/null +++ b/tests/qunit/editor/tinymce/dom/Selection.html @@ -0,0 +1,878 @@ + + + +Unit tests for tinymce.dom.Selection + + + + + + + + + +

                                                                      Unit tests for tinymce.dom.Selection

                                                                      +

                                                                      +
                                                                      +

                                                                      +
                                                                        + + + + diff --git a/tests/qunit/editor/tinymce/dom/Serializer.html b/tests/qunit/editor/tinymce/dom/Serializer.html new file mode 100644 index 0000000000..1a5310f364 --- /dev/null +++ b/tests/qunit/editor/tinymce/dom/Serializer.html @@ -0,0 +1,515 @@ + + + +Unit tests for tinymce.dom.Serializer + + + + + + + + + +

                                                                        Unit tests for tinymce.dom.Serializer

                                                                        +

                                                                        +
                                                                        +

                                                                        +
                                                                          +
                                                                          +
                                                                          +
                                                                          + + diff --git a/tests/qunit/editor/tinymce/dom/TridentSelection.html b/tests/qunit/editor/tinymce/dom/TridentSelection.html new file mode 100644 index 0000000000..3d5cb87cbb --- /dev/null +++ b/tests/qunit/editor/tinymce/dom/TridentSelection.html @@ -0,0 +1,586 @@ + + + +Unit tests for DOM Selection IE implementation + + + + + + + + + + +

                                                                          Unit tests for DOM Selection IE implementation

                                                                          +

                                                                          +
                                                                          +

                                                                          +
                                                                            + + + diff --git a/tests/qunit/editor/tinymce/dom/test.css b/tests/qunit/editor/tinymce/dom/test.css new file mode 100644 index 0000000000..dbfc43aee4 --- /dev/null +++ b/tests/qunit/editor/tinymce/dom/test.css @@ -0,0 +1,120 @@ +body, div, h1 { font-family: 'trebuchet ms', verdana, arial; margin: 0; padding: 0 } +body {font-size: 10pt; } +h1 { padding: 15px; font-size: large; background-color: #06b; color: white; } +h1 a { color: white; } +h2 { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal } + +.pass { color: green; } +.fail { color: red; } +p.result { margin-left: 1em; } + +#banner { height: 2em; border-bottom: 1px solid white; } +h2.pass { background-color: green; } +h2.fail { background-color: red; } + +div.testrunner-toolbar { background: #eee; border-top: 1px solid black; padding: 10px; } + +ol#tests > li > strong { cursor:pointer; } + +div#fx-tests h4 { + background: red; +} + +div#fx-tests h4.pass { + background: green; +} + +div#fx-tests div.box { + background: red url(data/cow.jpg) no-repeat; + overflow: hidden; + border: 2px solid #000; +} + +div#fx-tests div.overflow { + overflow: visible; +} + +div.inline { + display: inline; +} + +div.autoheight { + height: auto; +} + +div.autowidth { + width: auto; +} + +div.autoopacity { + opacity: auto; +} + +div.largewidth { + width: 100px; +} + +div.largeheight { + height: 100px; +} + +div.largeopacity { + filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100); +} + +div.medwidth { + width: 50px; +} + +div.medheight { + height: 50px; +} + +div.medopacity { + opacity: 0.5; + filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50); +} + +div.nowidth { + width: 0px; +} + +div.noheight { + height: 0px; +} + +div.noopacity { + opacity: 0; + filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); +} + +div.hidden { + display: none; +} + +div#fx-tests div.widewidth { + background-repeat: repeat-x; +} + +div#fx-tests div.wideheight { + background-repeat: repeat-y; +} + +div#fx-tests div.widewidth.wideheight { + background-repeat: repeat; +} + +div#fx-tests div.noback { + background-image: none; +} + +div.chain, div.chain div { width: 100px; height: 20px; position: relative; float: left; } +div.chain div { position: absolute; top: 0px; left: 0px; } + +div.chain.test { background: red; } +div.chain.test div { background: green; } + +div.chain.out { background: green; } +div.chain.out div { background: red; display: none; } + +div#show-tests * { display: none; } diff --git a/tests/qunit/editor/tinymce/dom/tests.js b/tests/qunit/editor/tinymce/dom/tests.js new file mode 100644 index 0000000000..a31786a801 --- /dev/null +++ b/tests/qunit/editor/tinymce/dom/tests.js @@ -0,0 +1,12 @@ +{ + "title": "tinymce.dom", + "tests": [ + {"title": "DOMUtils", "url": "DOMUtils.html"}, + {"title": "DOMUtils (jQuery)", "url": "DOMUtils_jquery.html"}, + {"title": "EventUtils", "url": "EventUtils.html"}, + {"title": "Range (IE/Native)", "url": "Range.html"}, + {"title": "Selection", "url": "Selection.html"}, + {"title": "Serializer", "url": "Serializer.html"}, + {"title": "TridentSelection (IE)", "url": "TridentSelection.html"} + ] +} diff --git a/tests/qunit/editor/tinymce/html/DomParser.html b/tests/qunit/editor/tinymce/html/DomParser.html new file mode 100644 index 0000000000..a79b84ea0b --- /dev/null +++ b/tests/qunit/editor/tinymce/html/DomParser.html @@ -0,0 +1,506 @@ + + + +tinymce.html.DomParser tests + + + + + + + + + +

                                                                            tinymce.html.DomParser tests

                                                                            +

                                                                            +
                                                                            +

                                                                            +
                                                                              +
                                                                              + + diff --git a/tests/qunit/editor/tinymce/html/Entities.html b/tests/qunit/editor/tinymce/html/Entities.html new file mode 100644 index 0000000000..3715245915 --- /dev/null +++ b/tests/qunit/editor/tinymce/html/Entities.html @@ -0,0 +1,98 @@ + + + +tinymce.html.Entities tests + + + + + + + + + +

                                                                              tinymce.html.Entities tests

                                                                              +

                                                                              +
                                                                              +

                                                                              +
                                                                                +
                                                                                + + diff --git a/tests/qunit/editor/tinymce/html/Node.html b/tests/qunit/editor/tinymce/html/Node.html new file mode 100644 index 0000000000..e3cd5a9a6e --- /dev/null +++ b/tests/qunit/editor/tinymce/html/Node.html @@ -0,0 +1,466 @@ + + + +tinymce.html.Node tests + + + + + + + + + +

                                                                                tinymce.html.Node tests

                                                                                +

                                                                                +
                                                                                +

                                                                                +
                                                                                  +
                                                                                  + + diff --git a/tests/qunit/editor/tinymce/html/SaxParser.html b/tests/qunit/editor/tinymce/html/SaxParser.html new file mode 100644 index 0000000000..584995667c --- /dev/null +++ b/tests/qunit/editor/tinymce/html/SaxParser.html @@ -0,0 +1,616 @@ + + + +tinymce.html.SaxParser tests + + + + + + + + + +

                                                                                  tinymce.html.SaxParser tests

                                                                                  +

                                                                                  +
                                                                                  +

                                                                                  +
                                                                                    +
                                                                                    + + diff --git a/tests/qunit/editor/tinymce/html/Schema.html b/tests/qunit/editor/tinymce/html/Schema.html new file mode 100644 index 0000000000..62ce0be2a6 --- /dev/null +++ b/tests/qunit/editor/tinymce/html/Schema.html @@ -0,0 +1,374 @@ + + + +tinymce.html.Schema tests + + + + + + + + + +

                                                                                    tinymce.html.Schema tests

                                                                                    +

                                                                                    +
                                                                                    +

                                                                                    +
                                                                                      +
                                                                                      + + diff --git a/tests/qunit/editor/tinymce/html/Serializer.html b/tests/qunit/editor/tinymce/html/Serializer.html new file mode 100644 index 0000000000..ba8bf091a6 --- /dev/null +++ b/tests/qunit/editor/tinymce/html/Serializer.html @@ -0,0 +1,46 @@ + + + +tinymce.html.Serializer tests + + + + + + + + + +

                                                                                      tinymce.html.Serializer tests

                                                                                      +

                                                                                      +
                                                                                      +

                                                                                      +
                                                                                        +
                                                                                        + + diff --git a/tests/qunit/editor/tinymce/html/Styles.html b/tests/qunit/editor/tinymce/html/Styles.html new file mode 100644 index 0000000000..7c737c9b41 --- /dev/null +++ b/tests/qunit/editor/tinymce/html/Styles.html @@ -0,0 +1,176 @@ + + + +tinymce.html.Styles tests + + + + + + + + + +

                                                                                        tinymce.html.Styles tests

                                                                                        +

                                                                                        +
                                                                                        +

                                                                                        +
                                                                                          +
                                                                                          + + diff --git a/tests/qunit/editor/tinymce/html/Writer.html b/tests/qunit/editor/tinymce/html/Writer.html new file mode 100644 index 0000000000..9516ee0480 --- /dev/null +++ b/tests/qunit/editor/tinymce/html/Writer.html @@ -0,0 +1,174 @@ + + + +tinymce.html.Writer tests + + + + + + + + + +

                                                                                          tinymce.html.Writer tests

                                                                                          +

                                                                                          +
                                                                                          +

                                                                                          +
                                                                                            +
                                                                                            + + diff --git a/tests/qunit/editor/tinymce/html/obsolete.html b/tests/qunit/editor/tinymce/html/obsolete.html new file mode 100644 index 0000000000..aed9260fa9 --- /dev/null +++ b/tests/qunit/editor/tinymce/html/obsolete.html @@ -0,0 +1,294 @@ + + + +Support for obsolete tags and attributes in the default HTML 5.0 schema + + + + + + + + + +

                                                                                            Support for obsolete tags and attributes in the default HTML 5.0 schema

                                                                                            +

                                                                                            +
                                                                                            +

                                                                                            +
                                                                                              + + + + diff --git a/tests/qunit/editor/tinymce/html/tests.js b/tests/qunit/editor/tinymce/html/tests.js new file mode 100644 index 0000000000..266c7e9141 --- /dev/null +++ b/tests/qunit/editor/tinymce/html/tests.js @@ -0,0 +1,14 @@ +{ + "title": "tinymce.html", + "tests": [ + {"title": "DomParser", "url": "DomParser.html"}, + {"title": "Entities", "url": "Entities.html"}, + {"title": "Node", "url": "Node.html"}, + {"title": "SaxParser", "url": "SaxParser.html"}, + {"title": "Schema", "url": "Schema.html"}, + {"title": "Serializer", "url": "Serializer.html"}, + {"title": "Styles", "url": "Styles.html"}, + {"title": "Writer", "url": "Writer.html"}, + {"title": "Obsolete tags and attributes", "url": "obsolete.html"} + ] +} diff --git a/tests/qunit/editor/tinymce/tests.js b/tests/qunit/editor/tinymce/tests.js new file mode 100644 index 0000000000..9e961b6305 --- /dev/null +++ b/tests/qunit/editor/tinymce/tests.js @@ -0,0 +1,15 @@ +{ + "title": "tinymce", + "tests": [ + {"title": "Editor", "url": "Editor.html"}, + {"title": "EditorCommands", "url": "EditorCommands.html"}, + {"title": "EnterKey", "url": "EnterKey.html"}, + {"title": "ForceBlocks", "url": "ForceBlocks.html"}, + {"title": "Formatter (Apply)", "url": "Formatter_apply.html"}, + {"title": "Formatter (Remove)", "url": "Formatter_remove.html"}, + {"title": "Formatter (Check)", "url": "Formatter_check.html"}, + {"title": "Formatter (jsrobot)", "url": "Formatter_robot.html", "jsrobot":true}, + {"title": "UndoManager", "url": "UndoManager.html"}, + {"title": "Undo", "url": "UndoManager_robot.html", "jsrobot": true} + ] +} diff --git a/tests/qunit/editor/tinymce/ui/AbsoluteLayout.html b/tests/qunit/editor/tinymce/ui/AbsoluteLayout.html new file mode 100644 index 0000000000..4fa6cd7d84 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/AbsoluteLayout.html @@ -0,0 +1,63 @@ + + + + +ui.AbsoluteLayout Test Suite + + + + + + + + + + + +

                                                                                              ui.AbsoluteLayout Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Button.html b/tests/qunit/editor/tinymce/ui/Button.html new file mode 100644 index 0000000000..51c62319ef --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Button.html @@ -0,0 +1,133 @@ + + + + +Button Test Suite + + + + + + + + + + + +

                                                                                              Button Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/ButtonGroup.html b/tests/qunit/editor/tinymce/ui/ButtonGroup.html new file mode 100644 index 0000000000..3b59e12c47 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/ButtonGroup.html @@ -0,0 +1,43 @@ + + + + +ui.ButtonGroup Test Suite + + + + + + + + + + + +

                                                                                              ui.ButtonGroup Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Checkbox.html b/tests/qunit/editor/tinymce/ui/Checkbox.html new file mode 100644 index 0000000000..2674930a3d --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Checkbox.html @@ -0,0 +1,43 @@ + + + + +ui.Checkbox Test Suite + + + + + + + + + + + +

                                                                                              ui.Checkbox Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Collection.html b/tests/qunit/editor/tinymce/ui/Collection.html new file mode 100644 index 0000000000..dfcb1001c5 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Collection.html @@ -0,0 +1,273 @@ + + + + +Collection Test Suite + + + + + + + + + + + +

                                                                                              ui.Collection Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/ColorButton.html b/tests/qunit/editor/tinymce/ui/ColorButton.html new file mode 100644 index 0000000000..8a34d49777 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/ColorButton.html @@ -0,0 +1,132 @@ + + + + +Button Test Suite + + + + + + + + + + + +

                                                                                              Button Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/ComboBox.html b/tests/qunit/editor/tinymce/ui/ComboBox.html new file mode 100644 index 0000000000..09972eef48 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/ComboBox.html @@ -0,0 +1,49 @@ + + + + +ui.ComboBox Test Suite + + + + + + + + + + + +

                                                                                              ui.ComboBox Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Container.html b/tests/qunit/editor/tinymce/ui/Container.html new file mode 100644 index 0000000000..a3f18b7d5a --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Container.html @@ -0,0 +1,43 @@ + + + + +ui.Container Test Suite + + + + + + + + + + + +

                                                                                              ui.Container Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Control.html b/tests/qunit/editor/tinymce/ui/Control.html new file mode 100644 index 0000000000..7720d3d0c4 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Control.html @@ -0,0 +1,229 @@ + + + + +Control Test Suite + + + + + + + + + + + +

                                                                                              ui.Control Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/DragHelper.html b/tests/qunit/editor/tinymce/ui/DragHelper.html new file mode 100644 index 0000000000..5b8f910e56 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/DragHelper.html @@ -0,0 +1,43 @@ + + + + +ui.DragHelper Test Suite + + + + + + + + + + + +

                                                                                              ui.DragHelper Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/ElementPath.html b/tests/qunit/editor/tinymce/ui/ElementPath.html new file mode 100644 index 0000000000..85d514c432 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/ElementPath.html @@ -0,0 +1,43 @@ + + + + +ui.ElementPath Test Suite + + + + + + + + + + + +

                                                                                              ui.ElementPath Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Factory.html b/tests/qunit/editor/tinymce/ui/Factory.html new file mode 100644 index 0000000000..3bb2ff7aed --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Factory.html @@ -0,0 +1,43 @@ + + + + +ui.Factory Test Suite + + + + + + + + + + + +

                                                                                              ui.Factory Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/FieldSet.html b/tests/qunit/editor/tinymce/ui/FieldSet.html new file mode 100644 index 0000000000..fa61533fb4 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/FieldSet.html @@ -0,0 +1,43 @@ + + + + +ui.FieldSet Test Suite + + + + + + + + + + + +

                                                                                              ui.FieldSet Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/FilePicker.html b/tests/qunit/editor/tinymce/ui/FilePicker.html new file mode 100644 index 0000000000..fbf10ca22b --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/FilePicker.html @@ -0,0 +1,43 @@ + + + + +ui.FilePicker Test Suite + + + + + + + + + + + +

                                                                                              ui.FilePicker Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/FitLayout.html b/tests/qunit/editor/tinymce/ui/FitLayout.html new file mode 100644 index 0000000000..ecae41b288 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/FitLayout.html @@ -0,0 +1,87 @@ + + + + +ui.FitLayout Test Suite + + + + + + + + + + + +

                                                                                              ui.FitLayout Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/FlexLayout.html b/tests/qunit/editor/tinymce/ui/FlexLayout.html new file mode 100644 index 0000000000..a709dbd538 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/FlexLayout.html @@ -0,0 +1,915 @@ + + + + +ui.FlexLayout Test Suite + + + + + + + + + + + +

                                                                                              ui.FlexLayout Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/FloatPanel.html b/tests/qunit/editor/tinymce/ui/FloatPanel.html new file mode 100644 index 0000000000..706e8c5b72 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/FloatPanel.html @@ -0,0 +1,43 @@ + + + + +ui.FloatPanel Test Suite + + + + + + + + + + + +

                                                                                              ui.FloatPanel Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/FlowLayout.html b/tests/qunit/editor/tinymce/ui/FlowLayout.html new file mode 100644 index 0000000000..2e1a0c8970 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/FlowLayout.html @@ -0,0 +1,43 @@ + + + + +ui.FlowLayout Test Suite + + + + + + + + + + + +

                                                                                              ui.FlowLayout Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Form.html b/tests/qunit/editor/tinymce/ui/Form.html new file mode 100644 index 0000000000..0a79072704 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Form.html @@ -0,0 +1,43 @@ + + + + +ui.Form Test Suite + + + + + + + + + + + +

                                                                                              ui.Form Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/FormItem.html b/tests/qunit/editor/tinymce/ui/FormItem.html new file mode 100644 index 0000000000..c506d5f21b --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/FormItem.html @@ -0,0 +1,43 @@ + + + + +ui.FormItem Test Suite + + + + + + + + + + + +

                                                                                              ui.FormItem Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/GridLayout.html b/tests/qunit/editor/tinymce/ui/GridLayout.html new file mode 100644 index 0000000000..8724cfc0c2 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/GridLayout.html @@ -0,0 +1,244 @@ + + + + +ui.GridLayout Test Suite + + + + + + + + + + + +

                                                                                              ui.GridLayout Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Iframe.html b/tests/qunit/editor/tinymce/ui/Iframe.html new file mode 100644 index 0000000000..7c2186a4b4 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Iframe.html @@ -0,0 +1,43 @@ + + + + +ui.Iframe Test Suite + + + + + + + + + + + +

                                                                                              ui.Iframe Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/KeyboardNavigation.html b/tests/qunit/editor/tinymce/ui/KeyboardNavigation.html new file mode 100644 index 0000000000..f7f289b812 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/KeyboardNavigation.html @@ -0,0 +1,43 @@ + + + + +ui.KeyboardNavigation Test Suite + + + + + + + + + + + +

                                                                                              ui.KeyboardNavigation Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Label.html b/tests/qunit/editor/tinymce/ui/Label.html new file mode 100644 index 0000000000..8ef0a538e6 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Label.html @@ -0,0 +1,43 @@ + + + + +ui.Label Test Suite + + + + + + + + + + + +

                                                                                              ui.Label Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Layout.html b/tests/qunit/editor/tinymce/ui/Layout.html new file mode 100644 index 0000000000..7209e6bab4 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Layout.html @@ -0,0 +1,43 @@ + + + + +ui.Layout Test Suite + + + + + + + + + + + +

                                                                                              ui.Layout Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/ListBox.html b/tests/qunit/editor/tinymce/ui/ListBox.html new file mode 100644 index 0000000000..44f79b39d2 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/ListBox.html @@ -0,0 +1,43 @@ + + + + +ui.ListBox Test Suite + + + + + + + + + + + +

                                                                                              ui.ListBox Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Menu.html b/tests/qunit/editor/tinymce/ui/Menu.html new file mode 100644 index 0000000000..42843c6f2c --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Menu.html @@ -0,0 +1,43 @@ + + + + +ui.Menu Test Suite + + + + + + + + + + + +

                                                                                              ui.Menu Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/MenuBar.html b/tests/qunit/editor/tinymce/ui/MenuBar.html new file mode 100644 index 0000000000..61d0c6cd30 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/MenuBar.html @@ -0,0 +1,43 @@ + + + + +ui.MenuBar Test Suite + + + + + + + + + + + +

                                                                                              ui.MenuBar Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/MenuButton.html b/tests/qunit/editor/tinymce/ui/MenuButton.html new file mode 100644 index 0000000000..eb7415e570 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/MenuButton.html @@ -0,0 +1,139 @@ + + + + +ui.MenuButton Test Suite + + + + + + + + + + + +

                                                                                              MenuButton Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/MenuItem.html b/tests/qunit/editor/tinymce/ui/MenuItem.html new file mode 100644 index 0000000000..b6c06869a9 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/MenuItem.html @@ -0,0 +1,43 @@ + + + + +ui.MenuItem Test Suite + + + + + + + + + + + +

                                                                                              ui.MenuItem Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/MessageBox.html b/tests/qunit/editor/tinymce/ui/MessageBox.html new file mode 100644 index 0000000000..20ddc8a3ca --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/MessageBox.html @@ -0,0 +1,43 @@ + + + + +ui.MessageBox Test Suite + + + + + + + + + + + +

                                                                                              ui.MessageBox Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Movable.html b/tests/qunit/editor/tinymce/ui/Movable.html new file mode 100644 index 0000000000..d62ea1638d --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Movable.html @@ -0,0 +1,43 @@ + + + + +ui.Movable Test Suite + + + + + + + + + + + +

                                                                                              ui.Movable Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Panel.html b/tests/qunit/editor/tinymce/ui/Panel.html new file mode 100644 index 0000000000..7e383c3a9a --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Panel.html @@ -0,0 +1,67 @@ + + + + +ui.Panel + + + + + + + + + + + +

                                                                                              ui.Panel Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/PanelButton.html b/tests/qunit/editor/tinymce/ui/PanelButton.html new file mode 100644 index 0000000000..0b1d66e768 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/PanelButton.html @@ -0,0 +1,43 @@ + + + + +ui.PanelButton Test Suite + + + + + + + + + + + +

                                                                                              ui.PanelButton Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Path.html b/tests/qunit/editor/tinymce/ui/Path.html new file mode 100644 index 0000000000..56609f706b --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Path.html @@ -0,0 +1,43 @@ + + + + +ui.Path Test Suite + + + + + + + + + + + +

                                                                                              ui.Path Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Radio.html b/tests/qunit/editor/tinymce/ui/Radio.html new file mode 100644 index 0000000000..ab95e781be --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Radio.html @@ -0,0 +1,43 @@ + + + + +ui.Radio Test Suite + + + + + + + + + + + +

                                                                                              ui.Radio Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Resizable.html b/tests/qunit/editor/tinymce/ui/Resizable.html new file mode 100644 index 0000000000..fcdd5d9e4a --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Resizable.html @@ -0,0 +1,43 @@ + + + + +ui.Resizable Test Suite + + + + + + + + + + + +

                                                                                              ui.Resizable Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/ResizeHandle.html b/tests/qunit/editor/tinymce/ui/ResizeHandle.html new file mode 100644 index 0000000000..95fd6ddaac --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/ResizeHandle.html @@ -0,0 +1,43 @@ + + + + +ui.ResizeHandle Test Suite + + + + + + + + + + + +

                                                                                              ui.ResizeHandle Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Scrollable.html b/tests/qunit/editor/tinymce/ui/Scrollable.html new file mode 100644 index 0000000000..2d5df68257 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Scrollable.html @@ -0,0 +1,43 @@ + + + + +ui.Scrollable Test Suite + + + + + + + + + + + +

                                                                                              ui.Scrollable Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Selector.html b/tests/qunit/editor/tinymce/ui/Selector.html new file mode 100644 index 0000000000..5c0cb1ab81 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Selector.html @@ -0,0 +1,148 @@ + + + + +ui.Selector Test Suite + + + + + + + + + + + +

                                                                                              ui.Selector Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Spacer.html b/tests/qunit/editor/tinymce/ui/Spacer.html new file mode 100644 index 0000000000..e62842a593 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Spacer.html @@ -0,0 +1,43 @@ + + + + +ui.Spacer Test Suite + + + + + + + + + + + +

                                                                                              ui.Spacer Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/SplitButton.html b/tests/qunit/editor/tinymce/ui/SplitButton.html new file mode 100644 index 0000000000..63e64396a4 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/SplitButton.html @@ -0,0 +1,131 @@ + + + + +ui.SplitButton Test Suite + + + + + + + + + + + +

                                                                                              Button Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/StackLayout.html b/tests/qunit/editor/tinymce/ui/StackLayout.html new file mode 100644 index 0000000000..b1f680ff72 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/StackLayout.html @@ -0,0 +1,43 @@ + + + + +ui.StackLayout Test Suite + + + + + + + + + + + +

                                                                                              ui.StackLayout Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/TabPanel.html b/tests/qunit/editor/tinymce/ui/TabPanel.html new file mode 100644 index 0000000000..41c4b9712a --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/TabPanel.html @@ -0,0 +1,164 @@ + + + + +ui.TabPanel Test Suite + + + + + + + + + + + +

                                                                                              ui.TabPanel Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/TextBox.html b/tests/qunit/editor/tinymce/ui/TextBox.html new file mode 100644 index 0000000000..cf0e93f469 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/TextBox.html @@ -0,0 +1,59 @@ + + + + +ui.TextBox Test Suite + + + + + + + + + + + +

                                                                                              ui.TextBox Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Throbber.html b/tests/qunit/editor/tinymce/ui/Throbber.html new file mode 100644 index 0000000000..fa32591140 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Throbber.html @@ -0,0 +1,43 @@ + + + + +ui.Throbber Test Suite + + + + + + + + + + + +

                                                                                              ui.Throbber Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Toolbar.html b/tests/qunit/editor/tinymce/ui/Toolbar.html new file mode 100644 index 0000000000..f0c00418b9 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Toolbar.html @@ -0,0 +1,43 @@ + + + + +ui.Toolbar Test Suite + + + + + + + + + + + +

                                                                                              ui.Toolbar Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Tooltip.html b/tests/qunit/editor/tinymce/ui/Tooltip.html new file mode 100644 index 0000000000..a01db34abe --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Tooltip.html @@ -0,0 +1,43 @@ + + + + +ui.Tooltip Test Suite + + + + + + + + + + + +

                                                                                              ui.Tooltip Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Widget.html b/tests/qunit/editor/tinymce/ui/Widget.html new file mode 100644 index 0000000000..77cf19edee --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Widget.html @@ -0,0 +1,43 @@ + + + + +ui.Widget Test Suite + + + + + + + + + + + +

                                                                                              ui.Widget Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/Window.html b/tests/qunit/editor/tinymce/ui/Window.html new file mode 100644 index 0000000000..de07e8fec7 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/Window.html @@ -0,0 +1,118 @@ + + + + +ui.Window + + + + + + + + + + + +

                                                                                              ui.Window Test Suite

                                                                                              +

                                                                                              +

                                                                                              +
                                                                                                +
                                                                                              +
                                                                                              + + diff --git a/tests/qunit/editor/tinymce/ui/css/ui-overrides.css b/tests/qunit/editor/tinymce/ui/css/ui-overrides.css new file mode 100644 index 0000000000..3911d63f23 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/css/ui-overrides.css @@ -0,0 +1,30 @@ +/* Hardcodes sizes since fonts vary on platforms */ + +.mce-spacer { + width: 20px; + height: 20px; + visibility: visible; + border: 0 solid black; +} + +.mce-head .mce-title { + width: 100px; + height: 20px; + display: inline-block; +} + +.mce-btn .mce-txt { + width: 20px; +} + +/* Colors used for debugging */ + +.mce-red {background-color: red;} +.mce-green {background-color: green;} +.mce-blue {background-color: blue;} +.mce-yellow {background-color: yellow;} +.mce-magenta {background-color: magenta;} +.mce-cyan {background-color: cyan;} +.mce-dotted {background-image: url(../img/raster.gif);} +.mce-i-test {background: red;} + \ No newline at end of file diff --git a/tests/qunit/editor/tinymce/ui/img/raster.gif b/tests/qunit/editor/tinymce/ui/img/raster.gif new file mode 100644 index 0000000000000000000000000000000000000000..d901bc1a53bc8db4d35d75bd3490d98e23686e84 GIT binary patch literal 56 zcmZ?wbhEHbjEB<5wG8q|kKzxu40~3Ew|H{)3*2(z@xm3#Et`TRj F1^{LF4bA`n literal 0 HcmV?d00001 diff --git a/tests/qunit/editor/tinymce/ui/tests.js b/tests/qunit/editor/tinymce/ui/tests.js new file mode 100644 index 0000000000..db7f74f3d8 --- /dev/null +++ b/tests/qunit/editor/tinymce/ui/tests.js @@ -0,0 +1,55 @@ +{ + "title": "tinymce.ui", + "tests": [ + {"title": "AbsoluteLayout", "url": "AbsoluteLayout.html"}, + {"title": "Button", "url": "Button.html"}, + {"title": "ButtonGroup", "url": "ButtonGroup.html"}, + {"title": "Checkbox", "url": "Checkbox.html"}, + {"title": "Collection", "url": "Collection.html"}, + {"title": "ColorButton", "url": "ColorButton.html"}, + {"title": "ComboBox", "url": "ComboBox.html"}, + {"title": "Container", "url": "Container.html"}, + {"title": "Control", "url": "Control.html"}, + {"title": "DragHelper", "url": "DragHelper.html"}, + {"title": "ElementPath", "url": "ElementPath.html"}, + {"title": "Factory", "url": "Factory.html"}, + {"title": "FieldSet", "url": "FieldSet.html"}, + {"title": "FilePicker", "url": "FilePicker.html"}, + {"title": "FitLayout", "url": "FitLayout.html"}, + {"title": "FlexLayout", "url": "FlexLayout.html"}, + {"title": "FloatPanel", "url": "FloatPanel.html"}, + {"title": "FlowLayout", "url": "FlowLayout.html"}, + {"title": "Form", "url": "Form.html"}, + {"title": "FormItem", "url": "FormItem.html"}, + {"title": "GridLayout", "url": "GridLayout.html"}, + {"title": "Iframe", "url": "Iframe.html"}, + {"title": "KeyboardNavigation", "url": "KeyboardNavigation.html"}, + {"title": "Label", "url": "Label.html"}, + {"title": "Layout", "url": "Layout.html"}, + {"title": "ListBox", "url": "ListBox.html"}, + {"title": "Menu", "url": "Menu.html"}, + {"title": "MenuBar", "url": "MenuBar.html"}, + {"title": "MenuButton", "url": "MenuButton.html"}, + {"title": "MenuItem", "url": "MenuItem.html"}, + {"title": "MessageBox", "url": "MessageBox.html"}, + {"title": "Movable", "url": "Movable.html"}, + {"title": "Panel", "url": "Panel.html"}, + {"title": "PanelButton", "url": "PanelButton.html"}, + {"title": "Path", "url": "Path.html"}, + {"title": "Radio", "url": "Radio.html"}, + {"title": "Resizable", "url": "Resizable.html"}, + {"title": "ResizeHandle", "url": "ResizeHandle.html"}, + {"title": "Scrollable", "url": "Scrollable.html"}, + {"title": "Selector", "url": "Selector.html"}, + {"title": "Spacer", "url": "Spacer.html"}, + {"title": "SplitButton", "url": "SplitButton.html"}, + {"title": "StackLayout", "url": "StackLayout.html"}, + {"title": "TabPanel", "url": "TabPanel.html"}, + {"title": "TextBox", "url": "TextBox.html"}, + {"title": "Throbber", "url": "Throbber.html"}, + {"title": "Toolbar", "url": "Toolbar.html"}, + {"title": "Tooltip", "url": "Tooltip.html"}, + {"title": "Widget", "url": "Widget.html"}, + {"title": "Window", "url": "Window.html"} + ] +} diff --git a/tests/qunit/editor/tinymce/util/JSON.html b/tests/qunit/editor/tinymce/util/JSON.html new file mode 100644 index 0000000000..a27f6acf51 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/JSON.html @@ -0,0 +1,39 @@ + + + +tinymce.util.JSON tests + + + + + + + + + +

                                                                                              tinymce.util.JSON tests

                                                                                              +

                                                                                              +
                                                                                              +

                                                                                              +
                                                                                                +
                                                                                                + + diff --git a/tests/qunit/editor/tinymce/util/JSONRequest.html b/tests/qunit/editor/tinymce/util/JSONRequest.html new file mode 100644 index 0000000000..4698f03385 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/JSONRequest.html @@ -0,0 +1,77 @@ + + + +tinymce.util.JSONRequest tests + + + + + + + + + +

                                                                                                tinymce.util.JSONRequest tests

                                                                                                +

                                                                                                +
                                                                                                +

                                                                                                +
                                                                                                  +
                                                                                                  + + diff --git a/tests/qunit/editor/tinymce/util/LocalStorage.html b/tests/qunit/editor/tinymce/util/LocalStorage.html new file mode 100644 index 0000000000..2c405a6d0e --- /dev/null +++ b/tests/qunit/editor/tinymce/util/LocalStorage.html @@ -0,0 +1,118 @@ + + + +tinymce.util.LocalStorage tests + + + + + + + + + +

                                                                                                  tinymce.util.Cookie tests

                                                                                                  +

                                                                                                  +
                                                                                                  +

                                                                                                  +
                                                                                                    +
                                                                                                    + + diff --git a/tests/qunit/editor/tinymce/util/Quirks_all.html b/tests/qunit/editor/tinymce/util/Quirks_all.html new file mode 100644 index 0000000000..a64f93bf00 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/Quirks_all.html @@ -0,0 +1,76 @@ + + + +All browser types Quirks + + + + + + + + + + +

                                                                                                    All browser types Quirks

                                                                                                    +

                                                                                                    +
                                                                                                    +

                                                                                                    +
                                                                                                      + + + + diff --git a/tests/qunit/editor/tinymce/util/Quirks_firefox.html b/tests/qunit/editor/tinymce/util/Quirks_firefox.html new file mode 100644 index 0000000000..01ebd756f5 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/Quirks_firefox.html @@ -0,0 +1,75 @@ + + + +Firefox Quirks + + + + + + + + + + +

                                                                                                      Firefox Quirks

                                                                                                      +

                                                                                                      +
                                                                                                      +

                                                                                                      +
                                                                                                        + + + + diff --git a/tests/qunit/editor/tinymce/util/Quirks_ie8.html b/tests/qunit/editor/tinymce/util/Quirks_ie8.html new file mode 100644 index 0000000000..aa3f61e745 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/Quirks_ie8.html @@ -0,0 +1,82 @@ + + + +Internet Explorer 8 Quirks + + + + + + + + + + +

                                                                                                        Internet Explorer 8 Quirks

                                                                                                        +

                                                                                                        +
                                                                                                        +

                                                                                                        +
                                                                                                          + + + + diff --git a/tests/qunit/editor/tinymce/util/Quirks_remove.html b/tests/qunit/editor/tinymce/util/Quirks_remove.html new file mode 100644 index 0000000000..15508ef312 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/Quirks_remove.html @@ -0,0 +1,270 @@ + + + +Removing content tests + + + + + + + + + + +

                                                                                                          Removing content tests

                                                                                                          +

                                                                                                          +
                                                                                                          +

                                                                                                          +
                                                                                                            +
                                                                                                            + +
                                                                                                            + + + diff --git a/tests/qunit/editor/tinymce/util/Quirks_webkit.html b/tests/qunit/editor/tinymce/util/Quirks_webkit.html new file mode 100644 index 0000000000..361bb7bb1d --- /dev/null +++ b/tests/qunit/editor/tinymce/util/Quirks_webkit.html @@ -0,0 +1,132 @@ + + + +Webkit Quirks + + + + + + + + + +

                                                                                                            Webkit Quirks

                                                                                                            +

                                                                                                            +
                                                                                                            +

                                                                                                            +
                                                                                                              + + + diff --git a/tests/qunit/editor/tinymce/util/Quirks_webkit_jsrobot.html b/tests/qunit/editor/tinymce/util/Quirks_webkit_jsrobot.html new file mode 100644 index 0000000000..9a996a01ca --- /dev/null +++ b/tests/qunit/editor/tinymce/util/Quirks_webkit_jsrobot.html @@ -0,0 +1,205 @@ + + + +Webkit Quirks + + + + + + + + + + +

                                                                                                              Webkit Quirks

                                                                                                              +

                                                                                                              +
                                                                                                              +

                                                                                                              +
                                                                                                                + + + + diff --git a/tests/qunit/editor/tinymce/util/URI.html b/tests/qunit/editor/tinymce/util/URI.html new file mode 100644 index 0000000000..91adc88b64 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/URI.html @@ -0,0 +1,111 @@ + + + +tinymce.util.URI tests + + + + + + + + + +

                                                                                                                tinymce.html.Entities tests

                                                                                                                +

                                                                                                                +
                                                                                                                +

                                                                                                                +
                                                                                                                  +
                                                                                                                  + + diff --git a/tests/qunit/editor/tinymce/util/XHR.html b/tests/qunit/editor/tinymce/util/XHR.html new file mode 100644 index 0000000000..90b33eb758 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/XHR.html @@ -0,0 +1,53 @@ + + + +tinymce.util.XHR tests + + + + + + + + + +

                                                                                                                  tinymce.util.XHR tests

                                                                                                                  +

                                                                                                                  +
                                                                                                                  +

                                                                                                                  +
                                                                                                                    +
                                                                                                                    + + diff --git a/tests/qunit/editor/tinymce/util/json_rpc_error.js b/tests/qunit/editor/tinymce/util/json_rpc_error.js new file mode 100644 index 0000000000..be02a23562 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/json_rpc_error.js @@ -0,0 +1 @@ +{"result": null, "error": {"message":"General failure","code":42}, "id": 1} \ No newline at end of file diff --git a/tests/qunit/editor/tinymce/util/json_rpc_ok.js b/tests/qunit/editor/tinymce/util/json_rpc_ok.js new file mode 100644 index 0000000000..2bc6bdd0f2 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/json_rpc_ok.js @@ -0,0 +1 @@ +{"result": "Hello JSON-RPC", "error": null, "id": 1} \ No newline at end of file diff --git a/tests/qunit/editor/tinymce/util/test.xml b/tests/qunit/editor/tinymce/util/test.xml new file mode 100644 index 0000000000..7ed7b5e203 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/test.xml @@ -0,0 +1,6 @@ + + + + ÅÄÖ + + diff --git a/tests/qunit/editor/tinymce/util/tests.js b/tests/qunit/editor/tinymce/util/tests.js new file mode 100644 index 0000000000..642d6701e8 --- /dev/null +++ b/tests/qunit/editor/tinymce/util/tests.js @@ -0,0 +1,16 @@ +{ + "title": "tinymce.util", + "tests": [ + {"title": "JSON", "url": "JSON.html"}, + {"title": "JSONRequest", "url": "JSONRequest.html"}, + {"title": "LocalStorage", "url": "LocalStorage.html"}, + {"title": "URI", "url": "URI.html"}, + {"title": "XHR", "url": "XHR.html"}, + {"title": "All browser types", "url": "Quirks_all.html", "jsrobot": true}, + {"title": "Quirks (Firefox)", "url": "Quirks_firefox.html", "jsrobot": true}, + {"title": "Quirks (IE 8)", "url": "Quirks_ie8.html", "jsrobot": true}, + {"title": "Quirks (Webkit)", "url": "Quirks_webkit.html"}, + {"title": "Quirks JSRobot (Webkit)", "url": "Quirks_webkit_jsrobot.html", "jsrobot": true}, + {"title": "Quirks (Remove)", "url": "Quirks_remove.html", "jsrobot": true} + ] +} diff --git a/tests/qunit/index.html b/tests/qunit/index.html index 56d64a4862..92a2d75ece 100644 --- a/tests/qunit/index.html +++ b/tests/qunit/index.html @@ -28,6 +28,7 @@

                                                                                                                      +

                                                                                                                      TinyMCE tests