Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
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
12 changes: 6 additions & 6 deletions src/lib/flex/layout-gap/layout-gap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ describe('layout-gap directive', () => {
verifyCorrectMargin('column', 'margin-bottom');
});

it('should apply margin-right for row-reverse layouts', () => {
verifyCorrectMargin('row-reverse', 'margin-right');
it('should apply margin-left for row-reverse layouts', () => {
verifyCorrectMargin('row-reverse', 'margin-left');
});

it('should apply margin-bottom for column-reverse layouts', () => {
verifyCorrectMargin('column-reverse', 'margin-bottom');
it('should apply margin-top for column-reverse layouts', () => {
verifyCorrectMargin('column-reverse', 'margin-top');
});

it('should remove obsolete margin and apply valid margin for layout changes', () => {
Expand Down Expand Up @@ -241,7 +241,7 @@ describe('layout-gap directive', () => {
nodes = queryFor(fixture, 'span');

expectEl(nodes[0]).not.toHaveStyle({'margin-right': '8px'}, styler);
expectEl(nodes[0]).toHaveStyle({'margin-bottom': '8px'}, styler);
expectEl(nodes[0]).toHaveStyle({'margin-top': '8px'}, styler);


// layout = row-reverse, use margin-right
Expand All @@ -250,7 +250,7 @@ describe('layout-gap directive', () => {
nodes = queryFor(fixture, 'span');

expectEl(nodes[0]).not.toHaveStyle({'margin-bottom': '8px'}, styler);
expectEl(nodes[0]).toHaveStyle({'margin-right': '8px'}, styler);
expectEl(nodes[0]).toHaveStyle({'margin-left': '8px'}, styler);
});

it('should recognize hidden elements when applying gaps', () => {
Expand Down
10 changes: 8 additions & 2 deletions src/lib/flex/layout-gap/layout-gap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,17 @@ export class LayoutGapDirective extends BaseFxDirective

switch (this._layout) {
case 'column':
case 'column-reverse':
key = 'margin-bottom';
break;
case 'row' :
case 'column-reverse':
key = 'margin-top';
break;
case 'row':
key = this._directionality.value === 'rtl' ? 'margin-left' : 'margin-right';
break;
case 'row-reverse':
key = this._directionality.value === 'rtl' ? 'margin-right' : 'margin-left';
break;
default :
key = this._directionality.value === 'rtl' ? 'margin-left' : 'margin-right';
break;
Expand Down