@tdb/util
Version:
Shared helpers and utilities.
106 lines • 3.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var chai_1 = require("chai");
var __1 = require("..");
describe('css.arrayToEdges', function () {
it('undefined => undefined', function () {
chai_1.expect(__1.css.arrayToEdges(undefined)).to.eql(undefined);
});
it('null => undefined', function () {
chai_1.expect(__1.css.arrayToEdges(null)).to.eql(undefined);
});
it('[] => undefined', function () {
chai_1.expect(__1.css.arrayToEdges([])).to.eql(undefined);
});
it('"" => undefined', function () {
chai_1.expect(__1.css.arrayToEdges('')).to.eql(undefined);
chai_1.expect(__1.css.arrayToEdges(' ')).to.eql(undefined);
});
it('[null, null, null, null] => undefined', function () {
chai_1.expect(__1.css.arrayToEdges([null, null, null, null])).to.eql(undefined);
});
it('[null, null] => undefined', function () {
chai_1.expect(__1.css.arrayToEdges([null, null])).to.eql(undefined);
});
it('"0 10px 6em 9%"', function () {
chai_1.expect(__1.css.arrayToEdges('0 10px 6em 9%')).to.eql({
top: 0,
right: 10,
bottom: '6em',
left: '9%',
});
});
it('"20px 5em"', function () {
chai_1.expect(__1.css.arrayToEdges('20px 5em')).to.eql({
top: 20,
right: '5em',
bottom: 20,
left: '5em',
});
});
it('10', function () {
chai_1.expect(__1.css.arrayToEdges(10)).to.eql({
top: 10,
right: 10,
bottom: 10,
left: 10,
});
});
it('"10px"', function () {
chai_1.expect(__1.css.arrayToEdges('10px')).to.eql({
top: 10,
right: 10,
bottom: 10,
left: 10,
});
});
it('"5em"', function () {
chai_1.expect(__1.css.arrayToEdges('5em')).to.eql({
top: '5em',
right: '5em',
bottom: '5em',
left: '5em',
});
});
it('[10, 20, 30, 40]', function () {
chai_1.expect(__1.css.arrayToEdges([10, 20, 30, 40])).to.eql({
top: 10,
right: 20,
bottom: 30,
left: 40,
});
});
it('[10, null, "30%", "40px"]', function () {
chai_1.expect(__1.css.arrayToEdges([10, null, '30%', '40px'])).to.eql({
top: 10,
right: undefined,
bottom: '30%',
left: 40,
});
});
it('[10, 20]', function () {
chai_1.expect(__1.css.arrayToEdges([10, 20])).to.eql({
top: 10,
right: 20,
bottom: 10,
left: 20,
});
});
it('[null, 20]', function () {
chai_1.expect(__1.css.arrayToEdges([null, 20])).to.eql({
top: undefined,
right: 20,
bottom: undefined,
left: 20,
});
});
it('[10, null]', function () {
chai_1.expect(__1.css.arrayToEdges([10, null])).to.eql({
top: 10,
right: undefined,
bottom: 10,
left: undefined,
});
});
});
//# sourceMappingURL=util.test.js.map