@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,108 +0,0 @@
|
|
|
1
|
-
import { createID } from "../../../../../utils/components.utils";
|
|
2
|
-
import { renderAttributes, renderProperties } from "../../../../../utils/e2e.test.utils";
|
|
3
|
-
import { setPageContent, describe, testEach, expect, test } from "../../../../../utils/playwright.e2e.test.utils";
|
|
4
|
-
const TIMEOUT = 1000;
|
|
5
|
-
const defaultSlots = '<span slot="item-1">Choix A</span><span slot="item-2">Choix B</span>';
|
|
6
|
-
const defaultProps = {
|
|
7
|
-
identifier: createID(),
|
|
8
|
-
label: 'label',
|
|
9
|
-
items: [
|
|
10
|
-
{ title: 'batman', value: false },
|
|
11
|
-
{ title: 'joker', value: true },
|
|
12
|
-
],
|
|
13
|
-
};
|
|
14
|
-
const createHTML = (args = {}, slots = defaultSlots) => {
|
|
15
|
-
const props = Object.assign(Object.assign({}, defaultProps), args);
|
|
16
|
-
return `<mg-input-toggle ${renderAttributes(props)}>${slots}</mg-input-toggle><script>${renderProperties(props, `[identifier="${props.identifier}"]`)}</script>`;
|
|
17
|
-
};
|
|
18
|
-
describe('mg-input-toggle', () => {
|
|
19
|
-
testEach([
|
|
20
|
-
{},
|
|
21
|
-
{ args: { isOnOff: true }, slots: '<span slot="item-1">Non</span><span slot="item-2">Oui</span>' },
|
|
22
|
-
{ args: { isIcon: true, isOnOff: true }, slots: '<mg-icon icon="cross" slot="item-1"></mg-icon><mg-icon icon="check" slot="item-2"></mg-icon>' },
|
|
23
|
-
{
|
|
24
|
-
slots: '<span slot="item-1">Choix A très long long long long long long long long long long long long long</span><span slot="item-2">Choix B très long long long long long long long long long long long long long</span>',
|
|
25
|
-
},
|
|
26
|
-
])('Keyboard navigation %s', async (page, { args, slots }) => {
|
|
27
|
-
await setPageContent(page, createHTML(args, slots));
|
|
28
|
-
await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });
|
|
29
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
30
|
-
for (const key of ['Tab', 'Space', 'Tab']) {
|
|
31
|
-
if (key === 'Space')
|
|
32
|
-
await page.locator('mg-input-toggle button').press('Space');
|
|
33
|
-
else
|
|
34
|
-
await page.keyboard.down(key);
|
|
35
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
testEach([
|
|
39
|
-
{ args: { labelOnTop: true, helpText: 'HelpText Message' } },
|
|
40
|
-
{ args: { inputVerticalList: true, helpText: 'HelpText Message' } },
|
|
41
|
-
{ args: { labelOnTop: true, inputVerticalList: true, helpText: 'HelpText Message' } },
|
|
42
|
-
{
|
|
43
|
-
slots: '<span slot="item-1">Choix A très long long long long long long long long long long long long long</span><span slot="item-2">Choix B très long long long long long long long long long long long long long</span>',
|
|
44
|
-
},
|
|
45
|
-
{ args: { readonly: true }, slots: '<span slot="item-1">Choix A avec text long long</span><span slot="item-2">Choix B avec text long long</span>' },
|
|
46
|
-
{ args: { labelHide: true } },
|
|
47
|
-
{ args: { isOnOff: true, readonly: true }, slots: '<span slot="item-1">Off</span><span slot="item-2">On</span>' },
|
|
48
|
-
{ args: { placeholder: 'placeholder', helpText: 'HelpText Message' } },
|
|
49
|
-
{ args: { helpText: '<mg-icon icon="user" size="small"></mg-icon> Welcome batman' } },
|
|
50
|
-
])('Render without tooltip %s', async (page, { args, slots }) => {
|
|
51
|
-
await setPageContent(page, createHTML(args, slots));
|
|
52
|
-
await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });
|
|
53
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
54
|
-
});
|
|
55
|
-
testEach([undefined, false, true])('Render and toggle value whith reverse checked logic %s', async (page, value) => {
|
|
56
|
-
await setPageContent(page, createHTML({
|
|
57
|
-
items: [
|
|
58
|
-
{ title: 'batman', value: true },
|
|
59
|
-
{ title: 'joker', value: false },
|
|
60
|
-
],
|
|
61
|
-
value,
|
|
62
|
-
}));
|
|
63
|
-
await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });
|
|
64
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
65
|
-
await page.locator('mg-input-toggle button').click();
|
|
66
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
67
|
-
});
|
|
68
|
-
testEach([true, false])('render with tooltip, case label-on-top %s', async (page, labelOnTop) => {
|
|
69
|
-
await setPageContent(page, createHTML({ tooltip: 'Tooltip message', labelOnTop }), { width: 250, height: 65 });
|
|
70
|
-
await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });
|
|
71
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
72
|
-
await page.keyboard.down('Tab');
|
|
73
|
-
if (!labelOnTop) {
|
|
74
|
-
// when label on top tooltip is on fist tab (next to label)
|
|
75
|
-
await page.keyboard.down('Tab');
|
|
76
|
-
await page.locator('mg-tooltip-content.hydrated').waitFor({ timeout: TIMEOUT });
|
|
77
|
-
await expect(page.locator('body')).toHaveScreenshot();
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
testEach([true, false].flatMap(value => [true, false].flatMap(readonly => [true, false].flatMap(labelOnTop => [true, false].map(disabled => ({ value, labelOnTop, readonly, disabled }))))))('Should render with template %s', async (page, args) => {
|
|
84
|
-
await setPageContent(page, createHTML(args));
|
|
85
|
-
await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });
|
|
86
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
87
|
-
});
|
|
88
|
-
testEach([true, false].map(labelOnTop => ({
|
|
89
|
-
label: 'long label long label long label long label long label long label long label long label long label long label long label',
|
|
90
|
-
tooltip: 'tooltip message',
|
|
91
|
-
labelOnTop,
|
|
92
|
-
})))('render inside a div.mg-form-group %s', async (page, args) => {
|
|
93
|
-
await setPageContent(page, `<div class="mg-form-group">${createHTML(args)}</div>`);
|
|
94
|
-
await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });
|
|
95
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
96
|
-
});
|
|
97
|
-
test('render with error', async ({ page }) => {
|
|
98
|
-
await setPageContent(page, createHTML({}));
|
|
99
|
-
await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });
|
|
100
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
101
|
-
await page.$eval('mg-input-toggle', async (el) => {
|
|
102
|
-
await el.setError(false, 'This is an error Batman');
|
|
103
|
-
});
|
|
104
|
-
await page.locator('.mg-c-input__input--has-error');
|
|
105
|
-
await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
//# sourceMappingURL=mg-input-toggle.e2e.playwright.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-toggle.e2e.playwright.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAY,IAAI,EAAE,MAAM,gDAAgD,CAAC;AAK5H,MAAM,OAAO,GAAG,IAAI,CAAC;AAErB,MAAM,YAAY,GAAG,sEAAsE,CAAC;AAE5F,MAAM,YAAY,GAAG;EACnB,UAAU,EAAE,QAAQ,EAAE;EACtB,KAAK,EAAE,OAAO;EACd,KAAK,EAAE;IACL,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE;IACjC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE;GAChC;CACF,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,OAAkB,EAAE,EAAE,KAAK,GAAG,YAAY,EAAE,EAAE;EAChE,MAAM,KAAK,mCAAQ,YAAY,GAAK,IAAI,CAAE,CAAC;EAC3C,OAAO,oBAAoB,gBAAgB,CAAC,KAAK,CAAC,IAAI,KAAK,6BAA6B,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,KAAK,CAAC,UAAU,IAAI,CAAC,WAAW,CAAC;AACnK,CAAC,CAAC;AAEF,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;EAC/B,QAAQ,CAAC;IACP,EAAE;IACF,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,8DAA8D,EAAE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C,IAAI,EAAE,8BAA8B,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEnF,MAAM,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7E,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;EACnE,CAAC,CAAC,CAAC;EAEH,IAAI,CAAC,mBAAmB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;IAC3C,MAAM,cAAc,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3C,MAAM,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7E,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAEjE,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAC,EAAE,EAAC,EAAE;MAC7C,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC;IACpD,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;EACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { createID } from '../../../../../utils/components.utils';\nimport { renderAttributes, renderProperties } from '../../../../../utils/e2e.test.utils';\nimport { setPageContent, describe, testEach, expect, PageType, test } from '../../../../../utils/playwright.e2e.test.utils';\nimport { MgInputToggle } from '../mg-input-toggle';\n\ntype PropsType = Partial<MgInputToggle>;\n\nconst TIMEOUT = 1000;\n\nconst defaultSlots = '<span slot=\"item-1\">Choix A</span><span slot=\"item-2\">Choix B</span>';\n\nconst defaultProps = {\n identifier: createID(),\n label: 'label',\n items: [\n { title: 'batman', value: false },\n { title: 'joker', value: true },\n ],\n};\n\nconst createHTML = (args: PropsType = {}, slots = defaultSlots) => {\n const props = { ...defaultProps, ...args };\n return `<mg-input-toggle ${renderAttributes(props)}>${slots}</mg-input-toggle><script>${renderProperties(props, `[identifier=\"${props.identifier}\"]`)}</script>`;\n};\n\ndescribe('mg-input-toggle', () => {\n testEach([\n {},\n { args: { isOnOff: true }, slots: '<span slot=\"item-1\">Non</span><span slot=\"item-2\">Oui</span>' },\n { args: { isIcon: true, isOnOff: true }, slots: '<mg-icon icon=\"cross\" slot=\"item-1\"></mg-icon><mg-icon icon=\"check\" slot=\"item-2\"></mg-icon>' },\n {\n slots:\n '<span slot=\"item-1\">Choix A très long long long long long long long long long long long long long</span><span slot=\"item-2\">Choix B très long long long long long long long long long long long long long</span>',\n },\n ])('Keyboard navigation %s', async (page: PageType, { args, slots }: { args: PropsType; slots: string }) => {\n await setPageContent(page, createHTML(args, slots));\n\n await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n\n for (const key of ['Tab', 'Space', 'Tab']) {\n if (key === 'Space') await page.locator('mg-input-toggle button').press('Space');\n else await page.keyboard.down(key);\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n }\n });\n\n testEach([\n { args: { labelOnTop: true, helpText: 'HelpText Message' } },\n { args: { inputVerticalList: true, helpText: 'HelpText Message' } },\n { args: { labelOnTop: true, inputVerticalList: true, helpText: 'HelpText Message' } },\n {\n slots:\n '<span slot=\"item-1\">Choix A très long long long long long long long long long long long long long</span><span slot=\"item-2\">Choix B très long long long long long long long long long long long long long</span>',\n },\n { args: { readonly: true }, slots: '<span slot=\"item-1\">Choix A avec text long long</span><span slot=\"item-2\">Choix B avec text long long</span>' },\n { args: { labelHide: true } },\n { args: { isOnOff: true, readonly: true }, slots: '<span slot=\"item-1\">Off</span><span slot=\"item-2\">On</span>' },\n { args: { placeholder: 'placeholder', helpText: 'HelpText Message' } },\n { args: { helpText: '<mg-icon icon=\"user\" size=\"small\"></mg-icon> Welcome batman' } },\n ])('Render without tooltip %s', async (page: PageType, { args, slots }: { args: PropsType; slots: string }) => {\n await setPageContent(page, createHTML(args, slots));\n\n await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n\n testEach([undefined, false, true])('Render and toggle value whith reverse checked logic %s', async (page: PageType, value) => {\n await setPageContent(\n page,\n createHTML({\n items: [\n { title: 'batman', value: true },\n { title: 'joker', value: false },\n ],\n value,\n }),\n );\n\n await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n\n await page.locator('mg-input-toggle button').click();\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n\n testEach([true, false])('render with tooltip, case label-on-top %s', async (page: PageType, labelOnTop: boolean) => {\n await setPageContent(page, createHTML({ tooltip: 'Tooltip message', labelOnTop }), { width: 250, height: 65 });\n\n await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n\n await page.keyboard.down('Tab');\n if (!labelOnTop) {\n // when label on top tooltip is on fist tab (next to label)\n await page.keyboard.down('Tab');\n await page.locator('mg-tooltip-content.hydrated').waitFor({ timeout: TIMEOUT });\n await expect(page.locator('body')).toHaveScreenshot();\n } else {\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n }\n });\n\n testEach(\n [true, false].flatMap(value =>\n [true, false].flatMap(readonly => [true, false].flatMap(labelOnTop => [true, false].map(disabled => ({ value, labelOnTop, readonly, disabled })))),\n ),\n )('Should render with template %s', async (page: PageType, args) => {\n await setPageContent(page, createHTML(args));\n\n await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });\n\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n\n testEach(\n [true, false].map(labelOnTop => ({\n label: 'long label long label long label long label long label long label long label long label long label long label long label',\n tooltip: 'tooltip message',\n labelOnTop,\n })),\n )('render inside a div.mg-form-group %s', async (page: PageType, args) => {\n await setPageContent(page, `<div class=\"mg-form-group\">${createHTML(args)}</div>`);\n\n await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n\n test('render with error', async ({ page }) => {\n await setPageContent(page, createHTML({}));\n\n await page.locator('mg-input-toggle.hydrated').waitFor({ timeout: TIMEOUT });\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n\n await page.$eval('mg-input-toggle', async el => {\n await el.setError(false, 'This is an error Batman');\n });\n\n await page.locator('.mg-c-input__input--has-error');\n await expect(page.locator('.e2e-screenshot')).toHaveScreenshot();\n });\n});\n"]}
|
package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
import { newSpecPage } from "@stencil/core/testing";
|
|
3
|
-
import { MgInputToggle } from "../mg-input-toggle";
|
|
4
|
-
import { MgIcon } from "../../../../atoms/mg-icon/mg-icon";
|
|
5
|
-
const getPage = (args, slots) => newSpecPage({
|
|
6
|
-
components: [MgInputToggle, MgIcon],
|
|
7
|
-
template: () => h("mg-input-toggle", Object.assign({}, args), slots && slots.map(slot => slot())),
|
|
8
|
-
});
|
|
9
|
-
const defaultSlots = [() => h("span", { slot: "item-1" }, "Batman"), () => h("span", { slot: "item-2" }, "Joker")];
|
|
10
|
-
const onOffSlots = [() => h("span", { slot: "item-1" }, "Non"), () => h("span", { slot: "item-2" }, "Oui")];
|
|
11
|
-
const iconSlots = [
|
|
12
|
-
() => (h("span", { slot: "item-1" }, h("mg-icon", { icon: "cross" }))),
|
|
13
|
-
() => (h("span", { slot: "item-2" }, h("mg-icon", { icon: "check" }))),
|
|
14
|
-
];
|
|
15
|
-
const defaultProps = {
|
|
16
|
-
label: 'label',
|
|
17
|
-
identifier: 'identifier',
|
|
18
|
-
items: [
|
|
19
|
-
{ title: 'batman', value: false },
|
|
20
|
-
{ title: 'joker', value: true },
|
|
21
|
-
],
|
|
22
|
-
};
|
|
23
|
-
describe('mg-input-toggle', () => {
|
|
24
|
-
describe.each([
|
|
25
|
-
{
|
|
26
|
-
props: Object.assign({}, defaultProps),
|
|
27
|
-
slots: defaultSlots,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
props: Object.assign(Object.assign({}, defaultProps), { value: '' }),
|
|
31
|
-
slots: defaultSlots,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
props: Object.assign(Object.assign({}, defaultProps), { value: true }),
|
|
35
|
-
slots: defaultSlots,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
props: Object.assign(Object.assign({}, defaultProps), { value: 'true' }),
|
|
39
|
-
slots: defaultSlots,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
props: Object.assign(Object.assign({}, defaultProps), { isOnOff: false }),
|
|
43
|
-
slots: onOffSlots,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
props: Object.assign(Object.assign({}, defaultProps), { isIcon: true, isOnOff: true }),
|
|
47
|
-
slots: iconSlots,
|
|
48
|
-
},
|
|
49
|
-
])('template', ({ props, slots }) => {
|
|
50
|
-
test.each([
|
|
51
|
-
Object.assign({}, props),
|
|
52
|
-
Object.assign(Object.assign({}, props), { labelOnTop: true }),
|
|
53
|
-
Object.assign(Object.assign({}, props), { labelHide: true }),
|
|
54
|
-
Object.assign(Object.assign({}, props), { readonly: true }),
|
|
55
|
-
Object.assign(Object.assign({}, props), { disabled: true }),
|
|
56
|
-
Object.assign(Object.assign({}, props), { helpText: 'Hello joker' }),
|
|
57
|
-
Object.assign(Object.assign({}, props), { tooltip: 'My Tooltip Message' }),
|
|
58
|
-
Object.assign(Object.assign({}, props), { tooltip: 'My Tooltip Message', labelOnTop: true }),
|
|
59
|
-
])('Should render with args %s:', async (args) => {
|
|
60
|
-
const { root } = await getPage(args, slots);
|
|
61
|
-
expect(root).toMatchSnapshot();
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
describe('errors', () => {
|
|
65
|
-
test.each(['', ' ', undefined])('Should not render with invalid identifier property: %s', async (identifier) => {
|
|
66
|
-
expect.assertions(1);
|
|
67
|
-
try {
|
|
68
|
-
await getPage({
|
|
69
|
-
identifier,
|
|
70
|
-
label: 'label',
|
|
71
|
-
items: [
|
|
72
|
-
{ title: 'batman', value: false },
|
|
73
|
-
{ title: 'joker', value: true },
|
|
74
|
-
],
|
|
75
|
-
}, defaultSlots);
|
|
76
|
-
}
|
|
77
|
-
catch (err) {
|
|
78
|
-
expect(err.message).toMatch('<mg-input> prop "identifier" is required.');
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
test.each(['', ' ', undefined])('Should throw error with invalid label property: %s', async (label) => {
|
|
82
|
-
expect.assertions(1);
|
|
83
|
-
try {
|
|
84
|
-
await getPage({
|
|
85
|
-
identifier: 'identifier',
|
|
86
|
-
label,
|
|
87
|
-
items: [
|
|
88
|
-
{ title: 'batman', value: false },
|
|
89
|
-
{ title: 'joker', value: true },
|
|
90
|
-
],
|
|
91
|
-
}, defaultSlots);
|
|
92
|
-
}
|
|
93
|
-
catch (err) {
|
|
94
|
-
expect(err.message).toMatch('<mg-input> prop "label" is required.');
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
test('Should throw an error with labelOnTop & labelHide set to true', async () => {
|
|
98
|
-
expect.assertions(1);
|
|
99
|
-
try {
|
|
100
|
-
await getPage({ identifier: 'identifier', label: 'batman', labelOnTop: true, labelHide: true, items: ['batman', 'joker'] }, defaultSlots);
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
expect(err.message).toMatch('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide"');
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
test('Should throw an error with less than 2 items, case %s', async () => {
|
|
107
|
-
expect.assertions(1);
|
|
108
|
-
try {
|
|
109
|
-
await getPage({ label: 'batman', items: [{ title: 'batman' }] }, defaultSlots);
|
|
110
|
-
}
|
|
111
|
-
catch (err) {
|
|
112
|
-
expect(err.message).toMatch('<mg-input-toggle> prop "items" require 2 items.');
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
test.each([undefined, [defaultSlots[0]], [...defaultSlots, ...defaultSlots]])('Should throw an error with blank slots', async () => {
|
|
116
|
-
expect.assertions(1);
|
|
117
|
-
try {
|
|
118
|
-
await getPage({ label: 'batman', items: ['batman', 'joker'] });
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
expect(err.message).toMatch('<mg-input-toggle> 2 slots are required.');
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
test.each([
|
|
125
|
-
[['batman', { title: 'batman', value: 'batman' }]],
|
|
126
|
-
[['batman', { batman: 'batman' }]],
|
|
127
|
-
[[true, false]],
|
|
128
|
-
[[1, 2]],
|
|
129
|
-
[[true, 'batman']],
|
|
130
|
-
[[{ title: 'batman', value: 'batman' }, { batman: 'batman' }]],
|
|
131
|
-
[
|
|
132
|
-
[
|
|
133
|
-
{ title: 'batman', value: undefined },
|
|
134
|
-
{ title: 'batman', value: 'test' },
|
|
135
|
-
],
|
|
136
|
-
],
|
|
137
|
-
])('Should throw error with invalid items property: %s', async (items) => {
|
|
138
|
-
expect.assertions(1);
|
|
139
|
-
try {
|
|
140
|
-
await getPage({ label: 'Label', items }, defaultSlots);
|
|
141
|
-
}
|
|
142
|
-
catch (err) {
|
|
143
|
-
expect(err.message).toMatch('<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue.');
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
test.each([
|
|
148
|
-
{
|
|
149
|
-
items: [
|
|
150
|
-
{ title: 'batman', value: 'a' },
|
|
151
|
-
{ title: 'joker', value: 'b' },
|
|
152
|
-
],
|
|
153
|
-
expected: 'b',
|
|
154
|
-
value: undefined,
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
items: [
|
|
158
|
-
{ title: 'batman', value: 'a' },
|
|
159
|
-
{ title: 'joker', value: 'b' },
|
|
160
|
-
],
|
|
161
|
-
expected: 'a',
|
|
162
|
-
value: 'b',
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
items: [
|
|
166
|
-
{ title: 'batman', value: 1 },
|
|
167
|
-
{ title: 'joker', value: 2 },
|
|
168
|
-
],
|
|
169
|
-
expected: 2,
|
|
170
|
-
value: 1,
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
items: [
|
|
174
|
-
{ title: 'batman', value: false },
|
|
175
|
-
{ title: 'robin', value: true },
|
|
176
|
-
],
|
|
177
|
-
expected: false,
|
|
178
|
-
value: true,
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
items: [
|
|
182
|
-
{ title: 'batman', value: true },
|
|
183
|
-
{ title: 'robin', value: false },
|
|
184
|
-
],
|
|
185
|
-
expected: true,
|
|
186
|
-
value: false,
|
|
187
|
-
},
|
|
188
|
-
])('Should trigger events for items with inputValue: %s', async ({ items, expected, value }) => {
|
|
189
|
-
const args = { label: 'label', items, identifier: 'identifier', helpText: 'My help text', value };
|
|
190
|
-
const page = await getPage(args, defaultSlots);
|
|
191
|
-
const mgInputToggle = page.doc.querySelector('mg-input-toggle');
|
|
192
|
-
const button = mgInputToggle.shadowRoot.querySelector('button');
|
|
193
|
-
jest.spyOn(page.rootInstance.valueChange, 'emit');
|
|
194
|
-
button.dispatchEvent(new CustomEvent('focus', { bubbles: true }));
|
|
195
|
-
await page.waitForChanges();
|
|
196
|
-
expect(page.root).toMatchSnapshot(); //Snapshot on focus
|
|
197
|
-
button.dispatchEvent(new CustomEvent('click', { bubbles: true }));
|
|
198
|
-
await page.waitForChanges();
|
|
199
|
-
expect(page.rootInstance.valueChange.emit).toHaveBeenCalledWith(expected);
|
|
200
|
-
expect(page.rootInstance.valueChange.emit).toHaveBeenCalledTimes(1);
|
|
201
|
-
});
|
|
202
|
-
describe('setError', () => {
|
|
203
|
-
test.each([true, false])("should display override error with setError component's public method", async (valid) => {
|
|
204
|
-
const page = await getPage(Object.assign({}, defaultProps), defaultSlots);
|
|
205
|
-
const mgInputToggle = page.doc.querySelector('mg-input-toggle');
|
|
206
|
-
const spyInputValid = jest.spyOn(page.rootInstance.inputValid, 'emit');
|
|
207
|
-
await mgInputToggle.setError(valid, 'error batman');
|
|
208
|
-
await page.waitForChanges();
|
|
209
|
-
expect(spyInputValid).toHaveBeenCalledTimes(1);
|
|
210
|
-
expect(page.root).toMatchSnapshot();
|
|
211
|
-
});
|
|
212
|
-
test.each([
|
|
213
|
-
{
|
|
214
|
-
valid: '',
|
|
215
|
-
errorMessage: 'Override error',
|
|
216
|
-
error: '<mg-input-toggle> method "setError()" param "valid" must be a boolean',
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
valid: undefined,
|
|
220
|
-
errorMessage: 'Override error',
|
|
221
|
-
error: '<mg-input-toggle> method "setError()" param "valid" must be a boolean',
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
valid: true,
|
|
225
|
-
errorMessage: ' ',
|
|
226
|
-
error: '<mg-input-toggle> method "setError()" param "errorMessage" must be a string',
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
valid: true,
|
|
230
|
-
errorMessage: true,
|
|
231
|
-
error: '<mg-input-toggle> method "setError()" param "errorMessage" must be a string',
|
|
232
|
-
},
|
|
233
|
-
])("shloud throw error with setError component's public method invalid params", async (params) => {
|
|
234
|
-
expect.assertions(1);
|
|
235
|
-
try {
|
|
236
|
-
const page = await getPage(Object.assign({}, defaultProps), defaultSlots);
|
|
237
|
-
const mgInputToggle = page.doc.querySelector('mg-input-toggle');
|
|
238
|
-
await mgInputToggle.setError(params.valid, params.errorMessage);
|
|
239
|
-
await page.waitForChanges();
|
|
240
|
-
}
|
|
241
|
-
catch (err) {
|
|
242
|
-
expect(err.message).toMatch(params.error);
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
//# sourceMappingURL=mg-input-toggle.spec.js.map
|
package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-toggle.spec.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAE3D,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,KAAM,EAAE,EAAE,CAC/B,WAAW,CAAC;EACV,UAAU,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC;EACnC,QAAQ,EAAE,GAAG,EAAE,CAAC,uCAAqB,IAAI,GAAG,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAmB;CAClG,CAAC,CAAC;AAEL,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,CAAC,YAAM,IAAI,EAAC,QAAQ,aAAc,EAAE,GAAG,EAAE,CAAC,YAAM,IAAI,EAAC,QAAQ,YAAa,CAAC,CAAC;AACvG,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,CAAC,YAAM,IAAI,EAA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7F,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;MACrB,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,OAAO,mBAAM,YAAY,GAAI,YAAY,CAAC,CAAC;QAE9D,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;QAChE,MAAM,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,KAA2B,EAAE,MAAM,CAAC,YAAiC,CAAC,CAAC;QAE3G,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;OAC7B;MAAC,OAAO,GAAG,EAAE;QACZ,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;OAC3C;IACH,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgInputToggle } from '../mg-input-toggle';\nimport { MgIcon } from '../../../../atoms/mg-icon/mg-icon';\n\nconst getPage = (args, slots?) =>\n newSpecPage({\n components: [MgInputToggle, MgIcon],\n template: () => <mg-input-toggle {...args}>{slots && slots.map(slot => slot())}</mg-input-toggle>,\n });\n\nconst defaultSlots = [() => <span slot=\"item-1\">Batman</span>, () => <span slot=\"item-2\">Joker</span>];\nconst onOffSlots = [() => <span slot=\"item-1\">Non</span>, () => <span slot=\"item-2\">Oui</span>];\nconst iconSlots = [\n () => (\n <span slot=\"item-1\">\n <mg-icon icon=\"cross\"></mg-icon>\n </span>\n ),\n () => (\n <span slot=\"item-2\">\n <mg-icon icon=\"check\"></mg-icon>\n </span>\n ),\n];\n\nconst defaultProps = {\n label: 'label',\n identifier: 'identifier',\n items: [\n { title: 'batman', value: false },\n { title: 'joker', value: true },\n ],\n};\n\ndescribe('mg-input-toggle', () => {\n describe.each([\n {\n props: {\n ...defaultProps,\n },\n slots: defaultSlots,\n },\n {\n props: {\n ...defaultProps,\n value: '',\n },\n slots: defaultSlots,\n },\n {\n props: {\n ...defaultProps,\n value: true,\n },\n slots: defaultSlots,\n },\n {\n props: {\n ...defaultProps,\n value: 'true',\n },\n slots: defaultSlots,\n },\n {\n props: {\n ...defaultProps,\n isOnOff: false,\n },\n slots: onOffSlots,\n },\n {\n props: {\n ...defaultProps,\n isIcon: true,\n isOnOff: true,\n },\n slots: iconSlots,\n },\n ])('template', ({ props, slots }) => {\n test.each([\n {\n ...props,\n },\n {\n ...props,\n labelOnTop: true,\n },\n {\n ...props,\n labelHide: true,\n },\n {\n ...props,\n readonly: true,\n },\n {\n ...props,\n disabled: true,\n },\n {\n ...props,\n helpText: 'Hello joker',\n },\n {\n ...props,\n tooltip: 'My Tooltip Message',\n },\n {\n ...props,\n tooltip: 'My Tooltip Message',\n labelOnTop: true,\n },\n ])('Should render with args %s:', async args => {\n const { root } = await getPage(args, slots);\n expect(root).toMatchSnapshot();\n });\n });\n\n describe('errors', () => {\n test.each(['', ' ', undefined])('Should not render with invalid identifier property: %s', async identifier => {\n expect.assertions(1);\n try {\n await getPage(\n {\n identifier,\n label: 'label',\n items: [\n { title: 'batman', value: false },\n { title: 'joker', value: true },\n ],\n },\n defaultSlots,\n );\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"identifier\" is required.');\n }\n });\n\n test.each(['', ' ', undefined])('Should throw error with invalid label property: %s', async label => {\n expect.assertions(1);\n try {\n await getPage(\n {\n identifier: 'identifier',\n label,\n items: [\n { title: 'batman', value: false },\n { title: 'joker', value: true },\n ],\n },\n defaultSlots,\n );\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"label\" is required.');\n }\n });\n\n test('Should throw an error with labelOnTop & labelHide set to true', async () => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label: 'batman', labelOnTop: true, labelHide: true, items: ['batman', 'joker'] }, defaultSlots);\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\"');\n }\n });\n\n test('Should throw an error with less than 2 items, case %s', async () => {\n expect.assertions(1);\n try {\n await getPage({ label: 'batman', items: [{ title: 'batman' }] }, defaultSlots);\n } catch (err) {\n expect(err.message).toMatch('<mg-input-toggle> prop \"items\" require 2 items.');\n }\n });\n\n test.each([undefined, [defaultSlots[0]], [...defaultSlots, ...defaultSlots]])('Should throw an error with blank slots', async () => {\n expect.assertions(1);\n try {\n await getPage({ label: 'batman', items: ['batman', 'joker'] });\n } catch (err) {\n expect(err.message).toMatch('<mg-input-toggle> 2 slots are required.');\n }\n });\n\n test.each([\n [['batman', { title: 'batman', value: 'batman' }]],\n [['batman', { batman: 'batman' }]],\n [[true, false]],\n [[1, 2]],\n [[true, 'batman']],\n [[{ title: 'batman', value: 'batman' }, { batman: 'batman' }]],\n [\n [\n { title: 'batman', value: undefined },\n { title: 'batman', value: 'test' },\n ],\n ],\n ])('Should throw error with invalid items property: %s', async items => {\n expect.assertions(1);\n try {\n await getPage({ label: 'Label', items }, defaultSlots);\n } catch (err) {\n expect(err.message).toMatch('<mg-input-toggle> prop \"items\" is required and all items must be the same type: ToggleValue.');\n }\n });\n });\n\n test.each([\n {\n items: [\n { title: 'batman', value: 'a' },\n { title: 'joker', value: 'b' },\n ],\n expected: 'b',\n value: undefined,\n },\n {\n items: [\n { title: 'batman', value: 'a' },\n { title: 'joker', value: 'b' },\n ],\n expected: 'a',\n value: 'b',\n },\n {\n items: [\n { title: 'batman', value: 1 },\n { title: 'joker', value: 2 },\n ],\n expected: 2,\n value: 1,\n },\n {\n items: [\n { title: 'batman', value: false },\n { title: 'robin', value: true },\n ],\n expected: false,\n value: true,\n },\n {\n items: [\n { title: 'batman', value: true },\n { title: 'robin', value: false },\n ],\n expected: true,\n value: false,\n },\n ])('Should trigger events for items with inputValue: %s', async ({ items, expected, value }) => {\n const args = { label: 'label', items, identifier: 'identifier', helpText: 'My help text', value };\n const page = await getPage(args, defaultSlots);\n\n const mgInputToggle = page.doc.querySelector('mg-input-toggle');\n const button = mgInputToggle.shadowRoot.querySelector('button');\n\n jest.spyOn(page.rootInstance.valueChange, 'emit');\n\n button.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot(); //Snapshot on focus\n\n button.dispatchEvent(new CustomEvent('click', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.rootInstance.valueChange.emit).toHaveBeenCalledWith(expected);\n expect(page.rootInstance.valueChange.emit).toHaveBeenCalledTimes(1);\n });\n\n describe('setError', () => {\n test.each([true, false])(\"should display override error with setError component's public method\", async valid => {\n const page = await getPage({ ...defaultProps }, defaultSlots);\n\n const mgInputToggle = page.doc.querySelector('mg-input-toggle');\n\n const spyInputValid = jest.spyOn(page.rootInstance.inputValid, 'emit');\n\n await mgInputToggle.setError(valid, 'error batman');\n\n await page.waitForChanges();\n\n expect(spyInputValid).toHaveBeenCalledTimes(1);\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([\n {\n valid: '',\n errorMessage: 'Override error',\n error: '<mg-input-toggle> method \"setError()\" param \"valid\" must be a boolean',\n },\n {\n valid: undefined,\n errorMessage: 'Override error',\n error: '<mg-input-toggle> method \"setError()\" param \"valid\" must be a boolean',\n },\n {\n valid: true,\n errorMessage: ' ',\n error: '<mg-input-toggle> method \"setError()\" param \"errorMessage\" must be a string',\n },\n {\n valid: true,\n errorMessage: true,\n error: '<mg-input-toggle> method \"setError()\" param \"errorMessage\" must be a string',\n },\n ])(\"shloud throw error with setError component's public method invalid params\", async params => {\n expect.assertions(1);\n try {\n const page = await getPage({ ...defaultProps }, defaultSlots);\n\n const mgInputToggle = page.doc.querySelector('mg-input-toggle');\n await mgInputToggle.setError(params.valid as unknown as boolean, params.errorMessage as unknown as string);\n\n await page.waitForChanges();\n } catch (err) {\n expect(err.message).toMatch(params.error);\n }\n });\n });\n});\n"]}
|