Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
Update postcss
Browse files Browse the repository at this point in the history
  • Loading branch information
madyankin committed May 20, 2017
1 parent 1dbcba3 commit 6898bd1
Show file tree
Hide file tree
Showing 15 changed files with 172 additions and 115 deletions.
9 changes: 4 additions & 5 deletions package.json
Expand Up @@ -17,21 +17,20 @@
"url": "https://github.com/outpunk/postcss-each.git"
},
"dependencies": {
"postcss": "^5.0.21",
"postcss-simple-vars": "^2.0.0"
"postcss": "^6.0.1",
"postcss-simple-vars": "^4.0.0"
},
"devDependencies": {
"babel": "^6.5.2",
"babel-cli": "^6.9.0",
"babel-core": "^6.9.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-es2015": "^6.9.0",
"jscs": "^3.0.3",
"mocha": "^2.5.3"
"jscs": "^3.0.3"
},
"scripts": {
"pretest": "jscs index.js test",
"test": "mocha --compilers js:babel-core/register",
"test": "jest",
"transpile": "babel index.js > index.es5.js",
"prepublish": "npm run transpile",
"postpublish": "rm *.es5.js && git push --follow-tags"
Expand Down
165 changes: 165 additions & 0 deletions test/__snapshots__/test.js.snap
@@ -0,0 +1,165 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`postcss-each doesn't replace other variables 1`] = `
"
.icon-foo, .foo {
background: url(\\"$(bg).png\\");
}
.icon-bar, .bar {
background: url(\\"$(bg).png\\");
}
"
`;

exports[`postcss-each iterates and assigns multiple values 1`] = `
"
.icon-a-x-0 {
background: url(\\"a.png\\");
color: x;
}
.icon-b-y-1 {
background: url(\\"b.png\\");
color: y;
}
.icon-c-z-2 {
background: url(\\"c.png\\");
color: z;
}
"
`;

exports[`postcss-each iterates short names 1`] = `
"
.icon-foo {
background: url(\\"foo.png\\");
}
"
`;

exports[`postcss-each iterates through given values 1`] = `
"
.icon-foo {
background: url(\\"foo.png\\");
}
.icon-bar {
background: url(\\"bar.png\\");
}
"
`;

exports[`postcss-each iterates through one value 1`] = `
"
.icon-foo {
background: url(\\"foo.png\\");
}
"
`;

exports[`postcss-each iterates value and index 1`] = `
"
.icon-foo {
background: url(\\"foo_0.png\\");
}
.icon-bar {
background: url(\\"bar_1.png\\");
}
"
`;

exports[`postcss-each performs nested iteration 1`] = `
"
.icon-foo {
border: abc;
border: xyz
}
.icon-bar {
border: abc;
border: xyz
}
.a {
hello: a;
}
.a-x {
color: purple;
blah: u;
blah: v
}
.a-y {
color: purple;
blah: u;
blah: v
}
.b {
hello: b;
}
.b-x {
color: purple;
blah: u;
blah: v
}
.b-y {
color: purple;
blah: u;
blah: v
}
"
`;

exports[`postcss-each performs nested iteration with parent's variables 1`] = `
"
.icon-foo {
border: foo-abc;
border: xyz
}
.icon-bar {
border: bar-abc;
border: xyz
}
"
`;

exports[`postcss-each respects multiline expressions 1`] = `
"
.foo {
background: url(\\"foo.png\\")
}
.bar {
background: url(\\"bar.png\\")
}
"
`;

exports[`postcss-each respects multiple properties 1`] = `
"
.icon-foo {
background: url(\\"foo.png\\");
content: \\"foo\\";
}
.icon-bar {
background: url(\\"bar.png\\");
content: \\"bar\\";
}
"
`;

exports[`postcss-each respects multiple selectors 1`] = `
"
.icon-foo, .foo {
background: url(\\"foo.png\\");
}
.icon-bar, .bar {
background: url(\\"bar.png\\");
}
"
`;

exports[`postcss-each respects properties with \`in\` substring 1`] = `
"
.print {
background: url(\\"print.png\\");
}
.bar {
background: url(\\"bar.png\\");
}
"
`;
6 changes: 0 additions & 6 deletions test/cases/multiline-expressions.expected.css

This file was deleted.

12 changes: 0 additions & 12 deletions test/cases/multiple-assignment.expected.css

This file was deleted.

8 changes: 0 additions & 8 deletions test/cases/multiple-properties.expected.css

This file was deleted.

6 changes: 0 additions & 6 deletions test/cases/multiple-selectors.expected.css

This file was deleted.

6 changes: 0 additions & 6 deletions test/cases/multiple-values.expected.css

This file was deleted.

8 changes: 0 additions & 8 deletions test/cases/nested-iteration-parent-vars.expected.css

This file was deleted.

34 changes: 0 additions & 34 deletions test/cases/nested-iteration.expected.css

This file was deleted.

3 changes: 0 additions & 3 deletions test/cases/one-value.expected.css

This file was deleted.

6 changes: 0 additions & 6 deletions test/cases/other-variables.expected.css

This file was deleted.

3 changes: 0 additions & 3 deletions test/cases/short-names.expected.css

This file was deleted.

6 changes: 0 additions & 6 deletions test/cases/value-with-index.expected.css

This file was deleted.

6 changes: 0 additions & 6 deletions test/cases/with-in-substring.expected.css

This file was deleted.

9 changes: 3 additions & 6 deletions test/test.js
Expand Up @@ -21,9 +21,9 @@ const cases = {
'nested-iteration-parent-vars': 'performs nested iteration with parent\'s variables',
};

function test(input, expected, opts, done) {
function test(input, opts, done) {
const result = postcss([plugin(opts)]).process(input);
assert.equal(result.css, expected);
expect(result.css).toMatchSnapshot();
};

function css(name) {
Expand All @@ -44,9 +44,6 @@ describe('postcss-each', () => {

for (let caseName in cases) {
const description = cases[caseName];

it(description, () => {
test(css(caseName), css(caseName + '.expected'));
});
it(description, () => test(css(caseName)));
}
});

0 comments on commit 6898bd1

Please sign in to comment.