@scania/tegel 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tds-dropdown.cjs.entry.js +17 -13
- package/dist/cjs/tds-header-cell.cjs.entry.js +2 -2
- package/dist/cjs/tds-icon.cjs.entry.js +3 -2
- package/dist/cjs/tds-modal.cjs.entry.js +1 -1
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/components/dropdown/dropdown.css +1 -0
- package/dist/collection/components/dropdown/dropdown.js +16 -12
- package/dist/collection/components/icon/icon.js +23 -5
- package/dist/collection/components/modal/modal.css +1 -1
- package/dist/collection/components/table/table-header-cell/table-header-cell.js +13 -10
- package/dist/components/icon.js +4 -2
- package/dist/components/tds-dropdown.js +17 -13
- package/dist/components/tds-header-cell.js +2 -2
- package/dist/components/tds-modal.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-dropdown.entry.js +17 -13
- package/dist/esm/tds-header-cell.entry.js +2 -2
- package/dist/esm/tds-icon.entry.js +3 -2
- package/dist/esm/tds-modal.entry.js +1 -1
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/p-15f8ac46.entry.js +1 -0
- package/dist/tegel/p-3b597a64.entry.js +1 -0
- package/dist/tegel/{p-6dc8f2dd.entry.js → p-78853c02.entry.js} +1 -1
- package/dist/tegel/p-7d93c35b.entry.js +1 -0
- package/dist/tegel/tegel.esm.js +1 -1
- package/dist/types/components/dropdown/dropdown.d.ts +2 -0
- package/dist/types/components/icon/icon.d.ts +6 -3
- package/dist/types/components/table/table-header-cell/table-header-cell.d.ts +14 -8
- package/dist/types/components.d.ts +20 -12
- package/package.json +1 -1
- package/dist/collection/components/accordion/accordion.stories.js +0 -100
- package/dist/collection/components/accordion/test/basic/accordion.e2e.js +0 -19
- package/dist/collection/components/accordion/test/disabled/accordion.e2e.js +0 -19
- package/dist/collection/components/accordion/test/expanded/accordion.e2e.js +0 -24
- package/dist/collection/components/accordion/test/padding-reset/accordion.e2e.js +0 -24
- package/dist/collection/components/badge/badge.stories.js +0 -106
- package/dist/collection/components/badge/test/basic/badge.e2e.js +0 -10
- package/dist/collection/components/badge/test/value/badge.e2e.js +0 -11
- package/dist/collection/components/banner/banner.stories.js +0 -92
- package/dist/collection/components/banner/test/basic/banner.e2e.js +0 -15
- package/dist/collection/components/banner/test/default/banner.e2e.js +0 -37
- package/dist/collection/components/banner/test/error/banner.e2e.js +0 -15
- package/dist/collection/components/banner/test/information/banner.e2e.js +0 -15
- package/dist/collection/components/block/block.stories.js +0 -49
- package/dist/collection/components/breadcrumbs/breadcrumbs.stories.js +0 -36
- package/dist/collection/components/breadcrumbs/test/default/breadcrumbs.e2e.js +0 -33
- package/dist/collection/components/button/button.stories.js +0 -185
- package/dist/collection/components/button/test/basic/button.e2e.js +0 -35
- package/dist/collection/components/button/test/danger/button.e2e.js +0 -18
- package/dist/collection/components/button/test/disabled/button.e2e.js +0 -24
- package/dist/collection/components/button/test/ghost/button.e2e.js +0 -18
- package/dist/collection/components/button/test/icon/button.e2e.js +0 -38
- package/dist/collection/components/button/test/secondary/button.e2e.js +0 -18
- package/dist/collection/components/card/card.stories.js +0 -163
- package/dist/collection/components/card/test/basic/card.e2e.js +0 -10
- package/dist/collection/components/card/test/clickable/card.e2e.js +0 -21
- package/dist/collection/components/card/test/default/card.e2e.js +0 -33
- package/dist/collection/components/checkbox/checkbox.stories.js +0 -93
- package/dist/collection/components/chip/chip.stories.js +0 -230
- package/dist/collection/components/datetime/datetime.stories.js +0 -219
- package/dist/collection/components/divider/divider.stories.js +0 -62
- package/dist/collection/components/dropdown/dropdown.stories.js +0 -260
- package/dist/collection/components/dropdown/test/basic/dropdown.e2e.js +0 -41
- package/dist/collection/components/dropdown/test/default/dropdown.e2e.js +0 -76
- package/dist/collection/components/dropdown/test/error/dropdown.e2e.js +0 -36
- package/dist/collection/components/dropdown/test/filter/dropdown.e2e.js +0 -56
- package/dist/collection/components/dropdown/test/filter/hide-no-result-message/dropdown.e2e.js +0 -23
- package/dist/collection/components/dropdown/test/filter/normalize-text-false/dropdown.e2e.js +0 -43
- package/dist/collection/components/dropdown/test/multiselect/dropdown.e2e.js +0 -81
- package/dist/collection/components/footer/footer.stories.js +0 -145
- package/dist/collection/components/footer/test/default/footer.e2e.js +0 -34
- package/dist/collection/components/header/header.stories.js +0 -82
- package/dist/collection/components/header/test/default/header.e2e.js +0 -44
- package/dist/collection/components/icon/icon.stories.js +0 -48
- package/dist/collection/components/link/link.stories.js +0 -59
- package/dist/collection/components/message/message.stories.js +0 -109
- package/dist/collection/components/message/test/basic/message.e2e.js +0 -16
- package/dist/collection/components/message/test/error/message.e2e.js +0 -28
- package/dist/collection/components/message/test/information/message.e2e.js +0 -10
- package/dist/collection/components/message/test/success/message.e2e.js +0 -10
- package/dist/collection/components/message/test/warning/message.e2e.js +0 -10
- package/dist/collection/components/modal/modal.stories.js +0 -119
- package/dist/collection/components/modal/test/default/modal.e2e.js +0 -28
- package/dist/collection/components/modal/test/open-close/modal.e2e.js +0 -63
- package/dist/collection/components/modal/test/prevent-true/modal.e2e.js +0 -13
- package/dist/collection/components/popover-canvas/popover-canvas.stories.js +0 -92
- package/dist/collection/components/popover-canvas/test/default/popover-canvas.e2e.js +0 -30
- package/dist/collection/components/popover-canvas/test/show-false/popover-canvas.e2e.js +0 -30
- package/dist/collection/components/popover-canvas/test/show-true/popover-canvas.e2e.js +0 -30
- package/dist/collection/components/popover-menu/popover-menu.stories.js +0 -146
- package/dist/collection/components/popover-menu/test/default/popover-menu.e2e.js +0 -60
- package/dist/collection/components/popover-menu/test/icons-fluid/popover-menu.e2e.js +0 -27
- package/dist/collection/components/popover-menu/test/show/popover-menu.e2e.js +0 -20
- package/dist/collection/components/popover-menu/test/show-false/popover-menu.e2e.js +0 -20
- package/dist/collection/components/radio-button/radio-button.stories.js +0 -91
- package/dist/collection/components/side-menu/side-menu.stories.js +0 -224
- package/dist/collection/components/side-menu/test/collapsible/side-menu.e2e.js +0 -28
- package/dist/collection/components/side-menu/test/default/side-menu.e2e.js +0 -38
- package/dist/collection/components/slider/slider.stories.js +0 -243
- package/dist/collection/components/spinner/spinner.stories.js +0 -61
- package/dist/collection/components/stepper/stepper.stories.js +0 -95
- package/dist/collection/components/table/table/test/batch/table.e2e.js +0 -24
- package/dist/collection/components/table/table/test/default/table.e2e.js +0 -46
- package/dist/collection/components/table/table/test/expandable-row/table.e2e.js +0 -64
- package/dist/collection/components/table/table/test/filtering/table.e2e.js +0 -41
- package/dist/collection/components/table/table/test/multiselect/table.e2e.js +0 -47
- package/dist/collection/components/table/table/test/pagination/table.e2e.js +0 -53
- package/dist/collection/components/table/table/test/sorting/table.e2e.js +0 -36
- package/dist/collection/components/table/table-component-basic.stories.js +0 -184
- package/dist/collection/components/table/table-component-batch-actions.stories.js +0 -188
- package/dist/collection/components/table/table-component-custom-width.stories.js +0 -174
- package/dist/collection/components/table/table-component-expandable-rows.stories.js +0 -160
- package/dist/collection/components/table/table-component-filtering.stories.js +0 -195
- package/dist/collection/components/table/table-component-multiselect.stories.js +0 -211
- package/dist/collection/components/table/table-component-pagination.stories.js +0 -196
- package/dist/collection/components/table/table-component-sorting.stories.js +0 -240
- package/dist/collection/components/tabs/folder-tabs/folder-tabs.stories.js +0 -105
- package/dist/collection/components/tabs/inline-tabs/inline-tabs.stories.js +0 -99
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +0 -101
- package/dist/collection/components/text-field/text-field.stories.js +0 -247
- package/dist/collection/components/textarea/test/basic/textarea.e2e.js +0 -26
- package/dist/collection/components/textarea/test/default/textarea.e2e.js +0 -34
- package/dist/collection/components/textarea/test/read-only/textarea.e2e.js +0 -26
- package/dist/collection/components/textarea/textarea.stories.js +0 -188
- package/dist/collection/components/toast/toast.stories.js +0 -90
- package/dist/collection/components/toggle/toggle.stories.js +0 -95
- package/dist/collection/components/tooltip/tooltip.stories.js +0 -126
- package/dist/collection/stories/Installation/angular.stories.js +0 -111
- package/dist/collection/stories/Installation/javascript.stories.js +0 -99
- package/dist/collection/stories/Installation/react.stories.js +0 -117
- package/dist/collection/stories/announcements/announce-tegel.stories.js +0 -262
- package/dist/collection/stories/announcements/prefix-change.stories.js +0 -93
- package/dist/collection/stories/formatHtmlPreview.js +0 -10
- package/dist/collection/stories/foundations/color/color-brand.stories.js +0 -38
- package/dist/collection/stories/foundations/color/color-scales.stories.js +0 -71
- package/dist/collection/stories/foundations/color/color-semantic.stories.js +0 -40
- package/dist/collection/stories/foundations/grid/grid.stories.js +0 -386
- package/dist/collection/stories/foundations/spacing/spacing-element.stories.js +0 -100
- package/dist/collection/stories/foundations/spacing/spacing-layout.stories.js +0 -94
- package/dist/collection/stories/foundations/typography/typography-body.stories.js +0 -16
- package/dist/collection/stories/foundations/typography/typography-detail.stories.js +0 -17
- package/dist/collection/stories/foundations/typography/typography-headline.stories.js +0 -39
- package/dist/collection/stories/foundations/typography/typography-paragraph.stories.js +0 -12
- package/dist/collection/stories/patterns/navigation/navigation-basic.stories.js +0 -85
- package/dist/collection/stories/patterns/navigation/navigation-fewitems.stories.js +0 -259
- package/dist/collection/stories/patterns/navigation/navigation-manyitems.stories.js +0 -247
- package/dist/collection/stories/patterns/navigation/navigation-user-menu.stories.js +0 -140
- package/dist/collection/stories/tegel.stories.js +0 -283
- package/dist/collection/stories/utility/color/background-color.stories.js +0 -96
- package/dist/collection/stories/utility/color/text-color.stories.js +0 -94
- package/dist/tegel/p-556600b1.entry.js +0 -1
- package/dist/tegel/p-c6553022.entry.js +0 -1
- package/dist/tegel/p-f801cf0e.entry.js +0 -1
- package/dist/types/components/accordion/accordion.stories.d.ts +0 -77
- package/dist/types/components/badge/badge.stories.d.ts +0 -73
- package/dist/types/components/banner/banner.stories.d.ts +0 -69
- package/dist/types/components/block/block.stories.d.ts +0 -32
- package/dist/types/components/breadcrumbs/breadcrumbs.stories.d.ts +0 -16
- package/dist/types/components/button/button.stories.d.ts +0 -147
- package/dist/types/components/card/card.stories.d.ts +0 -128
- package/dist/types/components/checkbox/checkbox.stories.d.ts +0 -65
- package/dist/types/components/chip/chip.stories.d.ts +0 -99
- package/dist/types/components/datetime/datetime.stories.d.ts +0 -151
- package/dist/types/components/divider/divider.stories.d.ts +0 -58
- package/dist/types/components/dropdown/dropdown.stories.d.ts +0 -205
- package/dist/types/components/footer/footer.stories.d.ts +0 -44
- package/dist/types/components/header/header.stories.d.ts +0 -32
- package/dist/types/components/icon/icon.stories.d.ts +0 -36
- package/dist/types/components/link/link.stories.d.ts +0 -44
- package/dist/types/components/message/message.stories.d.ts +0 -88
- package/dist/types/components/modal/modal.stories.d.ts +0 -78
- package/dist/types/components/popover-canvas/popover-canvas.stories.d.ts +0 -27
- package/dist/types/components/popover-menu/popover-menu.stories.d.ts +0 -51
- package/dist/types/components/radio-button/radio-button.stories.d.ts +0 -39
- package/dist/types/components/side-menu/side-menu.stories.d.ts +0 -65
- package/dist/types/components/slider/slider.stories.d.ts +0 -235
- package/dist/types/components/spinner/spinner.stories.d.ts +0 -46
- package/dist/types/components/stepper/stepper.stories.d.ts +0 -80
- package/dist/types/components/table/table-component-basic.stories.d.ts +0 -144
- package/dist/types/components/table/table-component-batch-actions.stories.d.ts +0 -139
- package/dist/types/components/table/table-component-custom-width.stories.d.ts +0 -131
- package/dist/types/components/table/table-component-expandable-rows.stories.d.ts +0 -131
- package/dist/types/components/table/table-component-filtering.stories.d.ts +0 -131
- package/dist/types/components/table/table-component-multiselect.stories.d.ts +0 -147
- package/dist/types/components/table/table-component-pagination.stories.d.ts +0 -131
- package/dist/types/components/table/table-component-sorting.stories.d.ts +0 -183
- package/dist/types/components/tabs/folder-tabs/folder-tabs.stories.d.ts +0 -69
- package/dist/types/components/tabs/inline-tabs/inline-tabs.stories.d.ts +0 -61
- package/dist/types/components/tabs/navigation-tabs/navigation-tabs.stories.d.ts +0 -61
- package/dist/types/components/text-field/text-field.stories.d.ts +0 -201
- package/dist/types/components/textarea/textarea.stories.d.ts +0 -139
- package/dist/types/components/toast/toast.stories.d.ts +0 -64
- package/dist/types/components/toggle/toggle.stories.d.ts +0 -74
- package/dist/types/components/tooltip/tooltip.stories.d.ts +0 -66
- package/dist/types/stories/Installation/angular.stories.d.ts +0 -6
- package/dist/types/stories/Installation/javascript.stories.d.ts +0 -7
- package/dist/types/stories/Installation/react.stories.d.ts +0 -6
- package/dist/types/stories/announcements/announce-tegel.stories.d.ts +0 -6
- package/dist/types/stories/announcements/prefix-change.stories.d.ts +0 -6
- package/dist/types/stories/formatHtmlPreview.d.ts +0 -2
- package/dist/types/stories/foundations/color/color-brand.stories.d.ts +0 -13
- package/dist/types/stories/foundations/color/color-scales.stories.d.ts +0 -30
- package/dist/types/stories/foundations/color/color-semantic.stories.d.ts +0 -13
- package/dist/types/stories/foundations/grid/grid.stories.d.ts +0 -35
- package/dist/types/stories/foundations/spacing/spacing-element.stories.d.ts +0 -8
- package/dist/types/stories/foundations/spacing/spacing-layout.stories.d.ts +0 -8
- package/dist/types/stories/foundations/typography/typography-body.stories.d.ts +0 -8
- package/dist/types/stories/foundations/typography/typography-detail.stories.d.ts +0 -8
- package/dist/types/stories/foundations/typography/typography-headline.stories.d.ts +0 -21
- package/dist/types/stories/foundations/typography/typography-paragraph.stories.d.ts +0 -8
- package/dist/types/stories/patterns/navigation/navigation-basic.stories.d.ts +0 -23
- package/dist/types/stories/patterns/navigation/navigation-fewitems.stories.d.ts +0 -23
- package/dist/types/stories/patterns/navigation/navigation-manyitems.stories.d.ts +0 -38
- package/dist/types/stories/patterns/navigation/navigation-user-menu.stories.d.ts +0 -33
- package/dist/types/stories/tegel.stories.d.ts +0 -6
- package/dist/types/stories/utility/color/background-color.stories.d.ts +0 -64
- package/dist/types/stories/utility/color/text-color.stories.d.ts +0 -64
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import itemReadme from "./breadcrumb/readme.md";
|
|
2
|
-
import readme from "./readme.md";
|
|
3
|
-
import formatHtmlPreview from "../../stories/formatHtmlPreview";
|
|
4
|
-
import { ComponentsFolder } from "../../utils/constants";
|
|
5
|
-
export default {
|
|
6
|
-
title: `${ComponentsFolder}/Breadcrumbs`,
|
|
7
|
-
parameters: {
|
|
8
|
-
notes: { Breadcrumbs: readme, Breadcrumb: itemReadme },
|
|
9
|
-
design: [
|
|
10
|
-
{
|
|
11
|
-
name: 'Figma',
|
|
12
|
-
type: 'figma',
|
|
13
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2703%3A4725&t=rVXuTOgTmXPauyHd-1',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: 'Link',
|
|
17
|
-
type: 'link',
|
|
18
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2703%3A4725&t=rVXuTOgTmXPauyHd-1',
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
const Template = () => formatHtmlPreview(`
|
|
24
|
-
<tds-breadcrumbs>
|
|
25
|
-
<tds-breadcrumb>
|
|
26
|
-
<a href="#">Page 1</a>
|
|
27
|
-
</tds-breadcrumb>
|
|
28
|
-
<tds-breadcrumb>
|
|
29
|
-
<a href="#">Page 2</a>
|
|
30
|
-
</tds-breadcrumb>
|
|
31
|
-
<tds-breadcrumb current>
|
|
32
|
-
<a href="#">Page 3</a>
|
|
33
|
-
</tds-breadcrumb>
|
|
34
|
-
</tds-breadcrumbs>
|
|
35
|
-
`);
|
|
36
|
-
export const Default = Template.bind({});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/breadcrumbs/test/default/index.html';
|
|
4
|
-
test.describe('tds-breadcrumbs-default', () => {
|
|
5
|
-
test('renders default breadcrumbs correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
/* Check diff on screenshot */
|
|
8
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
9
|
-
});
|
|
10
|
-
test('items Page 1, Page 2, Page 3 exist on the page', async ({ page }) => {
|
|
11
|
-
await page.goto(componentTestPath);
|
|
12
|
-
const navigation = page.getByRole('navigation');
|
|
13
|
-
await expect(navigation).toHaveCount(1);
|
|
14
|
-
const listItems = page.getByRole('listitem');
|
|
15
|
-
await expect(listItems).toHaveCount(3);
|
|
16
|
-
const pageOne = page.getByRole('link').filter({ hasText: 'Page 1' });
|
|
17
|
-
const pageTwo = page.getByRole('link').filter({ hasText: 'Page 2' });
|
|
18
|
-
const pageThree = page.getByRole('link').filter({ hasText: 'Page 3' });
|
|
19
|
-
await expect(pageOne).toHaveCount(1);
|
|
20
|
-
await expect(pageOne).toBeVisible();
|
|
21
|
-
await expect(pageTwo).toHaveCount(1);
|
|
22
|
-
await expect(pageTwo).toBeVisible();
|
|
23
|
-
await expect(pageThree).toHaveCount(1);
|
|
24
|
-
await expect(pageThree).toBeVisible();
|
|
25
|
-
});
|
|
26
|
-
test('page 3 item should be able to become focused', async ({ page }) => {
|
|
27
|
-
await page.goto(componentTestPath);
|
|
28
|
-
const pageThree = page.getByText(/Page 3/);
|
|
29
|
-
await pageThree.focus();
|
|
30
|
-
/* Check diff on screenshot */
|
|
31
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import formatHtmlPreview from "../../stories/formatHtmlPreview";
|
|
2
|
-
import { iconsNames } from "../icon/iconsArray";
|
|
3
|
-
import readme from "./readme.md";
|
|
4
|
-
import { ComponentsFolder } from "../../utils/constants";
|
|
5
|
-
export default {
|
|
6
|
-
title: `${ComponentsFolder}/Button`,
|
|
7
|
-
parameters: {
|
|
8
|
-
notes: readme,
|
|
9
|
-
layout: 'padded',
|
|
10
|
-
design: [
|
|
11
|
-
{
|
|
12
|
-
name: 'Figma',
|
|
13
|
-
type: 'figma',
|
|
14
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1574%3A72148&t=rVXuTOgTmXPauyHd-1',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: 'Link',
|
|
18
|
-
type: 'link',
|
|
19
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1574%3A72148&t=rVXuTOgTmXPauyHd-1',
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
argTypes: {
|
|
24
|
-
modeVariant: {
|
|
25
|
-
name: 'Mode variant',
|
|
26
|
-
description: 'Mode variant adjusts component colors to have better visibility depending on global mode and background.',
|
|
27
|
-
control: {
|
|
28
|
-
type: 'radio',
|
|
29
|
-
},
|
|
30
|
-
options: ['Inherit from parent', 'Primary', 'Secondary'],
|
|
31
|
-
table: {
|
|
32
|
-
defaultValue: { summary: 'Inherit from parent' },
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
variant: {
|
|
36
|
-
name: 'Variant',
|
|
37
|
-
description: 'Four different Button variants to help the user to distinguish the level of importance of the task they represent.',
|
|
38
|
-
control: {
|
|
39
|
-
type: 'radio',
|
|
40
|
-
},
|
|
41
|
-
options: ['Primary', 'Secondary', 'Ghost', 'Danger'],
|
|
42
|
-
table: {
|
|
43
|
-
defaultValue: { summary: 'primary' },
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
type: {
|
|
47
|
-
name: 'Type',
|
|
48
|
-
description: 'Native types of button',
|
|
49
|
-
control: {
|
|
50
|
-
type: 'radio',
|
|
51
|
-
},
|
|
52
|
-
options: ['Button', 'Submit', 'Reset'],
|
|
53
|
-
table: {
|
|
54
|
-
defaultValue: { summary: 'button' },
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
size: {
|
|
58
|
-
name: 'Size',
|
|
59
|
-
description: 'Sets the size of the Button.',
|
|
60
|
-
control: {
|
|
61
|
-
type: 'radio',
|
|
62
|
-
},
|
|
63
|
-
options: ['Large', 'Medium', 'Small', 'Extra small'],
|
|
64
|
-
table: {
|
|
65
|
-
defaultValue: { summary: 'lg' },
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
text: {
|
|
69
|
-
name: 'Text',
|
|
70
|
-
description: 'Sets the text to be displayed on the Button.',
|
|
71
|
-
control: {
|
|
72
|
-
type: 'text',
|
|
73
|
-
},
|
|
74
|
-
if: { arg: 'onlyIcon', truthy: false },
|
|
75
|
-
},
|
|
76
|
-
fullbleed: {
|
|
77
|
-
name: 'Fullbleed',
|
|
78
|
-
description: 'Sets a fluid width on the Button.',
|
|
79
|
-
control: {
|
|
80
|
-
type: 'boolean',
|
|
81
|
-
},
|
|
82
|
-
table: {
|
|
83
|
-
defaultValue: { summary: false },
|
|
84
|
-
},
|
|
85
|
-
if: { arg: 'onlyIcon', truthy: false },
|
|
86
|
-
},
|
|
87
|
-
onlyIcon: {
|
|
88
|
-
name: 'Only Icon',
|
|
89
|
-
description: 'Displays only the icon and excludes any text from the Button.',
|
|
90
|
-
control: {
|
|
91
|
-
type: 'boolean',
|
|
92
|
-
},
|
|
93
|
-
table: {
|
|
94
|
-
defaultValue: { summary: false },
|
|
95
|
-
},
|
|
96
|
-
if: { arg: 'size', neq: 'Extra small' },
|
|
97
|
-
},
|
|
98
|
-
icon: {
|
|
99
|
-
name: 'Icon',
|
|
100
|
-
description: 'Sets icon to be displayed on the Button. Choose "none" to exclude the icon.',
|
|
101
|
-
control: {
|
|
102
|
-
type: 'select',
|
|
103
|
-
},
|
|
104
|
-
options: ['none', ...iconsNames],
|
|
105
|
-
if: { arg: 'size', neq: 'Extra small' },
|
|
106
|
-
},
|
|
107
|
-
disabled: {
|
|
108
|
-
name: 'Disabled',
|
|
109
|
-
description: 'Disables the Button.',
|
|
110
|
-
control: {
|
|
111
|
-
type: 'boolean',
|
|
112
|
-
},
|
|
113
|
-
table: {
|
|
114
|
-
defaultValue: { summary: false },
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
args: {
|
|
119
|
-
modeVariant: 'Inherit from parent',
|
|
120
|
-
type: 'Button',
|
|
121
|
-
variant: 'Primary',
|
|
122
|
-
size: 'Large',
|
|
123
|
-
text: 'Button',
|
|
124
|
-
fullbleed: false,
|
|
125
|
-
onlyIcon: false,
|
|
126
|
-
icon: 'none',
|
|
127
|
-
disabled: false,
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
const WebComponentTemplate = ({ modeVariant, type, variant, size, text = 'Button', fullbleed, onlyIcon, icon, disabled, }) => {
|
|
131
|
-
const variantLookUp = {
|
|
132
|
-
Primary: 'primary',
|
|
133
|
-
Secondary: 'secondary',
|
|
134
|
-
Ghost: 'ghost',
|
|
135
|
-
Danger: 'danger',
|
|
136
|
-
};
|
|
137
|
-
const sizeLookUp = {
|
|
138
|
-
'Large': 'lg',
|
|
139
|
-
'Medium': 'md',
|
|
140
|
-
'Small': 'sm',
|
|
141
|
-
'Extra small': 'xs',
|
|
142
|
-
};
|
|
143
|
-
const modeVariantLookup = {
|
|
144
|
-
Primary: 'primary',
|
|
145
|
-
Secondary: 'secondary',
|
|
146
|
-
};
|
|
147
|
-
const typeLookup = {
|
|
148
|
-
Button: 'button',
|
|
149
|
-
Submit: 'submit',
|
|
150
|
-
Reset: 'reset',
|
|
151
|
-
};
|
|
152
|
-
return formatHtmlPreview(`
|
|
153
|
-
<style>
|
|
154
|
-
/* demo-wrapper is for demonstration purposes only*/
|
|
155
|
-
.demo-wrapper{
|
|
156
|
-
width: 100%;
|
|
157
|
-
}
|
|
158
|
-
</style>
|
|
159
|
-
|
|
160
|
-
<div class="demo-wrapper">
|
|
161
|
-
<tds-button
|
|
162
|
-
type='${typeLookup[type]}'
|
|
163
|
-
variant="${variantLookUp[variant]}"
|
|
164
|
-
size="${sizeLookUp[size]}" ${disabled ? 'disabled' : ''} ${fullbleed ? 'fullbleed' : ''}
|
|
165
|
-
${!onlyIcon ? `text="${text}"` : ''}
|
|
166
|
-
${modeVariant !== 'Inherit from parent'
|
|
167
|
-
? `mode-variant="${modeVariantLookup[modeVariant]}"`
|
|
168
|
-
: ''}
|
|
169
|
-
>
|
|
170
|
-
${onlyIcon || (icon && icon !== 'none')
|
|
171
|
-
? `
|
|
172
|
-
<tds-icon slot="icon" size='${sizeLookUp[size] === 'sm' ? '16px' : '20px'}' name='${icon}'></tds-icon>
|
|
173
|
-
`
|
|
174
|
-
: ''}
|
|
175
|
-
</tds-button>
|
|
176
|
-
</div>
|
|
177
|
-
<script>
|
|
178
|
-
document.querySelector('tds-button').addEventListener('click', (event) => {
|
|
179
|
-
console.log(event)
|
|
180
|
-
})
|
|
181
|
-
</script>
|
|
182
|
-
`);
|
|
183
|
-
};
|
|
184
|
-
/** Button as a web component */
|
|
185
|
-
export const Default = WebComponentTemplate.bind({});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/button/test/basic/index.html';
|
|
4
|
-
test.describe('tds-button-basic', () => {
|
|
5
|
-
test('renders basic button correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
const button = page.getByTestId('tds-button-testid');
|
|
8
|
-
await expect(button).toHaveCount(1);
|
|
9
|
-
/* Check diff on screenshot */
|
|
10
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
11
|
-
});
|
|
12
|
-
test('component receives click event', async ({ page }) => {
|
|
13
|
-
await page.goto(componentTestPath);
|
|
14
|
-
const button = page.getByRole('button');
|
|
15
|
-
const myEventSpy = await page.spyOnEvent('click');
|
|
16
|
-
await button.click();
|
|
17
|
-
expect(myEventSpy).toHaveReceivedEvent();
|
|
18
|
-
});
|
|
19
|
-
test('expect button to be of role button', async ({ page }) => {
|
|
20
|
-
await page.goto(componentTestPath);
|
|
21
|
-
const button = page.getByRole('button');
|
|
22
|
-
await expect(button).toHaveCount(1);
|
|
23
|
-
});
|
|
24
|
-
test('Text is displayed', async ({ page }) => {
|
|
25
|
-
await page.goto(componentTestPath);
|
|
26
|
-
const button = page.getByText('Button', { exact: true });
|
|
27
|
-
await expect(button).toBeVisible();
|
|
28
|
-
});
|
|
29
|
-
test('Check so that height is correct to lg/default measurements', async ({ page }) => {
|
|
30
|
-
await page.goto(componentTestPath);
|
|
31
|
-
const button = page.getByText('Button', { exact: true });
|
|
32
|
-
const buttonHeight = await button.evaluate((style) => getComputedStyle(style).height);
|
|
33
|
-
expect(buttonHeight).toBe('56px');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/button/test/danger/index.html';
|
|
4
|
-
test.describe('tds-button-danger', () => {
|
|
5
|
-
test('renders danger button correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
const button = page.getByTestId('tds-button-testid');
|
|
8
|
-
await expect(button).toHaveCount(1);
|
|
9
|
-
/* Check diff on screenshot */
|
|
10
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
11
|
-
});
|
|
12
|
-
test('Check so that height is correct to sm measurements', async ({ page }) => {
|
|
13
|
-
await page.goto(componentTestPath);
|
|
14
|
-
const button = page.getByText('Button', { exact: true });
|
|
15
|
-
const buttonHeight = await button.evaluate((style) => getComputedStyle(style).height);
|
|
16
|
-
expect(buttonHeight).toBe('40px');
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/button/test/disabled/index.html';
|
|
4
|
-
test.describe('tds-button-disabled', () => {
|
|
5
|
-
test('renders disabled button correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
const button = page.getByTestId('tds-button-testid');
|
|
8
|
-
await expect(button).toHaveCount(1);
|
|
9
|
-
/* Check diff on screenshot */
|
|
10
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
11
|
-
});
|
|
12
|
-
test('disabled button should be disabled', async ({ page }) => {
|
|
13
|
-
await page.goto(componentTestPath);
|
|
14
|
-
/* Check if disabled */
|
|
15
|
-
const button = page.getByRole('button');
|
|
16
|
-
await expect(button).toBeDisabled();
|
|
17
|
-
});
|
|
18
|
-
test('the cursor should be not-allowed', async ({ page }) => {
|
|
19
|
-
await page.goto(componentTestPath);
|
|
20
|
-
const button = page.getByTestId('tds-button-testid').getByRole('button');
|
|
21
|
-
const buttonCursorState = await button.evaluate((style) => getComputedStyle(style).cursor);
|
|
22
|
-
expect(buttonCursorState).toBe('not-allowed');
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/button/test/ghost/index.html';
|
|
4
|
-
test.describe('tds-button-ghost', () => {
|
|
5
|
-
test('renders ghost button correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
const button = page.getByTestId('tds-button-testid');
|
|
8
|
-
await expect(button).toHaveCount(1);
|
|
9
|
-
/* Check diff on screenshot */
|
|
10
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
11
|
-
});
|
|
12
|
-
test('Check so that height is correct to md measurements', async ({ page }) => {
|
|
13
|
-
await page.goto(componentTestPath);
|
|
14
|
-
const button = page.getByText('Button', { exact: true });
|
|
15
|
-
const buttonHeight = await button.evaluate((style) => getComputedStyle(style).height);
|
|
16
|
-
expect(buttonHeight).toBe('24px');
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/button/test/icon/index.html';
|
|
4
|
-
test.describe('tds-button-icon', () => {
|
|
5
|
-
test('renders icon button correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
const button = page.getByTestId('tds-button-testid');
|
|
8
|
-
await expect(button).toHaveCount(1);
|
|
9
|
-
/* Check diff on screenshot */
|
|
10
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
11
|
-
});
|
|
12
|
-
test('icon should exist', async ({ page }) => {
|
|
13
|
-
await page.goto(componentTestPath);
|
|
14
|
-
const icon = page.getByRole('img');
|
|
15
|
-
await expect(icon).toBeVisible();
|
|
16
|
-
});
|
|
17
|
-
test('Check so that height and width is correct to lg/default measurements with a single button', async ({ page, }) => {
|
|
18
|
-
await page.goto(componentTestPath);
|
|
19
|
-
const button = page.getByRole('button');
|
|
20
|
-
const buttonHeight = await button.evaluate((style) => getComputedStyle(style).height);
|
|
21
|
-
expect(buttonHeight).toBe('56px');
|
|
22
|
-
const buttonWidth = await button.evaluate((style) => getComputedStyle(style).width);
|
|
23
|
-
expect(buttonWidth).toBe('56px');
|
|
24
|
-
const icon = page.getByRole('img');
|
|
25
|
-
const iconHeight = await icon.evaluate((style) => getComputedStyle(style).height);
|
|
26
|
-
expect(iconHeight).toBe('20px');
|
|
27
|
-
const iconWidth = await icon.evaluate((style) => getComputedStyle(style).width);
|
|
28
|
-
expect(iconWidth).toBe('20px');
|
|
29
|
-
});
|
|
30
|
-
test('Check so that height and width is correct to lg/default measurements with a single button for the icon', async ({ page, }) => {
|
|
31
|
-
await page.goto(componentTestPath);
|
|
32
|
-
const icon = page.getByRole('img');
|
|
33
|
-
const iconHeight = await icon.evaluate((style) => getComputedStyle(style).height);
|
|
34
|
-
expect(iconHeight).toBe('20px');
|
|
35
|
-
const iconWidth = await icon.evaluate((style) => getComputedStyle(style).width);
|
|
36
|
-
expect(iconWidth).toBe('20px');
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/button/test/secondary/index.html';
|
|
4
|
-
test.describe('tds-button-secondary', () => {
|
|
5
|
-
test('renders secondary button correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
const button = page.getByTestId('tds-button-testid');
|
|
8
|
-
await expect(button).toHaveCount(1);
|
|
9
|
-
/* Check diff on screenshot */
|
|
10
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
11
|
-
});
|
|
12
|
-
test('Check so that height is correct to md measurements', async ({ page }) => {
|
|
13
|
-
await page.goto(componentTestPath);
|
|
14
|
-
const button = page.getByText('Button', { exact: true });
|
|
15
|
-
const buttonHeight = await button.evaluate((style) => getComputedStyle(style).height);
|
|
16
|
-
expect(buttonHeight).toBe('48px');
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import readme from "./readme.md";
|
|
2
|
-
import CardPlaceholder from "../../stories/assets/image/card-placeholder.png";
|
|
3
|
-
import CardBodyImage from "../../stories/assets/image/card-img.png";
|
|
4
|
-
import formatHtmlPreview from "../../stories/formatHtmlPreview";
|
|
5
|
-
import { ComponentsFolder } from "../../utils/constants";
|
|
6
|
-
export default {
|
|
7
|
-
title: `${ComponentsFolder}/Card`,
|
|
8
|
-
parameters: {
|
|
9
|
-
notes: readme,
|
|
10
|
-
layout: 'centered',
|
|
11
|
-
design: [
|
|
12
|
-
{
|
|
13
|
-
name: 'Figma',
|
|
14
|
-
type: 'figma',
|
|
15
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2891%3A125&t=rVXuTOgTmXPauyHd-1',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: 'Link',
|
|
19
|
-
type: 'link',
|
|
20
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=2891%3A125&t=rVXuTOgTmXPauyHd-1',
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
argTypes: {
|
|
25
|
-
modeVariant: {
|
|
26
|
-
name: 'Mode variant',
|
|
27
|
-
description: 'Mode variant adjusts component colors to have better visibility depending on global mode and background.',
|
|
28
|
-
control: {
|
|
29
|
-
type: 'radio',
|
|
30
|
-
},
|
|
31
|
-
options: ['Inherit from parent', 'Primary', 'Secondary'],
|
|
32
|
-
table: {
|
|
33
|
-
defaultValue: { summary: 'Inherit from parent' },
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
header: {
|
|
37
|
-
name: 'Header text',
|
|
38
|
-
description: 'Sets the header text.',
|
|
39
|
-
control: {
|
|
40
|
-
type: 'text',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
subheader: {
|
|
44
|
-
name: 'Subheader text',
|
|
45
|
-
description: 'Sets the subheader text.',
|
|
46
|
-
control: {
|
|
47
|
-
type: 'text',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
thumbnail: {
|
|
51
|
-
name: 'Header thumbnail',
|
|
52
|
-
description: 'Toggles a thumbnail in the header.',
|
|
53
|
-
control: {
|
|
54
|
-
type: 'boolean',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
imagePlacement: {
|
|
58
|
-
name: 'Body image placement',
|
|
59
|
-
description: 'Sets the placement of the body image, above or below the header.',
|
|
60
|
-
control: {
|
|
61
|
-
type: 'radio',
|
|
62
|
-
},
|
|
63
|
-
options: ['Above', 'Below'],
|
|
64
|
-
table: {
|
|
65
|
-
defaultValue: { summary: 'below' },
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
bodyImg: {
|
|
69
|
-
name: 'Body image',
|
|
70
|
-
description: 'Toggles an image in the Card body. Cannot be combined with divider.',
|
|
71
|
-
control: {
|
|
72
|
-
type: 'boolean',
|
|
73
|
-
},
|
|
74
|
-
if: { arg: 'bodyDivider', eq: false },
|
|
75
|
-
},
|
|
76
|
-
bodyContent: {
|
|
77
|
-
name: 'Body text',
|
|
78
|
-
description: 'Sets the body text for the Card.',
|
|
79
|
-
control: {
|
|
80
|
-
type: 'text',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
bodyDivider: {
|
|
84
|
-
name: 'Body divider',
|
|
85
|
-
description: 'Adds a divider above the body content. Cannot be combined with body image.',
|
|
86
|
-
control: {
|
|
87
|
-
type: 'boolean',
|
|
88
|
-
},
|
|
89
|
-
if: { arg: 'bodyImg', eq: false },
|
|
90
|
-
table: {
|
|
91
|
-
defaultValue: { summary: false },
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
cardActions: {
|
|
95
|
-
name: 'Content of the bottom of the Card',
|
|
96
|
-
description: 'Slot to add custom HTML elements to the bottom of the Card.',
|
|
97
|
-
control: {
|
|
98
|
-
type: 'text',
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
clickable: {
|
|
102
|
-
name: 'Clickable',
|
|
103
|
-
description: 'Toggles if the Card is clickable or not.',
|
|
104
|
-
control: {
|
|
105
|
-
type: 'boolean',
|
|
106
|
-
},
|
|
107
|
-
table: {
|
|
108
|
-
defaultValue: { summary: false },
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
args: {
|
|
113
|
-
modeVariant: 'Inherit from parent',
|
|
114
|
-
header: 'Header text',
|
|
115
|
-
subheader: 'Subheader text',
|
|
116
|
-
thumbnail: true,
|
|
117
|
-
imagePlacement: 'Below',
|
|
118
|
-
bodyImg: false,
|
|
119
|
-
bodyContent: '',
|
|
120
|
-
bodyDivider: false,
|
|
121
|
-
cardActions: `<tds-icon slot="actions" size="20px" name="arrow_right"></tds-icon>`,
|
|
122
|
-
clickable: false,
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
const Template = ({ modeVariant, header, subheader, thumbnail, imagePlacement, bodyImg, bodyContent, bodyDivider, cardActions, clickable, }) => formatHtmlPreview(`<style>
|
|
126
|
-
/* demo-wrapper is for demonstration purposes only*/
|
|
127
|
-
.demo-wrapper {
|
|
128
|
-
width: 368px;
|
|
129
|
-
}
|
|
130
|
-
</style>
|
|
131
|
-
<div class="demo-wrapper">
|
|
132
|
-
<tds-card
|
|
133
|
-
${modeVariant !== 'Inherit from parent' ? `mode-variant="${modeVariant.toLowerCase()}"` : ''}
|
|
134
|
-
${header ? `header="${header}"` : ''}
|
|
135
|
-
image-placement="${imagePlacement.toLowerCase()}-header"
|
|
136
|
-
${subheader ? `subheader="${subheader}"` : ''}
|
|
137
|
-
${bodyImg ? `body-img="${CardBodyImage}"` : ''}
|
|
138
|
-
${clickable ? 'clickable' : ''}
|
|
139
|
-
${bodyDivider ? 'body-divider' : ''}
|
|
140
|
-
>
|
|
141
|
-
${thumbnail
|
|
142
|
-
? `<img slot="thumbnail" src="${CardPlaceholder}" alt="Thumbnail for the card."/>`
|
|
143
|
-
: ''}
|
|
144
|
-
${bodyContent
|
|
145
|
-
? `
|
|
146
|
-
<div slot="body">
|
|
147
|
-
${bodyContent}
|
|
148
|
-
</div>`
|
|
149
|
-
: ''}
|
|
150
|
-
${cardActions ? `${cardActions}` : ''}
|
|
151
|
-
</tds-card>
|
|
152
|
-
</div>
|
|
153
|
-
${clickable
|
|
154
|
-
? `
|
|
155
|
-
<script>
|
|
156
|
-
document.addEventListener('tdsClick', (event)=>{
|
|
157
|
-
console.log('Card with id: ', event.detail.cardId, ' was clicked.')
|
|
158
|
-
})
|
|
159
|
-
</script>
|
|
160
|
-
`
|
|
161
|
-
: ''}
|
|
162
|
-
`);
|
|
163
|
-
export const Default = Template.bind({});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/card/test/basic/index.html';
|
|
4
|
-
test.describe('tds-card-basic', () => {
|
|
5
|
-
test('renders basic card correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
/* Check diff on screenshot */
|
|
8
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/card/test/clickable/index.html';
|
|
4
|
-
test.describe('tds-card-clickable', () => {
|
|
5
|
-
test('renders clickable card correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
const cardButton = page.getByRole('button');
|
|
8
|
-
await cardButton.hover();
|
|
9
|
-
/* Check diff on screenshot */
|
|
10
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
11
|
-
});
|
|
12
|
-
test('card should contain a button that is clickable', async ({ page }) => {
|
|
13
|
-
await page.goto(componentTestPath);
|
|
14
|
-
const cardButton = page.getByRole('button');
|
|
15
|
-
await expect(cardButton).toHaveCount(1);
|
|
16
|
-
await expect(cardButton).toBeVisible();
|
|
17
|
-
const myEventSpy = await page.spyOnEvent('click');
|
|
18
|
-
await cardButton.click();
|
|
19
|
-
expect(myEventSpy).toHaveReceivedEvent();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/card/test/default/index.html';
|
|
4
|
-
test.describe('tds-card-default', () => {
|
|
5
|
-
test('renders default card correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
/* Check diff on screenshot */
|
|
8
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
9
|
-
});
|
|
10
|
-
test('header text exists', async ({ page }) => {
|
|
11
|
-
await page.goto(componentTestPath);
|
|
12
|
-
const cardHeaderText = page.getByText('Header text', { exact: true });
|
|
13
|
-
await expect(cardHeaderText).toHaveCount(1);
|
|
14
|
-
await expect(cardHeaderText).toBeVisible();
|
|
15
|
-
});
|
|
16
|
-
test('subheader text exists', async ({ page }) => {
|
|
17
|
-
await page.goto(componentTestPath);
|
|
18
|
-
const cardSubheaderText = page.getByText('Subheader text', { exact: true });
|
|
19
|
-
await expect(cardSubheaderText).toHaveCount(1);
|
|
20
|
-
await expect(cardSubheaderText).toBeVisible();
|
|
21
|
-
});
|
|
22
|
-
test('arrow icon exists', async ({ page }) => {
|
|
23
|
-
await page.goto(componentTestPath);
|
|
24
|
-
const cardTdsIcon = page.getByRole('img');
|
|
25
|
-
await expect(cardTdsIcon).toHaveCount(1);
|
|
26
|
-
await expect(cardTdsIcon).toBeVisible();
|
|
27
|
-
});
|
|
28
|
-
test('card should not contain a button that is clickable', async ({ page }) => {
|
|
29
|
-
await page.goto(componentTestPath);
|
|
30
|
-
const cardButton = page.getByRole('button');
|
|
31
|
-
await expect(cardButton).toHaveCount(0);
|
|
32
|
-
});
|
|
33
|
-
});
|