Commit | Line | Data |
---|---|---|
6a1aa64f DV |
1 | <html> |
2 | <head> | |
3 | <script type="text/javascript" src="../MochiKit/Base.js"></script> | |
4 | <script type="text/javascript" src="../MochiKit/Iter.js"></script> | |
5 | <script type="text/javascript" src="../MochiKit/DOM.js"></script> | |
6 | <script type="text/javascript" src="../MochiKit/Style.js"></script> | |
7 | <script type="text/javascript" src="../MochiKit/Logging.js"></script> | |
8 | <script type="text/javascript" src="../MochiKit/Color.js"></script> | |
9 | <script type="text/javascript" src="SimpleTest/SimpleTest.js"></script> | |
10 | <link rel="stylesheet" type="text/css" href="SimpleTest/test.css"> | |
11 | <style type="text/css">.redtext {color: red}</style> | |
12 | </head> | |
13 | <body> | |
14 | <div style="position:absolute; top: 0px; left:0px; width:0px; height:0px"> | |
15 | <span style="color: red" id="c_direct"></span> | |
16 | <span class="redtext" id="c_indirect"></span> | |
17 | </div> | |
18 | <pre id="test"> | |
19 | <script type="text/javascript" src="test_Color.js"></script> | |
20 | <script type="text/javascript"> | |
21 | try { | |
22 | ||
23 | var t = {ok:ok, is:is}; | |
24 | tests.test_Color({ok:ok, is:is}); | |
25 | is( | |
26 | Color.fromText(SPAN()).toHexString(), | |
27 | "#000000", | |
28 | "fromText no style" | |
29 | ); | |
30 | ||
31 | is( | |
32 | Color.fromText("c_direct").toHexString(), | |
33 | Color.fromName("red").toHexString(), | |
34 | "fromText direct style" | |
35 | ); | |
36 | ||
37 | is( | |
38 | Color.fromText("c_indirect").toHexString(), | |
39 | Color.fromName("red").toHexString(), | |
40 | "fromText indirect style" | |
41 | ); | |
42 | ||
43 | is( | |
44 | Color.fromComputedStyle("c_direct", "color").toHexString(), | |
45 | Color.fromName("red").toHexString(), | |
46 | "fromComputedStyle direct style" | |
47 | ); | |
48 | ||
49 | is( | |
50 | Color.fromComputedStyle("c_indirect", "color").toHexString(), | |
51 | Color.fromName("red").toHexString(), | |
52 | "fromComputedStyle indirect style" | |
53 | ); | |
54 | ||
55 | is( | |
56 | Color.fromBackground((SPAN(null, 'test'))).toHexString(), | |
57 | Color.fromName("white").toHexString(), | |
58 | "fromBackground with DOM" | |
59 | ); | |
60 | ||
61 | ||
62 | // Done! | |
63 | ||
64 | ok( true, "test suite finished!"); | |
65 | ||
66 | } catch (err) { | |
67 | ||
68 | var s = "test suite failure!\n"; | |
69 | var o = {}; | |
70 | var k = null; | |
71 | for (k in err) { | |
72 | // ensure unique keys?! | |
73 | if (!o[k]) { | |
74 | s += k + ": " + err[k] + "\n"; | |
75 | o[k] = err[k]; | |
76 | } | |
77 | } | |
78 | ok ( false, s ); | |
79 | ||
80 | } | |
81 | </script> | |
82 | </pre> | |
83 | </body> | |
84 | </html> |