Skip to content
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
15 changes: 15 additions & 0 deletions modules/__tests__/createPrefixer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,21 @@ describe('Static Prefixer', () => {
}
expect(prefix(input)).toEqual(output)
})

it('should expand the shorthand gridRow without a slash', () => {
const input = { gridRow: 'span 3' }
const output = {
gridRow: 'span 3',
}
expect(prefix(input)).toEqual(output)
})
it('should expand the shorthand gridColumn without a slash', () => {
const input = { gridColumn: 'span 3' }
const output = {
gridColumn: 'span 3',
}
expect(prefix(input)).toEqual(output)
})
})
})
})
Expand Down
12 changes: 10 additions & 2 deletions modules/plugins/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ function isSimplePositionValue(value: any) {
return typeof value === 'number' && !isNaN(value)
}

function isComplexSpanValue(value: string) {
return typeof value === 'string' && value.includes('/')
}

const alignmentValues = ['center', 'end', 'start', 'stretch']

const displayValues = {
Expand All @@ -21,7 +25,7 @@ const propertyConverters = {
gridColumn: (value: any, style: Object) => {
if (isSimplePositionValue(value)) {
style.msGridColumn = value
} else {
} else if (isComplexSpanValue(value)) {
const [start, end] = value.split('/')
propertyConverters.gridColumnStart(+start, style)

Expand All @@ -31,6 +35,8 @@ const propertyConverters = {
} else {
propertyConverters.gridColumnEnd(+end, style)
}
} else {
propertyConverters.gridColumnStart(value, style)
}
},

Expand All @@ -50,7 +56,7 @@ const propertyConverters = {
gridRow: (value: any, style: Object) => {
if (isSimplePositionValue(value)) {
style.msGridRow = value
} else {
} else if (isComplexSpanValue(value)) {
const [start, end] = value.split('/')
propertyConverters.gridRowStart(+start, style)

Expand All @@ -60,6 +66,8 @@ const propertyConverters = {
} else {
propertyConverters.gridRowEnd(+end, style)
}
} else {
propertyConverters.gridRowStart(value, style)
}
},

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@
"prettier": "^1.14.2",
"rimraf": "^2.6.2"
}
}
}