mirror of
https://github.com/pebble-dev/clay.git
synced 2026-09-03 23:57:43 -04:00
add sunlight colors to color picker and tests
This commit is contained in:
@@ -9,17 +9,21 @@ describe('manipulators', function() {
|
||||
/**
|
||||
* @param {string} itemType
|
||||
* @param {*} value
|
||||
* @param {*} expected
|
||||
* @return {void}
|
||||
*/
|
||||
function testSetGet(itemType, value) {
|
||||
function testSetGet(itemType, value, expected) {
|
||||
expected = typeof expected === 'undefined' ? value : expected;
|
||||
|
||||
describe('.set() and .get()', function() {
|
||||
it('sets and gets the value then triggers a "change" event', function() {
|
||||
it('sets: "' + value + '" and gets: "' + expected + '" then triggers "change"',
|
||||
function() {
|
||||
var handlerSpy = sinon.spy();
|
||||
var clayItem = fixture.clayItem(itemType);
|
||||
clayItem.on('change', handlerSpy);
|
||||
|
||||
clayItem.set(value);
|
||||
assert.strictEqual(clayItem.get(), value);
|
||||
assert.strictEqual(clayItem.get(), expected);
|
||||
assert.strictEqual(handlerSpy.callCount, 1, 'handler not called once');
|
||||
assert(handlerSpy.calledOn(clayItem), 'handler not called on clayItem');
|
||||
});
|
||||
@@ -80,4 +84,17 @@ describe('manipulators', function() {
|
||||
testDisable('toggle');
|
||||
testEnable('toggle');
|
||||
});
|
||||
|
||||
describe('color', function() {
|
||||
testSetGet('color', 'FF0000', 0xff0000);
|
||||
testSetGet('color', '#FF0000', 0xff0000);
|
||||
testSetGet('color', '0xFF0000', 0xff0000);
|
||||
testSetGet('color', '#ff0000', 0xff0000);
|
||||
testSetGet('color', 0xff0000, 0xff0000);
|
||||
testSetGet('color', '', 0x000000);
|
||||
testSetGet('color', false, 0x000000);
|
||||
testSetGet('color', undefined, 0x000000);
|
||||
testDisable('color');
|
||||
testEnable('color');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user