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

Side by Side Diff: LayoutTests/fast/dom/domstring-attribute-reflection.html

Issue 101423002: Remove TreatNullAs=NullString for HTMLTextAreaElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase on top of HTMLSelectElement patch Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/dom/domstring-attribute-reflection-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 <script> 5 <script>
6 var element; 6 var element;
7 7
8 function testDOMStringReflection(elementName, contentAttributeName, idlAttribute Name, treatNullAsString) { 8 function testDOMStringReflection(elementName, contentAttributeName, idlAttribute Name) {
9 idlAttributeName = idlAttributeName || contentAttributeName; 9 idlAttributeName = idlAttributeName || contentAttributeName;
10 element = document.createElement(elementName); 10 element = document.createElement(elementName);
11 debug('Reflected DOMString attribute test for ' + elementName + '/@' + conte ntAttributeName); 11 debug('Reflected DOMString attribute test for ' + elementName + '/@' + conte ntAttributeName);
12 debug('Initial value:'); 12 debug('Initial value:');
13 shouldBeEqualToString('element.' + idlAttributeName, ''); 13 shouldBeEqualToString('element.' + idlAttributeName, '');
14 shouldBeNull('element.getAttribute("' + contentAttributeName + '")'); 14 shouldBeNull('element.getAttribute("' + contentAttributeName + '")');
15 15
16 debug('Setting a value via the IDL attribute:'); 16 debug('Setting a value via the IDL attribute:');
17 shouldBeEqualToString('element.' + idlAttributeName + ' = "foo"; element.' + idlAttributeName, 'foo'); 17 shouldBeEqualToString('element.' + idlAttributeName + ' = "foo"; element.' + idlAttributeName, 'foo');
18 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , 'foo'); 18 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , 'foo');
19 19
20 debug('Setting a value via the content attribute:'); 20 debug('Setting a value via the content attribute:');
21 shouldBeEqualToString('element.setAttribute("' + contentAttributeName + '", " bar\\n"); element.' + idlAttributeName, ' bar\n'); 21 shouldBeEqualToString('element.setAttribute("' + contentAttributeName + '", " bar\\n"); element.' + idlAttributeName, ' bar\n');
22 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , ' bar\n'); 22 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , ' bar\n');
23 23
24 debug('Setting null via the IDL attribute:'); 24 debug('Setting null via the IDL attribute:');
25 if (treatNullAsString) { 25 shouldBeEqualToString('element.' + idlAttributeName + ' = null; element.' + idlAttributeName, 'null');
26 shouldBeEqualToString('element.' + idlAttributeName + ' = null; element. ' + idlAttributeName, 'null'); 26 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , 'null');
27 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")', 'null');
28 } else {
29 shouldBeEqualToString('element.' + idlAttributeName + ' = null; element. ' + idlAttributeName, '');
30 shouldBeNull('element.getAttribute("' + contentAttributeName + '")');
31 }
32 27
33 debug('Setting null via the content attribute:'); 28 debug('Setting null via the content attribute:');
34 shouldBeEqualToString('element.setAttribute("' + contentAttributeName + '", null); element.' + idlAttributeName, 'null'); 29 shouldBeEqualToString('element.setAttribute("' + contentAttributeName + '", null); element.' + idlAttributeName, 'null');
35 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , 'null'); 30 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , 'null');
36 31
37 debug('Setting undefined via the IDL attribute:'); 32 debug('Setting undefined via the IDL attribute:');
38 shouldBeEqualToString('element.' + idlAttributeName + ' = undefined; element .' + idlAttributeName, 'undefined'); 33 shouldBeEqualToString('element.' + idlAttributeName + ' = undefined; element .' + idlAttributeName, 'undefined');
39 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , 'undefined'); 34 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , 'undefined');
40 35
41 debug('Setting undefined via the content attribute:'); 36 debug('Setting undefined via the content attribute:');
42 shouldBeEqualToString('element.setAttribute("' + contentAttributeName + '", undefined); element.' + idlAttributeName, 'undefined'); 37 shouldBeEqualToString('element.setAttribute("' + contentAttributeName + '", undefined); element.' + idlAttributeName, 'undefined');
43 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , 'undefined'); 38 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , 'undefined');
44 39
45 debug('Setting non-string via the IDL attribute:'); 40 debug('Setting non-string via the IDL attribute:');
46 shouldBeEqualToString('element.' + idlAttributeName + ' = 123; element.' + i dlAttributeName, '123'); 41 shouldBeEqualToString('element.' + idlAttributeName + ' = 123; element.' + i dlAttributeName, '123');
47 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , '123'); 42 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , '123');
48 43
49 debug('Setting non-string via the content attribute:'); 44 debug('Setting non-string via the content attribute:');
50 shouldBeEqualToString('element.setAttribute("' + contentAttributeName + '", 456); element.' + idlAttributeName, '456'); 45 shouldBeEqualToString('element.setAttribute("' + contentAttributeName + '", 456); element.' + idlAttributeName, '456');
51 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , '456'); 46 shouldBeEqualToString('element.getAttribute("' + contentAttributeName + '")' , '456');
52 47
53 debug('\n'); 48 debug('\n');
54 } 49 }
55 50
56 testDOMStringReflection('button', 'name', 'name', true); 51 testDOMStringReflection('button', 'name');
57 testDOMStringReflection('fieldset', 'name', 'name', true); 52 testDOMStringReflection('fieldset', 'name');
58 testDOMStringReflection('form', 'name', 'name', true); 53 testDOMStringReflection('form', 'name');
59 testDOMStringReflection('input', 'name', 'name', true); 54 testDOMStringReflection('input', 'name');
60 testDOMStringReflection('input', 'step', 'step', true); 55 testDOMStringReflection('input', 'step');
61 testDOMStringReflection('keygen', 'name', 'name', true); 56 testDOMStringReflection('keygen', 'name');
62 testDOMStringReflection('object', 'name', 'name', true); 57 testDOMStringReflection('object', 'name');
63 testDOMStringReflection('output', 'name', 'name', true); 58 testDOMStringReflection('output', 'name');
64 testDOMStringReflection('select', 'name', 'name', true); 59 testDOMStringReflection('select', 'name');
65 testDOMStringReflection('textarea', 'name'); 60 testDOMStringReflection('textarea', 'name');
66 61
67 // Add more DOMString attributes! 62 // Add more DOMString attributes!
68 63
69 </script> 64 </script>
70 </body> 65 </body>
71 </html> 66 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/domstring-attribute-reflection-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698