Adds test case for rgba percentages with decimals

This commit is contained in:
Anders Lisspers 2014-02-27 10:19:42 +01:00
parent 11a21f10ee
commit f5ba67541e

View file

@ -204,6 +204,17 @@
equal(oColor.getAlpha(), 0.5, 'alpha should be set properly');
});
test('fromRgba (percentage values with decimals)', function() {
var originalRgba = 'rgba( 100.00%, 100.00%, 100.00% , 0.5 )';
oColor = fabric.Color.fromRgba(originalRgba);
ok(oColor);
ok(oColor instanceof fabric.Color);
equal(oColor.toRgba(), 'rgba(255,255,255,0.5)');
equal(oColor.toHex(), 'FFFFFF');
equal(oColor.getAlpha(), 0.5, 'alpha should be set properly');
});
test('fromHsl', function() {
ok(typeof fabric.Color.fromHsl == 'function');
var originalHsl = 'hsl(262,80%,12%)';