Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Body cell won't overflow if consumer has given width #13

Merged
merged 2 commits into from
Nov 14, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class GridTestComponent {
}),
new ListItemModel('7', {
column1: '21',
column2: 'Grape',
column2: 'Some long text that would provoke an overflow of monster proportions!',
column3: 21,
column4: moment().add(7, 'minute')
})
Expand Down
4 changes: 3 additions & 1 deletion src/app/public/modules/grid/grid.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@
[fieldSelector]="column.field"
[item]="item"
[columnId]="column.id"
[attr.sky-cmp-id]="column.id || column.field">
[attr.sky-cmp-id]="column.id || column.field"
[style.max-width.px]="column.width"
[style.width.px]="column.width">
</sky-grid-cell>
</td>
</tr>
Expand Down
14 changes: 14 additions & 0 deletions src/app/public/modules/grid/grid.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ describe('Grid Component', () => {
}
}
}

function verifyConsumerColumnWidthsAreMaintained() {
for (let i = 0; i < component.grid.displayedColumns.length; i ++) {
let col = component.grid.displayedColumns[i];
if (col.width) {
let colEl = element.queryAll(By.css('thead th'))[i];
verifyWidthsMatch(colEl.nativeElement.offsetWidth, col.width);
}
}
}
//#endregion

describe('standard setup', () => {
Expand Down Expand Up @@ -411,6 +421,10 @@ describe('Grid Component', () => {
}
});

it('should maintain column width when provided by consumer', () => {
verifyConsumerColumnWidthsAreMaintained();
});

it('should pass accessibility', async(() => {
fixture.detectChanges();
fixture.whenStable().then(() => {
Expand Down