@mgdis/mg-components 5.19.2 → 5.20.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/{components.utils-dc9c8a53.js → components.utils-cd908d4e.js} +102 -99
- package/dist/cjs/components.utils-cd908d4e.js.map +1 -0
- package/dist/cjs/{index-c042e24b.js → index-8532b5e9.js} +320 -137
- package/dist/cjs/index-8532b5e9.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_34.cjs.entry.js +5130 -5057
- package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +224 -224
- package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
- package/dist/collection/assets/icons/index.js +193 -183
- package/dist/collection/assets/icons/index.js.map +1 -0
- package/dist/collection/collection-manifest.json +6 -6
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +161 -161
- package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +362 -347
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/atoms/mg-card/mg-card.js +126 -126
- package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +101 -101
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -1
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +47 -47
- package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +231 -231
- package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -1
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +132 -132
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +158 -158
- package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +46 -46
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +3 -3
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +398 -398
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +8 -0
- package/dist/collection/components/molecules/inputs/MgInput.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +84 -84
- package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +8 -8
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +266 -266
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +4 -4
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +789 -791
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +4 -4
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +589 -572
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +4 -4
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +779 -767
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +537 -520
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +566 -550
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +701 -689
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +0 -4
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +771 -754
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +706 -689
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +527 -522
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +2 -2
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +263 -263
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +6 -6
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +423 -423
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +214 -214
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +155 -150
- package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +332 -335
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +85 -85
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +189 -189
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +325 -304
- package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +317 -317
- package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js +2 -2
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +216 -216
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +409 -399
- package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +91 -91
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +336 -329
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +94 -94
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +4 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +348 -343
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
- package/dist/collection/locales/fr/messages.json +4 -4
- package/dist/collection/locales/index.spec.js +20 -20
- package/dist/collection/locales/index.spec.js.map +1 -1
- package/dist/collection/utils/behaviors.utils.js +127 -127
- package/dist/collection/utils/behaviors.utils.js.map +1 -1
- package/dist/collection/utils/behaviors.utils.spec.js +42 -42
- package/dist/collection/utils/behaviors.utils.spec.js.map +1 -1
- package/dist/collection/utils/components.utils.js +77 -75
- package/dist/collection/utils/components.utils.js.map +1 -1
- package/dist/collection/utils/components.utils.spec.js +150 -135
- package/dist/collection/utils/components.utils.spec.js.map +1 -1
- package/dist/collection/utils/e2e.test.utils.js +21 -21
- package/dist/collection/utils/e2e.test.utils.js.map +1 -1
- package/dist/collection/utils/locale.utils.js +17 -17
- package/dist/collection/utils/locale.utils.js.map +1 -1
- package/dist/collection/utils/locale.utils.spec.js +45 -45
- package/dist/collection/utils/locale.utils.spec.js.map +1 -1
- package/dist/collection/utils/playwright.e2e.test.utils.js +41 -41
- package/dist/collection/utils/playwright.e2e.test.utils.js.map +1 -1
- package/dist/collection/utils/playwright.fixture.js +24 -0
- package/dist/collection/utils/playwright.fixture.js.map +1 -0
- package/dist/collection/utils/unit.test.utils.js +50 -50
- package/dist/collection/utils/unit.test.utils.js.map +1 -1
- package/dist/components/MgInput.js +105 -97
- package/dist/components/MgInput.js.map +1 -1
- package/dist/components/components.utils.js +78 -76
- package/dist/components/components.utils.js.map +1 -1
- package/dist/components/index2.js +21 -21
- package/dist/components/index2.js.map +1 -1
- package/dist/components/mg-action-more.d.ts +2 -2
- package/dist/components/mg-action-more.js +173 -173
- package/dist/components/mg-action-more.js.map +1 -1
- package/dist/components/mg-badge.d.ts +2 -2
- package/dist/components/mg-badge2.js +83 -83
- package/dist/components/mg-badge2.js.map +1 -1
- package/dist/components/mg-button.d.ts +2 -2
- package/dist/components/mg-button2.js +182 -167
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-card.d.ts +2 -2
- package/dist/components/mg-card2.js +77 -77
- package/dist/components/mg-card2.js.map +1 -1
- package/dist/components/mg-character-left.d.ts +2 -2
- package/dist/components/mg-character-left2.js +50 -50
- package/dist/components/mg-character-left2.js.map +1 -1
- package/dist/components/mg-details.d.ts +2 -2
- package/dist/components/mg-details.js +69 -69
- package/dist/components/mg-details.js.map +1 -1
- package/dist/components/mg-divider.d.ts +2 -2
- package/dist/components/mg-divider.js +30 -30
- package/dist/components/mg-divider.js.map +1 -1
- package/dist/components/mg-form.d.ts +2 -2
- package/dist/components/mg-form.js +171 -179
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-icon.d.ts +2 -2
- package/dist/components/mg-icon2.js +327 -309
- package/dist/components/mg-icon2.js.map +1 -1
- package/dist/components/mg-illustrated-message.d.ts +2 -2
- package/dist/components/mg-illustrated-message.js +51 -51
- package/dist/components/mg-illustrated-message.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated.d.ts +2 -2
- package/dist/components/mg-input-checkbox-paginated2.js +170 -170
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.d.ts +2 -2
- package/dist/components/mg-input-checkbox.js +478 -480
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.d.ts +2 -2
- package/dist/components/mg-input-date.js +266 -260
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.d.ts +2 -2
- package/dist/components/mg-input-numeric.js +354 -348
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.d.ts +2 -2
- package/dist/components/mg-input-password.js +205 -199
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.d.ts +2 -2
- package/dist/components/mg-input-radio.js +236 -231
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select.d.ts +2 -2
- package/dist/components/mg-input-select2.js +316 -310
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text.d.ts +2 -2
- package/dist/components/mg-input-text2.js +306 -300
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.d.ts +2 -2
- package/dist/components/mg-input-textarea.js +277 -271
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-title.d.ts +2 -2
- package/dist/components/mg-input-title2.js +60 -60
- package/dist/components/mg-input-title2.js.map +1 -1
- package/dist/components/mg-input-toggle.d.ts +2 -2
- package/dist/components/mg-input-toggle.js +251 -251
- package/dist/components/mg-input-toggle.js.map +1 -1
- package/dist/components/mg-item-more.d.ts +2 -2
- package/dist/components/mg-item-more.js +285 -285
- package/dist/components/mg-item-more.js.map +1 -1
- package/dist/components/mg-menu-item.d.ts +2 -2
- package/dist/components/mg-menu-item2.js +345 -345
- package/dist/components/mg-menu-item2.js.map +1 -1
- package/dist/components/mg-menu.conf.js +2 -2
- package/dist/components/mg-menu.conf.js.map +1 -1
- package/dist/components/mg-menu.d.ts +2 -2
- package/dist/components/mg-menu2.js +176 -176
- package/dist/components/mg-menu2.js.map +1 -1
- package/dist/components/mg-message.d.ts +2 -2
- package/dist/components/mg-message.js +198 -193
- package/dist/components/mg-message.js.map +1 -1
- package/dist/components/mg-modal.d.ts +2 -2
- package/dist/components/mg-modal.js +198 -198
- package/dist/components/mg-modal.js.map +1 -1
- package/dist/components/mg-pagination.d.ts +2 -2
- package/dist/components/mg-pagination2.js +133 -133
- package/dist/components/mg-pagination2.js.map +1 -1
- package/dist/components/mg-panel.d.ts +2 -2
- package/dist/components/mg-panel.js +238 -238
- package/dist/components/mg-panel.js.map +1 -1
- package/dist/components/mg-popover-content.d.ts +2 -2
- package/dist/components/mg-popover-content2.js +70 -70
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/mg-popover.d.ts +2 -2
- package/dist/components/mg-popover2.js +224 -222
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-skip-links.d.ts +2 -2
- package/dist/components/mg-skip-links.js +57 -57
- package/dist/components/mg-skip-links.js.map +1 -1
- package/dist/components/mg-tabs.d.ts +2 -2
- package/dist/components/mg-tabs.js +243 -243
- package/dist/components/mg-tabs.js.map +1 -1
- package/dist/components/mg-tag.d.ts +2 -2
- package/dist/components/mg-tag.js +97 -97
- package/dist/components/mg-tag.js.map +1 -1
- package/dist/components/mg-tooltip-content.d.ts +2 -2
- package/dist/components/mg-tooltip-content2.js +30 -30
- package/dist/components/mg-tooltip-content2.js.map +1 -1
- package/dist/components/mg-tooltip.d.ts +2 -2
- package/dist/components/mg-tooltip2.js +316 -316
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/components/popper.js +6 -12
- package/dist/components/popper.js.map +1 -1
- package/dist/esm/{components.utils-0f76010d.js → components.utils-0d67c31c.js} +102 -100
- package/dist/esm/components.utils-0d67c31c.js.map +1 -0
- package/dist/esm/{index-ce01e63b.js → index-f34a3a2c.js} +320 -137
- package/dist/esm/index-f34a3a2c.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_34.entry.js +5130 -5057
- package/dist/esm/mg-action-more_34.entry.js.map +1 -1
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-item-more.entry.js +224 -224
- package/dist/esm/mg-item-more.entry.js.map +1 -1
- package/dist/mg-components/locales/fr/messages.json +4 -4
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/p-629454f7.entry.js +2 -0
- package/dist/mg-components/p-629454f7.entry.js.map +1 -0
- package/dist/mg-components/p-7444ff40.js +3 -0
- package/dist/mg-components/p-7444ff40.js.map +1 -0
- package/dist/mg-components/p-af42d17b.js +2 -0
- package/dist/mg-components/p-af42d17b.js.map +1 -0
- package/dist/mg-components/{p-01ebc95a.entry.js → p-e0fb0f3c.entry.js} +2 -2
- package/dist/mg-components/p-e0fb0f3c.entry.js.map +1 -0
- package/dist/types/assets/icons/index.d.ts +193 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +41 -41
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +100 -96
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +39 -39
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +37 -37
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +12 -12
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +56 -56
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +34 -34
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +51 -51
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.d.ts +12 -12
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +3 -3
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +113 -113
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +10 -3
- package/dist/types/components/molecules/inputs/MgInput.d.ts +17 -16
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +100 -100
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +26 -26
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +262 -260
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.conf.d.ts +4 -4
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +150 -149
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +4 -4
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +223 -222
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +142 -141
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +3 -3
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +152 -151
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +6 -6
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +193 -192
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +1 -6
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +195 -194
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +181 -180
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +141 -141
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +2 -2
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +97 -97
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +6 -6
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +179 -179
- package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +12 -11
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +72 -72
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +45 -45
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +103 -104
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +27 -27
- package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +5 -5
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +61 -61
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +100 -93
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +107 -107
- package/dist/types/components/molecules/mg-pagination/mg-pagination.conf.d.ts +2 -2
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +74 -74
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +149 -149
- package/dist/types/components/molecules/mg-popover/mg-popover-content/mg-popover-content.d.ts +43 -43
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +88 -88
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +2 -2
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +40 -40
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +10 -10
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +118 -118
- package/dist/types/components.d.ts +296 -32
- package/dist/types/locales/index.d.ts +172 -172
- package/dist/types/stencil-public-runtime.d.ts +29 -0
- package/dist/types/utils/behaviors.utils.d.ts +65 -65
- package/dist/types/utils/components.utils.d.ts +32 -26
- package/dist/types/utils/locale.utils.d.ts +2 -2
- package/dist/types/utils/playwright.fixture.d.ts +3 -0
- package/dist/types/utils/unit.test.utils.d.ts +5 -5
- package/package.json +33 -47
- package/dist/cjs/components.utils-dc9c8a53.js.map +0 -1
- package/dist/cjs/index-c042e24b.js.map +0 -1
- package/dist/collection/components/atoms/mg-badge/test/mg-badge.e2e.playwright.js +0 -33
- package/dist/collection/components/atoms/mg-badge/test/mg-badge.e2e.playwright.js.map +0 -1
- package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js +0 -70
- package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js.map +0 -1
- package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +0 -91
- package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +0 -1
- package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +0 -142
- package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +0 -1
- package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js +0 -36
- package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js.map +0 -1
- package/dist/collection/components/atoms/mg-card/test/mg-card.spec.js +0 -43
- package/dist/collection/components/atoms/mg-card/test/mg-card.spec.js.map +0 -1
- package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.e2e.js +0 -15
- package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.e2e.js.map +0 -1
- package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.spec.js +0 -42
- package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.spec.js.map +0 -1
- package/dist/collection/components/atoms/mg-divider/test/mg-divider.e2e.js +0 -11
- package/dist/collection/components/atoms/mg-divider/test/mg-divider.e2e.js.map +0 -1
- package/dist/collection/components/atoms/mg-divider/test/mg-divider.spec.js +0 -14
- package/dist/collection/components/atoms/mg-divider/test/mg-divider.spec.js.map +0 -1
- package/dist/collection/components/atoms/mg-icon/test/mg-icon.e2e.js +0 -55
- package/dist/collection/components/atoms/mg-icon/test/mg-icon.e2e.js.map +0 -1
- package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js +0 -84
- package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js.map +0 -1
- package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js +0 -12
- package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.js.map +0 -1
- package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js +0 -23
- package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js.map +0 -1
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js +0 -23
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.playwright.js.map +0 -1
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +0 -71
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +0 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +0 -138
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +0 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +0 -272
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +0 -237
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +0 -640
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.e2e.js +0 -123
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.e2e.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +0 -379
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.e2e.js +0 -212
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.e2e.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +0 -456
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js +0 -115
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +0 -289
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +0 -154
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +0 -355
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.e2e.js +0 -194
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.e2e.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +0 -399
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js +0 -147
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +0 -353
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.e2e.js +0 -129
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.e2e.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +0 -318
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js +0 -108
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +0 -247
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +0 -1
- package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.js +0 -239
- package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.spec.js +0 -175
- package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.spec.js.map +0 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js +0 -100
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.spec.js +0 -295
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js +0 -128
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js +0 -187
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-details/test/mg-details.e2e.playwright.js +0 -30
- package/dist/collection/components/molecules/mg-details/test/mg-details.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +0 -42
- package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-form/test/mg-form.e2e.js +0 -169
- package/dist/collection/components/molecules/mg-form/test/mg-form.e2e.js.map +0 -1
- package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +0 -277
- package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.e2e.js +0 -39
- package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.e2e.js.map +0 -1
- package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.spec.js +0 -36
- package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.js +0 -85
- package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.spec.js +0 -106
- package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-message/test/mg-message.e2e.js +0 -64
- package/dist/collection/components/molecules/mg-message/test/mg-message.e2e.js.map +0 -1
- package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +0 -109
- package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +0 -62
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.template.js +0 -40
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.template.js.map +0 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +0 -26
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +0 -122
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.js +0 -57
- package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.spec.js +0 -121
- package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +0 -106
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +0 -213
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js +0 -140
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +0 -142
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.e2e.js +0 -55
- package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.e2e.js.map +0 -1
- package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.spec.js +0 -55
- package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.spec.js.map +0 -1
- package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.js +0 -76
- package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.js.map +0 -1
- package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +0 -332
- package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +0 -1
- package/dist/collection/utils/stencil.e2e.test.utils.js +0 -33
- package/dist/collection/utils/stencil.e2e.test.utils.js.map +0 -1
- package/dist/esm/components.utils-0f76010d.js.map +0 -1
- package/dist/esm/index-ce01e63b.js.map +0 -1
- package/dist/mg-components/p-01ebc95a.entry.js.map +0 -1
- package/dist/mg-components/p-1aa89acf.js +0 -3
- package/dist/mg-components/p-1aa89acf.js.map +0 -1
- package/dist/mg-components/p-71a5a848.entry.js +0 -2
- package/dist/mg-components/p-71a5a848.entry.js.map +0 -1
- package/dist/mg-components/p-c9e2c669.js +0 -2
- package/dist/mg-components/p-c9e2c669.js.map +0 -1
- package/dist/types/components/atoms/mg-badge/test/mg-badge.e2e.playwright.d.ts +0 -1
- package/dist/types/components/atoms/mg-input-title/test/mg-input-title.e2e.playwright.d.ts +0 -1
- package/dist/types/components/atoms/mg-tag/test/mg-tag.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.d.ts +0 -2
- package/dist/types/components/molecules/mg-details/test/mg-details.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.template.d.ts +0 -12
- package/dist/types/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/mg-panel/test/mg-panel.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/mg-popover/test/mg-popover.e2e.playwright.d.ts +0 -1
- package/dist/types/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.d.ts +0 -1
- package/dist/types/utils/stencil.e2e.test.utils.d.ts +0 -14
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
2
|
-
if (!Symbol.asyncIterator)
|
|
3
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
-
var m = o[Symbol.asyncIterator], i;
|
|
5
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
6
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
-
};
|
|
9
|
-
import { renderAttributes } from "../../../../../utils/e2e.test.utils";
|
|
10
|
-
import { setPageContent, expect, describe, describeEach, testEach, test, updateScreenshotClass } from "../../../../../utils/playwright.e2e.test.utils";
|
|
11
|
-
import { Direction, sizes } from "../mg-menu.conf";
|
|
12
|
-
var Position;
|
|
13
|
-
(function (Position) {
|
|
14
|
-
Position["PRESS"] = "press";
|
|
15
|
-
Position["DOWN"] = "down";
|
|
16
|
-
})(Position || (Position = {}));
|
|
17
|
-
var Key;
|
|
18
|
-
(function (Key) {
|
|
19
|
-
Key["TAB"] = "Tab";
|
|
20
|
-
Key["SHIFT"] = "Shift";
|
|
21
|
-
Key["ENTER"] = "Enter";
|
|
22
|
-
})(Key || (Key = {}));
|
|
23
|
-
const TIMEOUT = 1000;
|
|
24
|
-
const getSubMenuSize = (size) => {
|
|
25
|
-
if (size === 'large')
|
|
26
|
-
return 'medium';
|
|
27
|
-
else if (size === 'medium')
|
|
28
|
-
return 'regular';
|
|
29
|
-
else
|
|
30
|
-
return 'regular';
|
|
31
|
-
};
|
|
32
|
-
const numberToPx = (value) => `${value}px`;
|
|
33
|
-
const getFrameSize = (direction, size) => direction === Direction.VERTICAL
|
|
34
|
-
? { width: 400, height: ['medium', 'large'].includes(size) ? 400 : 250 }
|
|
35
|
-
: { width: ['medium', 'large'].includes(size) ? 1200 : 800, height: 200 };
|
|
36
|
-
const createHTML = (args, containerSize) => `
|
|
37
|
-
<header class="menu-container menu-container--${containerSize}">
|
|
38
|
-
<mg-menu ${renderAttributes(Object.assign({ label: 'menu' }, args))}>
|
|
39
|
-
<mg-menu-item status="active">
|
|
40
|
-
<span slot="label">1 - head-1</span>
|
|
41
|
-
<mg-menu ${renderAttributes({ label: 'sub-menu 1', direction: Direction.VERTICAL, size: getSubMenuSize(args === null || args === void 0 ? void 0 : args.size) })}>
|
|
42
|
-
<mg-menu-item><span slot="label">Batman begins</span></mg-menu-item>
|
|
43
|
-
</mg-menu>
|
|
44
|
-
</mg-menu-item>
|
|
45
|
-
<mg-menu-item status="disabled"><span slot="label">1 - head-2 long</span></mg-menu-item>
|
|
46
|
-
<mg-menu-item href="#link">
|
|
47
|
-
<span slot="label">1 - head-3 very long</span>
|
|
48
|
-
<mg-icon icon='user' slot='image'></mg-icon>
|
|
49
|
-
</mg-menu-item>
|
|
50
|
-
<mg-menu-item>
|
|
51
|
-
<span slot="label">1 - head-4</span>
|
|
52
|
-
<mg-icon icon='user' slot='image'></mg-icon>
|
|
53
|
-
${(args === null || args === void 0 ? void 0 : args.badge) ? "<mg-badge value='2' label='hello' slot='information'></mg-badge>" : ''}
|
|
54
|
-
</mg-menu-item>
|
|
55
|
-
<mg-menu-item>
|
|
56
|
-
<span slot="label">1 - head-5</span>
|
|
57
|
-
<mg-icon icon='user' slot='image'></mg-icon>
|
|
58
|
-
${(args === null || args === void 0 ? void 0 : args.badge) ? "<mg-badge value='2' label='hello' slot='information'></mg-badge>" : ''}
|
|
59
|
-
<mg-menu ${renderAttributes({ label: 'sub-menu 2', direction: Direction.VERTICAL, size: getSubMenuSize(args === null || args === void 0 ? void 0 : args.size) })}>
|
|
60
|
-
<mg-menu-item><span slot="label">Batman begins with a longer title to go outide screen</span></mg-menu-item>
|
|
61
|
-
</mg-menu>
|
|
62
|
-
</mg-menu-item>
|
|
63
|
-
</mg-menu>
|
|
64
|
-
</header>
|
|
65
|
-
<style>
|
|
66
|
-
.menu-container.menu-container--vertical-small {
|
|
67
|
-
width: 180px;
|
|
68
|
-
}
|
|
69
|
-
</style>
|
|
70
|
-
`;
|
|
71
|
-
describe('mg-menu', () => {
|
|
72
|
-
describeEach([Direction.HORIZONTAL, Direction.VERTICAL])('direction %s', (direction) => {
|
|
73
|
-
testEach(sizes)(`should renders, case direction ${direction} size %s with large screen`, async (page, size) => {
|
|
74
|
-
await setPageContent(page, createHTML({ direction, size, badge: true }), getFrameSize(direction, size));
|
|
75
|
-
await updateScreenshotClass(page, { width: numberToPx(getFrameSize(direction, size).width) });
|
|
76
|
-
await page.locator('mg-menu.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
77
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
describe('navigation horizontal', () => {
|
|
81
|
-
test(`should success mouse navigation, case direction ${Direction.HORIZONTAL}`, async ({ page }) => {
|
|
82
|
-
await setPageContent(page, createHTML({ direction: Direction.HORIZONTAL }), { width: 800, height: 80 });
|
|
83
|
-
await page.locator('mg-menu.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
84
|
-
const actions = [
|
|
85
|
-
{ position: 0, expanded: 'true' },
|
|
86
|
-
{ position: 5, expanded: 'true' },
|
|
87
|
-
{ position: 0, expanded: 'true' },
|
|
88
|
-
];
|
|
89
|
-
for (const { position, expanded } of actions) {
|
|
90
|
-
const item = await page.locator('mg-menu').first().locator('mg-menu-item').nth(position);
|
|
91
|
-
await item.click();
|
|
92
|
-
await page.locator('mg-popover-content[data-show]').waitFor({ timeout: TIMEOUT });
|
|
93
|
-
expect(await item.locator('button').first().getAttribute('aria-expanded')).toEqual(expanded);
|
|
94
|
-
}
|
|
95
|
-
// menu-item close
|
|
96
|
-
await page.$eval('body', elm => {
|
|
97
|
-
elm.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
98
|
-
});
|
|
99
|
-
await expect(page.locator('body')).toHaveScreenshot();
|
|
100
|
-
});
|
|
101
|
-
test(`should success keyboard navigation, case direction ${Direction.HORIZONTAL}`, async ({ page }) => {
|
|
102
|
-
var _a, e_1, _b, _c;
|
|
103
|
-
await setPageContent(page, createHTML({ direction: Direction.HORIZONTAL }), getFrameSize(Direction.HORIZONTAL));
|
|
104
|
-
await page.locator('mg-menu.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
105
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
106
|
-
const actions = [
|
|
107
|
-
{ position: Position.PRESS, key: Key.TAB, openeItem: null },
|
|
108
|
-
{ position: Position.PRESS, key: Key.TAB, openeItem: null },
|
|
109
|
-
{ position: Position.PRESS, key: Key.TAB, openeItem: null },
|
|
110
|
-
{ position: Position.PRESS, key: Key.TAB, openeItem: null },
|
|
111
|
-
{ position: Position.PRESS, key: Key.ENTER, openeItem: 5 },
|
|
112
|
-
{ position: Position.PRESS, key: Key.TAB, openeItem: 5 },
|
|
113
|
-
{ position: Position.PRESS, key: Key.SHIFT, openeItem: 5 },
|
|
114
|
-
{ position: Position.PRESS, key: Key.ENTER, openeItem: null },
|
|
115
|
-
{ position: Position.PRESS, key: Key.TAB, openeItem: null },
|
|
116
|
-
];
|
|
117
|
-
try {
|
|
118
|
-
for (var _d = true, actions_1 = __asyncValues(actions), actions_1_1; actions_1_1 = await actions_1.next(), _a = actions_1_1.done, !_a; _d = true) {
|
|
119
|
-
_c = actions_1_1.value;
|
|
120
|
-
_d = false;
|
|
121
|
-
const action = _c;
|
|
122
|
-
if (action.key === Key.SHIFT) {
|
|
123
|
-
await page.keyboard.down(Key.SHIFT);
|
|
124
|
-
await page.keyboard.press(Key.TAB);
|
|
125
|
-
await page.keyboard.up(Key.SHIFT);
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
await page.keyboard[action.position](action.key);
|
|
129
|
-
}
|
|
130
|
-
let item;
|
|
131
|
-
if (action.openeItem > 0) {
|
|
132
|
-
item = await page.locator('mg-menu').first().locator('mg-menu-item').nth(action.openeItem).locator('button[aria-expanded="true"]');
|
|
133
|
-
expect(await item.getAttribute('aria-expanded')).toEqual('true');
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
item = await page.locator('mg-menu').first().locator('mg-menu-item').first().locator('button').first();
|
|
137
|
-
expect(await item.getAttribute('aria-expanded')).toEqual('false');
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch (e_1_1) {
|
|
142
|
-
e_1 = { error: e_1_1 };
|
|
143
|
-
}
|
|
144
|
-
finally {
|
|
145
|
-
try {
|
|
146
|
-
if (!_d && !_a && (_b = actions_1.return))
|
|
147
|
-
await _b.call(actions_1);
|
|
148
|
-
}
|
|
149
|
-
finally {
|
|
150
|
-
if (e_1)
|
|
151
|
-
throw e_1.error;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
describe('navigation vertical', () => {
|
|
157
|
-
test(`should success mouse navigation, case direction ${Direction.VERTICAL}`, async ({ page }) => {
|
|
158
|
-
var _a, e_2, _b, _c;
|
|
159
|
-
await setPageContent(page, createHTML({ direction: Direction.VERTICAL }), getFrameSize(Direction.VERTICAL));
|
|
160
|
-
await page.locator('mg-menu.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
161
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
162
|
-
const positions = [0, 4, 5, 0];
|
|
163
|
-
try {
|
|
164
|
-
for (var _d = true, positions_1 = __asyncValues(positions), positions_1_1; positions_1_1 = await positions_1.next(), _a = positions_1_1.done, !_a; _d = true) {
|
|
165
|
-
_c = positions_1_1.value;
|
|
166
|
-
_d = false;
|
|
167
|
-
const position = _c;
|
|
168
|
-
const item = await page.locator('mg-menu').first().locator('mg-menu-item').nth(position);
|
|
169
|
-
await item.click();
|
|
170
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
catch (e_2_1) {
|
|
174
|
-
e_2 = { error: e_2_1 };
|
|
175
|
-
}
|
|
176
|
-
finally {
|
|
177
|
-
try {
|
|
178
|
-
if (!_d && !_a && (_b = positions_1.return))
|
|
179
|
-
await _b.call(positions_1);
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
if (e_2)
|
|
183
|
-
throw e_2.error;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
await page.$eval('body', elm => {
|
|
187
|
-
elm.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
188
|
-
});
|
|
189
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
190
|
-
});
|
|
191
|
-
test(`should success keyboard navigation, case direction ${Direction.VERTICAL}`, async ({ page }) => {
|
|
192
|
-
var _a, e_3, _b, _c;
|
|
193
|
-
await setPageContent(page, createHTML({ direction: Direction.VERTICAL }), getFrameSize(Direction.VERTICAL));
|
|
194
|
-
await page.locator('mg-menu.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
195
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
196
|
-
const actions = [
|
|
197
|
-
{ position: Position.PRESS, key: Key.TAB },
|
|
198
|
-
{ position: Position.PRESS, key: Key.TAB },
|
|
199
|
-
{ position: Position.PRESS, key: Key.TAB },
|
|
200
|
-
{ position: Position.PRESS, key: Key.TAB },
|
|
201
|
-
{ position: Position.PRESS, key: Key.ENTER },
|
|
202
|
-
{ position: Position.PRESS, key: Key.TAB },
|
|
203
|
-
{ position: Position.PRESS, key: Key.SHIFT },
|
|
204
|
-
{ position: Position.PRESS, key: Key.ENTER },
|
|
205
|
-
{ position: Position.PRESS, key: Key.TAB },
|
|
206
|
-
];
|
|
207
|
-
try {
|
|
208
|
-
for (var _d = true, actions_2 = __asyncValues(actions), actions_2_1; actions_2_1 = await actions_2.next(), _a = actions_2_1.done, !_a; _d = true) {
|
|
209
|
-
_c = actions_2_1.value;
|
|
210
|
-
_d = false;
|
|
211
|
-
const action = _c;
|
|
212
|
-
if (action.key === Key.SHIFT) {
|
|
213
|
-
await page.keyboard.down(Key.SHIFT);
|
|
214
|
-
await page.keyboard.press(Key.TAB);
|
|
215
|
-
await page.keyboard.up(Key.SHIFT);
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
await page.keyboard[action.position](action.key);
|
|
219
|
-
}
|
|
220
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
catch (e_3_1) {
|
|
224
|
-
e_3 = { error: e_3_1 };
|
|
225
|
-
}
|
|
226
|
-
finally {
|
|
227
|
-
try {
|
|
228
|
-
if (!_d && !_a && (_b = actions_2.return))
|
|
229
|
-
await _b.call(actions_2);
|
|
230
|
-
}
|
|
231
|
-
finally {
|
|
232
|
-
if (e_3)
|
|
233
|
-
throw e_3.error;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
//# sourceMappingURL=mg-menu.e2e.playwright.js.map
|
package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mg-menu.e2e.playwright.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/menu/mg-menu/test/mg-menu.e2e.playwright.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAY,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACjK,OAAO,EAAE,SAAS,EAAgB,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEjE,IAAK,QAGJ;AAHD,WAAK,QAAQ;EACX,2BAAe,CAAA;EACf,yBAAa,CAAA;AACf,CAAC,EAHI,QAAQ,KAAR,QAAQ,QAGZ;AAED,IAAK,GAIJ;AAJD,WAAK,GAAG;EACN,kBAAW,CAAA;EACX,sBAAe,CAAA;EACf,sBAAe,CAAA;AACjB,CAAC,EAJI,GAAG,KAAH,GAAG,QAIP;AAED,MAAM,OAAO,GAAG,IAAI,CAAC;AAErB,MAAM,cAAc,GAAG,CAAC,IAAkB,EAAgB,EAAE;EAC1D,IAAI,IAAI,KAAK,OAAO;IAAE,OAAO,QAAQ,CAAC;OACjC,IAAI,IAAI,KAAK,QAAQ;IAAE,OAAO,SAAS,CAAC;;IACxC,OAAO,SAAS,CAAC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utils/e2e.test.utils';\nimport { setPageContent, expect, describe, describeEach, testEach, test, PageType, updateScreenshotClass } from '../../../../../utils/playwright.e2e.test.utils';\nimport { Direction, MenuSizeType, sizes } from '../mg-menu.conf';\n\nenum Position {\n PRESS = 'press',\n DOWN = 'down',\n}\n\nenum Key {\n TAB = 'Tab',\n SHIFT = 'Shift',\n ENTER = 'Enter',\n}\n\nconst TIMEOUT = 1000;\n\nconst getSubMenuSize = (size: MenuSizeType): MenuSizeType => {\n if (size === 'large') return 'medium';\n else if (size === 'medium') return 'regular';\n else return 'regular';\n};\n\nconst numberToPx = (value: number): string => `${value}px`;\n\nconst getFrameSize = (direction: Direction, size?: MenuSizeType): { width: number; height: number } =>\n direction === Direction.VERTICAL\n ? { width: 400, height: ['medium', 'large'].includes(size) ? 400 : 250 }\n : { width: ['medium', 'large'].includes(size) ? 1200 : 800, height: 200 };\n\nconst createHTML = (args, containerSize?): string => `\n <header class=\"menu-container menu-container--${containerSize}\">\n <mg-menu ${renderAttributes({ label: 'menu', ...args })}>\n <mg-menu-item status=\"active\">\n <span slot=\"label\">1 - head-1</span>\n <mg-menu ${renderAttributes({ label: 'sub-menu 1', direction: Direction.VERTICAL, size: getSubMenuSize(args?.size) })}>\n <mg-menu-item><span slot=\"label\">Batman begins</span></mg-menu-item>\n </mg-menu>\n </mg-menu-item>\n <mg-menu-item status=\"disabled\"><span slot=\"label\">1 - head-2 long</span></mg-menu-item>\n <mg-menu-item href=\"#link\">\n <span slot=\"label\">1 - head-3 very long</span>\n <mg-icon icon='user' slot='image'></mg-icon>\n </mg-menu-item>\n <mg-menu-item>\n <span slot=\"label\">1 - head-4</span>\n <mg-icon icon='user' slot='image'></mg-icon>\n ${args?.badge ? \"<mg-badge value='2' label='hello' slot='information'></mg-badge>\" : ''} \n </mg-menu-item>\n <mg-menu-item>\n <span slot=\"label\">1 - head-5</span>\n <mg-icon icon='user' slot='image'></mg-icon>\n ${args?.badge ? \"<mg-badge value='2' label='hello' slot='information'></mg-badge>\" : ''} \n <mg-menu ${renderAttributes({ label: 'sub-menu 2', direction: Direction.VERTICAL, size: getSubMenuSize(args?.size) })}>\n <mg-menu-item><span slot=\"label\">Batman begins with a longer title to go outide screen</span></mg-menu-item>\n </mg-menu>\n </mg-menu-item>\n </mg-menu>\n </header>\n <style>\n .menu-container.menu-container--vertical-small {\n width: 180px;\n }\n </style>\n `;\n\ndescribe('mg-menu', () => {\n describeEach([Direction.HORIZONTAL, Direction.VERTICAL])('direction %s', (direction: Direction) => {\n testEach(sizes)(`should renders, case direction ${direction} size %s with large screen`, async (page: PageType, size: MenuSizeType) => {\n await setPageContent(page, createHTML({ direction, size, badge: true }), getFrameSize(direction, size));\n\n await updateScreenshotClass(page, { width: numberToPx(getFrameSize(direction, size).width) });\n\n await page.locator('mg-menu.hydrated').first().waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n });\n\n describe('navigation horizontal', () => {\n test(`should success mouse navigation, case direction ${Direction.HORIZONTAL}`, async ({ page }) => {\n await setPageContent(page, createHTML({ direction: Direction.HORIZONTAL }), { width: 800, height: 80 });\n await page.locator('mg-menu.hydrated').first().waitFor({ timeout: TIMEOUT });\n const actions = [\n { position: 0, expanded: 'true' },\n { position: 5, expanded: 'true' },\n { position: 0, expanded: 'true' },\n ];\n for (const { position, expanded } of actions) {\n const item = await page.locator('mg-menu').first().locator('mg-menu-item').nth(position);\n await item.click();\n await page.locator('mg-popover-content[data-show]').waitFor({ timeout: TIMEOUT });\n expect(await item.locator('button').first().getAttribute('aria-expanded')).toEqual(expanded);\n }\n // menu-item close\n await page.$eval('body', elm => {\n elm.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n });\n await expect(page.locator('body')).toHaveScreenshot();\n });\n test(`should success keyboard navigation, case direction ${Direction.HORIZONTAL}`, async ({ page }) => {\n await setPageContent(page, createHTML({ direction: Direction.HORIZONTAL }), getFrameSize(Direction.HORIZONTAL));\n await page.locator('mg-menu.hydrated').first().waitFor({ timeout: TIMEOUT });\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n const actions = [\n { position: Position.PRESS, key: Key.TAB, openeItem: null },\n { position: Position.PRESS, key: Key.TAB, openeItem: null },\n { position: Position.PRESS, key: Key.TAB, openeItem: null },\n { position: Position.PRESS, key: Key.TAB, openeItem: null },\n { position: Position.PRESS, key: Key.ENTER, openeItem: 5 },\n { position: Position.PRESS, key: Key.TAB, openeItem: 5 },\n { position: Position.PRESS, key: Key.SHIFT, openeItem: 5 },\n { position: Position.PRESS, key: Key.ENTER, openeItem: null },\n { position: Position.PRESS, key: Key.TAB, openeItem: null },\n ];\n for await (const action of actions) {\n if (action.key === Key.SHIFT) {\n await page.keyboard.down(Key.SHIFT);\n await page.keyboard.press(Key.TAB);\n await page.keyboard.up(Key.SHIFT);\n } else {\n await page.keyboard[action.position](action.key);\n }\n let item;\n if (action.openeItem > 0) {\n item = await page.locator('mg-menu').first().locator('mg-menu-item').nth(action.openeItem).locator('button[aria-expanded=\"true\"]');\n expect(await item.getAttribute('aria-expanded')).toEqual('true');\n } else {\n item = await page.locator('mg-menu').first().locator('mg-menu-item').first().locator('button').first();\n expect(await item.getAttribute('aria-expanded')).toEqual('false');\n }\n }\n });\n });\n\n describe('navigation vertical', () => {\n test(`should success mouse navigation, case direction ${Direction.VERTICAL}`, async ({ page }) => {\n await setPageContent(page, createHTML({ direction: Direction.VERTICAL }), getFrameSize(Direction.VERTICAL));\n await page.locator('mg-menu.hydrated').first().waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n\n const positions = [0, 4, 5, 0];\n for await (const position of positions) {\n const item = await page.locator('mg-menu').first().locator('mg-menu-item').nth(position);\n await item.click();\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n }\n\n await page.$eval('body', elm => {\n elm.dispatchEvent(new MouseEvent('click', { bubbles: true }));\n });\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n\n test(`should success keyboard navigation, case direction ${Direction.VERTICAL}`, async ({ page }) => {\n await setPageContent(page, createHTML({ direction: Direction.VERTICAL }), getFrameSize(Direction.VERTICAL));\n await page.locator('mg-menu.hydrated').first().waitFor({ timeout: TIMEOUT });\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n\n const actions = [\n { position: Position.PRESS, key: Key.TAB },\n { position: Position.PRESS, key: Key.TAB },\n { position: Position.PRESS, key: Key.TAB },\n { position: Position.PRESS, key: Key.TAB },\n { position: Position.PRESS, key: Key.ENTER },\n { position: Position.PRESS, key: Key.TAB },\n { position: Position.PRESS, key: Key.SHIFT },\n { position: Position.PRESS, key: Key.ENTER },\n { position: Position.PRESS, key: Key.TAB },\n ];\n\n for await (const action of actions) {\n if (action.key === Key.SHIFT) {\n await page.keyboard.down(Key.SHIFT);\n await page.keyboard.press(Key.TAB);\n await page.keyboard.up(Key.SHIFT);\n } else {\n await page.keyboard[action.position](action.key);\n }\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n }\n });\n });\n});\n"]}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
2
|
-
if (!Symbol.asyncIterator)
|
|
3
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
-
var m = o[Symbol.asyncIterator], i;
|
|
5
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
6
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
-
};
|
|
9
|
-
import { h } from "@stencil/core";
|
|
10
|
-
import { newSpecPage } from "@stencil/core/testing";
|
|
11
|
-
import { MgMenu } from "../mg-menu";
|
|
12
|
-
import { Direction } from "../mg-menu.conf";
|
|
13
|
-
import { MgMenuItem } from "../../mg-menu-item/mg-menu-item";
|
|
14
|
-
import { MgPopover } from "../../../mg-popover/mg-popover";
|
|
15
|
-
import { forcePopoverId, mockConsoleError, mockWindowFrames, setupMutationObserverMock, setupResizeObserverMock } from "../../../../../utils/unit.test.utils";
|
|
16
|
-
import { MgItemMore } from "../../../mg-item-more/mg-item-more";
|
|
17
|
-
import { MgPopoverContent } from "../../../mg-popover/mg-popover-content/mg-popover-content";
|
|
18
|
-
mockConsoleError();
|
|
19
|
-
mockWindowFrames();
|
|
20
|
-
let id;
|
|
21
|
-
/**
|
|
22
|
-
* set id if param is true
|
|
23
|
-
* @param hasId - true if need a generated id
|
|
24
|
-
* @returns genereted id
|
|
25
|
-
*/
|
|
26
|
-
const setId = (hasId) => (hasId ? `test-${id++}` : undefined);
|
|
27
|
-
const getPage = async (args, options = { submenu: true, itemMore: false }) => {
|
|
28
|
-
const components = [MgMenu, MgMenuItem, MgPopover, MgPopoverContent];
|
|
29
|
-
if (!options.submenu && options.itemMore)
|
|
30
|
-
components.push(MgItemMore);
|
|
31
|
-
const page = await newSpecPage({
|
|
32
|
-
components,
|
|
33
|
-
template: () => (h("mg-menu", Object.assign({}, args), h("mg-menu-item", { id: setId(args.hasId), identifier: "identifier-1" }, h("span", { slot: "label" }, "batman"), options.submenu && (h("mg-menu", { label: "batman - submenu", direction: Direction.VERTICAL }, h("mg-menu-item", null, h("span", { slot: "label" }, "batman begins"), h("mg-menu", { label: "batman begins - submenu", direction: Direction.VERTICAL }, h("mg-menu-item", null, h("span", { slot: "label" }, "movie")))), h("mg-menu-item", null, h("span", { slot: "label" }, "joker: the dark knight")), h("mg-menu-item", null, h("span", { slot: "label" }, "bane: the dark knight rise"))))), h("mg-menu-item", { id: setId(args.hasId), identifier: "identifier-2" }, h("span", { slot: "label" }, "joker"), args.badge && h("mg-badge", { value: 1, label: "bad guy" }), h("div", null, h("h2", null, "This is a joker card"), h("p", null, "If you don't know the joker, you can watch the movie."))), h("mg-menu-item", { href: "#bane", id: setId(args.hasId), identifier: "identifier-3" }, h("span", { slot: "label" }, "bane")))),
|
|
34
|
-
});
|
|
35
|
-
jest.runOnlyPendingTimers();
|
|
36
|
-
await page.waitForChanges();
|
|
37
|
-
[page.doc, ...Array.from(page.doc.querySelectorAll('mg-menu')).map(el => el.shadowRoot)].forEach(el => Array.from(el.querySelectorAll('mg-menu-item')).forEach((item, index) => {
|
|
38
|
-
forcePopoverId(item, `mg-popover-test_${index}`);
|
|
39
|
-
}));
|
|
40
|
-
return page;
|
|
41
|
-
};
|
|
42
|
-
describe('mg-menu', () => {
|
|
43
|
-
let fireMo;
|
|
44
|
-
beforeEach(() => {
|
|
45
|
-
id = 1;
|
|
46
|
-
jest.useFakeTimers();
|
|
47
|
-
setupResizeObserverMock({
|
|
48
|
-
observe: function () {
|
|
49
|
-
return null;
|
|
50
|
-
},
|
|
51
|
-
disconnect: function () {
|
|
52
|
-
return null;
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
setupMutationObserverMock({
|
|
56
|
-
observe: function () {
|
|
57
|
-
fireMo = this.cb;
|
|
58
|
-
},
|
|
59
|
-
disconnect: () => null,
|
|
60
|
-
takeRecords: () => [],
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
afterEach(() => jest.clearAllTimers());
|
|
64
|
-
describe('render', () => {
|
|
65
|
-
test.each([{ label: 'batman menu' }, { label: 'batman menu', direction: 'horizontal' }, { label: 'batman menu', direction: 'vertical' }])('with args %s', async (args) => {
|
|
66
|
-
const { root } = await getPage(args);
|
|
67
|
-
expect(root).toMatchSnapshot();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
describe('errors', () => {
|
|
71
|
-
const baseProps = { label: 'batman menu' };
|
|
72
|
-
test.each([
|
|
73
|
-
{ props: { direction: 'horizontal' }, error: '<mg-menu> prop "label" is required.' },
|
|
74
|
-
{ props: Object.assign(Object.assign({}, baseProps), { direction: 'test' }), error: '<mg-menu> prop "direction" must be one of: horizontal, vertical.' },
|
|
75
|
-
{ props: Object.assign(Object.assign({}, baseProps), { direction: Direction.VERTICAL, itemmore: { icon: 'user' } }), error: '<mg-menu> prop "itemmore" must be paired with direction horizontal.' },
|
|
76
|
-
{ props: Object.assign(Object.assign({}, baseProps), { size: 'batman' }), error: '<mg-menu> prop "size" must be one of: regular, medium, large.' },
|
|
77
|
-
])('Should throw error when props are invalid, case %s', async ({ props, error }) => {
|
|
78
|
-
expect.assertions(1);
|
|
79
|
-
try {
|
|
80
|
-
await getPage(props);
|
|
81
|
-
}
|
|
82
|
-
catch (err) {
|
|
83
|
-
expect(err.message).toMatch(error);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
describe.each(['horizontal', 'vertical'])('events', direction => {
|
|
88
|
-
test(`should manage outside click, case direction ${direction}`, async () => {
|
|
89
|
-
const page = await getPage({ label: 'batman menu', direction });
|
|
90
|
-
const firstItem = page.root.querySelector('[title="batman"]').closest('mg-menu-item');
|
|
91
|
-
expect(firstItem.expanded).toBe(false);
|
|
92
|
-
firstItem.shadowRoot.querySelector('button').dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
93
|
-
await page.waitForChanges();
|
|
94
|
-
jest.runOnlyPendingTimers();
|
|
95
|
-
expect(firstItem.expanded).toBe(true);
|
|
96
|
-
document.dispatchEvent(new CustomEvent('click', { bubbles: true }));
|
|
97
|
-
await page.waitForChanges();
|
|
98
|
-
expect(firstItem.expanded).toBe(direction === 'vertical');
|
|
99
|
-
});
|
|
100
|
-
test.each(['click', 'focus'])(`should manage sibling menu-item expanded props in ${direction} menu, case %s event`, async (event) => {
|
|
101
|
-
const page = await getPage({ label: 'batman menu', direction });
|
|
102
|
-
// open batman item
|
|
103
|
-
const batmanItem = page.doc.querySelector('[title="batman"]').closest('mg-menu-item');
|
|
104
|
-
expect(batmanItem.expanded).toBe(false);
|
|
105
|
-
if (direction === 'horizontal') {
|
|
106
|
-
expect(batmanItem.shadowRoot.querySelector('mg-popover')).not.toBe(null);
|
|
107
|
-
}
|
|
108
|
-
batmanItem.shadowRoot.querySelector('button').dispatchEvent(new CustomEvent('click', { bubbles: true }));
|
|
109
|
-
await page.waitForChanges();
|
|
110
|
-
jest.runOnlyPendingTimers();
|
|
111
|
-
expect(batmanItem.expanded).toBe(true);
|
|
112
|
-
// open batman first child item
|
|
113
|
-
const batmanChildItem = page.doc.querySelector('[title="batman begins"]').closest('mg-menu-item');
|
|
114
|
-
batmanChildItem.shadowRoot.querySelector('button').dispatchEvent(new CustomEvent('click', { bubbles: true }));
|
|
115
|
-
await page.waitForChanges();
|
|
116
|
-
expect(batmanItem.expanded).toBe(true);
|
|
117
|
-
expect(batmanChildItem.expanded).toBe(true);
|
|
118
|
-
// open joker item must close batman first child item
|
|
119
|
-
const jokerItem = page.doc.querySelector('[title="joker"]').closest('mg-menu-item');
|
|
120
|
-
jokerItem.shadowRoot.querySelector('button').dispatchEvent(new CustomEvent(event, { bubbles: true }));
|
|
121
|
-
await page.waitForChanges();
|
|
122
|
-
expect(batmanItem.expanded).toBe(false);
|
|
123
|
-
expect(batmanChildItem.expanded).toBe(false);
|
|
124
|
-
expect(jokerItem.expanded).toBe(event === 'click');
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
describe.each([Direction.VERTICAL, Direction.HORIZONTAL])('MutationObserver %s', direction => {
|
|
128
|
-
test.each([{ label: 'batman menu', direction }])('with args %s', async (args) => {
|
|
129
|
-
var _a, e_1, _b, _c;
|
|
130
|
-
const page = await getPage(args);
|
|
131
|
-
const mutations = [[{ type: 'childList', removedNodes: [{ nodeName: 'MG-ITEM-MORE' }] }], [{ type: 'childList', removedNodes: [{ nodeName: 'MG-MENU-ITEM' }] }]];
|
|
132
|
-
try {
|
|
133
|
-
for (var _d = true, mutations_1 = __asyncValues(mutations), mutations_1_1; mutations_1_1 = await mutations_1.next(), _a = mutations_1_1.done, !_a; _d = true) {
|
|
134
|
-
_c = mutations_1_1.value;
|
|
135
|
-
_d = false;
|
|
136
|
-
const mutation = _c;
|
|
137
|
-
fireMo(mutation);
|
|
138
|
-
await page.waitForChanges();
|
|
139
|
-
expect(page.root).toMatchSnapshot();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
catch (e_1_1) {
|
|
143
|
-
e_1 = { error: e_1_1 };
|
|
144
|
-
}
|
|
145
|
-
finally {
|
|
146
|
-
try {
|
|
147
|
-
if (!_d && !_a && (_b = mutations_1.return))
|
|
148
|
-
await _b.call(mutations_1);
|
|
149
|
-
}
|
|
150
|
-
finally {
|
|
151
|
-
if (e_1)
|
|
152
|
-
throw e_1.error;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
describe('mg-item-more', () => {
|
|
158
|
-
test.each(['click', 'focus'])('should manage "mg-item-more" event %s', async (event) => {
|
|
159
|
-
const page = await getPage({ label: 'batman menu' }, { submenu: false, itemMore: true });
|
|
160
|
-
const mgItemMore = page.doc.querySelector('mg-item-more');
|
|
161
|
-
mgItemMore.dispatchEvent(new CustomEvent('item-loaded', { bubbles: true }));
|
|
162
|
-
await page.flushQueue();
|
|
163
|
-
await page.waitForChanges();
|
|
164
|
-
const moreMenuItem = mgItemMore.shadowRoot.querySelector('mg-menu-item');
|
|
165
|
-
forcePopoverId(moreMenuItem, `mg-popover-test_more-item`);
|
|
166
|
-
expect(page.root).toMatchSnapshot();
|
|
167
|
-
moreMenuItem.shadowRoot.querySelector('button').dispatchEvent(new CustomEvent(event, { bubbles: true }));
|
|
168
|
-
await page.flushQueue();
|
|
169
|
-
await page.waitForChanges();
|
|
170
|
-
expect(moreMenuItem.expanded).toBe(event === 'click');
|
|
171
|
-
expect(page.root).toMatchSnapshot();
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
//# sourceMappingURL=mg-menu.spec.js.map
|
|
@@ -1 +0,0 @@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,KAAK,OAAO,CAAC,CAAC;MACtD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgMenu } from '../mg-menu';\nimport { Direction } from '../mg-menu.conf';\nimport { MgMenuItem } from '../../mg-menu-item/mg-menu-item';\nimport { MgPopover } from '../../../mg-popover/mg-popover';\nimport { forcePopoverId, mockConsoleError, mockWindowFrames, setupMutationObserverMock, setupResizeObserverMock } from '../../../../../utils/unit.test.utils';\nimport { MgItemMore } from '../../../mg-item-more/mg-item-more';\nimport { MgPopoverContent } from '../../../mg-popover/mg-popover-content/mg-popover-content';\n\nmockConsoleError();\nmockWindowFrames();\n\nlet id;\n/**\n * set id if param is true\n * @param hasId - true if need a generated id\n * @returns genereted id\n */\nconst setId = (hasId: boolean): string => (hasId ? `test-${id++}` : undefined);\n\nconst getPage = async (args, options = { submenu: true, itemMore: false }) => {\n const components: unknown[] = [MgMenu, MgMenuItem, MgPopover, MgPopoverContent];\n if (!options.submenu && options.itemMore) components.push(MgItemMore);\n const page = await newSpecPage({\n components,\n template: () => (\n <mg-menu {...args}>\n <mg-menu-item id={setId(args.hasId)} identifier=\"identifier-1\">\n <span slot=\"label\">batman</span>\n {options.submenu && (\n <mg-menu label=\"batman - submenu\" direction={Direction.VERTICAL}>\n <mg-menu-item>\n <span slot=\"label\">batman begins</span>\n <mg-menu label=\"batman begins - submenu\" direction={Direction.VERTICAL}>\n <mg-menu-item>\n <span slot=\"label\">movie</span>\n </mg-menu-item>\n </mg-menu>\n </mg-menu-item>\n <mg-menu-item>\n <span slot=\"label\">joker: the dark knight</span>\n </mg-menu-item>\n <mg-menu-item>\n <span slot=\"label\">bane: the dark knight rise</span>\n </mg-menu-item>\n </mg-menu>\n )}\n </mg-menu-item>\n <mg-menu-item id={setId(args.hasId)} identifier=\"identifier-2\">\n <span slot=\"label\">joker</span>\n {args.badge && <mg-badge value={1} label=\"bad guy\"></mg-badge>}\n <div>\n <h2>This is a joker card</h2>\n <p>If you don't know the joker, you can watch the movie.</p>\n </div>\n </mg-menu-item>\n <mg-menu-item href=\"#bane\" id={setId(args.hasId)} identifier=\"identifier-3\">\n <span slot=\"label\">bane</span>\n </mg-menu-item>\n </mg-menu>\n ),\n });\n\n jest.runOnlyPendingTimers();\n await page.waitForChanges();\n\n [page.doc, ...Array.from(page.doc.querySelectorAll('mg-menu')).map(el => el.shadowRoot)].forEach(el =>\n Array.from(el.querySelectorAll('mg-menu-item')).forEach((item, index) => {\n forcePopoverId(item, `mg-popover-test_${index}`);\n }),\n );\n\n return page;\n};\n\ndescribe('mg-menu', () => {\n let fireMo;\n beforeEach(() => {\n id = 1;\n jest.useFakeTimers();\n setupResizeObserverMock({\n observe: function () {\n return null;\n },\n disconnect: function () {\n return null;\n },\n });\n setupMutationObserverMock({\n observe: function () {\n fireMo = this.cb;\n },\n disconnect: () => null,\n takeRecords: () => [],\n });\n });\n\n afterEach(() => jest.clearAllTimers());\n\n describe('render', () => {\n test.each([{ label: 'batman menu' }, { label: 'batman menu', direction: 'horizontal' }, { label: 'batman menu', direction: 'vertical' }])('with args %s', async args => {\n const { root } = await getPage(args);\n\n expect(root).toMatchSnapshot();\n });\n });\n\n describe('errors', () => {\n const baseProps = { label: 'batman menu' };\n test.each([\n { props: { direction: 'horizontal' }, error: '<mg-menu> prop \"label\" is required.' },\n { props: { ...baseProps, direction: 'test' }, error: '<mg-menu> prop \"direction\" must be one of: horizontal, vertical.' },\n { props: { ...baseProps, direction: Direction.VERTICAL, itemmore: { icon: 'user' } }, error: '<mg-menu> prop \"itemmore\" must be paired with direction horizontal.' },\n { props: { ...baseProps, size: 'batman' }, error: '<mg-menu> prop \"size\" must be one of: regular, medium, large.' },\n ])('Should throw error when props are invalid, case %s', async ({ props, error }) => {\n expect.assertions(1);\n\n try {\n await getPage(props);\n } catch (err) {\n expect(err.message).toMatch(error);\n }\n });\n });\n\n describe.each(['horizontal', 'vertical'])('events', direction => {\n test(`should manage outside click, case direction ${direction}`, async () => {\n const page = await getPage({ label: 'batman menu', direction });\n\n const firstItem: HTMLMgMenuItemElement = page.root.querySelector('[title=\"batman\"]').closest('mg-menu-item');\n expect(firstItem.expanded).toBe(false);\n\n firstItem.shadowRoot.querySelector('button').dispatchEvent(new MouseEvent('click', { bubbles: true }));\n await page.waitForChanges();\n jest.runOnlyPendingTimers();\n\n expect(firstItem.expanded).toBe(true);\n\n document.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(firstItem.expanded).toBe(direction === 'vertical');\n });\n\n test.each(['click', 'focus'])(`should manage sibling menu-item expanded props in ${direction} menu, case %s event`, async event => {\n const page = await getPage({ label: 'batman menu', direction });\n // open batman item\n const batmanItem: HTMLMgMenuItemElement = page.doc.querySelector('[title=\"batman\"]').closest('mg-menu-item');\n expect(batmanItem.expanded).toBe(false);\n if (direction === 'horizontal') {\n expect(batmanItem.shadowRoot.querySelector('mg-popover')).not.toBe(null);\n }\n\n batmanItem.shadowRoot.querySelector('button').dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n jest.runOnlyPendingTimers();\n\n expect(batmanItem.expanded).toBe(true);\n\n // open batman first child item\n const batmanChildItem: HTMLMgMenuItemElement = page.doc.querySelector('[title=\"batman begins\"]').closest('mg-menu-item');\n\n batmanChildItem.shadowRoot.querySelector('button').dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(batmanItem.expanded).toBe(true);\n expect(batmanChildItem.expanded).toBe(true);\n\n // open joker item must close batman first child item\n const jokerItem: HTMLMgMenuItemElement = page.doc.querySelector('[title=\"joker\"]').closest('mg-menu-item');\n\n jokerItem.shadowRoot.querySelector('button').dispatchEvent(new CustomEvent(event, { bubbles: true }));\n await page.waitForChanges();\n\n expect(batmanItem.expanded).toBe(false);\n expect(batmanChildItem.expanded).toBe(false);\n expect(jokerItem.expanded).toBe(event === 'click');\n });\n });\n\n describe.each([Direction.VERTICAL, Direction.HORIZONTAL])('MutationObserver %s', direction => {\n test.each([{ label: 'batman menu', direction }])('with args %s', async args => {\n const page = await getPage(args);\n\n const mutations = [[{ type: 'childList', removedNodes: [{ nodeName: 'MG-ITEM-MORE' }] }], [{ type: 'childList', removedNodes: [{ nodeName: 'MG-MENU-ITEM' }] }]];\n\n for await (const mutation of mutations) {\n fireMo(mutation);\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n }\n });\n });\n\n describe('mg-item-more', () => {\n test.each(['click', 'focus'])('should manage \"mg-item-more\" event %s', async event => {\n const page = await getPage({ label: 'batman menu' }, { submenu: false, itemMore: true });\n\n const mgItemMore = page.doc.querySelector('mg-item-more');\n mgItemMore.dispatchEvent(new CustomEvent('item-loaded', { bubbles: true }));\n\n await page.flushQueue();\n await page.waitForChanges();\n\n const moreMenuItem = mgItemMore.shadowRoot.querySelector('mg-menu-item');\n\n forcePopoverId(moreMenuItem, `mg-popover-test_more-item`);\n expect(page.root).toMatchSnapshot();\n\n moreMenuItem.shadowRoot.querySelector('button').dispatchEvent(new CustomEvent(event, { bubbles: true }));\n\n await page.flushQueue();\n await page.waitForChanges();\n\n expect(moreMenuItem.expanded).toBe(event === 'click');\n expect(page.root).toMatchSnapshot();\n });\n });\n});\n"]}
|
package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
2
|
-
if (!Symbol.asyncIterator)
|
|
3
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
-
var m = o[Symbol.asyncIterator], i;
|
|
5
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
6
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
-
};
|
|
9
|
-
import { renderAttributes } from "../../../../../utils/e2e.test.utils";
|
|
10
|
-
import { Direction, sizes } from "../../mg-menu/mg-menu.conf";
|
|
11
|
-
import { Status } from "../mg-menu-item.conf";
|
|
12
|
-
import { describe, describeEach, expect, setPageContent, test, testEach } from "../../../../../utils/playwright.e2e.test.utils";
|
|
13
|
-
const TIMEOUT = 1000;
|
|
14
|
-
const slotContent = '<div><h3>Demo title</h3><p>some content</p></div>';
|
|
15
|
-
const slotMenuItem = '<mg-menu label="submenu"><mg-menu-item><span slot="label">Batman begins</span></mg-menu-item></mg-menu>';
|
|
16
|
-
const slotImage = '<mg-icon icon="user" slot="image"></mg-icon>';
|
|
17
|
-
const slotInformation = '<mg-badge value="2" label="hello" slot="information"></mg-badge>';
|
|
18
|
-
const slotMetadata = '<span slot="metadata">is a hero</span>';
|
|
19
|
-
const createHTML = (args, slot = '', direction = Direction.HORIZONTAL) => `
|
|
20
|
-
<mg-menu ${renderAttributes(Object.assign({ label: 'batmenu', direction }, args))}">
|
|
21
|
-
<mg-menu-item ${renderAttributes(args)}>
|
|
22
|
-
<span slot="label">${args.label ? args.label : 'batman'} ${args.href ? 'link' : ''}</span>
|
|
23
|
-
${slot}
|
|
24
|
-
</mg-menu-item>
|
|
25
|
-
</mg-menu>
|
|
26
|
-
`;
|
|
27
|
-
describe('mg-menu-item', () => {
|
|
28
|
-
describeEach([Direction.HORIZONTAL, Direction.VERTICAL])('render %s', (direction) => {
|
|
29
|
-
testEach([Status.ACTIVE, Status.VISIBLE, Status.HIDDEN, Status.DISABLED].flatMap(status => [undefined, '#link'].flatMap(href => [true, false].map(submenu => createHTML({ status, href }, submenu && slotMenuItem, direction)))))('should render whith status %s', async (page, html) => {
|
|
30
|
-
await setPageContent(page, html, { width: 100, height: 38 });
|
|
31
|
-
if (!html.includes('status="hidden"')) {
|
|
32
|
-
await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
33
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
await expect(page.locator('body')).toHaveScreenshot();
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
testEach([
|
|
40
|
-
{ label: 'submenu', slot: slotMenuItem },
|
|
41
|
-
{ label: 'image', slot: slotImage },
|
|
42
|
-
{ label: 'information', slot: slotInformation },
|
|
43
|
-
{ label: 'information AND image', slot: slotInformation + slotImage },
|
|
44
|
-
].flatMap(({ label, slot }) => [slotMenuItem, ''].flatMap(submenu => [slotMetadata, ''].map(metadata => createHTML({ label, size: metadata !== '' ? 'medium' : 'regular' }, [slot, metadata, submenu].join(''), direction)))))('should render whith slots %s', async (page, html) => {
|
|
45
|
-
await setPageContent(page, html, { width: 130, height: 60 });
|
|
46
|
-
await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
47
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
48
|
-
});
|
|
49
|
-
testEach(sizes)(`should renders direction=${direction}, props size=%s`, async (page, size) => {
|
|
50
|
-
await setPageContent(page, createHTML({ size }, [slotInformation, slotImage, slotMenuItem].join(''), direction), { width: 130, height: 110 });
|
|
51
|
-
await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
52
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
53
|
-
});
|
|
54
|
-
testEach([true, false])(`should renders direction=${direction}, props expanded=%s`, async (page, expanded) => {
|
|
55
|
-
await setPageContent(page, createHTML({ expanded }, slotMenuItem, direction), { width: 130, height: 110 });
|
|
56
|
-
await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
57
|
-
await expect(page.locator(expanded ? 'body' : '.e2e-screenshot')).toHaveScreenshot();
|
|
58
|
-
});
|
|
59
|
-
test('should render content slot', async ({ page }) => {
|
|
60
|
-
await setPageContent(page, createHTML({ expanded: true }, slotContent, direction), { width: 100, height: 150 });
|
|
61
|
-
await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
62
|
-
await expect(page.locator('body')).toHaveScreenshot();
|
|
63
|
-
});
|
|
64
|
-
testEach([Status.ACTIVE, Status.VISIBLE, Status.HIDDEN, Status.DISABLED])('shoud manage keyboard navigation %s', async (page, status) => {
|
|
65
|
-
var _a, e_1, _b, _c;
|
|
66
|
-
await setPageContent(page, createHTML({ status }, slotMenuItem, direction), { width: 120, height: 200 });
|
|
67
|
-
if (status !== Status.HIDDEN) {
|
|
68
|
-
await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });
|
|
69
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
await expect(page.locator('body')).toHaveScreenshot();
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
for (var _d = true, _e = __asyncValues(['Tab', 'Enter']), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
|
|
76
|
-
_c = _f.value;
|
|
77
|
-
_d = false;
|
|
78
|
-
const key = _c;
|
|
79
|
-
await page.keyboard.press(key);
|
|
80
|
-
await page.waitForTimeout(200);
|
|
81
|
-
await expect(page.locator('body')).toHaveScreenshot();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch (e_1_1) {
|
|
85
|
-
e_1 = { error: e_1_1 };
|
|
86
|
-
}
|
|
87
|
-
finally {
|
|
88
|
-
try {
|
|
89
|
-
if (!_d && !_a && (_b = _e.return))
|
|
90
|
-
await _b.call(_e);
|
|
91
|
-
}
|
|
92
|
-
finally {
|
|
93
|
-
if (e_1)
|
|
94
|
-
throw e_1.error;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
//# sourceMappingURL=mg-menu-item.e2e.playwright.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mg-menu-item.e2e.playwright.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAY,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAE1I,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,WAAW,GAAG,mDAAmD,CAAC;AACxE,MAAM,YAAY,GAAG,yGAAyG,CAAC;AAC/H,MAAM,SAAS,GAAG,8CAA8C,CAAC;AACjE,MAAM,eAAe,GAAG,kEAAkE,CAAC;AAC3F,MAAM,YAAY,GAAG,wCAAwC,CAAC;AAE9D,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,SAAS,CAAC,UAAU,EAAE,EAAE,CAAC;WAC/D,gBAAgB,iBAAG,KAAK,EAAE,SAAS,EAAE,SAAS,IAAK,IAAI,EAAG;kBACnD,gBAAgB,CAAC,IAAI,CAAC;yBACf,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;MAChF,IAAI;;;CAGT,CAAC;AA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ClB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;UAC/B,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;UAC/B,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;SACvD;;;;;;;;;IACH,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { renderAttributes } from '../../../../../utils/e2e.test.utils';\nimport { Direction, sizes } from '../../mg-menu/mg-menu.conf';\nimport { Status } from '../mg-menu-item.conf';\nimport { PageType, describe, describeEach, expect, setPageContent, test, testEach } from '../../../../../utils/playwright.e2e.test.utils';\n\nconst TIMEOUT = 1000;\nconst slotContent = '<div><h3>Demo title</h3><p>some content</p></div>';\nconst slotMenuItem = '<mg-menu label=\"submenu\"><mg-menu-item><span slot=\"label\">Batman begins</span></mg-menu-item></mg-menu>';\nconst slotImage = '<mg-icon icon=\"user\" slot=\"image\"></mg-icon>';\nconst slotInformation = '<mg-badge value=\"2\" label=\"hello\" slot=\"information\"></mg-badge>';\nconst slotMetadata = '<span slot=\"metadata\">is a hero</span>';\n\nconst createHTML = (args, slot = '', direction = Direction.HORIZONTAL) => `\n<mg-menu ${renderAttributes({ label: 'batmenu', direction, ...args })}\">\n <mg-menu-item ${renderAttributes(args)}>\n <span slot=\"label\">${args.label ? args.label : 'batman'} ${args.href ? 'link' : ''}</span>\n ${slot}\n </mg-menu-item>\n</mg-menu>\n`;\n\ndescribe('mg-menu-item', () => {\n describeEach([Direction.HORIZONTAL, Direction.VERTICAL])('render %s', (direction: Direction) => {\n testEach(\n [Status.ACTIVE, Status.VISIBLE, Status.HIDDEN, Status.DISABLED].flatMap(status =>\n [undefined, '#link'].flatMap(href => [true, false].map(submenu => createHTML({ status, href }, submenu && slotMenuItem, direction))),\n ),\n )('should render whith status %s', async (page: PageType, html: string) => {\n await setPageContent(page, html, { width: 100, height: 38 });\n\n if (!html.includes('status=\"hidden\"')) {\n await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n } else {\n await expect(page.locator('body')).toHaveScreenshot();\n }\n });\n\n testEach(\n [\n { label: 'submenu', slot: slotMenuItem },\n { label: 'image', slot: slotImage },\n { label: 'information', slot: slotInformation },\n { label: 'information AND image', slot: slotInformation + slotImage },\n ].flatMap(({ label, slot }) =>\n [slotMenuItem, ''].flatMap(submenu =>\n [slotMetadata, ''].map(metadata => createHTML({ label, size: metadata !== '' ? 'medium' : 'regular' }, [slot, metadata, submenu].join(''), direction)),\n ),\n ),\n )('should render whith slots %s', async (page: PageType, html: string) => {\n await setPageContent(page, html, { width: 130, height: 60 });\n\n await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n\n testEach(sizes)(`should renders direction=${direction}, props size=%s`, async (page: PageType, size) => {\n await setPageContent(page, createHTML({ size }, [slotInformation, slotImage, slotMenuItem].join(''), direction), { width: 130, height: 110 });\n\n await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n\n testEach([true, false])(`should renders direction=${direction}, props expanded=%s`, async (page: PageType, expanded: boolean) => {\n await setPageContent(page, createHTML({ expanded }, slotMenuItem, direction), { width: 130, height: 110 });\n\n await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator(expanded ? 'body' : '.e2e-screenshot')).toHaveScreenshot();\n });\n\n test('should render content slot', async ({ page }) => {\n await setPageContent(page, createHTML({ expanded: true }, slotContent, direction), { width: 100, height: 150 });\n\n await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('body')).toHaveScreenshot();\n });\n\n testEach([Status.ACTIVE, Status.VISIBLE, Status.HIDDEN, Status.DISABLED])('shoud manage keyboard navigation %s', async (page: PageType, status) => {\n await setPageContent(page, createHTML({ status }, slotMenuItem, direction), { width: 120, height: 200 });\n\n if (status !== Status.HIDDEN) {\n await page.locator('mg-menu-item.hydrated').first().waitFor({ timeout: TIMEOUT });\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n } else {\n await expect(page.locator('body')).toHaveScreenshot();\n }\n\n for await (const key of ['Tab', 'Enter']) {\n await page.keyboard.press(key);\n await page.waitForTimeout(200);\n await expect(page.locator('body')).toHaveScreenshot();\n }\n });\n });\n});\n"]}
|