Skip to content

Commit

Permalink
[Grid] Restore spacing 0 value and update test
Browse files Browse the repository at this point in the history
  • Loading branch information
ifndefdeadmau5 committed Jan 6, 2019
1 parent d9e0598 commit 9305f32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions packages/material-ui/src/Grid/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import withStyles from '../styles/withStyles';
import { keys as breakpointKeys } from '../styles/createBreakpoints';
import requirePropFactory from '../utils/requirePropFactory';

const GUTTERS = [1, 2, 3, 4, 5, 6, 7, 8];
const GUTTERS = [0, 1, 2, 3, 4, 5, 6, 7, 8];
const GRID_SIZES = ['auto', true, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];

function generateGrid(globalStyles, theme, breakpoint) {
Expand Down Expand Up @@ -68,7 +68,12 @@ function generateGrid(globalStyles, theme, breakpoint) {
function generateGutter(theme, breakpoint) {
const styles = {};

GUTTERS.forEach(spacing => {
GUTTERS.forEach((spacing, index) => {
if (index === 0) {
// Skip the default style.
return;
}

const themeSpacing = spacing * theme.spacing.unit;

styles[`spacing-${breakpoint}-${spacing}`] = {
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Grid/Grid.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('<Grid />', () => {
describe('prop: spacing', () => {
it('should have a spacing', () => {
const wrapper = shallow(<Grid container spacing={1} />);
assert.strictEqual(wrapper.hasClass(classes['spacing-xs-8']), true);
assert.strictEqual(wrapper.hasClass(classes['spacing-xs-1']), true);
});
});

Expand Down

0 comments on commit 9305f32

Please sign in to comment.