-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QUnit-based tests for the fixed bugs.
- Loading branch information
Martijn
authored and
Martijn
committed
May 13, 2013
1 parent
466c261
commit 3143bde
Showing
3 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/>').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'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!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> | ||
</body> | ||
</html> |