@platform/css
Version:
Helpers for working with inline CSS.
44 lines (43 loc) • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var chai_1 = require("chai");
var _1 = require(".");
describe('color', function () {
describe('color.format()', function () {
var test = function (value, output) {
(0, chai_1.expect)(_1.color.format(value)).to.eql(output);
};
it('converts number to RGBA', function () {
test(0, 'rgba(0, 0, 0, 0.0)');
test(1, 'rgba(255, 255, 255, 1)');
test(0.5, 'rgba(255, 255, 255, 0.5)');
test(-1, 'rgba(0, 0, 0, 1)');
test(-0.5, 'rgba(0, 0, 0, 0.5)');
});
it('converts TRUE to RED (ruby)', function () {
test(true, _1.color.RED);
});
it('undefined', function () {
test(undefined, undefined);
});
it('string: RGB value', function () {
var rgb = 'rgb(0, 245, 35)';
test(rgb, rgb);
});
it('string: RGBA value', function () {
var rgb = 'rgba(0, 245, 35, 0.7)';
test(rgb, rgb);
});
it('string: hex value', function () {
var hex = '#fff';
test(hex, hex);
});
it('string: hex value with no hash', function () {
test('fff', '#fff');
});
it('string: does not convert "url(...)"', function () {
var value = "url(my-image.png)";
test(value, value);
});
});
});