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