UNPKG

style-helper

Version:

Small helpers for working with CSS-in-JS

53 lines 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var index_1 = require("./index"); describe('style helper', function () { it('should quote a string', function () { expect(index_1.quote('testing')).toEqual('"testing"'); expect(index_1.quote('"')).toEqual('"\\""'); }); it('should handle urls', function () { expect(index_1.url('/path.png')).toEqual('url("/path.png")'); }); it('should turn styles into an object', function () { expect(index_1.objectify(['padding', 10])).toEqual({ padding: 10 }); }); it('should support objectifying keys as arrays', function () { var key = ['.a', '.b']; expect(index_1.objectify([key, { margin: 10 }])).toEqual({ '.a': { margin: 10 }, '.b': { margin: 10 } }); }); it('should merge css object together', function () { expect(index_1.merge({ margin: 5, padding: 10 }, { '@media print': { margin: 0, padding: 0 } }, { '@media print': { padding: 5 } })).toEqual({ margin: 5, padding: 10, '@media print': { margin: 0, padding: 5 } }); }); it('should support multi style objects', function () { expect(index_1.multi(['& .a', '& .b'], { margin: 10 })).toEqual({ '& .a': { margin: 10 }, '& .b': { margin: 10 } }); }); }); //# sourceMappingURL=index.spec.js.map