Skip to content

Commit

Permalink
Should not throw error when a border property value is undefined (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjansson committed Oct 18, 2018
1 parent ca671f2 commit 6545a96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/postcss-merge-longhand/src/__tests__/borders.js
Expand Up @@ -533,3 +533,10 @@ test(
passthroughCSS,
'h1{border-color:red green blue magenta;border-top-color:var(--color-var)}',
);

test(
'Should not throw error when a border property value is undefined (#639)',
processCSS,
'h1{border:2px solid #fff;border-color:inherit}',
'h1{border:2px solid;border-color:inherit}',
);
2 changes: 1 addition & 1 deletion packages/postcss-merge-longhand/src/lib/decl/borders.js
Expand Up @@ -50,7 +50,7 @@ function getLevel (prop) {
}
}

const isValueCustomProp = value => !!~value.search(/var\s*\(\s*--/i);
const isValueCustomProp = value => value && !!~value.search(/var\s*\(\s*--/i);

function canMergeValues (values) {
return !values.some(isValueCustomProp) || values.every(isValueCustomProp);
Expand Down

0 comments on commit 6545a96

Please sign in to comment.