(function() { module("tinymce.plugins.TextPattern", { setupModule: function() { QUnit.stop(); tinymce.init({ selector: 'textarea', add_unload_trigger: false, skin: false, indent: false, plugins: "textpattern", init_instance_callback: function(ed) { window.editor = ed; QUnit.start(); } }); }, teardown: function() { delete editor.settings.textpattern_patterns; } }); test('Italic format on single word using space', function() { editor.setContent('
*abc*\u00a0
'); Utils.setSelection('p', 6); editor.fire('keyup', {keyCode: 32}); equal( editor.getContent(), 'abc
' ); }); test('Bold format on single word using space', function() { editor.setContent('**abc**\u00a0
'); Utils.setSelection('p', 8); editor.fire('keyup', {keyCode: 32}); equal( editor.getContent(), 'abc
' ); }); test('Bold format on multiple words using space', function() { editor.setContent('**abc 123**\u00a0
'); Utils.setSelection('p', 12); editor.fire('keyup', {keyCode: 32}); equal( editor.getContent(), 'abc 123
' ); }); test('Bold format on single word using enter', function() { editor.setContent('**abc**
'); Utils.setSelection('p', 7); editor.fire('keydown', {keyCode: 13}); equal( editor.getContent(), 'abc
' ); }); test('H1 format on single word node using enter', function() { editor.setContent('
#abc
'); Utils.setSelection('p', 4); editor.fire('keydown', {keyCode: 13}); equal( editor.getContent(), '' ); }); test('OL format on single word node using enter', function() { editor.setContent('
1. abc
'); Utils.setSelection('p', 6); editor.fire('keydown', {keyCode: 13}); equal( editor.getContent(), '* abc
'); Utils.setSelection('p', 5); editor.fire('keydown', {keyCode: 13}); equal( editor.getContent(), '