module("tinymce.ForceBlocks", { autostart: false, setupModule: function() { QUnit.stop(); tinymce.init({ selector: "textarea", add_unload_trigger: false, indent: false, skin: false, entities: 'raw', valid_styles: { '*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display' }, init_instance_callback: function(ed) { window.editor = ed; QUnit.start(); } }); }, teardown: function() { editor.settings.forced_root_block = 'p'; editor.settings.forced_root_block_attrs = null; } }); test('Wrap single root text node in P', function() { editor.getBody().innerHTML = 'abcd'; Utils.setSelection('body', 2); Utils.pressArrowKey(); equal(Utils.cleanHtml(editor.getBody().innerHTML), '
abcd
'); equal(editor.selection.getNode().nodeName, 'P'); }); test('Wrap single root text node in P with attrs', function() { editor.settings.forced_root_block_attrs = {"class": "class1"}; editor.getBody().innerHTML = 'abcd'; Utils.setSelection('body', 2); Utils.pressArrowKey(); equal(editor.getContent(), 'abcd
'); equal(editor.selection.getNode().nodeName, 'P'); }); test('Wrap single root text node in P but not table sibling', function() { editor.getBody().innerHTML = 'abcdx |
abcd
x |
x |
abcd
x |