cleanup and update of jquery-colorpicker dependency
This commit is contained in:
39
js/jquery-colorpicker/test/events.js
vendored
Normal file
39
js/jquery-colorpicker/test/events.js
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
module('events');
|
||||
|
||||
test('Empty input value should not set altField background to black', function() {
|
||||
expect(4);
|
||||
|
||||
var $input = $('<input type="text" value=""/>').appendTo('#qunit-fixture');
|
||||
var $altfield = $('<div></div>').appendTo('#qunit-fixture');
|
||||
|
||||
equal($altfield.css('backgroundColor'), 'rgba(0, 0, 0, 0)', 'Initial state, no color');
|
||||
|
||||
var jqcp = $input.colorpicker({
|
||||
altField: $altfield
|
||||
});
|
||||
|
||||
equal($altfield.css('backgroundColor'), 'rgba(0, 0, 0, 0)', 'After creation, no color');
|
||||
|
||||
jqcp.colorpicker('open');
|
||||
|
||||
equal($altfield.css('backgroundColor'), 'rgba(0, 0, 0, 0)', 'After open, no color');
|
||||
|
||||
jqcp.colorpicker('close');
|
||||
|
||||
equal($altfield.css('backgroundColor'), 'rgba(0, 0, 0, 0)', 'After close, no color');
|
||||
});
|
||||
|
||||
asyncTest('Changing the color in input should trigger a \'change\' event on the input', function() {
|
||||
expect(1);
|
||||
|
||||
var $input = $('<input type="text" value=""/>').appendTo('#qunit-fixture');
|
||||
|
||||
$input.change(function() {
|
||||
ok(true, 'triggered');
|
||||
start();
|
||||
});
|
||||
|
||||
var jqcp = $input.colorpicker();
|
||||
|
||||
jqcp.colorpicker('setColor', 'red');
|
||||
});
|
19
js/jquery-colorpicker/test/index.html
Normal file
19
js/jquery-colorpicker/test/index.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>JQCP QUnit test</title>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
|
||||
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>
|
||||
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css"/>
|
||||
<script src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
<script src="../jquery.colorpicker.js"></script>
|
||||
<script src="events.js"></script>
|
||||
<script src="issues.js"></script>
|
||||
</body>
|
||||
</html>
|
22
js/jquery-colorpicker/test/issues.js
vendored
Normal file
22
js/jquery-colorpicker/test/issues.js
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
module('issues');
|
||||
|
||||
test('#94: Clicking black swatch on empty input does not change input', function() {
|
||||
expect(4);
|
||||
|
||||
var $input = $('<input type="text" value=""/>').appendTo('#qunit-fixture');
|
||||
var jqcp = $input.colorpicker({
|
||||
parts: ['swatches']
|
||||
});
|
||||
|
||||
equal($input.val(), '', 'Starts empty');
|
||||
|
||||
jqcp.colorpicker('open');
|
||||
equal($input.val(), '', 'Still empty on open');
|
||||
|
||||
$('.ui-colorpicker-swatch[title="white"]').click();
|
||||
equal($input.val(), 'ffffff', 'Clicking white, input white');
|
||||
|
||||
$input.val('');
|
||||
$('.ui-colorpicker-swatch[title="black"]').click();
|
||||
equal($input.val(), '000000', 'Clicking black, input black (remains empty in issue #94).');
|
||||
});
|
Reference in New Issue
Block a user