Skip to content

Commit

Permalink
feat(table): add test coverage for new elements
Browse files Browse the repository at this point in the history
  • Loading branch information
brentswisher committed Jan 28, 2025
1 parent 598b6d3 commit dd68264
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect } from 'chai';
import { fixture, html } from '@open-wc/testing';
import { PharosTableBody } from './pharos-table-body';

describe('PharosTableBody', () => {
let component: PharosTableBody;
beforeEach(async () => {
component = await fixture(html` <test-pharos-table-body></test-pharos-table-body> `);
});

it('should have the correct role attribute on the custom element', async () => {
expect(component.getAttribute('role')).to.equal('rowgroup');
});

it('should have the correct display style on the custom element', async () => {
const displayValue = window.getComputedStyle(component, null).getPropertyValue('display');
expect(displayValue).to.equal('table-row-group');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect } from 'chai';
import { fixture, html } from '@open-wc/testing';
import { PharosTableCell } from './pharos-table-cell';

describe('PharosTableCell', () => {
let component: PharosTableCell;
beforeEach(async () => {
component = await fixture(html` <test-pharos-table-cell></test-pharos-table-cell> `);
});

it('should have the correct role attribute on the custom element', async () => {
expect(component.getAttribute('role')).to.equal('cell');
});

it('should have the correct display style on the custom element', async () => {
const displayValue = window.getComputedStyle(component, null).getPropertyValue('display');
expect(displayValue).to.equal('table-cell');
});
});
19 changes: 19 additions & 0 deletions packages/pharos/src/components/table-row/pharos-table-row.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect } from 'chai';
import { fixture, html } from '@open-wc/testing';
import { PharosTableRow } from './pharos-table-row';

describe('PharosTableRow', () => {
let component: PharosTableRow;
beforeEach(async () => {
component = await fixture(html` <test-pharos-table-row></test-pharos-table-row> `);
});

it('should have the correct role attribute on the custom element', async () => {
expect(component.getAttribute('role')).to.equal('row');
});

it('should have the correct display style on the custom element', async () => {
const displayValue = window.getComputedStyle(component, null).getPropertyValue('display');
expect(displayValue).to.equal('table-row');
});
});

0 comments on commit dd68264

Please sign in to comment.