@watermarkinsights/ripple 5.0.0 → 5.1.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/{app-globals-d6c37251.js → app-globals-aad9863d.js} +2 -2
- package/dist/cjs/{chartFunctions-b32ecbeb.js → chartFunctions-e86ed63c.js} +8 -4
- package/dist/cjs/{index-0f1bacce.js → index-4853a7b4.js} +537 -494
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/priv-chart-popover.cjs.entry.js +1 -1
- package/dist/cjs/priv-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/priv-navigator-button.cjs.entry.js +1 -1
- package/dist/cjs/priv-navigator-item.cjs.entry.js +1 -1
- package/dist/cjs/ripple.cjs.js +3 -3
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +1 -1
- package/dist/cjs/wm-button.cjs.entry.js +1 -1
- package/dist/cjs/wm-chart-slice.cjs.entry.js +1 -1
- package/dist/cjs/wm-chart.cjs.entry.js +2 -2
- package/dist/cjs/wm-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-file-list.cjs.entry.js +1 -1
- package/dist/cjs/wm-file.cjs.entry.js +1 -1
- package/dist/cjs/wm-input.cjs.entry.js +1 -1
- package/dist/cjs/wm-line-chart.cjs.entry.js +2 -2
- package/dist/cjs/wm-modal-footer.cjs.entry.js +1 -1
- package/dist/cjs/wm-modal-header.cjs.entry.js +1 -1
- package/dist/cjs/wm-modal.cjs.entry.js +1 -1
- package/dist/cjs/wm-navigation_3.cjs.entry.js +1 -1
- package/dist/cjs/wm-navigator.cjs.entry.js +1 -1
- package/dist/cjs/wm-option_2.cjs.entry.js +1 -1
- package/dist/cjs/wm-pagination.cjs.entry.js +1 -1
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-search.cjs.entry.js +1 -1
- package/dist/cjs/wm-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +1 -1
- package/dist/cjs/wm-tag-input.cjs.entry.js +1 -1
- package/dist/cjs/wm-tag-option.cjs.entry.js +1 -1
- package/dist/cjs/wm-textarea.cjs.entry.js +1 -1
- package/dist/cjs/wm-timepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-toggletip.cjs.entry.js +1 -1
- package/dist/cjs/wm-uploader.cjs.entry.js +1 -1
- package/dist/cjs/wm-wrapper.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/charts/chartFunctions.js +7 -3
- package/dist/esm/{app-globals-2df700e6.js → app-globals-4e667854.js} +2 -2
- package/dist/esm/{chartFunctions-e43ec877.js → chartFunctions-8098e455.js} +8 -4
- package/dist/esm/{index-5815b978.js → index-7923308f.js} +537 -494
- package/dist/esm/loader.js +3 -3
- package/dist/esm/priv-chart-popover.entry.js +1 -1
- package/dist/esm/priv-datepicker.entry.js +1 -1
- package/dist/esm/priv-navigator-button.entry.js +1 -1
- package/dist/esm/priv-navigator-item.entry.js +1 -1
- package/dist/esm/ripple.js +4 -4
- package/dist/esm/wm-action-menu_2.entry.js +1 -1
- package/dist/esm/wm-button.entry.js +1 -1
- package/dist/esm/wm-chart-slice.entry.js +1 -1
- package/dist/esm/wm-chart.entry.js +2 -2
- package/dist/esm/wm-datepicker.entry.js +1 -1
- package/dist/esm/wm-file-list.entry.js +1 -1
- package/dist/esm/wm-file.entry.js +1 -1
- package/dist/esm/wm-input.entry.js +1 -1
- package/dist/esm/wm-line-chart.entry.js +2 -2
- package/dist/esm/wm-modal-footer.entry.js +1 -1
- package/dist/esm/wm-modal-header.entry.js +1 -1
- package/dist/esm/wm-modal.entry.js +1 -1
- package/dist/esm/wm-navigation_3.entry.js +1 -1
- package/dist/esm/wm-navigator.entry.js +1 -1
- package/dist/esm/wm-option_2.entry.js +1 -1
- package/dist/esm/wm-pagination.entry.js +1 -1
- package/dist/esm/wm-progress-indicator_3.entry.js +2 -2
- package/dist/esm/wm-search.entry.js +1 -1
- package/dist/esm/wm-snackbar.entry.js +1 -1
- package/dist/esm/wm-tab-item_3.entry.js +1 -1
- package/dist/esm/wm-tag-input.entry.js +1 -1
- package/dist/esm/wm-tag-option.entry.js +1 -1
- package/dist/esm/wm-textarea.entry.js +1 -1
- package/dist/esm/wm-timepicker.entry.js +1 -1
- package/dist/esm/wm-toggletip.entry.js +1 -1
- package/dist/esm/wm-uploader.entry.js +1 -1
- package/dist/esm/wm-wrapper.entry.js +1 -1
- package/dist/esm-es5/{app-globals-2df700e6.js → app-globals-4e667854.js} +1 -1
- package/dist/esm-es5/chartFunctions-8098e455.js +1 -0
- package/dist/esm-es5/index-7923308f.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
- package/dist/esm-es5/priv-datepicker.entry.js +1 -1
- package/dist/esm-es5/priv-navigator-button.entry.js +1 -1
- package/dist/esm-es5/priv-navigator-item.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
- package/dist/esm-es5/wm-button.entry.js +1 -1
- package/dist/esm-es5/wm-chart-slice.entry.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-file-list.entry.js +1 -1
- package/dist/esm-es5/wm-file.entry.js +1 -1
- package/dist/esm-es5/wm-input.entry.js +1 -1
- package/dist/esm-es5/wm-line-chart.entry.js +1 -1
- package/dist/esm-es5/wm-modal-footer.entry.js +1 -1
- package/dist/esm-es5/wm-modal-header.entry.js +1 -1
- package/dist/esm-es5/wm-modal.entry.js +1 -1
- package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
- package/dist/esm-es5/wm-navigator.entry.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/esm-es5/wm-pagination.entry.js +1 -1
- package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
- package/dist/esm-es5/wm-search.entry.js +1 -1
- package/dist/esm-es5/wm-snackbar.entry.js +1 -1
- package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
- package/dist/esm-es5/wm-tag-input.entry.js +1 -1
- package/dist/esm-es5/wm-tag-option.entry.js +1 -1
- package/dist/esm-es5/wm-textarea.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-wrapper.entry.js +1 -1
- package/dist/loader/index.d.ts +3 -0
- package/dist/ripple/{p-df4ab5de.system.entry.js → p-00f8637e.system.entry.js} +1 -1
- package/dist/ripple/{p-0a05e6d7.system.entry.js → p-06c018cf.system.entry.js} +1 -1
- package/dist/ripple/{p-411f0d1d.entry.js → p-0707b4c2.entry.js} +1 -1
- package/dist/ripple/{p-e14c3721.entry.js → p-0bb464b1.entry.js} +1 -1
- package/dist/ripple/{p-6f47d86c.system.entry.js → p-0d0e0a1e.system.entry.js} +1 -1
- package/dist/ripple/{p-9b894527.entry.js → p-0e7025db.entry.js} +1 -1
- package/dist/ripple/{p-d65e9846.entry.js → p-0ec1e075.entry.js} +1 -1
- package/dist/ripple/{p-9a977fbd.entry.js → p-0f72ed3a.entry.js} +1 -1
- package/dist/ripple/{p-b5729148.system.entry.js → p-186a4d76.system.entry.js} +1 -1
- package/dist/ripple/{p-9433f29c.entry.js → p-18c1593b.entry.js} +1 -1
- package/dist/ripple/{p-194c06e1.entry.js → p-19f29a48.entry.js} +1 -1
- package/dist/ripple/{p-85e59e6a.system.entry.js → p-1ee68e06.system.entry.js} +1 -1
- package/dist/ripple/{p-46584e7e.system.entry.js → p-1fcc8007.system.entry.js} +1 -1
- package/dist/ripple/{p-87eb2f99.system.entry.js → p-28119849.system.entry.js} +1 -1
- package/dist/ripple/{p-0c218ac2.system.entry.js → p-2849847d.system.entry.js} +1 -1
- package/dist/ripple/{p-70c459b2.entry.js → p-2f39732e.entry.js} +1 -1
- package/dist/ripple/{p-ac727a0a.system.entry.js → p-30ee0f5c.system.entry.js} +1 -1
- package/dist/ripple/{p-44f2e1a7.entry.js → p-340f96b5.entry.js} +1 -1
- package/dist/ripple/{p-74565577.system.entry.js → p-3639dbbc.system.entry.js} +1 -1
- package/dist/ripple/{p-1b8584f9.entry.js → p-3e605541.entry.js} +1 -1
- package/dist/ripple/{p-440571f7.system.entry.js → p-439d839b.system.entry.js} +1 -1
- package/dist/ripple/{p-e80009db.entry.js → p-445d6915.entry.js} +1 -1
- package/dist/ripple/{p-1435a717.entry.js → p-48ed56a0.entry.js} +1 -1
- package/dist/ripple/{p-4a8016fb.entry.js → p-49f94f8a.entry.js} +1 -1
- package/dist/ripple/{p-764cee74.system.js → p-4ba32e58.system.js} +1 -1
- package/dist/ripple/{p-0bf7cdda.system.entry.js → p-510fab1c.system.entry.js} +1 -1
- package/dist/ripple/p-539b7be9.system.js +2 -0
- package/dist/ripple/{p-7ffb6f07.entry.js → p-57694990.entry.js} +1 -1
- package/dist/ripple/{p-e9d29b5b.system.entry.js → p-58a286e8.system.entry.js} +1 -1
- package/dist/ripple/{p-ef0854e6.entry.js → p-5ff41948.entry.js} +1 -1
- package/dist/ripple/{p-76740c92.entry.js → p-636ca7f2.entry.js} +1 -1
- package/dist/ripple/{p-0bef5c1b.system.entry.js → p-66a57d81.system.entry.js} +1 -1
- package/dist/ripple/p-681c1853.js +1 -0
- package/dist/ripple/{p-7d2bd039.entry.js → p-6b71806b.entry.js} +1 -1
- package/dist/ripple/{p-5c4245d9.system.entry.js → p-7afa2fdc.system.entry.js} +1 -1
- package/dist/ripple/{p-ce492826.js → p-7c12ac23.js} +1 -1
- package/dist/ripple/{p-5297476b.entry.js → p-7cb98aa5.entry.js} +1 -1
- package/dist/ripple/{p-87c85aac.system.entry.js → p-7dbc4abc.system.entry.js} +1 -1
- package/dist/ripple/{p-6f61a5f1.entry.js → p-8c7b9bad.entry.js} +1 -1
- package/dist/ripple/p-94a54d68.system.js +1 -0
- package/dist/ripple/{p-b878d9c7.entry.js → p-950edf62.entry.js} +1 -1
- package/dist/ripple/{p-6a231093.system.entry.js → p-96f3d9e7.system.entry.js} +1 -1
- package/dist/ripple/{p-47441a2a.system.entry.js → p-9bda128e.system.entry.js} +1 -1
- package/dist/ripple/{p-eab22c94.entry.js → p-9ca027b7.entry.js} +1 -1
- package/dist/ripple/{p-6372934d.entry.js → p-9d4ea9f8.entry.js} +1 -1
- package/dist/ripple/{p-49632308.system.entry.js → p-9d8817a7.system.entry.js} +1 -1
- package/dist/ripple/{p-9936c43c.system.entry.js → p-a0098136.system.entry.js} +1 -1
- package/dist/ripple/p-a431d6e5.js +2 -0
- package/dist/ripple/{p-7ade6e66.system.entry.js → p-a6119885.system.entry.js} +1 -1
- package/dist/ripple/{p-25cf3ccb.entry.js → p-a77f2168.entry.js} +1 -1
- package/dist/ripple/{p-3cc9b812.entry.js → p-adfaeeea.entry.js} +1 -1
- package/dist/ripple/{p-66960670.system.entry.js → p-b02c0c41.system.entry.js} +1 -1
- package/dist/ripple/{p-1166513e.system.entry.js → p-bbb8c02f.system.entry.js} +1 -1
- package/dist/ripple/{p-3b9a9d73.entry.js → p-bd7e892d.entry.js} +1 -1
- package/dist/ripple/{p-441354a5.system.entry.js → p-c9552e88.system.entry.js} +1 -1
- package/dist/ripple/{p-018498a7.system.entry.js → p-cd0a862f.system.entry.js} +1 -1
- package/dist/ripple/{p-25e011a6.entry.js → p-d344e490.entry.js} +1 -1
- package/dist/ripple/{p-dabff389.system.entry.js → p-d87e105b.system.entry.js} +1 -1
- package/dist/ripple/{p-44d8f4b2.system.entry.js → p-e0ff556b.system.entry.js} +1 -1
- package/dist/ripple/{p-8edd4ce6.system.entry.js → p-e19e1ece.system.entry.js} +1 -1
- package/dist/ripple/{p-c53f1dcb.entry.js → p-e3d8f2f6.entry.js} +1 -1
- package/dist/ripple/{p-116477b7.entry.js → p-e8eef357.entry.js} +1 -1
- package/dist/ripple/{p-e0ca71d3.entry.js → p-eb596891.entry.js} +1 -1
- package/dist/ripple/{p-35627044.system.entry.js → p-ec384895.system.entry.js} +1 -1
- package/dist/ripple/{p-5356db9b.entry.js → p-eccb5aaf.entry.js} +1 -1
- package/dist/ripple/{p-567c5edd.system.entry.js → p-edcb8f48.system.entry.js} +1 -1
- package/dist/ripple/{p-d8f1fd76.entry.js → p-f963be6d.entry.js} +1 -1
- package/dist/ripple/{p-838d75c2.system.js → p-fde81b94.system.js} +1 -1
- package/dist/ripple/{p-d37a720b.system.entry.js → p-ff7dac66.system.entry.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/stencil-public-runtime.d.ts +0 -2
- package/package.json +2 -2
- package/dist/collection/components/charts/chartFunctions.spec.js +0 -16
- package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.e2e.js +0 -81
- package/dist/collection/components/charts/screenshots.e2e.js +0 -96
- package/dist/collection/components/charts/wm-chart/wm-chart.e2e.js +0 -213
- package/dist/collection/components/charts/wm-chart/wm-chart.spec.js +0 -37
- package/dist/collection/components/charts/wm-line-chart/wm-line-chart.e2e.js +0 -176
- package/dist/collection/components/charts/wm-line-chart/wm-line-chart.spec.js +0 -163
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.e2e.js +0 -69
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.spec.js +0 -79
- package/dist/collection/components/wm-action-menu/wm-action-menu.e2e.js +0 -200
- package/dist/collection/components/wm-action-menu/wm-action-menu.spec.js +0 -48
- package/dist/collection/components/wm-button/wm-button.e2e.js +0 -55
- package/dist/collection/components/wm-button/wm-button.spec.js +0 -74
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.spec.js +0 -76
- package/dist/collection/components/wm-datepicker/wm-datepicker.e2e.js +0 -382
- package/dist/collection/components/wm-datepicker/wm-datepicker.spec.js +0 -21
- package/dist/collection/components/wm-file/wm-file.spec.js +0 -194
- package/dist/collection/components/wm-file-list/wm-file-list.spec.js +0 -69
- package/dist/collection/components/wm-input/wm-input.e2e.js +0 -32
- package/dist/collection/components/wm-input/wm-input.spec.js +0 -173
- package/dist/collection/components/wm-menuitem/wm-menuitem.e2e.js +0 -23
- package/dist/collection/components/wm-menuitem/wm-menuitem.spec.js +0 -54
- package/dist/collection/components/wm-modal/wm-modal-footer.spec.js +0 -11
- package/dist/collection/components/wm-modal/wm-modal-header.spec.js +0 -8
- package/dist/collection/components/wm-modal/wm-modal.e2e.js +0 -104
- package/dist/collection/components/wm-modal/wm-modal.spec.js +0 -30
- package/dist/collection/components/wm-navigation/wm-navigation.e2e.js +0 -102
- package/dist/collection/components/wm-navigation/wm-navigation.spec.js +0 -91
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.e2e.js +0 -50
- package/dist/collection/components/wm-navigator/wm-navigator.e2e.js +0 -209
- package/dist/collection/components/wm-navigator/wm-navigator.spec.js +0 -177
- package/dist/collection/components/wm-option/wm-option.e2e.js +0 -22
- package/dist/collection/components/wm-option/wm-option.spec.js +0 -63
- package/dist/collection/components/wm-pagination/wm-pagination.e2e.js +0 -312
- package/dist/collection/components/wm-search/wm-search.e2e.js +0 -76
- package/dist/collection/components/wm-search/wm-search.spec.js +0 -71
- package/dist/collection/components/wm-select/wm-select.e2e.js +0 -521
- package/dist/collection/components/wm-select/wm-select.spec.js +0 -271
- package/dist/collection/components/wm-snackbar/wm-snackbar.e2e.js +0 -112
- package/dist/collection/components/wm-snackbar/wm-snackbar.spec.js +0 -9
- package/dist/collection/components/wm-tabs/wm-tabs.e2e.js +0 -91
- package/dist/collection/components/wm-tabs/wm-tabs.spec.js +0 -12
- package/dist/collection/components/wm-tag-input/wm-tag-input.e2e.js +0 -204
- package/dist/collection/components/wm-tag-input/wm-tag-input.spec.js +0 -195
- package/dist/collection/components/wm-textarea/wm-textarea.e2e.js +0 -41
- package/dist/collection/components/wm-textarea/wm-textarea.spec.js +0 -79
- package/dist/collection/components/wm-timepicker/wm-timepicker.e2e.js +0 -163
- package/dist/collection/components/wm-timepicker/wm-timepicker.spec.js +0 -147
- package/dist/collection/components/wm-toggletip/wm-toggletip.e2e.js +0 -69
- package/dist/collection/components/wm-toggletip/wm-toggletip.spec.js +0 -21
- package/dist/collection/components/wm-uploader/wm-uploader.e2e.js +0 -70
- package/dist/collection/components/wm-uploader/wm-uploader.spec.js +0 -234
- package/dist/collection/global/functions.spec.js +0 -126
- package/dist/collection/lang/lang.spec.js +0 -20
- package/dist/esm-es5/chartFunctions-e43ec877.js +0 -1
- package/dist/esm-es5/index-5815b978.js +0 -1
- package/dist/ripple/p-1eb84629.system.js +0 -2
- package/dist/ripple/p-7bf00a52.js +0 -2
- package/dist/ripple/p-9bf31e42.js +0 -1
- package/dist/ripple/p-aa41cf09.system.js +0 -1
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { newE2EPage } from "@stencil/core/testing";
|
|
2
|
-
import { AxePuppeteer } from "@axe-core/puppeteer";
|
|
3
|
-
describe("Progress Monitor", () => {
|
|
4
|
-
let page;
|
|
5
|
-
async function createPageHelper() {
|
|
6
|
-
page = await newE2EPage();
|
|
7
|
-
await page.setContent(`<html lang='en'><head><title>Page</title></head><body><main><h1>Title</h1>
|
|
8
|
-
<wm-progress-monitor id="first-monitor">
|
|
9
|
-
<wm-progress-indicator label="First Indicator">
|
|
10
|
-
<wm-progress-slice amount="5" popover-title="5/20 Completed" popover-text="Popover text" popover-button-text="Button text" legend="completed" </wm-progress-slice>
|
|
11
|
-
<wm-progress-slice amount="15" popover-title="15/20 Not completed" popover-text="Popover text" popover-button-text="Button text" legend="not completed" </wm-progress-slice>
|
|
12
|
-
</wm-progress-indicator>
|
|
13
|
-
<wm-progress-indicator label="Second Indicator">
|
|
14
|
-
<wm-progress-slice amount="3" popover-title="3/20 Completed" popover-text="Popover text" popover-button-text="Button text" legend="completed" </wm-progress-slice>
|
|
15
|
-
<wm-progress-slice amount="17" popover-title="17/20 Not completed" popover-text="Popover text" popover-button-text="Button text" legend="not completed" </wm-progress-slice>
|
|
16
|
-
</wm-progress-indicator>
|
|
17
|
-
</wm-progress-monitor>
|
|
18
|
-
</main></body></html>`);
|
|
19
|
-
}
|
|
20
|
-
it("passes Axe checks", async () => {
|
|
21
|
-
await createPageHelper();
|
|
22
|
-
const results = await new AxePuppeteer(page).analyze();
|
|
23
|
-
expect(results.violations.length).toBe(0);
|
|
24
|
-
});
|
|
25
|
-
// Monitor toggles Indicator modes
|
|
26
|
-
it("toggles indicator modes", async () => {
|
|
27
|
-
await createPageHelper();
|
|
28
|
-
const indicator = await page.find("wm-progress-indicator");
|
|
29
|
-
page.setViewport({ width: 500, height: 900 });
|
|
30
|
-
await page.waitForChanges();
|
|
31
|
-
let classes = indicator.shadowRoot.querySelector(".component-wrapper").getAttribute("class");
|
|
32
|
-
expect(classes).toContain("bar");
|
|
33
|
-
page.setViewport({ width: 700, height: 900 });
|
|
34
|
-
await page.waitForChanges();
|
|
35
|
-
classes = indicator.shadowRoot.querySelector(".component-wrapper").getAttribute("class");
|
|
36
|
-
expect(classes).toContain("doughnut");
|
|
37
|
-
});
|
|
38
|
-
/* can't get the popover to show
|
|
39
|
-
// Slices read x of y {{popover text}}
|
|
40
|
-
it("announces the slice to SR", async () => {
|
|
41
|
-
await createPageHelper();
|
|
42
|
-
const indicator = await page.find("wm-progress-indicator");
|
|
43
|
-
await page.keyboard.press("Tab");
|
|
44
|
-
await page.waitForChanges();
|
|
45
|
-
await page.keyboard.press("ArrowDown");
|
|
46
|
-
await page.waitForChanges();
|
|
47
|
-
const popover = indicator.shadowRoot.querySelector("priv-chart-popover");
|
|
48
|
-
const results = await page.compareScreenshot();
|
|
49
|
-
expect(results).toMatchScreenshot({ allowableMismatchedPixels: 100 });
|
|
50
|
-
|
|
51
|
-
popover.open = true;
|
|
52
|
-
const liveRegion = popover.querySelector(".live-region");
|
|
53
|
-
expect(liveRegion.textContent).toBe("");
|
|
54
|
-
});
|
|
55
|
-
*/
|
|
56
|
-
/*** E2E ***/
|
|
57
|
-
// Doughnuts display in row, bars display in column
|
|
58
|
-
// Popovers automatically appear when navigating via keyboard
|
|
59
|
-
// Popovers emit wmProgressIndicatorButtonTriggered
|
|
60
|
-
// Tab navigates through indicators, no tab stop on Monitor
|
|
61
|
-
// Clicking a slice opens the popover
|
|
62
|
-
// Clicking outside or hitting escape closes the popover
|
|
63
|
-
/*** CAN'T BE TESTED? ***/
|
|
64
|
-
// Default breakpoint is the width of all children
|
|
65
|
-
// Breakpoint is customizable
|
|
66
|
-
//// including "px" makes it px
|
|
67
|
-
//// # less than 100 refers to # of charts
|
|
68
|
-
//// # greater than 100 refers to px
|
|
69
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { newSpecPage } from "@stencil/core/testing";
|
|
2
|
-
import { ProgressMonitor } from "./wm-progress-monitor";
|
|
3
|
-
import { ProgressIndicator } from "./wm-progress-indicator";
|
|
4
|
-
import { ProgressSlice } from "./wm-progress-slice";
|
|
5
|
-
import * as globalFuncs from "../../../global/functions";
|
|
6
|
-
jest.spyOn(globalFuncs, "generateId");
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
globalFuncs.generateId.mockImplementation(() => "random-id");
|
|
9
|
-
// mock ResizeObserver
|
|
10
|
-
global.ResizeObserver = jest.fn().mockImplementation(() => ({
|
|
11
|
-
observe: jest.fn(),
|
|
12
|
-
unobserve: jest.fn(),
|
|
13
|
-
disconnect: jest.fn(),
|
|
14
|
-
}));
|
|
15
|
-
async function createPageHelper() {
|
|
16
|
-
return await newSpecPage({
|
|
17
|
-
components: [ProgressMonitor, ProgressIndicator, ProgressSlice],
|
|
18
|
-
html: `<wm-progress-monitor id="first-monitor">
|
|
19
|
-
<wm-progress-indicator label="First Indicator">
|
|
20
|
-
<wm-progress-slice
|
|
21
|
-
amount="5"
|
|
22
|
-
popover-title="5/20 Completed"
|
|
23
|
-
popover-text="Popover text"
|
|
24
|
-
popover-button-text="Button text"
|
|
25
|
-
legend="completed"
|
|
26
|
-
></wm-progress-slice>
|
|
27
|
-
<wm-progress-slice
|
|
28
|
-
amount="15"
|
|
29
|
-
popover-title="15/20 Not completed"
|
|
30
|
-
popover-text="Popover text"
|
|
31
|
-
popover-button-text="Button text"
|
|
32
|
-
legend="not completed"
|
|
33
|
-
></wm-progress-slice>
|
|
34
|
-
</wm-progress-indicator>
|
|
35
|
-
<wm-progress-indicator label="Second Indicator">
|
|
36
|
-
<wm-progress-slice
|
|
37
|
-
amount="3"
|
|
38
|
-
popover-title="3/20 Completed"
|
|
39
|
-
popover-text="Popover text"
|
|
40
|
-
popover-button-text="Button text"
|
|
41
|
-
legend="completed"
|
|
42
|
-
></wm-progress-slice>
|
|
43
|
-
<wm-progress-slice
|
|
44
|
-
amount="17"
|
|
45
|
-
popover-title="17/20 Not completed"
|
|
46
|
-
popover-text="Popover text"
|
|
47
|
-
popover-button-text="Button text"
|
|
48
|
-
legend="not completed"
|
|
49
|
-
></wm-progress-slice>
|
|
50
|
-
</wm-progress-indicator>
|
|
51
|
-
</wm-progress-monitor>`,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
describe("Progress Monitor", () => {
|
|
55
|
-
it("builds", async () => {
|
|
56
|
-
const page = await createPageHelper();
|
|
57
|
-
expect(page.root).toMatchSnapshot();
|
|
58
|
-
});
|
|
59
|
-
it("properties and attributes", async () => {
|
|
60
|
-
var _a;
|
|
61
|
-
const page = await createPageHelper();
|
|
62
|
-
const indicator = page.root.querySelector("wm-progress-indicator");
|
|
63
|
-
expect(indicator).toHaveProperty("label");
|
|
64
|
-
expect(indicator).toHaveProperty("subinfo");
|
|
65
|
-
expect(indicator).toHaveProperty("completionMessage");
|
|
66
|
-
expect(indicator).toHaveProperty("showLegend");
|
|
67
|
-
const indicatorComponentWrapper = (_a = indicator.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".component-wrapper");
|
|
68
|
-
expect(indicatorComponentWrapper).toEqualAttribute("role", "application");
|
|
69
|
-
expect(indicatorComponentWrapper).toEqualAttribute("aria-label", "First Indicator");
|
|
70
|
-
expect(indicatorComponentWrapper).toEqualAttribute("aria-roledescription", "Interactive chart");
|
|
71
|
-
expect(indicatorComponentWrapper).toEqualAttribute("aria-describedby", "chart-instructions");
|
|
72
|
-
const slice = page.root.querySelector("wm-progress-slice");
|
|
73
|
-
expect(slice).toHaveProperty("amount");
|
|
74
|
-
expect(slice).toHaveProperty("legend");
|
|
75
|
-
expect(slice).toHaveProperty("popoverTitle");
|
|
76
|
-
expect(slice).toHaveProperty("popoverText");
|
|
77
|
-
expect(slice).toHaveProperty("popoverButtonText");
|
|
78
|
-
});
|
|
79
|
-
});
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { newE2EPage } from "@stencil/core/testing";
|
|
2
|
-
import { AxePuppeteer } from "@axe-core/puppeteer";
|
|
3
|
-
describe("wm-action-menu", () => {
|
|
4
|
-
let page;
|
|
5
|
-
beforeEach(async () => {
|
|
6
|
-
page = await newE2EPage();
|
|
7
|
-
await page.setContent("<html lang='en'><head><title>Page</title></head><body><main><h1>Title</h1><wm-action-menu id='test' tooltip='menu name'><wm-menuitem id='first' onClick='action()'>First action</wm-menuitem><wm-menuitem id='second'>Second action</wm-menuitem><wm-menuitem id='third'>Third action</wm-menuitem></wm-action-menu><script>function action() {document.getElementById('first').innerHTML = 'Changed text'}</script></main></body></html>");
|
|
8
|
-
});
|
|
9
|
-
it("passes Axe checks", async () => {
|
|
10
|
-
const results = await new AxePuppeteer(page).analyze();
|
|
11
|
-
expect(results.violations.length).toBe(0);
|
|
12
|
-
});
|
|
13
|
-
//ATTRIBUTES;
|
|
14
|
-
it("has the right WAI_ARIA roles, states and properties", async () => {
|
|
15
|
-
const wmbtn = await page.find("wm-action-menu >>> wm-button");
|
|
16
|
-
const menu = await page.find("wm-action-menu >>> #menu-test");
|
|
17
|
-
const second = await page.find("#second");
|
|
18
|
-
const third = await page.find("#third");
|
|
19
|
-
await page.waitForChanges();
|
|
20
|
-
// check aria-expanded attribute
|
|
21
|
-
expect(wmbtn).toEqualAttribute("aria-expanded", "false");
|
|
22
|
-
// If the element with the aria-expanded attribute controls the expansion of another grouping container that is not 'owned by' the element, the author SHOULD reference the container by using the aria-controls attribute.
|
|
23
|
-
// src: https://www.w3.org/WAI/PF/aria/states_and_properties#aria-expanded
|
|
24
|
-
expect(wmbtn).toEqualAttribute("aria-controls", "menu-test");
|
|
25
|
-
// An element that contains or owns all the menu items has role menu.
|
|
26
|
-
expect(menu).toEqualAttribute("role", "menu");
|
|
27
|
-
expect(menu).toEqualAttribute("tabindex", "-1");
|
|
28
|
-
// Each menuitem in the menu has role menuitem.
|
|
29
|
-
expect(second).toEqualAttribute("role", "menuitem"); // just checking one randomly
|
|
30
|
-
expect(third).toEqualAttribute("tabindex", "-1");
|
|
31
|
-
});
|
|
32
|
-
// Down Arrow: Moves focus to the first menuitem. If the dropdown is collapsed, it also expands the list.
|
|
33
|
-
// Up Arrow: Moves focus to the last menuitem. If the dropdown is collapsed, it also expands the list.
|
|
34
|
-
it("handles Up and Down Arrow keys", async () => {
|
|
35
|
-
const wmbtn = await page.find("wm-action-menu >>> wm-button");
|
|
36
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("false");
|
|
37
|
-
await page.keyboard.press("Tab");
|
|
38
|
-
await page.waitForChanges();
|
|
39
|
-
await page.keyboard.press("ArrowDown");
|
|
40
|
-
await page.waitForChanges();
|
|
41
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("true");
|
|
42
|
-
const first = await page.find("wm-menuitem#first >>> div");
|
|
43
|
-
const second = await page.find("wm-menuitem#second >>> div");
|
|
44
|
-
expect(first).toHaveClass("focus");
|
|
45
|
-
await page.keyboard.press("ArrowDown");
|
|
46
|
-
await page.waitForChanges();
|
|
47
|
-
expect(second).toHaveClass("focus");
|
|
48
|
-
await page.keyboard.press("ArrowUp");
|
|
49
|
-
await page.waitForChanges();
|
|
50
|
-
expect(first).toHaveClass("focus");
|
|
51
|
-
await page.keyboard.press("Enter");
|
|
52
|
-
await page.waitForChanges();
|
|
53
|
-
await page.waitForTimeout(500); //allow closing animation and setTimeout to finish
|
|
54
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("false");
|
|
55
|
-
await page.keyboard.press("ArrowUp");
|
|
56
|
-
await page.waitForChanges();
|
|
57
|
-
// after the action runs the dropdown close and the dev should focus the relevant element.
|
|
58
|
-
// in case they don't, focus will return to the body. The component checks that and brings focus
|
|
59
|
-
// back to the button when that's the case.
|
|
60
|
-
// Things seem to happen differently with headless chrome / puppeteer. Focus stays on the menuitem even after
|
|
61
|
-
// it has become unable to have focus in normal browsers (after dropdown closes). Focus never gets to body.
|
|
62
|
-
// So here we simply test that the active el is not the body
|
|
63
|
-
const activeEl = await page.evaluate(() => document.activeElement.tagName);
|
|
64
|
-
expect(activeEl).not.toEqual("BODY");
|
|
65
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("true");
|
|
66
|
-
await page.keyboard.press("ArrowUp");
|
|
67
|
-
await page.waitForChanges();
|
|
68
|
-
expect(second).toHaveClass("focus");
|
|
69
|
-
});
|
|
70
|
-
// Home: If the dropdown is displayed, moves focus to first menuitem.
|
|
71
|
-
// End: If the dropdown is displayed, moves focus to last menuitem.
|
|
72
|
-
it("handles Home and End keys", async () => {
|
|
73
|
-
await page.keyboard.press("Tab");
|
|
74
|
-
await page.keyboard.press("Enter");
|
|
75
|
-
await page.waitForTimeout(40);
|
|
76
|
-
await page.keyboard.press("ArrowDown");
|
|
77
|
-
await page.keyboard.press("ArrowDown");
|
|
78
|
-
await page.waitForChanges();
|
|
79
|
-
const focusedEl = await page.find("wm-menuitem#third >>> div");
|
|
80
|
-
expect(focusedEl).toHaveClass("focus");
|
|
81
|
-
await page.keyboard.press("Home");
|
|
82
|
-
await page.waitForChanges();
|
|
83
|
-
const homefocusedEl = await page.find("wm-menuitem#first >>> div");
|
|
84
|
-
expect(focusedEl).not.toHaveClass("focus");
|
|
85
|
-
expect(homefocusedEl).toHaveClass("focus");
|
|
86
|
-
await page.keyboard.press("End");
|
|
87
|
-
await page.waitForChanges();
|
|
88
|
-
const endfocusedEl = await page.find("wm-menuitem#third >>> div");
|
|
89
|
-
expect(endfocusedEl).toHaveClass("focus");
|
|
90
|
-
});
|
|
91
|
-
// - Type a character: focus moves to the next menuitem with a name that starts with the typed character.
|
|
92
|
-
// - Type multiple characters in rapid succession: focus moves to the next menuitem with a name that starts with the string of characters typed
|
|
93
|
-
it("handles typing", async () => {
|
|
94
|
-
await page.keyboard.press("Tab");
|
|
95
|
-
await page.keyboard.press("Enter");
|
|
96
|
-
await page.waitForChanges();
|
|
97
|
-
await page.keyboard.press("t");
|
|
98
|
-
await page.waitForChanges();
|
|
99
|
-
const focusedEl = await page.find("wm-menuitem#third >>> div");
|
|
100
|
-
expect(focusedEl).toHaveClass("focus");
|
|
101
|
-
});
|
|
102
|
-
// OPEN / CLOSE
|
|
103
|
-
// Spacebar: Should open the popup (we didn't implement, comes for free. Test is to make sure we don't break it)
|
|
104
|
-
it("handles the Spacebar key", async () => {
|
|
105
|
-
await page.keyboard.press("Tab");
|
|
106
|
-
await page.keyboard.press("Space");
|
|
107
|
-
await page.waitForChanges();
|
|
108
|
-
const wmbtn = await page.find("wm-action-menu >>> wm-button");
|
|
109
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("true");
|
|
110
|
-
});
|
|
111
|
-
// Escape: If the menu is displayed, closes the popup and returns focus to the button.
|
|
112
|
-
it("handles the Escape key", async () => {
|
|
113
|
-
await page.keyboard.press("Tab");
|
|
114
|
-
await page.keyboard.press("Enter");
|
|
115
|
-
await page.waitForChanges();
|
|
116
|
-
const wmbtn = await page.find("wm-action-menu >>> wm-button");
|
|
117
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("true");
|
|
118
|
-
await page.keyboard.press("ArrowDown");
|
|
119
|
-
await page.keyboard.press("Escape");
|
|
120
|
-
await page.waitForChanges();
|
|
121
|
-
await page.waitForTimeout(500); //allow closing animation and setTimeout to finish
|
|
122
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("false");
|
|
123
|
-
const activeElId = await page.evaluate(() => document.activeElement.id);
|
|
124
|
-
expect(activeElId).toEqual("test");
|
|
125
|
-
//When dropdown reopens, focus returns to first element
|
|
126
|
-
await page.keyboard.press("Enter");
|
|
127
|
-
await page.waitForChanges();
|
|
128
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("true");
|
|
129
|
-
const focusedEl = await page.find("wm-menuitem#first >>> div");
|
|
130
|
-
expect(focusedEl).toHaveClass("focus"); //
|
|
131
|
-
});
|
|
132
|
-
// Enter:
|
|
133
|
-
// - If the focus is on the button, it expands the dropdown and places focuses on the first menuitem.
|
|
134
|
-
// - If the dropdown is open, it closes the dropdown.
|
|
135
|
-
it("opens and closes the dropdown when enter key is pressed", async () => {
|
|
136
|
-
await page.keyboard.press("Tab");
|
|
137
|
-
const wmbtn = await page.find("wm-action-menu >>> wm-button");
|
|
138
|
-
await page.keyboard.press("Enter");
|
|
139
|
-
await page.waitForChanges();
|
|
140
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("true");
|
|
141
|
-
await page.keyboard.press("Enter");
|
|
142
|
-
await page.waitForChanges();
|
|
143
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("false");
|
|
144
|
-
});
|
|
145
|
-
it("runs the onClick function passed to the menuitem when clicked or key pressed", async () => {
|
|
146
|
-
page = await newE2EPage();
|
|
147
|
-
await page.setContent(`<html lang='en'><head><title>Page</title></head><body><main><h1>Title</h1>
|
|
148
|
-
<wm-action-menu id='test' tooltip='menu name'>
|
|
149
|
-
<wm-menuitem id='first' onClick='action()'>First action</wm-menuitem>
|
|
150
|
-
</wm-action-menu>
|
|
151
|
-
<div id='changeMe'>default</div>
|
|
152
|
-
<script>
|
|
153
|
-
function action() {
|
|
154
|
-
document.getElementById('changeMe').textContent += "&"
|
|
155
|
-
}
|
|
156
|
-
</script></main></body></html>`);
|
|
157
|
-
const div = await page.find("#changeMe");
|
|
158
|
-
await page.keyboard.press("Tab");
|
|
159
|
-
await page.waitForChanges();
|
|
160
|
-
await page.keyboard.press("Enter");
|
|
161
|
-
await page.waitForChanges();
|
|
162
|
-
await page.keyboard.press("Enter");
|
|
163
|
-
await page.waitForChanges();
|
|
164
|
-
expect(div.textContent).toBe("default&");
|
|
165
|
-
await page.waitForTimeout(300); // make sure menu is closed before reopening (closes after the 250ms animation)
|
|
166
|
-
await page.keyboard.press("Enter");
|
|
167
|
-
await page.waitForChanges();
|
|
168
|
-
await page.click("#first");
|
|
169
|
-
await page.waitForChanges();
|
|
170
|
-
expect(div.textContent).toBe("default&&");
|
|
171
|
-
});
|
|
172
|
-
it("doesn't open the dropdown if the dropdown is disabled", async () => {
|
|
173
|
-
await page.evaluate(() => document.querySelector("wm-action-menu").setAttribute("disabled", "true"));
|
|
174
|
-
await page.keyboard.press("Tab");
|
|
175
|
-
await page.keyboard.press("Enter");
|
|
176
|
-
await page.waitForChanges();
|
|
177
|
-
const wmbtn = await page.find("wm-action-menu >>> wm-button");
|
|
178
|
-
await page.waitForChanges();
|
|
179
|
-
expect(wmbtn.getAttribute("aria-expanded")).toEqual("false");
|
|
180
|
-
});
|
|
181
|
-
// TOOLTIP
|
|
182
|
-
it("renders a tooltip when type is icon", async () => {
|
|
183
|
-
await page.keyboard.press("Tab");
|
|
184
|
-
await page.waitForChanges();
|
|
185
|
-
const tooltipEl = await page.find("#wm-tooltip");
|
|
186
|
-
expect(tooltipEl.textContent).toBe("menu name");
|
|
187
|
-
});
|
|
188
|
-
it("uses the label instead of tooltip text", async () => {
|
|
189
|
-
page = await newE2EPage();
|
|
190
|
-
await page.setContent("<wm-action-menu icon='f1c0' action-menu-type='icon' tooltip='delete' label-for-identical-buttons='delete this particular thing'><wm-menuitem>1</wm-menuitem></wm-action-menu>");
|
|
191
|
-
// use case: when the tooltip is something like "edit" and there are several buttons on a page, the aria label should be more specific than the tooltip
|
|
192
|
-
const wmbtn = await page.find("wm-action-menu >>> wm-button");
|
|
193
|
-
const btn = wmbtn.shadowRoot.querySelector("button");
|
|
194
|
-
await page.keyboard.press("Tab");
|
|
195
|
-
await page.waitForChanges();
|
|
196
|
-
const tooltipEl = await page.find("#wm-tooltip");
|
|
197
|
-
expect(tooltipEl.textContent).toEqual("delete");
|
|
198
|
-
expect(btn).toEqualAttribute("aria-label", "delete this particular thing");
|
|
199
|
-
});
|
|
200
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { newSpecPage } from "@stencil/core/testing";
|
|
2
|
-
import { ActionMenu } from "./wm-action-menu";
|
|
3
|
-
import { Menuitem } from "../wm-menuitem/wm-menuitem";
|
|
4
|
-
import * as globalFuncs from "../../global/functions";
|
|
5
|
-
jest.spyOn(globalFuncs, "getTextDir").mockImplementation(() => "rtl");
|
|
6
|
-
jest.spyOn(globalFuncs, "generateId");
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
globalFuncs.generateId.mockImplementation(() => "random-id");
|
|
9
|
-
describe("wm-action-menu", () => {
|
|
10
|
-
it("builds", async () => {
|
|
11
|
-
const page = await newSpecPage({
|
|
12
|
-
components: [ActionMenu, Menuitem],
|
|
13
|
-
html: "<wm-action-menu action-menu-type='icon' tooltip='Menu Name'><wm-menuitem icon='f3eb' onClick='someFunction()'>Menuitem one</wm-menuitem></wm-action-menu>",
|
|
14
|
-
});
|
|
15
|
-
expect(page.root).toMatchSnapshot();
|
|
16
|
-
});
|
|
17
|
-
it("has the right props", () => {
|
|
18
|
-
const menu = new ActionMenu();
|
|
19
|
-
expect(menu).toHaveProperty("childItems");
|
|
20
|
-
expect(menu).toHaveProperty("keysSoFar");
|
|
21
|
-
expect(menu).toHaveProperty("searchIndex");
|
|
22
|
-
expect(menu).toHaveProperty("tooltipPosition");
|
|
23
|
-
expect(menu).toHaveProperty("actionMenuType");
|
|
24
|
-
expect(menu).toHaveProperty("buttonText");
|
|
25
|
-
expect(menu).toHaveProperty("tooltip");
|
|
26
|
-
expect(menu).toHaveProperty("labelForIdenticalButtons");
|
|
27
|
-
});
|
|
28
|
-
describe("error throwing", () => {
|
|
29
|
-
it("throws error when action-menu-type is text/selector but no button-text is passed", async () => {
|
|
30
|
-
const mockFunc = jest.fn();
|
|
31
|
-
console.error = mockFunc;
|
|
32
|
-
await newSpecPage({
|
|
33
|
-
components: [ActionMenu, Menuitem],
|
|
34
|
-
html: "<wm-action-menu action-menu-type='text'><wm-menuitem icon='f3eb' onClick='someFunction()'>Menuitem one</wm-menuitem></wm-action-menu>",
|
|
35
|
-
});
|
|
36
|
-
expect(mockFunc).toHaveBeenCalledWith("wm-action-menu should have a valid button-text property when action-menu-type is set to 'text' or 'selector'");
|
|
37
|
-
});
|
|
38
|
-
it("throws error when action-menu-type is icon but no tooltip is passed", async () => {
|
|
39
|
-
const mockFunc = jest.fn();
|
|
40
|
-
console.error = mockFunc;
|
|
41
|
-
await newSpecPage({
|
|
42
|
-
components: [ActionMenu, Menuitem],
|
|
43
|
-
html: "<wm-action-menu action-menu-type='icon'><wm-menuitem icon='f3eb' onClick='someFunction()'>Menuitem one</wm-menuitem></wm-action-menu>",
|
|
44
|
-
});
|
|
45
|
-
expect(mockFunc).toHaveBeenCalledWith("wm-action-menu should have a valid tooltip when action-menu-type is set to 'icon'");
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { newE2EPage } from "@stencil/core/testing";
|
|
2
|
-
import { AxePuppeteer } from "@axe-core/puppeteer";
|
|
3
|
-
describe("wm-button", () => {
|
|
4
|
-
let page;
|
|
5
|
-
beforeEach(async () => {
|
|
6
|
-
page = await newE2EPage();
|
|
7
|
-
});
|
|
8
|
-
it("passes Axe checks", async () => {
|
|
9
|
-
await page.setContent(`<html lang='en'><head><title>Page</title></head><body><main><h1>Title</h1>
|
|
10
|
-
<wm-button>Click me</wm-button>
|
|
11
|
-
</main></body></html>`);
|
|
12
|
-
const results = await new AxePuppeteer(page).analyze();
|
|
13
|
-
expect(results.violations.length).toBe(0);
|
|
14
|
-
});
|
|
15
|
-
it("renders a button", async () => {
|
|
16
|
-
await page.setContent("<wm-button></wm-button>");
|
|
17
|
-
const element = await page.find("wm-button >>> button");
|
|
18
|
-
expect(element).not.toBeNull();
|
|
19
|
-
});
|
|
20
|
-
it("delegates focus", async () => {
|
|
21
|
-
await page.setContent("<wm-button>click here</wm-button>");
|
|
22
|
-
const wmButton = await page.find("wm-button");
|
|
23
|
-
wmButton.focus();
|
|
24
|
-
let activeEl = await page.evaluate(async () => {
|
|
25
|
-
let el = await document.activeElement.shadowRoot.activeElement;
|
|
26
|
-
return el.nodeName;
|
|
27
|
-
});
|
|
28
|
-
expect(activeEl).toBe("BUTTON");
|
|
29
|
-
});
|
|
30
|
-
it("renders a tooltip for text-only buttons if text is truncated", async () => {
|
|
31
|
-
await page.setContent("<wm-button text-wrap='false' style='width: 100px' button-type='textonly'>Text-only button with a very long text and text-wrap set to false</wm-button>");
|
|
32
|
-
await page.waitForChanges();
|
|
33
|
-
await page.keyboard.press("Tab");
|
|
34
|
-
await page.waitForChanges();
|
|
35
|
-
const tooltip = await page.find("#wm-tooltip");
|
|
36
|
-
expect(tooltip.textContent).toEqual("Text-only button with a very long text and text-wrap set to false");
|
|
37
|
-
});
|
|
38
|
-
it("uses the label instead of tooltip text", async () => {
|
|
39
|
-
// use case: when the tooltip is something like "edit" and there are several buttons on a page, the aria label should be more specific than the tooltip
|
|
40
|
-
await page.setContent("<wm-button button-type='icononly' icon='f1c0' tooltip='delete' label-for-identical-buttons='Delete item 37' ></wm-button>");
|
|
41
|
-
await page.waitForChanges();
|
|
42
|
-
const btn = await page.find("wm-button >>> button");
|
|
43
|
-
expect(btn.getAttribute("aria-label")).toBe("Delete item 37");
|
|
44
|
-
});
|
|
45
|
-
it("renders the passed-in property button type property as a class", async () => {
|
|
46
|
-
await page.setContent("<wm-button></wm-button>");
|
|
47
|
-
const component = await page.find("wm-button");
|
|
48
|
-
const defaultButton = await page.find("wm-button >>> button");
|
|
49
|
-
expect(defaultButton).toHaveClass("-secondary");
|
|
50
|
-
component.setProperty("buttonType", "primary");
|
|
51
|
-
const primaryButton = await page.find("wm-button >>> button");
|
|
52
|
-
await page.waitForChanges();
|
|
53
|
-
expect(primaryButton).toHaveClass("-primary");
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { newSpecPage } from "@stencil/core/testing";
|
|
2
|
-
import * as globalFunctions from "../../global/functions";
|
|
3
|
-
jest.spyOn(globalFunctions, "generateId").mockReturnValue("random-id");
|
|
4
|
-
import { Button } from "./wm-button";
|
|
5
|
-
describe("button", () => {
|
|
6
|
-
it("builds", async () => {
|
|
7
|
-
const page = await newSpecPage({
|
|
8
|
-
components: [Button],
|
|
9
|
-
html: "<wm-button></wm-button>",
|
|
10
|
-
});
|
|
11
|
-
expect(page.root).toMatchSnapshot();
|
|
12
|
-
});
|
|
13
|
-
it("has style and an icon type props with default values", async () => {
|
|
14
|
-
const page = await newSpecPage({
|
|
15
|
-
components: [Button],
|
|
16
|
-
html: "<wm-button></wm-button>",
|
|
17
|
-
});
|
|
18
|
-
const button = page.root;
|
|
19
|
-
const buttonEl = page.root.shadowRoot.querySelector("button");
|
|
20
|
-
expect(button).toHaveProperty("buttonType");
|
|
21
|
-
expect(button.buttonType).toEqual("secondary");
|
|
22
|
-
expect(buttonEl).toHaveClass("-secondary");
|
|
23
|
-
expect(button).toHaveProperty("icon");
|
|
24
|
-
expect(button.icon).toEqual(undefined);
|
|
25
|
-
expect(button).toHaveProperty("iconSize");
|
|
26
|
-
expect(button.iconSize).toBeUndefined;
|
|
27
|
-
});
|
|
28
|
-
it("has a method that validates the style property and resets an invalid property to a button type of secondary", async () => {
|
|
29
|
-
const page = await newSpecPage({
|
|
30
|
-
components: [Button],
|
|
31
|
-
html: "<wm-button></wm-button>",
|
|
32
|
-
});
|
|
33
|
-
const button = page.root;
|
|
34
|
-
expect(button).toHaveProperty("buttonType");
|
|
35
|
-
button.setAttribute("button-type", "foobar");
|
|
36
|
-
expect(button.buttonType).toEqual("secondary");
|
|
37
|
-
});
|
|
38
|
-
it("sets the aria label if the property labelForIdenticalButtons is passed", async () => {
|
|
39
|
-
const page = await newSpecPage({
|
|
40
|
-
components: [Button],
|
|
41
|
-
html: "<wm-button label-for-identical-buttons='read this instead of the text'>Button</wm-button>",
|
|
42
|
-
});
|
|
43
|
-
const button = page.root.shadowRoot.querySelector("button");
|
|
44
|
-
expect(button).toEqualAttribute("aria-label", "read this instead of the text");
|
|
45
|
-
});
|
|
46
|
-
// TOOLTIP
|
|
47
|
-
describe("error throwing", () => {
|
|
48
|
-
it("throws error when icononly or navigational button used without tooltip", async () => {
|
|
49
|
-
const mockFunc = jest.fn();
|
|
50
|
-
console.error = mockFunc;
|
|
51
|
-
await newSpecPage({
|
|
52
|
-
components: [Button],
|
|
53
|
-
html: "<wm-button icon='f1c0' button-type='icononly'></wm-button>",
|
|
54
|
-
});
|
|
55
|
-
expect(mockFunc).toHaveBeenCalledWith("wm-button should have a valid 'tooltip' property when button-type is set to 'icononly' or 'navigational'.");
|
|
56
|
-
const mockFunc2 = jest.fn();
|
|
57
|
-
console.error = mockFunc2;
|
|
58
|
-
await newSpecPage({
|
|
59
|
-
components: [Button],
|
|
60
|
-
html: "<wm-button icon='f1c0' button-type='navigational'></wm-button>",
|
|
61
|
-
});
|
|
62
|
-
expect(mockFunc2).toHaveBeenCalledWith("wm-button should have a valid 'tooltip' property when button-type is set to 'icononly' or 'navigational'.");
|
|
63
|
-
});
|
|
64
|
-
it("throws error when icononly button used without icon", async () => {
|
|
65
|
-
const mockFunc = jest.fn();
|
|
66
|
-
console.error = mockFunc;
|
|
67
|
-
await newSpecPage({
|
|
68
|
-
components: [Button],
|
|
69
|
-
html: "<wm-button button-type='icononly' tooltip='edit'></wm-button>",
|
|
70
|
-
});
|
|
71
|
-
expect(mockFunc).toHaveBeenCalledWith("wm-button should have a valid 'icon' property when button-type is set to 'icononly' or 'navigational'.");
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
});
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { newSpecPage } from "@stencil/core/testing";
|
|
2
|
-
import { PrivDatepicker } from "./priv-datepicker";
|
|
3
|
-
describe("priv-datepicker", () => {
|
|
4
|
-
// ts erroneously prints a warning (unused var)
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
let page, privDatepicker;
|
|
7
|
-
beforeEach(async () => {
|
|
8
|
-
page = await newSpecPage({
|
|
9
|
-
components: [PrivDatepicker],
|
|
10
|
-
html: "<priv-datepicker></priv-datepicker>",
|
|
11
|
-
});
|
|
12
|
-
privDatepicker = page.root;
|
|
13
|
-
});
|
|
14
|
-
it("gets the number of days in a month", async () => {
|
|
15
|
-
const pd = new PrivDatepicker();
|
|
16
|
-
expect(pd.getMonthDays(1, 2021)).toBe(31);
|
|
17
|
-
expect(pd.getMonthDays(2, 2021)).toBe(28);
|
|
18
|
-
expect(pd.getMonthDays(2, 2020)).toBe(29);
|
|
19
|
-
expect(pd.getMonthDays(11, 2067)).toBe(30);
|
|
20
|
-
expect(pd.getMonthDays(13, 2)).toBe(31); // returns 31 by default
|
|
21
|
-
});
|
|
22
|
-
it("pads numbers", async () => {
|
|
23
|
-
const pd = new PrivDatepicker();
|
|
24
|
-
expect(pd.zeroPad(3, 1)).toBe("3");
|
|
25
|
-
expect(pd.zeroPad(3, 2)).toBe("03");
|
|
26
|
-
expect(pd.zeroPad(3, 3)).toBe("003");
|
|
27
|
-
expect(pd.zeroPad("003", 3)).toBe("003");
|
|
28
|
-
expect(pd.zeroPad("12345", 3)).toBe("12345");
|
|
29
|
-
expect(pd.zeroPad("12345.34", 3)).toBe("12345.34");
|
|
30
|
-
});
|
|
31
|
-
it("removes leading zeroes", async () => {
|
|
32
|
-
const pd = new PrivDatepicker();
|
|
33
|
-
expect(pd.removeZeroes("12")).toBe(12);
|
|
34
|
-
expect(pd.removeZeroes("01")).toBe(1);
|
|
35
|
-
expect(pd.removeZeroes("0001312")).toBe(1312);
|
|
36
|
-
// note that the function only works for integers
|
|
37
|
-
// the following would fail
|
|
38
|
-
// expect(pd.removeZeroes("3.1415")).toBe(3.1415);
|
|
39
|
-
});
|
|
40
|
-
it("finds the first weekday of the month", async () => {
|
|
41
|
-
// 1 = Sunday, 7 = Saturday
|
|
42
|
-
const pd = new PrivDatepicker();
|
|
43
|
-
expect(pd.getMonthFirstDay(2, 2021)).toBe(2); // Mon
|
|
44
|
-
expect(pd.getMonthFirstDay(7, 1986)).toBe(3); // Tue
|
|
45
|
-
expect(pd.getMonthFirstDay(12, 2030)).toBe(1); // Sun
|
|
46
|
-
});
|
|
47
|
-
it("finds the previous month", async () => {
|
|
48
|
-
const pd = new PrivDatepicker();
|
|
49
|
-
expect(pd.getPreviousMonth(12, 2000)).toStrictEqual({ month: 11, year: 2000 });
|
|
50
|
-
expect(pd.getPreviousMonth(1, 2000)).toStrictEqual({ month: 12, year: 1999 });
|
|
51
|
-
});
|
|
52
|
-
it("finds the next month", async () => {
|
|
53
|
-
const pd = new PrivDatepicker();
|
|
54
|
-
expect(pd.getNextMonth(12, 2000)).toStrictEqual({ month: 1, year: 2001 });
|
|
55
|
-
expect(pd.getNextMonth(1, 2000)).toStrictEqual({ month: 2, year: 2000 });
|
|
56
|
-
});
|
|
57
|
-
it("generates the calendar dates", async () => {
|
|
58
|
-
const pd = new PrivDatepicker();
|
|
59
|
-
expect(pd.getCalendarDates(8, 2021)).toMatchSnapshot();
|
|
60
|
-
});
|
|
61
|
-
it("checks if the date is today", async () => {
|
|
62
|
-
// format is array with year, month, day
|
|
63
|
-
const pd = new PrivDatepicker();
|
|
64
|
-
expect(pd.isDateToday(["2012", "12", "12"])).toBe(false);
|
|
65
|
-
expect(pd.isDateToday(["2021", "9", "13"])).toBe(false);
|
|
66
|
-
const today = new Date();
|
|
67
|
-
let todayDateArray = [
|
|
68
|
-
today.getFullYear().toString(),
|
|
69
|
-
(today.getMonth() + 1).toString(),
|
|
70
|
-
today.getDate().toString(),
|
|
71
|
-
];
|
|
72
|
-
todayDateArray[1] = pd.zeroPad(todayDateArray[1], 2);
|
|
73
|
-
todayDateArray[2] = pd.zeroPad(todayDateArray[2], 2);
|
|
74
|
-
expect(pd.isDateToday(todayDateArray)).toBe(true);
|
|
75
|
-
});
|
|
76
|
-
});
|