Skip to content

Commit

Permalink
fix calc regex (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisrudge committed Apr 27, 2020
1 parent 85f7d29 commit 5eb09c7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
## 4.2.1
* Fix `calc` regex [#69](https://github.com/luisrudge/postcss-flexbugs-fixes/pull/69)

## 4.2.0
* Don't change values that reference custom props [#64](https://github.com/luisrudge/postcss-flexbugs-fixes/pull/64)

Expand Down
2 changes: 1 addition & 1 deletion bugs/bug81a.js
@@ -1,7 +1,7 @@
var postcss = require('postcss');

module.exports = function(decl) {
var regex = /(\d{1,}) (\d{1,}) (calc\(.*?\))/g;
var regex = /(\d{1,}) (\d{1,}) (calc\(.*\))/g;
var matches = regex.exec(decl.value);
if (decl.prop === 'flex' && matches) {
var grow = postcss.decl({
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "postcss-flexbugs-fixes",
"version": "4.2.0",
"version": "4.2.1",
"description": "PostCSS plugin This project tries to fix all of flexbug's issues",
"keywords": [
"postcss",
Expand Down
9 changes: 9 additions & 0 deletions specs/regressiveSpecs.js
@@ -0,0 +1,9 @@
var test = require('./test');

describe('regressive tests', function () {
it('https://github.com/luisrudge/postcss-flexbugs-fixes/issues/68', function (done) {
var input = 'div{flex: 1 0 calc(30% - (30px / 3));}';
var output = 'div{flex-grow: 1;flex-shrink: 0;flex-basis: calc(30% - (30px / 3));}';
test(input, output, {}, done);
});
});

0 comments on commit 5eb09c7

Please sign in to comment.