Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=338427 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 338427</title> |
michael@0 | 8 | <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=338427">Mozilla Bug 338427</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content"> |
michael@0 | 15 | <textarea id="editor" lang="testing-XX" spellcheck="true"></textarea> |
michael@0 | 16 | |
michael@0 | 17 | </div> |
michael@0 | 18 | <pre id="test"> |
michael@0 | 19 | <script class="testbody" type="text/javascript"> |
michael@0 | 20 | |
michael@0 | 21 | /** Test for Bug 338427 **/ |
michael@0 | 22 | function init() { |
michael@0 | 23 | Components.utils.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm"); |
michael@0 | 24 | |
michael@0 | 25 | var textarea = document.getElementById("editor"); |
michael@0 | 26 | var editor = textarea.editor; |
michael@0 | 27 | var spellchecker = editor.getInlineSpellChecker(true); |
michael@0 | 28 | spellchecker.enableRealTimeSpell = true; |
michael@0 | 29 | textarea.focus(); |
michael@0 | 30 | |
michael@0 | 31 | onSpellCheck(textarea, function () { |
michael@0 | 32 | var list = {}, count = {}; |
michael@0 | 33 | spellchecker.spellChecker.GetDictionaryList(list, count); |
michael@0 | 34 | ok(count.value > 0, "At least one dictionary should be present"); |
michael@0 | 35 | |
michael@0 | 36 | var lang = list.value[0]; |
michael@0 | 37 | spellchecker.spellChecker.SetCurrentDictionary(lang); |
michael@0 | 38 | |
michael@0 | 39 | onSpellCheck(textarea, function () { |
michael@0 | 40 | try { |
michael@0 | 41 | var dictionary = |
michael@0 | 42 | spellchecker.spellChecker.GetCurrentDictionary(); |
michael@0 | 43 | } catch(e) {} |
michael@0 | 44 | is(dictionary, lang, "Unexpected spell check dictionary"); |
michael@0 | 45 | SimpleTest.finish(); |
michael@0 | 46 | }); |
michael@0 | 47 | }); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 51 | addLoadEvent(init); |
michael@0 | 52 | |
michael@0 | 53 | </script> |
michael@0 | 54 | </pre> |
michael@0 | 55 | </body> |
michael@0 | 56 | </html> |
michael@0 | 57 |