1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>script.aculo.us Unit test file</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="../../lib/prototype.js" type="text/javascript"></script>
<script src="../../src/scriptaculous.js" type="text/javascript"></script>
<script src="../../src/unittest.js" type="text/javascript"></script>
<link rel="stylesheet" href="../test.css" type="text/css" />
</head>
<body>
<h1>script.aculo.us Unit test file</h1>
<p>
Tests for String.prototype extensions in effects.js
</p>
<!-- Log output -->
<div id="testlog"> </div>
<!-- Tests follow -->
<script type="text/javascript" language="javascript" charset="utf-8">
// <![CDATA[
new Test.Unit.Runner({
testStringParseColor: function() { with(this) {
assertEqual('#000000', "#000000".parseColor());
assertEqual('#000000', "rgb(0,0,0)".parseColor());
assertEqual('#000000', "rgb(0, 0, 0)".parseColor());
assertEqual('#000000', "#000".parseColor());
assertEqual('#1', "#1".parseColor());
assertEqual('#12', "#12".parseColor());
assertEqual('#112233', "#123".parseColor());
assertEqual('#1234', "#1234".parseColor());
assertEqual('#12345', "#12345".parseColor());
assertEqual('#123456', "#123456".parseColor());
assertEqual('#abcdef', "#aBcDeF".parseColor());
assertEqual('#aabbcc', "#aBc".parseColor());
assertEqual('white', "white".parseColor());
assertEqual('#123456', "#123456".parseColor('#000000')); // default to #000000 if not parseable
assertEqual('#000000', "white".parseColor('#000000')); // default to #000000 if not parseable
assertEqual('#ffffff', "rgb(255,255,255)".parseColor());
assertEqual('#ff0000', "rgb(255,0,0)".parseColor());
assertEqual('#00ff00', "rgb(0,255,0)".parseColor());
assertEqual('#0000ff', "rgb(0,0,255)".parseColor());
}},
testStringParseStyle: function() { with(this) {
var expected = "#<Hash:{'fontSize': '11px'}>";
assertInspect(expected, "font-size:11px".parseStyle());
assertInspect(expected, "font-SIZE: 11px".parseStyle());
assertInspect(expected, "font-size:11px ".parseStyle());
assertInspect(expected, " Font-size: 11px ".parseStyle());
}}
});
// ]]>
</script>
</body>
</html>
|