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

[css-grid] Fix bug when grid-rows/columns are prefixed with wrong values #1149

Merged
merged 2 commits into from
Oct 24, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/hacks/grid-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,19 @@ function transformRepeat ({ nodes }, { gap }) {
count: []
})

// insert gap values
if (gap) {
size = size.filter(i => i.trim())
let val = []
for (let i = 1; i <= count; i++) {
if (gap && i > 1) {
val.push(gap)
}
val.push(size.join())
size.forEach((item, index) => {
if (index > 0 || i > 1) {
val.push(gap)
}
val.push(item)
})
}

return val.join(' ')
}

Expand Down
11 changes: 11 additions & 0 deletions test/cases/grid.css
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,14 @@
.place-self-b {
place-self: start end;
}

/* must have correct -ms-grid-rows/columns values */
.grid-correct-rows-columns {
display: grid;
grid-template-columns: 50px repeat(2, 1fr 2fr) 50px;
grid-template-rows: repeat(1, auto 100px);
grid-gap: 20px;
grid-template-areas:
". . . . . ."
". . . . . .";
}
11 changes: 11 additions & 0 deletions test/cases/grid.disabled.css
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,14 @@
.place-self-b {
place-self: start end;
}

/* must have correct -ms-grid-rows/columns values */
.grid-correct-rows-columns {
display: grid;
grid-template-columns: 50px repeat(2, 1fr 2fr) 50px;
grid-template-rows: repeat(1, auto 100px);
grid-gap: 20px;
grid-template-areas:
". . . . . ."
". . . . . .";
}
14 changes: 14 additions & 0 deletions test/cases/grid.out.css
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,17 @@
-ms-grid-column-align: end;
place-self: start end;
}

/* must have correct -ms-grid-rows/columns values */
.grid-correct-rows-columns {
display: -ms-grid;
display: grid;
-ms-grid-columns: 50px 20px 1fr 20px 2fr 20px 1fr 20px 2fr 20px 50px;
grid-template-columns: 50px repeat(2, 1fr 2fr) 50px;
-ms-grid-rows: auto 20px 100px;
grid-template-rows: repeat(1, auto 100px);
grid-gap: 20px;
grid-template-areas:
". . . . . ."
". . . . . .";
}