user-interaction-editing-spellcheck.html (1654B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Editing: spellcheck attribute test</title> 5 <link rel="author" title="Baidu" href="mailto: guopengcheng@baidu.com"/> 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/#spelling-and-grammar-checking"/> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 </head> 10 <body> 11 <div id="log"></div> 12 <textarea id="testText1" spellcheck="true">Test textarea with spellcheck is true</textarea> 13 <textarea id="testText2" spellcheck="false">Test textarea with spellcheck is false</textarea> 14 <script type="text/javascript"> 15 test(function() { 16 assert_true(document.getElementById("testText1").spellcheck, "check for testText1 spellcheck value"); 17 assert_false(document.getElementById("testText2").spellcheck, "check for testText2 spellcheck value"); 18 }, "Getting spellcheck IDL attribute"); 19 test(function() { 20 var testElement = document.createElement("testElement"); 21 testElement.contentEditable = true; 22 testElement.spellcheck = true; 23 assert_true(testElement.spellcheck, "check for testElement.spellcheck value"); 24 assert_equals(testElement.getAttribute("spellcheck"), "true"); 25 }, "Setting spellcheck IDL attribute to true"); 26 test(function() { 27 var testElement = document.createElement("testElement"); 28 testElement.contentEditable = true; 29 testElement.spellcheck = false; 30 assert_false(testElement.spellcheck, "check for testText2 spellcheck value"); 31 assert_equals(testElement.getAttribute("spellcheck"), "false"); 32 }, "Setting spellcheck IDL attribute to false"); 33 </script> 34 </body> 35 </html>