mirror of
https://github.com/konvajs/konva.git
synced 2025-11-24 08:46:44 +08:00
fix: 🐛 hex color string supports four/eight-value syntax
This commit is contained in:
@@ -76,6 +76,43 @@ describe('Util', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('colorToRGBA() - from hex color string with percentage to RGBA conversion!', function () {
|
||||
assert.deepEqual(Konva.Util.colorToRGBA('#F00'), {
|
||||
r: 255,
|
||||
g: 0,
|
||||
b: 0,
|
||||
a: 1,
|
||||
});
|
||||
|
||||
assert.deepEqual(Konva.Util.colorToRGBA('#F00F'), {
|
||||
r: 255,
|
||||
g: 0,
|
||||
b: 0,
|
||||
a: 1,
|
||||
});
|
||||
|
||||
assert.deepEqual(Konva.Util.colorToRGBA('#F00C'), {
|
||||
r: 255,
|
||||
g: 0,
|
||||
b: 0,
|
||||
a: 0.8,
|
||||
});
|
||||
|
||||
assert.deepEqual(Konva.Util.colorToRGBA('#FF0000FF'), {
|
||||
r: 255,
|
||||
g: 0,
|
||||
b: 0,
|
||||
a: 1,
|
||||
});
|
||||
|
||||
assert.deepEqual(Konva.Util.colorToRGBA('#FF0000CC'), {
|
||||
r: 255,
|
||||
g: 0,
|
||||
b: 0,
|
||||
a: 0.8,
|
||||
});
|
||||
});
|
||||
|
||||
it('make sure Transform is exported', () => {
|
||||
assert.equal(!!Konva.Transform, true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user