module("tinymce.utils.Quirks_WebKit", { setupModule: function() { QUnit.stop(); tinymce.init({ selector: "textarea", elements: "elm1", plugins: wpPlugins, add_unload_trigger: false, skin: false, indent: false, disable_nodechange: true, init_instance_callback : function(ed) { window.editor = ed; QUnit.start(); } }); } }); if (tinymce.isWebKit) { test('Delete from beginning of P into H1', function() { editor.getBody().innerHTML = '

a

b

'; Utils.setSelection('p', 0); editor.execCommand('Delete'); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

ab

'); equal(editor.selection.getStart().nodeName, 'H1'); }); /* test('Delete whole H1 before P', function() { editor.getBody().innerHTML = '

a

b

'; var rng = editor.selection.getRng(); rng.setStartBefore(editor.getBody().firstChild); rng.setEndAfter(editor.getBody().firstChild); editor.selection.setRng(rng); editor.execCommand('Delete'); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

b

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('ForwardDelete whole H1 before P', function() { editor.getBody().innerHTML = '

a

b

'; var rng = editor.selection.getRng(); rng.setStartBefore(editor.getBody().firstChild); rng.setEndAfter(editor.getBody().firstChild); editor.selection.setRng(rng); editor.execCommand('ForwardDelete'); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

b

'); equal(editor.selection.getStart().nodeName, 'H1'); }); */ test('Delete range from middle of H1 to middle of span in P', function() { editor.getBody().innerHTML = '

ab

bcd

'; Utils.setSelection('h1', 1, 'span', 1); editor.execCommand('Delete'); equal(Utils.normalizeHtml(Utils.cleanHtml(editor.getBody().innerHTML)), '

ad

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('Delete from beginning of P with style span inside into H1 with inline block', function() { editor.getBody().innerHTML = '

a

bc

'; Utils.setSelection('p', 0); editor.execCommand('Delete'); equal(editor.getContent(), '

abc

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('Delete from beginning of P with style span inside into H1', function() { editor.getBody().innerHTML = '

a

bc

'; Utils.setSelection('p', 0); editor.execCommand('Delete'); equal(editor.getContent(), '

abc

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('Delete from beginning of P into H1 with contentEditable:false', function() { editor.getBody().innerHTML = '

a

bc

'; Utils.setSelection('p', 0); editor.execCommand('Delete'); equal(editor.getContent(), '

a

bc

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('Delete from beginning of P with style span inside into H1 with trailing BR', function() { editor.getBody().innerHTML = '

a

bc

'; Utils.setSelection('p', 0); editor.execCommand('Delete'); equal(editor.getContent(), '

abc

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('Delete from empty P with style span inside into H1', function() { editor.getBody().innerHTML = '

a


'; Utils.setSelection('span', 0); editor.execCommand('Delete'); equal(editor.getContent(), '

a

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('Delete from beginning of P with span style to H1', function() { editor.getBody().innerHTML = '

a

b

'; Utils.setSelection('span', 0); editor.execCommand('Delete'); equal(editor.getContent(), '

ab

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('Delete from beginning of P with BR line to H1', function() { editor.getBody().innerHTML = '

a

b
c

'; Utils.setSelection('p', 0); editor.execCommand('Delete'); equal(Utils.normalizeHtml(Utils.cleanHtml(editor.getBody().innerHTML)), '

ab
c

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('ForwardDelete from end of H1 to P with style span', function() { editor.getBody().innerHTML = '

a

b

'; Utils.setSelection('h1', 1); editor.execCommand('ForwardDelete'); equal(editor.getContent(), '

ab

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('ForwardDelete from end of H1 with trailing BR to P with style span', function() { editor.getBody().innerHTML = '

a

b

'; Utils.setSelection('h1', 1); editor.execCommand('ForwardDelete'); equal(editor.getContent(), '

ab

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('ForwardDelete from end of H1 with two trailing BR:s to P with style span', function() { editor.getBody().innerHTML = '

a

b

'; Utils.setSelection('h1', 1); editor.execCommand('ForwardDelete'); equal(editor.getContent(), '

a

b

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('ForwardDelete from end of H1 to P with style and inline block element', function() { editor.getBody().innerHTML = '

a

b

'; Utils.setSelection('h1', 1); editor.execCommand('ForwardDelete'); equal(editor.getContent(), '

ab

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('ForwardDelete from end of H1 with BR line to P', function() { editor.getBody().innerHTML = '

a
b

c

'; var rng = editor.selection.getRng(); rng.setStart(editor.$('h1')[0].lastChild, 1); rng.setEnd(editor.$('h1')[0].lastChild, 1); editor.selection.setRng(rng); editor.execCommand('ForwardDelete'); equal(Utils.normalizeHtml(Utils.cleanHtml(editor.getBody().innerHTML)), '

a
bc

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('ForwardDelete from end of H1 into P', function() { editor.getBody().innerHTML = '

a

b

'; Utils.setSelection('h1', 1); editor.execCommand('ForwardDelete'); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

ab

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('ForwardDelete from end of H1 into P with contentEditable:false', function() { editor.getBody().innerHTML = '

a

b

'; Utils.setSelection('h1', 1); editor.execCommand('ForwardDelete'); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

a

b

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('ForwardDelete from end of H1 into P with style span inside', function() { editor.getBody().innerHTML = '

a

bc

'; Utils.setSelection('h1', 1); editor.execCommand('ForwardDelete'); equal(editor.getContent(), '

abc

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('Backspace key from beginning of P into H1', function() { editor.getBody().innerHTML = '

a

b

'; Utils.setSelection('p', 0); editor.fire("keydown", {keyCode: 8}); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

ab

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('Delete key from end of H1 into P', function() { editor.getBody().innerHTML = '

a

b

'; Utils.setSelection('h1', 1); editor.fire("keydown", {keyCode: 46}); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

ab

'); equal(editor.selection.getStart().nodeName, 'H1'); }); test('Backspace previous word', function() { editor.getBody().innerHTML = '

abc 123

'; Utils.setSelection('p', 7); editor.fire("keydown", {keyCode: 8, ctrlKey: true}); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

abc 

'); equal(editor.selection.getStart().nodeName, 'P'); }); test('Backspace previous line', function() { editor.getBody().innerHTML = '

abc 123

'; Utils.setSelection('p', 7); editor.fire("keydown", {keyCode: 8, metaKey: true}); equal(Utils.cleanHtml(editor.getBody().innerHTML), '


'); equal(editor.selection.getStart().nodeName, 'BR'); }); test('Delete next word', function() { editor.getBody().innerHTML = '

abc 123

'; Utils.setSelection('p', 0); editor.fire("keydown", {keyCode: 46, ctrlKey: true}); // Remove nbsp since very old WebKit has an slight issue equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(' ', ''), '

123

'); equal(editor.selection.getStart().nodeName, 'P'); }); test('Delete next line', function() { editor.getBody().innerHTML = '

abc 123

'; Utils.setSelection('p', 0); editor.fire("keydown", {keyCode: 46, metaKey: true}); equal(Utils.cleanHtml(editor.getBody().innerHTML), '


'); equal(editor.selection.getStart().nodeName, 'BR'); }); test('Type over bold text in fully selected block and keep bold', function() { editor.getBody().innerHTML = '

x

'; Utils.setSelection('b', 0, 'b', 1); editor.fire("keypress", {keyCode: 65, charCode: 65}); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

a

'); equal(editor.selection.getStart().nodeName, 'B'); }); test('Type over partial bold text and keep bold', function() { editor.getBody().innerHTML = '

xy

'; Utils.setSelection('b', 0, 'b', 1); editor.fire("keypress", {keyCode: 65, charCode: 65}); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

ay

'); equal(editor.selection.getStart().nodeName, 'B'); }); test('Type over bold text wrapped inside other formats', function() { editor.getBody().innerHTML = '

123

'; Utils.setSelection('b', 0, 'b', 1); editor.fire("keypress", {keyCode: 65, charCode: 65}); equal(Utils.cleanHtml(editor.getBody().innerHTML), '

1a3

'); equal(editor.selection.getStart().nodeName, 'B'); }); } else { test("Skipped since the browser isn't WebKit", function() { ok(true, "Skipped"); }); }