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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/spelling/spellcheck_test.js

Issue 2456473002: Convert input-type-text.html with spellcheck_test (Closed)
Patch Set: Rename and remove expected text 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 // This file provides 7 // This file provides
8 // |spellcheck_test(sample, tester, expectedText, opt_title)| asynchronous test 8 // |spellcheck_test(sample, tester, expectedText, opt_title)| asynchronous test
9 // to W3C test harness for easier writing of spellchecker test cases. 9 // to W3C test harness for easier writing of spellchecker test cases.
10 // 10 //
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 * @private 201 * @private
202 * @param {!HTMLElement} element 202 * @param {!HTMLElement} element
203 */ 203 */
204 handleElementNode(element) { 204 handleElementNode(element) {
205 /** @type {string} */ 205 /** @type {string} */
206 const tagName = element.tagName.toLowerCase(); 206 const tagName = element.tagName.toLowerCase();
207 this.emit(`<${tagName}`); 207 this.emit(`<${tagName}`);
208 Array.from(element.attributes) 208 Array.from(element.attributes)
209 .sort((attr1, attr2) => attr1.name.localeCompare(attr2.name)) 209 .sort((attr1, attr2) => attr1.name.localeCompare(attr2.name))
210 .forEach(attr => { 210 .forEach(attr => {
211 // Text form control elements' values need special handling.
212 if (isHTMLInputElement(element) || isHTMLTextAreaElement(element)) {
yosin_UTC9 2016/10/27 01:44:46 nit: Please omit |isHTMLTextAreaElement()| since T
213 if (attr.name === 'value')
214 return;
215 }
211 if (attr.value === '') 216 if (attr.value === '')
212 return this.emit(` ${attr.name}`); 217 return this.emit(` ${attr.name}`);
213 const value = attr.value.replace(/&/g, '&amp;') 218 const value = attr.value.replace(/&/g, '&amp;')
214 .replace(/\u0022/g, '&quot;') 219 .replace(/\u0022/g, '&quot;')
215 .replace(/\u0027/g, '&apos;'); 220 .replace(/\u0027/g, '&apos;');
216 this.emit(` ${attr.name}="${value}"`); 221 this.emit(` ${attr.name}="${value}"`);
217 }); 222 });
218 if (isHTMLInputElement(element) && element.value) 223 if (isHTMLInputElement(element) && element.value)
219 this.handleInputNode(element); 224 this.handleInputNode(element);
220 this.emit('>'); 225 this.emit('>');
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 expectedText: expectedText, args: args}); 428 expectedText: expectedText, args: args});
424 return; 429 return;
425 } 430 }
426 431
427 invokeSpellcheckTest(input, tester, expectedText, args); 432 invokeSpellcheckTest(input, tester, expectedText, args);
428 } 433 }
429 434
430 // Export symbols 435 // Export symbols
431 window.spellcheck_test = spellcheckTest; 436 window.spellcheck_test = spellcheckTest;
432 })(); 437 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698