module("tinymce.plugins.Wordcount", { setupModule: function() { QUnit.stop(); tinymce.init({ selector: "textarea", add_unload_trigger: false, skin: false, wordcount_target_id: 'current-count', plugins: 'wordcount', init_instance_callback: function(ed) { window.editor = ed; QUnit.start(); } }); } }); test("Blank document has 0 words", function() { expect(1); editor.setContent(''); var result = editor.plugins.wordcount.getCount(); equal(result, 0); }); test("Simple word count", function() { expect(1); editor.setContent('
My sentence is this.
'); var result = editor.plugins.wordcount.getCount(); equal(result, 4); }); test("Does not count dashes", function() { expect(1); editor.setContent('Something -- ok
'); var result = editor.plugins.wordcount.getCount(); equal(result, 2); }); test("Does not count asterisks, non-word characters", function() { expect(1); editor.setContent('* something\n\u00b7 something else
'); var result = editor.plugins.wordcount.getCount(); equal(result, 3); }); test("Does not count numbers", function() { expect(1); editor.setContent('Something 123 ok
'); var result = editor.plugins.wordcount.getCount(); equal(result, 2); }); test("Does not count htmlentities", function() { expect(1); editor.setContent('It’s my life – – – don\'t you forget.
'); var result = editor.plugins.wordcount.getCount(); equal(result, 6); }); test("Counts hyphenated words as one word", function() { expect(1); editor.setContent('Hello some-word here.
'); var result = editor.plugins.wordcount.getCount(); equal(result, 3); }); test("Counts words between blocks as two words", function() { expect(1); editor.setContent('Hello
world
'); var result = editor.plugins.wordcount.getCount(); equal(result, 2); });