OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <title>MediaImage interface</title> | |
3 <script src="../../resources/testharness.js"></script> | |
4 <script src="../../resources/testharnessreport.js"></script> | |
5 <script> | |
6 test(function() { | |
7 var image = new MediaImage({}); | |
8 assert_not_equals(image, null); | |
9 | |
10 var exception = false; | |
11 try { | |
12 image = new MediaImage("foobar"); | |
13 } catch (e) { | |
14 exception = true; | |
15 } | |
16 assert_true(exception); | |
17 | |
18 exception = false; | |
19 try { | |
20 image = new MediaImage(42); | |
21 } catch (e) { | |
22 exception = true; | |
23 } | |
24 assert_true(exception); | |
25 }, 'Test that MediaImage is constructed using a dictionary'); | |
26 | |
27 test (function() { | |
28 var image = new MediaImage({ | |
29 src: 'foo', sizes: 'bar', type: 'plop'}); | |
30 assert_greater_than(image.src.indexOf('foo'), -1); | |
31 assert_equals(image.sizes, 'bar'); | |
32 assert_equals(image.type, 'plop'); | |
33 }, 'Test the different values allowed in MediaImage init dictionary'); | |
34 | |
35 test (function() { | |
36 var image = new MediaImage({}); | |
37 assert_equals(image.src, document.URL); | |
38 assert_equals(image.sizes, ''); | |
39 assert_equals(image.type, ''); | |
40 }, 'Test the default values for MediaImage'); | |
41 | |
42 test (function() { | |
43 var image = new MediaMetadata({ randomValueThatWillNotBeAdded: '... hopefull
y ;)' }); | |
44 assert_equals(image.randomValueThatWillNotBeAdded, undefined); | |
45 }, 'Test that passing unknown values to the dictionary is a no-op'); | |
46 </script> | |
OLD | NEW |