@mgdis/mg-components 5.19.3 → 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-69435877.js → components.utils-cd908d4e.js} +102 -99
- package/dist/cjs/components.utils-cd908d4e.js.map +1 -0
- package/dist/cjs/{index-60dd0c56.js → index-8532b5e9.js} +185 -87
- 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 +5115 -5110
- 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 +192 -190
- 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 -362
- 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 +2 -2
- 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 +788 -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 +588 -578
- 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 +778 -773
- 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 +536 -526
- 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 +565 -555
- 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 +700 -695
- 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.js +770 -760
- 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 +705 -695
- 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.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 -327
- 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 -140
- 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 +98 -98
- 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 -182
- 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 -171
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-icon.d.ts +2 -2
- package/dist/components/mg-icon2.js +318 -316
- 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 +477 -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 +265 -265
- 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 +353 -353
- 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 +204 -204
- 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 +234 -234
- 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 +315 -315
- 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 +305 -305
- 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 +276 -276
- 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 +344 -344
- 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 +197 -192
- 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 +69 -69
- 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/esm/{components.utils-6cf27db1.js → components.utils-0d67c31c.js} +102 -100
- package/dist/esm/components.utils-0d67c31c.js.map +1 -0
- package/dist/esm/{index-0f833068.js → index-f34a3a2c.js} +185 -87
- 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 +5115 -5110
- 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.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-91feda5a.entry.js → p-e0fb0f3c.entry.js} +2 -2
- 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 -100
- 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 +5 -5
- package/dist/types/components/molecules/inputs/MgInput.d.ts +16 -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 -262
- 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 -150
- 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 -223
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +142 -142
- 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 -152
- 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 -193
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +195 -195
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +181 -181
- 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 -12
- 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 -103
- 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 +294 -30
- 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 +18 -32
- package/dist/cjs/components.utils-69435877.js.map +0 -1
- package/dist/cjs/index-60dd0c56.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 -192
- 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 -634
- 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 -383
- 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 -460
- 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 -293
- 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 -359
- 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 -403
- 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 -355
- 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 -320
- 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 -136
- 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 -195
- 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 -292
- 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-6cf27db1.js.map +0 -1
- package/dist/esm/index-0f833068.js.map +0 -1
- package/dist/mg-components/p-10ed4425.entry.js +0 -2
- package/dist/mg-components/p-10ed4425.entry.js.map +0 -1
- package/dist/mg-components/p-36a51c5e.js +0 -2
- package/dist/mg-components/p-36a51c5e.js.map +0 -1
- package/dist/mg-components/p-9b12021b.js +0 -3
- package/dist/mg-components/p-9b12021b.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
- /package/dist/mg-components/{p-91feda5a.entry.js.map → p-e0fb0f3c.entry.js.map} +0 -0
package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { createPage } from "../../../../../utils/stencil.e2e.test.utils";
|
|
2
|
-
describe('mg-input-password', () => {
|
|
3
|
-
describe.each([
|
|
4
|
-
`<mg-input-password identifier="identifier" label="label"></mg-input-password>`,
|
|
5
|
-
`<mg-input-password identifier="identifier" label="label" label-on-top></mg-input-password>`,
|
|
6
|
-
`<mg-input-password identifier="identifier" label="label" label-hide></mg-input-password>`,
|
|
7
|
-
`<mg-input-password identifier="identifier" label="label" placeholder="placeholder" help-text="HelpText Message"></mg-input-password>`,
|
|
8
|
-
])('without tooltip', html => {
|
|
9
|
-
test('render', async () => {
|
|
10
|
-
const page = await createPage(html);
|
|
11
|
-
const element = await page.find('mg-input-password');
|
|
12
|
-
const input = await page.find('mg-input-password >>> input');
|
|
13
|
-
// Hide caret for screenshots
|
|
14
|
-
await page.$eval('mg-input-password', elm => {
|
|
15
|
-
const input = elm.shadowRoot.querySelector('input');
|
|
16
|
-
input.style.caretColor = 'transparent';
|
|
17
|
-
});
|
|
18
|
-
expect(element).toHaveClass('hydrated');
|
|
19
|
-
const screenshot = await page.screenshot();
|
|
20
|
-
expect(screenshot).toMatchImageSnapshot();
|
|
21
|
-
await page.keyboard.down('Tab');
|
|
22
|
-
await page.waitForChanges();
|
|
23
|
-
const screenshotFocus = await page.screenshot();
|
|
24
|
-
expect(screenshotFocus).toMatchImageSnapshot();
|
|
25
|
-
await input.press('KeyB');
|
|
26
|
-
await input.press('KeyL');
|
|
27
|
-
await input.press('KeyU');
|
|
28
|
-
await page.waitForChanges();
|
|
29
|
-
const screenshotType = await page.screenshot();
|
|
30
|
-
expect(screenshotType).toMatchImageSnapshot();
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
test.each([true, false])('render with tooltip, case label-on-top %s', async (labelOnTop) => {
|
|
34
|
-
const page = await createPage(`<mg-input-password identifier="identifier" label="label" tooltip="Tooltip message" label-on-top="${labelOnTop}"></mg-input-password>`);
|
|
35
|
-
const element = await page.find('mg-input-password');
|
|
36
|
-
expect(element).toHaveClass('hydrated');
|
|
37
|
-
const screenshot = await page.screenshot();
|
|
38
|
-
expect(screenshot).toMatchImageSnapshot();
|
|
39
|
-
await page.keyboard.down('Tab');
|
|
40
|
-
if (!labelOnTop) {
|
|
41
|
-
// Ensure to display tooltip
|
|
42
|
-
await page.setViewport({ width: 600, height: 65 });
|
|
43
|
-
// when label on top tooltip is on fist tab (next to label)
|
|
44
|
-
await page.keyboard.down('Tab');
|
|
45
|
-
}
|
|
46
|
-
await page.waitForChanges();
|
|
47
|
-
const screenshotTooltip = await page.screenshot();
|
|
48
|
-
expect(screenshotTooltip).toMatchImageSnapshot();
|
|
49
|
-
});
|
|
50
|
-
describe.each([
|
|
51
|
-
`<mg-input-password identifier="identifier" label="label" readonly></mg-input-password>`,
|
|
52
|
-
`<mg-input-password identifier="identifier" label="label" value="blu"></mg-input-password>`,
|
|
53
|
-
`<mg-input-password identifier="identifier" label="label" value="blu" readonly></mg-input-password>`,
|
|
54
|
-
`<mg-input-password identifier="identifier" label="label" value="blu" readonly label-on-top></mg-input-password>`,
|
|
55
|
-
`<mg-input-password identifier="identifier" label="label" disabled></mg-input-password>`,
|
|
56
|
-
`<mg-input-password identifier="identifier" label="label" value="blu" disabled></mg-input-password>`,
|
|
57
|
-
`<mg-input-password identifier="identifier" label="label" value="batman" help-text='<mg-icon icon="user" size="small"></mg-icon> Welcome batman'></mg-input-password>`,
|
|
58
|
-
`<mg-input-password identifier="identifier" label="label" value="blu" help-text="HelpText Message" required></mg-input-password>`,
|
|
59
|
-
`<mg-input-password identifier="identifier" label="label" value="blu" help-text="HelpText Message" required readonly></mg-input-password>`,
|
|
60
|
-
`<mg-input-password identifier="identifier" label="label" value="blu" help-text="HelpText Message" required disabled></mg-input-password>`,
|
|
61
|
-
])('Should render with template', html => {
|
|
62
|
-
test('render', async () => {
|
|
63
|
-
const page = await createPage(html);
|
|
64
|
-
const element = await page.find('mg-input-password');
|
|
65
|
-
expect(element).toHaveClass('hydrated');
|
|
66
|
-
const screenshot = await page.screenshot();
|
|
67
|
-
expect(screenshot).toMatchImageSnapshot();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
describe.each([
|
|
71
|
-
`<mg-input-password identifier="identifier" label="label" required></mg-input-password>`,
|
|
72
|
-
`<mg-input-password identifier="identifier" label="label" required lang="fr"></mg-input-password>`,
|
|
73
|
-
])('%s', html => {
|
|
74
|
-
test('Should render error when leaving an empty required input', async () => {
|
|
75
|
-
const page = await createPage(html);
|
|
76
|
-
const element = await page.find('mg-input-password');
|
|
77
|
-
expect(element).toHaveClass('hydrated');
|
|
78
|
-
await page.keyboard.down('Tab');
|
|
79
|
-
await page.keyboard.down('Tab');
|
|
80
|
-
await page.waitForChanges();
|
|
81
|
-
const screenshot = await page.screenshot();
|
|
82
|
-
expect(screenshot).toMatchImageSnapshot();
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
describe.each([
|
|
86
|
-
'<mg-input-password identifier="identifier" label="long label long label long label long label long label long label long label long label long label long label long label" tooltip="tooltip message"></mg-input-password>',
|
|
87
|
-
'<mg-input-password identifier="identifier" label="long label long label long label long label long label long label long label long label long label long label long label" tooltip="tooltip message" label-on-top></mg-input-password>',
|
|
88
|
-
])('inside a div.mg-form-group', html => {
|
|
89
|
-
test('render', async () => {
|
|
90
|
-
const page = await createPage(`<div class="mg-form-group">${html}</div>`);
|
|
91
|
-
const element = await page.find('mg-input-password');
|
|
92
|
-
expect(element).toHaveClass('hydrated');
|
|
93
|
-
const screenshot = await page.screenshot();
|
|
94
|
-
expect(screenshot).toMatchImageSnapshot();
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
describe.each([16])('with custom width: %s', width => {
|
|
98
|
-
test.each([false, true])('with label on top: %s', async (labelOnTop) => {
|
|
99
|
-
const page = await createPage(`<mg-input-password identifier="identifier" label="label" mg-width="${width}" label-on-top="${labelOnTop}"></mg-input-password>`);
|
|
100
|
-
const element = await page.find('mg-input-password');
|
|
101
|
-
expect(element).toHaveClass('hydrated');
|
|
102
|
-
const screenshot = await page.screenshot();
|
|
103
|
-
expect(screenshot).toMatchImageSnapshot();
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
test.each([false, true])('Ensure component fit in width 200px with label-on-top: %s', async (labelOnTop) => {
|
|
107
|
-
const page = await createPage(`<mg-input-password identifier="identifier" label="label" label-on-top="${labelOnTop}"></mg-input-password>`);
|
|
108
|
-
const element = await page.find('mg-input-password');
|
|
109
|
-
expect(element).toHaveClass('hydrated');
|
|
110
|
-
await page.setViewport({ width: 200, height: 100 });
|
|
111
|
-
const screenshot = await page.screenshot();
|
|
112
|
-
expect(screenshot).toMatchImageSnapshot();
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
//# sourceMappingURL=mg-input-password.e2e.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-password.e2e.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AAEzE,QAAQ,CAAC,mBAAmB,EAAE,GAAG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,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,2DAA2D,EAAE,KAAK,EAAC,UAAU,EAAC,EAAE;IACvG,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,0EAA0E,UAAU,wBAAwB,CAAC,CAAC;IAE5I,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAErD,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAExC,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAEpD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3C,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,EAAE,CAAC;EAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { createPage } from '../../../../../utils/stencil.e2e.test.utils';\n\ndescribe('mg-input-password', () => {\n describe.each([\n `<mg-input-password identifier=\"identifier\" label=\"label\"></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" label-on-top></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" label-hide></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" placeholder=\"placeholder\" help-text=\"HelpText Message\"></mg-input-password>`,\n ])('without tooltip', html => {\n test('render', async () => {\n const page = await createPage(html);\n\n const element = await page.find('mg-input-password');\n const input = await page.find('mg-input-password >>> input');\n\n // Hide caret for screenshots\n await page.$eval('mg-input-password', elm => {\n const input = elm.shadowRoot.querySelector('input');\n input.style.caretColor = 'transparent';\n });\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n await page.keyboard.down('Tab');\n\n await page.waitForChanges();\n\n const screenshotFocus = await page.screenshot();\n expect(screenshotFocus).toMatchImageSnapshot();\n\n await input.press('KeyB');\n await input.press('KeyL');\n await input.press('KeyU');\n\n await page.waitForChanges();\n\n const screenshotType = await page.screenshot();\n expect(screenshotType).toMatchImageSnapshot();\n });\n });\n\n test.each([true, false])('render with tooltip, case label-on-top %s', async labelOnTop => {\n const page = await createPage(`<mg-input-password identifier=\"identifier\" label=\"label\" tooltip=\"Tooltip message\" label-on-top=\"${labelOnTop}\"></mg-input-password>`);\n\n const element = await page.find('mg-input-password');\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n await page.keyboard.down('Tab');\n if (!labelOnTop) {\n // Ensure to display tooltip\n await page.setViewport({ width: 600, height: 65 });\n // when label on top tooltip is on fist tab (next to label)\n await page.keyboard.down('Tab');\n }\n\n await page.waitForChanges();\n\n const screenshotTooltip = await page.screenshot();\n expect(screenshotTooltip).toMatchImageSnapshot();\n });\n\n describe.each([\n `<mg-input-password identifier=\"identifier\" label=\"label\" readonly></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" value=\"blu\"></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" value=\"blu\" readonly></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" value=\"blu\" readonly label-on-top></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" disabled></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" value=\"blu\" disabled></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" value=\"batman\" help-text='<mg-icon icon=\"user\" size=\"small\"></mg-icon> Welcome batman'></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" value=\"blu\" help-text=\"HelpText Message\" required></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" value=\"blu\" help-text=\"HelpText Message\" required readonly></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" value=\"blu\" help-text=\"HelpText Message\" required disabled></mg-input-password>`,\n ])('Should render with template', html => {\n test('render', async () => {\n const page = await createPage(html);\n\n const element = await page.find('mg-input-password');\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n });\n\n describe.each([\n `<mg-input-password identifier=\"identifier\" label=\"label\" required></mg-input-password>`,\n `<mg-input-password identifier=\"identifier\" label=\"label\" required lang=\"fr\"></mg-input-password>`,\n ])('%s', html => {\n test('Should render error when leaving an empty required input', async () => {\n const page = await createPage(html);\n\n const element = await page.find('mg-input-password');\n\n expect(element).toHaveClass('hydrated');\n\n await page.keyboard.down('Tab');\n await page.keyboard.down('Tab');\n\n await page.waitForChanges();\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n });\n\n describe.each([\n '<mg-input-password identifier=\"identifier\" label=\"long label long label long label long label long label long label long label long label long label long label long label\" tooltip=\"tooltip message\"></mg-input-password>',\n '<mg-input-password identifier=\"identifier\" label=\"long label long label long label long label long label long label long label long label long label long label long label\" tooltip=\"tooltip message\" label-on-top></mg-input-password>',\n ])('inside a div.mg-form-group', html => {\n test('render', async () => {\n const page = await createPage(`<div class=\"mg-form-group\">${html}</div>`);\n\n const element = await page.find('mg-input-password');\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n });\n\n describe.each([16])('with custom width: %s', width => {\n test.each([false, true])('with label on top: %s', async labelOnTop => {\n const page = await createPage(`<mg-input-password identifier=\"identifier\" label=\"label\" mg-width=\"${width}\" label-on-top=\"${labelOnTop}\"></mg-input-password>`);\n\n const element = await page.find('mg-input-password');\n\n expect(element).toHaveClass('hydrated');\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n });\n\n test.each([false, true])('Ensure component fit in width 200px with label-on-top: %s', async labelOnTop => {\n const page = await createPage(`<mg-input-password identifier=\"identifier\" label=\"label\" label-on-top=\"${labelOnTop}\"></mg-input-password>`);\n\n const element = await page.find('mg-input-password');\n\n expect(element).toHaveClass('hydrated');\n\n await page.setViewport({ width: 200, height: 100 });\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n});\n"]}
|
package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js
DELETED
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
2
|
-
import { newSpecPage } from "@stencil/core/testing";
|
|
3
|
-
import { MgInputPassword } from "../mg-input-password";
|
|
4
|
-
import messages from "../../../../../locales/en/messages.json";
|
|
5
|
-
const getPage = args => {
|
|
6
|
-
const page = newSpecPage({
|
|
7
|
-
components: [MgInputPassword],
|
|
8
|
-
template: () => h("mg-input-password", Object.assign({}, args)),
|
|
9
|
-
});
|
|
10
|
-
jest.runAllTimers();
|
|
11
|
-
return page;
|
|
12
|
-
};
|
|
13
|
-
describe('mg-input-password', () => {
|
|
14
|
-
beforeEach(() => jest.useFakeTimers());
|
|
15
|
-
afterEach(() => jest.runOnlyPendingTimers());
|
|
16
|
-
test.each([
|
|
17
|
-
{ label: 'label', identifier: 'identifier' },
|
|
18
|
-
{ label: 'label', identifier: 'identifier', labelHide: true },
|
|
19
|
-
{ label: 'label', identifier: 'identifier', labelOnTop: true },
|
|
20
|
-
{ label: 'label', identifier: 'identifier', readonly: true },
|
|
21
|
-
{ label: 'label', identifier: 'identifier', readonly: true, labelOnTop: true, tooltip: 'Tooltip message' },
|
|
22
|
-
{ label: 'label', identifier: 'identifier', readonly: true, value: 'blu' },
|
|
23
|
-
{ label: 'label', identifier: 'identifier', required: true, value: 'blu', helpText: 'My help text' },
|
|
24
|
-
{ label: 'label', identifier: 'identifier', required: true, readonly: true, value: 'blu', helpText: 'My help text' },
|
|
25
|
-
{ label: 'label', identifier: 'identifier', required: true, disabled: true, value: 'blu', helpText: 'My help text' },
|
|
26
|
-
{ label: 'label', identifier: 'identifier', tooltip: 'My Tooltip Message' },
|
|
27
|
-
{ label: 'label', identifier: 'identifier', tooltip: 'My Tooltip Message', labelOnTop: true },
|
|
28
|
-
])('Should render with args %s:', async (args) => {
|
|
29
|
-
const { root } = await getPage(args);
|
|
30
|
-
expect(root).toMatchSnapshot();
|
|
31
|
-
});
|
|
32
|
-
test.each(['', ' ', undefined])('Should not render with invalid identifier property: %s', async (identifier) => {
|
|
33
|
-
expect.assertions(1);
|
|
34
|
-
try {
|
|
35
|
-
await getPage({ identifier });
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
expect(err.message).toMatch('<mg-input> prop "identifier" is required.');
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
test.each(['', ' ', undefined])('Should throw error with invalid label property: %s', async (label) => {
|
|
42
|
-
expect.assertions(1);
|
|
43
|
-
try {
|
|
44
|
-
await getPage({ identifier: 'identifier', label });
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
expect(err.message).toMatch('<mg-input> prop "label" is required.');
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
test('Should throw an error with labelOnTop & labelHide set to true', async () => {
|
|
51
|
-
expect.assertions(1);
|
|
52
|
-
try {
|
|
53
|
-
await getPage({ identifier: 'identifier', label: 'batman', labelOnTop: true, labelHide: true });
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
expect(err.message).toMatch('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide"');
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
test('Should trigger events', async () => {
|
|
60
|
-
const inputValue = 'Blu';
|
|
61
|
-
const args = { label: 'label', identifier: 'identifier', helpText: 'My help text' };
|
|
62
|
-
const page = await getPage(args);
|
|
63
|
-
const element = page.doc.querySelector('mg-input-password');
|
|
64
|
-
const input = element.shadowRoot.querySelector('input');
|
|
65
|
-
//mock validity
|
|
66
|
-
input.checkValidity = jest.fn(() => true);
|
|
67
|
-
Object.defineProperty(input, 'validity', {
|
|
68
|
-
get: jest.fn(() => ({
|
|
69
|
-
valueMissing: false,
|
|
70
|
-
patternMismatch: false,
|
|
71
|
-
})),
|
|
72
|
-
});
|
|
73
|
-
jest.spyOn(page.rootInstance.valueChange, 'emit');
|
|
74
|
-
const inputValidSpy = jest.spyOn(page.rootInstance.inputValid, 'emit');
|
|
75
|
-
input.dispatchEvent(new CustomEvent('focus', { bubbles: true }));
|
|
76
|
-
await page.waitForChanges();
|
|
77
|
-
expect(page.root).toMatchSnapshot(); //Snapshot on focus
|
|
78
|
-
input.value = inputValue;
|
|
79
|
-
input.dispatchEvent(new CustomEvent('input', { bubbles: true }));
|
|
80
|
-
await page.waitForChanges();
|
|
81
|
-
expect(page.rootInstance.valueChange.emit).toHaveBeenCalledWith(inputValue);
|
|
82
|
-
input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
|
|
83
|
-
await page.waitForChanges();
|
|
84
|
-
expect(inputValidSpy).toHaveBeenCalledTimes(1);
|
|
85
|
-
});
|
|
86
|
-
describe.each(['readonly', 'disabled'])('validity, case next state is %s', nextState => {
|
|
87
|
-
test.each([
|
|
88
|
-
{ validity: true, valueMissing: false },
|
|
89
|
-
{ validity: false, valueMissing: true },
|
|
90
|
-
{ validity: false, valueMissing: false },
|
|
91
|
-
])('validity (%s), valueMissing (%s)', async ({ validity, valueMissing }) => {
|
|
92
|
-
const args = { label: 'label', identifier: 'identifier', patternErrorMessage: 'Non' };
|
|
93
|
-
const page = await getPage(args);
|
|
94
|
-
const element = page.doc.querySelector('mg-input-password');
|
|
95
|
-
const input = element.shadowRoot.querySelector('input');
|
|
96
|
-
//mock validity
|
|
97
|
-
input.checkValidity = jest.fn(() => validity);
|
|
98
|
-
Object.defineProperty(input, 'validity', {
|
|
99
|
-
get: jest.fn(() => ({
|
|
100
|
-
valueMissing,
|
|
101
|
-
})),
|
|
102
|
-
});
|
|
103
|
-
input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
|
|
104
|
-
await page.waitForChanges();
|
|
105
|
-
if (validity) {
|
|
106
|
-
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
107
|
-
}
|
|
108
|
-
else if (valueMissing) {
|
|
109
|
-
expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);
|
|
110
|
-
}
|
|
111
|
-
expect(page.rootInstance.valid).toEqual(validity);
|
|
112
|
-
expect(page.rootInstance.invalid).toEqual(!validity);
|
|
113
|
-
if (valueMissing) {
|
|
114
|
-
expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled FALSE
|
|
115
|
-
element[nextState] = true;
|
|
116
|
-
await page.waitForChanges();
|
|
117
|
-
expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled TRUE
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
test("display error with displayError component's public method", async () => {
|
|
122
|
-
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
123
|
-
expect(page.root).toMatchSnapshot();
|
|
124
|
-
const element = page.doc.querySelector('mg-input-password');
|
|
125
|
-
const input = element.shadowRoot.querySelector('input');
|
|
126
|
-
//mock validity
|
|
127
|
-
input.checkValidity = jest.fn(() => false);
|
|
128
|
-
Object.defineProperty(input, 'validity', {
|
|
129
|
-
get: jest.fn(() => ({
|
|
130
|
-
valueMissing: true,
|
|
131
|
-
})),
|
|
132
|
-
});
|
|
133
|
-
await element.displayError();
|
|
134
|
-
await page.waitForChanges();
|
|
135
|
-
expect(page.root).toMatchSnapshot();
|
|
136
|
-
});
|
|
137
|
-
test.each([
|
|
138
|
-
{
|
|
139
|
-
valid: true,
|
|
140
|
-
errorMessage: 'Override error',
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
valid: false,
|
|
144
|
-
errorMessage: 'Override error',
|
|
145
|
-
},
|
|
146
|
-
])("should display override error with setError component's public method", async (params) => {
|
|
147
|
-
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
148
|
-
expect(page.root).toMatchSnapshot();
|
|
149
|
-
const element = page.doc.querySelector('mg-input-password');
|
|
150
|
-
const input = element.shadowRoot.querySelector('input');
|
|
151
|
-
//mock validity
|
|
152
|
-
Object.defineProperty(input, 'validity', {
|
|
153
|
-
get: () => ({}),
|
|
154
|
-
});
|
|
155
|
-
await element.setError(params.valid, params.errorMessage);
|
|
156
|
-
await page.waitForChanges();
|
|
157
|
-
expect(page.root).toMatchSnapshot();
|
|
158
|
-
});
|
|
159
|
-
test.each([
|
|
160
|
-
{
|
|
161
|
-
valid: '',
|
|
162
|
-
errorMessage: 'Override error',
|
|
163
|
-
error: '<mg-input-password> method "setError()" param "valid" must be a boolean',
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
valid: undefined,
|
|
167
|
-
errorMessage: 'Override error',
|
|
168
|
-
error: '<mg-input-password> method "setError()" param "valid" must be a boolean',
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
valid: true,
|
|
172
|
-
errorMessage: ' ',
|
|
173
|
-
error: '<mg-input-password> method "setError()" param "errorMessage" must be a string',
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
valid: true,
|
|
177
|
-
errorMessage: true,
|
|
178
|
-
error: '<mg-input-password> method "setError()" param "errorMessage" must be a string',
|
|
179
|
-
},
|
|
180
|
-
])("shloud throw error with setError component's public method invalid params", async (params) => {
|
|
181
|
-
expect.assertions(1);
|
|
182
|
-
try {
|
|
183
|
-
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
184
|
-
const element = page.doc.querySelector('mg-input-password');
|
|
185
|
-
await element.setError(params.valid, params.errorMessage);
|
|
186
|
-
await page.waitForChanges();
|
|
187
|
-
}
|
|
188
|
-
catch (err) {
|
|
189
|
-
expect(err.message).toMatch(params.error);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
test.each(['fr', 'xx'])('display error message with locale: %s', async (lang) => {
|
|
193
|
-
const page = await getPage({ label: 'label', identifier: 'identifier', required: true, lang });
|
|
194
|
-
const element = page.doc.querySelector('mg-input-password');
|
|
195
|
-
const input = element.shadowRoot.querySelector('input');
|
|
196
|
-
//mock validity
|
|
197
|
-
input.checkValidity = jest.fn(() => false);
|
|
198
|
-
Object.defineProperty(input, 'validity', {
|
|
199
|
-
get: jest.fn(() => ({
|
|
200
|
-
valueMissing: true,
|
|
201
|
-
})),
|
|
202
|
-
});
|
|
203
|
-
await element.displayError();
|
|
204
|
-
await page.waitForChanges();
|
|
205
|
-
expect(page.root).toMatchSnapshot();
|
|
206
|
-
});
|
|
207
|
-
test('Should remove error on input', async () => {
|
|
208
|
-
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
209
|
-
const element = page.doc.querySelector('mg-input-password');
|
|
210
|
-
const input = element.shadowRoot.querySelector('input');
|
|
211
|
-
//mock validity
|
|
212
|
-
input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);
|
|
213
|
-
Object.defineProperty(input, 'validity', {
|
|
214
|
-
get: jest
|
|
215
|
-
.fn()
|
|
216
|
-
.mockReturnValueOnce({
|
|
217
|
-
valueMissing: true,
|
|
218
|
-
})
|
|
219
|
-
.mockReturnValueOnce({
|
|
220
|
-
valueMissing: true,
|
|
221
|
-
})
|
|
222
|
-
.mockReturnValueOnce({
|
|
223
|
-
valueMissing: false,
|
|
224
|
-
})
|
|
225
|
-
.mockReturnValueOnce({
|
|
226
|
-
valueMissing: false,
|
|
227
|
-
}),
|
|
228
|
-
});
|
|
229
|
-
await element.displayError();
|
|
230
|
-
await page.waitForChanges();
|
|
231
|
-
expect(page.rootInstance.hasDisplayedError).toEqual(true);
|
|
232
|
-
expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);
|
|
233
|
-
input.value = 'blu';
|
|
234
|
-
input.dispatchEvent(new CustomEvent('input', { bubbles: true }));
|
|
235
|
-
await page.waitForChanges();
|
|
236
|
-
expect(page.rootInstance.hasDisplayedError).toEqual(true);
|
|
237
|
-
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
238
|
-
input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
|
|
239
|
-
await page.waitForChanges();
|
|
240
|
-
expect(page.rootInstance.hasDisplayedError).toEqual(false);
|
|
241
|
-
});
|
|
242
|
-
test('Should remove error on input when required change dynamically', async () => {
|
|
243
|
-
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
244
|
-
const element = page.doc.querySelector('mg-input-password');
|
|
245
|
-
const input = element.shadowRoot.querySelector('input');
|
|
246
|
-
//mock validity
|
|
247
|
-
input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);
|
|
248
|
-
Object.defineProperty(input, 'validity', {
|
|
249
|
-
get: jest
|
|
250
|
-
.fn()
|
|
251
|
-
.mockReturnValueOnce({
|
|
252
|
-
valueMissing: true,
|
|
253
|
-
})
|
|
254
|
-
.mockReturnValueOnce({
|
|
255
|
-
valueMissing: true,
|
|
256
|
-
})
|
|
257
|
-
.mockReturnValueOnce({
|
|
258
|
-
valueMissing: false,
|
|
259
|
-
})
|
|
260
|
-
.mockReturnValueOnce({
|
|
261
|
-
valueMissing: false,
|
|
262
|
-
}),
|
|
263
|
-
});
|
|
264
|
-
await element.displayError();
|
|
265
|
-
await page.waitForChanges();
|
|
266
|
-
expect(page.rootInstance.hasDisplayedError).toEqual(true);
|
|
267
|
-
expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);
|
|
268
|
-
element.required = false;
|
|
269
|
-
await page.waitForChanges();
|
|
270
|
-
// Error message should disapear and change the hasDisplayedError status
|
|
271
|
-
expect(page.rootInstance.hasDisplayedError).toEqual(false);
|
|
272
|
-
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
273
|
-
element.required = true;
|
|
274
|
-
await page.waitForChanges();
|
|
275
|
-
// If back on required the message is still not displayed
|
|
276
|
-
expect(page.rootInstance.hasDisplayedError).toEqual(false);
|
|
277
|
-
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
278
|
-
});
|
|
279
|
-
test('Should update mg-width', async () => {
|
|
280
|
-
const page = await getPage({ label: 'label', identifier: 'identifier' });
|
|
281
|
-
const element = page.doc.querySelector('mg-input-password');
|
|
282
|
-
element.mgWidth = 2;
|
|
283
|
-
await page.waitForChanges();
|
|
284
|
-
expect(page.root).toMatchSnapshot();
|
|
285
|
-
element.mgWidth = 4;
|
|
286
|
-
await page.waitForChanges();
|
|
287
|
-
expect(page.root).toMatchSnapshot();
|
|
288
|
-
element.mgWidth = 16;
|
|
289
|
-
await page.waitForChanges();
|
|
290
|
-
expect(page.root).toMatchSnapshot();
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
//# sourceMappingURL=mg-input-password.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-password.spec.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,QAAQ,MAAM,yCAAyC,CAAC;AAE/D,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE;EACrB,MAAM,IAAI,GAAG,WAAW,CAAC;IACvB,UAAU,EAAE,CAAC,eAAe,CAAC;IAC7B,QAAQ,EAAE,GAAG,EAAE,CAAC,yCAAuB,IAAI,EAAsB;GAClE,CAAC,CAAC;EACH,IAAI,CAAC,YAAY,EAAE,CAAC;EACpB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;EACjC,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;EACvC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;EAC7C,IAAI,CAAC,IAAI,CAA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AAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAC;IACzE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAE5D,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC;IACpB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpC,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC;IACpB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;IACrB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;EACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgInputPassword } from '../mg-input-password';\nimport messages from '../../../../../locales/en/messages.json';\n\nconst getPage = args => {\n const page = newSpecPage({\n components: [MgInputPassword],\n template: () => <mg-input-password {...args}></mg-input-password>,\n });\n jest.runAllTimers();\n return page;\n};\n\ndescribe('mg-input-password', () => {\n beforeEach(() => jest.useFakeTimers());\n afterEach(() => jest.runOnlyPendingTimers());\n test.each([\n { label: 'label', identifier: 'identifier' },\n { label: 'label', identifier: 'identifier', labelHide: true },\n { label: 'label', identifier: 'identifier', labelOnTop: true },\n { label: 'label', identifier: 'identifier', readonly: true },\n { label: 'label', identifier: 'identifier', readonly: true, labelOnTop: true, tooltip: 'Tooltip message' },\n { label: 'label', identifier: 'identifier', readonly: true, value: 'blu' },\n { label: 'label', identifier: 'identifier', required: true, value: 'blu', helpText: 'My help text' },\n { label: 'label', identifier: 'identifier', required: true, readonly: true, value: 'blu', helpText: 'My help text' },\n { label: 'label', identifier: 'identifier', required: true, disabled: true, value: 'blu', helpText: 'My help text' },\n { label: 'label', identifier: 'identifier', tooltip: 'My Tooltip Message' },\n { label: 'label', identifier: 'identifier', tooltip: 'My Tooltip Message', labelOnTop: true },\n ])('Should render with args %s:', async args => {\n const { root } = await getPage(args);\n expect(root).toMatchSnapshot();\n });\n\n test.each(['', ' ', undefined])('Should not render with invalid identifier property: %s', async identifier => {\n expect.assertions(1);\n try {\n await getPage({ identifier });\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({ identifier: 'identifier', label });\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 });\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 trigger events', async () => {\n const inputValue = 'Blu';\n const args = { label: 'label', identifier: 'identifier', helpText: 'My help text' };\n const page = await getPage(args);\n\n const element = page.doc.querySelector('mg-input-password');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => true);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: false,\n patternMismatch: false,\n })),\n });\n\n jest.spyOn(page.rootInstance.valueChange, 'emit');\n const inputValidSpy = jest.spyOn(page.rootInstance.inputValid, 'emit');\n\n input.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot(); //Snapshot on focus\n\n input.value = inputValue;\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n expect(page.rootInstance.valueChange.emit).toHaveBeenCalledWith(inputValue);\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n expect(inputValidSpy).toHaveBeenCalledTimes(1);\n });\n\n describe.each(['readonly', 'disabled'])('validity, case next state is %s', nextState => {\n test.each([\n { validity: true, valueMissing: false },\n { validity: false, valueMissing: true },\n { validity: false, valueMissing: false },\n ])('validity (%s), valueMissing (%s)', async ({ validity, valueMissing }) => {\n const args = { label: 'label', identifier: 'identifier', patternErrorMessage: 'Non' };\n const page = await getPage(args);\n\n const element = page.doc.querySelector('mg-input-password');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => validity);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing,\n })),\n });\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n if (validity) {\n expect(page.rootInstance.errorMessage).toBeUndefined();\n } else if (valueMissing) {\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n }\n expect(page.rootInstance.valid).toEqual(validity);\n expect(page.rootInstance.invalid).toEqual(!validity);\n if (valueMissing) {\n expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled FALSE\n element[nextState] = true;\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled TRUE\n }\n });\n });\n\n test(\"display error with displayError component's public method\", async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n\n expect(page.root).toMatchSnapshot();\n\n const element = page.doc.querySelector('mg-input-password');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: true,\n })),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([\n {\n valid: true,\n errorMessage: 'Override error',\n },\n {\n valid: false,\n errorMessage: 'Override error',\n },\n ])(\"should display override error with setError component's public method\", async params => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n\n expect(page.root).toMatchSnapshot();\n\n const element = page.doc.querySelector('mg-input-password');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n Object.defineProperty(input, 'validity', {\n get: () => ({}),\n });\n\n await element.setError(params.valid, params.errorMessage);\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([\n {\n valid: '',\n errorMessage: 'Override error',\n error: '<mg-input-password> method \"setError()\" param \"valid\" must be a boolean',\n },\n {\n valid: undefined,\n errorMessage: 'Override error',\n error: '<mg-input-password> method \"setError()\" param \"valid\" must be a boolean',\n },\n {\n valid: true,\n errorMessage: ' ',\n error: '<mg-input-password> method \"setError()\" param \"errorMessage\" must be a string',\n },\n {\n valid: true,\n errorMessage: true,\n error: '<mg-input-password> 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({ label: 'label', identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-password');\n\n await element.setError(params.valid as unknown as boolean, params.errorMessage as unknown as string);\n await page.waitForChanges();\n } catch (err) {\n expect(err.message).toMatch(params.error);\n }\n });\n\n test.each(['fr', 'xx'])('display error message with locale: %s', async lang => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true, lang });\n const element = page.doc.querySelector('mg-input-password');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: true,\n })),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test('Should remove error on input', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-password');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);\n Object.defineProperty(input, 'validity', {\n get: jest\n .fn()\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n }),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n\n input.value = 'blu';\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n });\n\n test('Should remove error on input when required change dynamically', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-password');\n const input = element.shadowRoot.querySelector('input');\n\n //mock validity\n input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);\n Object.defineProperty(input, 'validity', {\n get: jest\n .fn()\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n }),\n });\n\n await element.displayError();\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n\n element.required = false;\n await page.waitForChanges();\n\n // Error message should disapear and change the hasDisplayedError status\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n\n element.required = true;\n await page.waitForChanges();\n\n // If back on required the message is still not displayed\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n });\n\n test('Should update mg-width', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier' });\n const element = page.doc.querySelector('mg-input-password');\n\n element.mgWidth = 2;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 4;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 16;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
|