Skip to content

Commit

Permalink
Adds ability for lost-row to keep gutter for lost-move
Browse files Browse the repository at this point in the history
  • Loading branch information
peterramsing committed Dec 2, 2016
1 parent 2af7306 commit d2240f5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/lost-move.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ module.exports = function lostMoveDecl(css, settings) {
}
});

decl.parent.nodes.forEach( (declaration) => {
if (declaration.prop === 'lost-row') {
let rowArray = declaration.value.split(' ');
if (rowArray[1]) {
lostMoveGutter = rowArray[1];
}
}
if (declaration.prop === 'lost-row-gutter') {
lostMoveGutter = declaration.value;
}
});

decl.parent.nodes.forEach(function lostMoveDirectionFunction(declaration) {
if (declaration.prop === 'lost-move-direction') {
lostMoveDirection = declaration.value;
Expand Down
12 changes: 12 additions & 0 deletions test/lost-move.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ describe('lost-move', function() {
`a:nth-child(3n + 1) { clear: both; }`
);
});

it('retains the lost-row gutter', () => {
check(
`a { lost-row: 1/3 50px; lost-move: -1/3 column; }`,
`a { width: 100%; height: calc(99.9% * 1/3 - (50px - 50px * 1/3)); margin-bottom: 50px; position: relative; top: calc(99.9% * -1/3 - (50px - 50px * -1/3) + 50px); }\n`+
`a:last-child { margin-bottom: 0; }`
);
check(
`a { lost-row: 1/3; lost-move: -1/3 column; lost-row-gutter: 50px; }`,
`a { width: 100%; height: calc(99.9% * 1/3 - (50px - 50px * 1/3)); margin-bottom: 50px; position: relative; top: calc(99.9% * -1/3 - (50px - 50px * -1/3) + 50px); }\n`+
`a:last-child { margin-bottom: 0; }`
);
});

it('supports custom gutter', function() {
Expand Down

0 comments on commit d2240f5

Please sign in to comment.