fonteva-design-guide
Version:
## Dev, Build and Test
48 lines (39 loc) • 1.6 kB
JavaScript
import { createElement } from 'lwc';
import TILE_TEST from 'c/pfmTest';
describe('c-pfm-tile', () => {
afterEach(() => {
// The jsdom instance is shared across test cases in a single file so reset the DOM
while (document.body.firstChild) {
document.body.removeChild(document.body.firstChild);
}
});
it('check tile theme', () => {
const element = createElement('c-pfm-tile', {
is: TILE_TEST
});
document.body.appendChild(element);
// Verify tile theme
const tile = element.shadowRoot.querySelectorAll('.pfm-test_tiles c-pfm-tile');
expect(tile[1].theme === 'shade').toBeTruthy();
});
it('check tile spacing`', () => {
const element = createElement('c-pfm-tile', {
is: TILE_TEST
});
document.body.appendChild(element);
// Verify tile spacing
const tile = element.shadowRoot.querySelectorAll('.pfm-test_tiles c-pfm-tile');
expect(tile[2].padding === 'pfm-p-around_large').toBeTruthy();
expect(tile[2].margin === 'pfm-m-top_large').toBeTruthy();
});
it('check tile footer`', () => {
const element = createElement('c-pfm-tile', {
is: TILE_TEST
});
document.body.appendChild(element);
// Verify tile footer
let tile = element.shadowRoot.querySelectorAll('.pfm-test_tiles c-pfm-tile');
let footer = tile[3].querySelector('span[slot="footer"]');
expect(footer).not.toBeNull();
});
});