blob: 4b6a45cbb7adc239c9b0a60132c06a23a1377a25 (
plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
|
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=885996
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1234567</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript;version=1.8">
/** Test that the initial value of the nsIColorPicker is the current value of
the <input type='color'> element. **/
SimpleTest.waitForExplicitFinish();
var MockColorPicker = SpecialPowers.MockColorPicker;
var test = runTest();
SimpleTest.waitForFocus(function() {
test.next();
});
function runTest() {
MockColorPicker.init(window);
var element = null;
MockColorPicker.showCallback = function(picker) {
is(picker.initialColor, element.value);
SimpleTest.executeSoon(function() {
test.next();
});
return "";
};
for (var i = 0; i < document.getElementsByTagName('input').length; ++i) {
element = document.getElementsByTagName('input')[i];
if (element.parentElement.id === 'dynamic-values') {
element.value = '#deadbe';
}
synthesizeMouseAtCenter(element, {});
yield undefined;
};
MockColorPicker.cleanup();
SimpleTest.finish();
yield undefined;
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=885996">Mozilla Bug 885996</a>
<p id="display"></p>
<div id="content">
<div id='valid-values'>
<input type='color' value='#ff00ff'>
<input type='color' value='#ab3275'>
<input type='color' value='#abcdef'>
<input type='color' value='#ABCDEF'>
</div>
<div id='invalid-values'>
<input type='color' value='ffffff'>
<input type='color' value='#abcdez'>
<input type='color' value='#0123456'>
</div>
<div id='dynamic-values'>
<input type='color' value='#ab4594'>
<input type='color' value='#984534'>
<input type='color' value='#f8b9a0'>
</div>
</div>
<pre id="test">
</pre>
</body>
</html>
|