Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/spelling-attribute-change.html

Issue 2453313005: Convert editing/spelling/spelling-attribute-change.html with spellcheck_test (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!doctype html>
2 <html> 2 <script src="../../resources/testharness.js"></script>
3 <head> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../assert_selection.js"></script>
5 </head> 5 <script src="spellcheck_test.js"></script>
6 <body> 6
7 <p id="description"></p> 7 <script>
8 <div id="console"></div> 8 const testElementTypes = ['span', 'input', 'textarea'];
9 <script src="script-tests/spelling-attribute-change.js"></script> 9 const initialValues = [undefined, true, false];
10 </body> 10 const finalValues = [true, false];
11 </html> 11
12 function generateInputText(type, value) {
13 var text = `<${type} ${type === 'span' ? 'contenteditable ' : ''}id="target"`;
14 if (value !== undefined)
15 text += ` spellcheck="${value}"`;
16 text += '>';
17 if (type !== 'input')
18 text += `</${type}>`;
19 return text;
20 }
21
22 function generateExpectedText(type, value) {
23 const misspelling = value ? '#zz#' : 'zz';
24 var text = `<${type} ${type === 'span' ? 'contenteditable ' : ''}id="target" s pellcheck="${value}"`;
25 if (type === 'input') {
26 text += ` value="Hello,${misspelling}.">`;
27 } else {
28 text += `>Hello,${misspelling}.</${type}>`;
29 }
30 return text;
31 }
32
33 testElementTypes.forEach(type => {
yosin_UTC9 2016/10/28 08:43:52 Please don't use control-flow to generate sample i
Xiaocheng 2016/10/28 09:21:01 Done.
34 initialValues.forEach(initialValue => {
35 finalValues.forEach(finalValue => spellcheck_test(
36 generateInputText(type, initialValue),
37 document => {
38 const target = document.getElementById('target');
39 target.spellcheck = finalValue;
40 target.focus();
41 document.execCommand('insertText', false, 'Hello,');
42 document.execCommand('insertText', false, 'zz.');
43 },
44 generateExpectedText(type, finalValue),
45 `Change "spellcheck" of <${type}> from ${initialValue} to ${finalValue }`));
46 });
47 });
48 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698