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

Side by Side Diff: LayoutTests/fast/dom/idl-union-type-unittest.html

Issue 692993003: Named getter of HTMLAllCollection etc should be nullable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@union-nullable
Patch Set: Created 6 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> 1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script> 2 <script src="../../resources/js-test.js"></script>
3 <script> 3 <script>
4 description('IDL union types unittests'); 4 description('IDL union types unittests');
5 5
6 var element = document.createElement('div');
7 var nodeList = document.querySelectorAll('script');
8
6 if (window.internals) { 9 if (window.internals) {
7 // The conversion rule prefers string over double, hence a value which 10 // The conversion rule prefers string over double, hence a value which
8 // is neither double nor string will be converted using ToString(). 11 // is neither double nor string will be converted using ToString().
9 12
10 var unionTypesTest = internals.unionTypesTest(); 13 var unionTypesTest = internals.unionTypesTest();
11 14
12 debug('Tests for attributes'); 15 debug('Tests for attributes');
13 shouldBe('unionTypesTest.doubleOrStringAttribute', '0'); 16 shouldBe('unionTypesTest.doubleOrStringAttribute', '0');
14 unionTypesTest.doubleOrStringAttribute = 3.14; 17 unionTypesTest.doubleOrStringAttribute = 3.14;
15 shouldBe('unionTypesTest.doubleOrStringAttribute', '3.14'); 18 shouldBe('unionTypesTest.doubleOrStringAttribute', '3.14');
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultDoubleArg(undefin ed)', 'double is passed: 3.14'); 64 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultDoubleArg(undefin ed)', 'double is passed: 3.14');
62 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultDoubleArg("foo")' , 'string is passed: foo'); 65 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultDoubleArg("foo")' , 'string is passed: foo');
63 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultStringArg()', 'st ring is passed: foo'); 66 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultStringArg()', 'st ring is passed: foo');
64 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultStringArg(undefin ed)', 'string is passed: foo'); 67 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultStringArg(undefin ed)', 'string is passed: foo');
65 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultStringArg(3.14)', 'double is passed: 3.14'); 68 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultStringArg(3.14)', 'double is passed: 3.14');
66 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg()', 'null is passed'); 69 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg()', 'null is passed');
67 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg(undefined )', 'null is passed'); 70 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg(undefined )', 'null is passed');
68 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg(null)', ' null is passed'); 71 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg(null)', ' null is passed');
69 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg(3.14)', ' double is passed: 3.14'); 72 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg(3.14)', ' double is passed: 3.14');
70 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg("foo")', 'string is passed: foo'); 73 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg("foo")', 'string is passed: foo');
74 debug('');
71 75
76 debug('Tests for nullable method arguments');
77 shouldBeEqualToString('unionTypesTest.nodeListOrElementOrNullArg(undefined)' , 'null or undefined is passed');
78 shouldBeEqualToString('unionTypesTest.nodeListOrElementOrNullArg(null)', 'nu ll or undefined is passed');
79 shouldBeEqualToString('unionTypesTest.nodeListOrElementOrNullArg(nodeList)', 'nodelist is passed');
80 shouldBeEqualToString('unionTypesTest.nodeListOrElementOrNullArg(element)', 'element is passed');
81 shouldThrow('unionTypesTest.nodeListOrElementOrNullArg(3.14)');
82 shouldThrow('unionTypesTest.nodeListOrElementOrNullArg("foo")');
83 shouldThrow('unionTypesTest.nodeListOrElementOrNullArg({})');
84 shouldThrow('unionTypesTest.nodeListOrElementOrNullArg([])');
85
86 shouldThrow('unionTypesTest.nodeListOrElementArg(undefined)');
87 shouldThrow('unionTypesTest.nodeListOrElementArg(null)');
88 shouldBeEqualToString('unionTypesTest.nodeListOrElementArg(nodeList)', 'node list is passed');
89 shouldBeEqualToString('unionTypesTest.nodeListOrElementArg(element)', 'eleme nt is passed');
72 } 90 }
73 </script> 91 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698