Skip to content

Commit

Permalink
Merge pull request #453 from ThornWalli/feature/fix-postcss-pugin-opt…
Browse files Browse the repository at this point in the history
…ions

fix(plugin): fix options assignment
  • Loading branch information
peterramsing committed Jun 30, 2022
2 parents f2f252a + 4c90470 commit 3853637
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lost.js
Expand Up @@ -47,7 +47,7 @@ module.exports = (settings = {}) => {
return {
postcssPlugin: 'lost',
prepare() {
let runSettings = assign({}, defaultSettings, settings | {});
let runSettings = assign({}, defaultSettings, settings || {});
return {
AtRule(atRule) {
lostAtRule(atRule, runSettings);
Expand Down
44 changes: 44 additions & 0 deletions test/lost-plugin-options.js
@@ -0,0 +1,44 @@
'use strict';

const postcss = require('postcss');
const lost = require('../lost');
const expect = require('chai').expect;

describe('plugin-options', () => {
it('set options with plugin options', async () => {
const input = `
div {
lost-column: 1/2;
}
`;
const output = `
div {
flex-grow: 0;
flex-shrink: 0;
flex-basis: calc(99.9% * 1/2 - (15px - 15px * 1/2));
max-width: calc(99.9% * 1/2 - (15px - 15px * 1/2));
width: calc(99.9% * 1/2 - (15px - 15px * 1/2));
}
div:nth-child(1n) {
margin-right: 15px;
margin-left: 0;
}
div:last-child {
margin-right: 0;
}
div:nth-child(2n) {
margin-right: 0;
margin-left: auto;
}
`;
const result = await postcss([
lost({
gutter: '15px',
flexbox: 'flex',
cycle: 'auto'
})
])
.process(input);
expect(result.css).to.equal(output);
});
});

0 comments on commit 3853637

Please sign in to comment.