Skip to content

Commit

Permalink
Merge branch 'main' into VIV-1562-expanded-button-style
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardHelm authored Mar 4, 2024
2 parents 8fd6481 + 83a685b commit 8a2c7e2
Show file tree
Hide file tree
Showing 4 changed files with 825 additions and 2,491 deletions.
3 changes: 2 additions & 1 deletion libs/components/src/lib/data-grid/data-grid-cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class DataGridCell extends FoundationDataGridCell {
/**
* @internal
*/
_handleInteraction() {
_handleInteraction(): boolean {
const isHeaderCell = this.cellType === 'columnheader';
const isSortable = isHeaderCell && this.ariaSort !== null;

Expand All @@ -99,6 +99,7 @@ export class DataGridCell extends FoundationDataGridCell {
columnDataKey: this.#getColumnDataKey(),
});
}
return true;
}
}

Expand Down
43 changes: 43 additions & 0 deletions libs/components/src/lib/data-grid/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,52 @@ async function testSortColumns({ page }: { page: Page }) {
);
}

async function testCellLinkClick({ page }: { page: Page }) {
const template = `<div style="margin: 5px;">
<vwc-data-grid>
<vwc-data-grid-row role="row" class="header" row-type="header">
<vwc-data-grid-cell aria-sort="ascending" cell-type="columnheader" role="columnheader">
data1
</vwc-data-grid-cell>
<vwc-data-grid-cell aria-sort="none" cell-type="columnheader">
data2
</vwc-data-grid-cell>
<vwc-data-grid-cell aria-sort="descending" cell-type="columnheader">
data3
</vwc-data-grid-cell>
</vwc-data-grid-row>
<vwc-data-grid-row role="row">
<vwc-data-grid-cell role="gridcell" cell-type="default">
<a href="https://google.com">Link</a>
</vwc-data-grid-cell>
data11
</vwc-data-grid-cell>
</vwc-data-grid-row>
</vwc-data-grid>
</div>`;

await loadComponents({
page,
components,
});
await loadTemplate({
page,
template,
});

await page.waitForLoadState('networkidle');

const link = await page.locator('vwc-data-grid-cell a');
await link.isVisible();
await link.click();
await page.pause();
expect(await page.url()).toEqual('https://www.google.com/');
}

test('should show the component', gridTestFunction);
test('single cell selection', testCellSelection);
test('multi cell selection', testMultiCellSelection);
test('single row selection', testRowSelection);
test('multi row selection', testMultiRowSelection);
test('sort columns', testSortColumns);
test('cell link click', testCellLinkClick);
Loading

0 comments on commit 8a2c7e2

Please sign in to comment.