Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The default value of flex-basis is 0% #22

Merged
merged 1 commit into from
Sep 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bugs/bug4.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ module.exports = function(decl) {
}
var values = postcss.list.space(decl.value);
var flexGrow = values[0];
var flexShrink = values[1];
var flexBasis = values[2] || 'auto';
decl.value = flexGrow + ' ' + (flexShrink || '1') + ' ' + properBasis(flexBasis);
var flexShrink = values[1] || '1';
var flexBasis = values[2] || '0%';
decl.value = flexGrow + ' ' + flexShrink + ' ' + properBasis(flexBasis);
}
};
7 changes: 7 additions & 0 deletions bugs/bug6.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
var postcss = require('postcss');

module.exports = function(decl) {
if (decl.prop === 'flex') {
if(decl.value === 'none'){
return;
}
var values = postcss.list.space(decl.value);
var flexGrow = values[0];
var flexShrink = values[1] || '1';
var flexBasis = values[2] || '0%';
decl.value = flexGrow + ' ' + flexShrink + ' ' + flexBasis;
}
};
8 changes: 4 additions & 4 deletions specs/bug4Spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
var test = require('./test');

describe('bug 4', function() {
it('set auto for default flex-basis and 1 for flex-shrink in flex shorthand', function(done) {
it('set 0% for default flex-basis and 1 for flex-shrink in flex shorthand', function(done) {
var input = 'div{flex: 1;}';
var output = 'div{flex: 1 1 auto;}';
var output = 'div{flex: 1 1 0%;}';
test(input, output, {}, done);
});
it('set auto for default flex-basis when not specified', function(done) {
it('set 0% for default flex-basis when not specified', function(done) {
var input = 'div{flex: 1 1;}';
var output = 'div{flex: 1 1 auto;}';
var output = 'div{flex: 1 1 0%;}';
test(input, output, {}, done);
});
it('set flex-basis === 0% for flex-basis with plain 0', function(done) {
Expand Down
2 changes: 1 addition & 1 deletion specs/bug6Spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var test = require('./test');
describe('bug 6', function() {
it('Set flex-shrink to 1 by default', function(done) {
var input = 'div{flex: 1;}';
var output = 'div{flex: 1 1 auto;}';
var output = 'div{flex: 1 1 0%;}';
test(input, output, {}, done);
});
describe('does nothing', function() {
Expand Down
4 changes: 2 additions & 2 deletions specs/bug81aSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ describe('bug 8.1.a', function() {
describe('does nothing', function() {
it('when using only first value', function(done) {
var input = 'a{flex: 0}';
var output = 'a{flex: 0 1 auto}';
var output = 'a{flex: 0 1 0%}';
test(input, output, {}, done);
});
it('when using only first and second values', function(done) {
var input = 'a{flex: 0 0}';
var output = 'a{flex: 0 0 auto}';
var output = 'a{flex: 0 0 0%}';
test(input, output, {}, done);
});
it('when not using calc', function(done) {
Expand Down