OLD | NEW |
---|---|
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 dictionary unittest'); | 4 description('IDL dictionary unittest'); |
5 | 5 |
6 if (window.internals && internals.dictionaryTest) { | 6 if (window.internals && internals.dictionaryTest) { |
7 var dictionaryTest = window.internals.dictionaryTest(); | 7 var dictionaryTest = window.internals.dictionaryTest(); |
8 | 8 |
9 debug('Test for setting an empty dictionary'); | 9 debug('Test for setting an empty dictionary'); |
10 dictionaryTest.set({}); | 10 dictionaryTest.set({}); |
(...skipping 20 matching lines...) Expand all Loading... | |
31 booleanOrNullMember: true, doubleOrNullMember: 2.0, | 31 booleanOrNullMember: true, doubleOrNullMember: 2.0, |
32 stringSequenceMember: ['foo', 'bar', 'baz']}); | 32 stringSequenceMember: ['foo', 'bar', 'baz']}); |
33 dict = dictionaryTest.get(); | 33 dict = dictionaryTest.get(); |
34 shouldBe('dict.longMember', '3'); | 34 shouldBe('dict.longMember', '3'); |
35 shouldBeEqualToString('dict.stringMember', 'modifiedString'); | 35 shouldBeEqualToString('dict.stringMember', 'modifiedString'); |
36 shouldBeTrue('dict.booleanOrNullMember'); | 36 shouldBeTrue('dict.booleanOrNullMember'); |
37 shouldBe('dict.doubleOrNullMember', '2.0'); | 37 shouldBe('dict.doubleOrNullMember', '2.0'); |
38 shouldBe('dict.stringSequenceMember', '["foo", "bar", "baz"]'); | 38 shouldBe('dict.stringSequenceMember', '["foo", "bar", "baz"]'); |
39 debug(''); | 39 debug(''); |
40 | 40 |
41 // FIXME: Following test doesn't pass. Make it pass. | |
42 /* | |
43 debug('Test for explicit undefined or null, and missing members'); | 41 debug('Test for explicit undefined or null, and missing members'); |
44 dictionaryTest.reset(); | |
45 dictionaryTest.set({longMember: undefined, stringMember: undefined, | 42 dictionaryTest.set({longMember: undefined, stringMember: undefined, |
46 booleanOrNullMember: null}); | 43 booleanOrNullMember: null}); |
haraken
2014/08/27 16:07:43
Shall we add a test case to pass undefined to bool
bashi
2014/08/29 05:21:16
Done.
| |
47 dict = dictionaryTest.get(); | 44 dict = dictionaryTest.get(); |
48 shouldBeUndefined('dict.longMember'); | 45 shouldBeUndefined('dict.longMember'); |
49 shouldBeEqualToString('dict.stringMember', 'defaultStringValue'); | 46 shouldBeEqualToString('dict.stringMember', 'defaultStringValue'); |
50 shouldBeNull('dict.booleanOrNullMember'); | 47 shouldBeNull('dict.booleanOrNullMember'); |
51 shouldBeUndefined('dict.doubleOrNullMember'); | 48 shouldBeUndefined('dict.doubleOrNullMember'); |
52 shouldBeUndefined('dict.stringSequenceMember'); | 49 shouldBeUndefined('dict.stringSequenceMember'); |
53 debug(''); | 50 debug(''); |
54 */ | |
55 | 51 |
56 debug('Test for setting invalid member'); | 52 debug('Test for setting invalid member'); |
57 dictionaryTest.set({invalidMember: 'shouldNotBeSet'}); | 53 dictionaryTest.set({invalidMember: 'shouldNotBeSet'}); |
58 dict = dictionaryTest.get(); | 54 dict = dictionaryTest.get(); |
59 shouldBeUndefined('dict.invalidMember'); | 55 shouldBeUndefined('dict.invalidMember'); |
60 debug(''); | 56 debug(''); |
61 } | 57 } |
62 </script> | 58 </script> |
OLD | NEW |