@mgdis/mg-components 5.16.0 → 5.18.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/{index-fede8ee2.js → index-c042e24b.js} +321 -68
- package/dist/cjs/index-c042e24b.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +5 -12
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/mg-action-more_34.cjs.entry.js +485 -163
- package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -0
- package/dist/cjs/mg-components.cjs.js +5 -3
- package/dist/cjs/mg-components.cjs.js.map +1 -0
- package/dist/cjs/mg-item-more.cjs.entry.js +4 -2
- package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -0
- package/dist/cjs/{mg-menu.conf-f9d0ddec.js → mg-menu.conf-43aacf30.js} +2 -0
- package/dist/cjs/mg-menu.conf-43aacf30.js.map +1 -0
- package/dist/collection/assets/icons/index.js +7 -2
- package/dist/collection/collection-manifest.json +37 -37
- package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -0
- package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js.map +1 -0
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +6 -4
- package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -0
- package/dist/collection/components/atoms/mg-badge/test/mg-badge.e2e.playwright.js +33 -0
- package/dist/collection/components/atoms/mg-badge/test/mg-badge.e2e.playwright.js.map +1 -0
- package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js +70 -0
- package/dist/collection/components/atoms/mg-badge/test/mg-badge.spec.js.map +1 -0
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -0
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js.map +1 -0
- package/dist/collection/components/atoms/mg-button/mg-button.js +10 -6
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -0
- package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +91 -0
- package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +1 -0
- package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +142 -0
- package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +1 -0
- package/dist/collection/components/atoms/mg-card/mg-card.conf.js +1 -0
- package/dist/collection/components/atoms/mg-card/mg-card.conf.js.map +1 -0
- package/dist/collection/components/atoms/mg-card/mg-card.js +8 -5
- package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -0
- package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js +36 -0
- package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js.map +1 -0
- package/dist/collection/components/atoms/mg-card/test/mg-card.spec.js +43 -0
- package/dist/collection/components/atoms/mg-card/test/mg-card.spec.js.map +1 -0
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +3 -2
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js.map +1 -0
- package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.e2e.js +15 -0
- package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.e2e.js.map +1 -0
- package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.spec.js +42 -0
- package/dist/collection/components/atoms/mg-character-left/test/mg-character-left.spec.js.map +1 -0
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +2 -1
- package/dist/collection/components/atoms/mg-divider/mg-divider.js.map +1 -0
- package/dist/collection/components/atoms/mg-divider/test/mg-divider.e2e.js +11 -0
- package/dist/collection/components/atoms/mg-divider/test/mg-divider.e2e.js.map +1 -0
- package/dist/collection/components/atoms/mg-divider/test/mg-divider.spec.js +14 -0
- package/dist/collection/components/atoms/mg-divider/test/mg-divider.spec.js.map +1 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +1 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js.map +1 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +11 -7
- package/dist/collection/components/atoms/mg-icon/mg-icon.js.map +1 -0
- package/dist/collection/components/atoms/mg-icon/test/mg-icon.e2e.js +55 -0
- package/dist/collection/components/atoms/mg-icon/test/mg-icon.e2e.js.map +1 -0
- package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js +84 -0
- package/dist/collection/components/atoms/mg-icon/test/mg-icon.spec.js.map +1 -0
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +2 -1
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -0
- package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.js +18 -0
- package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.e2e.js.map +1 -0
- package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js +27 -0
- package/dist/collection/components/atoms/mg-input-title/test/mg-input-title.spec.js.map +1 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.conf.js +1 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.conf.js.map +1 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +6 -4
- package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -0
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js +37 -0
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.e2e.js.map +1 -0
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js +71 -0
- package/dist/collection/components/atoms/mg-tag/test/mg-tag.spec.js.map +1 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +1 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +38 -16
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -0
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +138 -0
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +1 -0
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +272 -0
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -0
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/MgInput.conf.js.map +1 -0
- package/dist/collection/components/molecules/inputs/MgInput.js +3 -2
- package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +12 -7
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +109 -27
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js +243 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +638 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +88 -15
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.e2e.js +123 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.e2e.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +379 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +120 -46
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.e2e.js +212 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.e2e.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +456 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +92 -16
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js +115 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +289 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +91 -15
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js +154 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.e2e.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +355 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.conf.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +95 -17
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.e2e.js +194 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.e2e.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +399 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +104 -27
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js +171 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.e2e.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +343 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +108 -31
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.e2e.js +129 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.e2e.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +318 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +6 -4
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.js +125 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js +203 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.spec.js.map +1 -0
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +1 -0
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js.map +1 -0
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +9 -5
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -0
- package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.js +268 -0
- package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.e2e.js.map +1 -0
- package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.spec.js +175 -0
- package/dist/collection/components/molecules/menu/mg-menu/test/mg-menu.spec.js.map +1 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +1 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +1 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +10 -7
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.js +119 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.js.map +1 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.spec.js +295 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js +1 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +19 -13
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -0
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js +128 -0
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js +187 -0
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-details/mg-details.js +2 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -0
- package/dist/collection/components/molecules/mg-details/test/mg-details.e2e.playwright.js +30 -0
- package/dist/collection/components/molecules/mg-details/test/mg-details.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js +42 -0
- package/dist/collection/components/molecules/mg-details/test/mg-details.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -6
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -0
- package/dist/collection/components/molecules/mg-form/test/mg-form.e2e.js +169 -0
- package/dist/collection/components/molecules/mg-form/test/mg-form.e2e.js.map +1 -0
- package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +277 -0
- package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +3 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -0
- package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.e2e.js +39 -0
- package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.e2e.js.map +1 -0
- package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.spec.js +36 -0
- package/dist/collection/components/molecules/mg-illustrated-message/test/mg-illustrated-message.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js +1 -0
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +11 -7
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -0
- package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.js +85 -0
- package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.spec.js +106 -0
- package/dist/collection/components/molecules/mg-item-more/test/mg-item-more.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-message/mg-message.conf.js +1 -0
- package/dist/collection/components/molecules/mg-message/mg-message.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-message/mg-message.js +7 -5
- package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -0
- package/dist/collection/components/molecules/mg-message/test/mg-message.e2e.js +64 -0
- package/dist/collection/components/molecules/mg-message/test/mg-message.e2e.js.map +1 -0
- package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js +109 -0
- package/dist/collection/components/molecules/mg-message/test/mg-message.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.conf.js +1 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -5
- package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -0
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +62 -0
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.template.js +40 -0
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.template.js.map +1 -0
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js +26 -0
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js +122 -0
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js +1 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +5 -4
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -0
- package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.js +57 -0
- package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.spec.js +121 -0
- package/dist/collection/components/molecules/mg-pagination/test/mg-pagination.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.conf.js +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +17 -12
- package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -0
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +106 -0
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +213 -0
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +4 -3
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +40 -18
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -0
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js +159 -0
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js.map +1 -0
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +142 -0
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.conf.js +1 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -3
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -0
- package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.e2e.js +55 -0
- package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.e2e.js.map +1 -0
- package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.spec.js +55 -0
- package/dist/collection/components/molecules/mg-skip-links/test/mg-skip-links.spec.js.map +1 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +1 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +8 -5
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -0
- package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.js +76 -0
- package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.js.map +1 -0
- package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js +332 -0
- package/dist/collection/components/molecules/mg-tabs/test/mg-tabs.spec.js.map +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/locales/index.js +4 -3
- package/dist/collection/locales/index.js.map +1 -0
- package/dist/collection/locales/index.spec.js +27 -0
- package/dist/collection/locales/index.spec.js.map +1 -0
- package/dist/collection/stories/icon-gallery.js +4 -3
- package/dist/collection/stories/icon-gallery.js.map +1 -0
- package/dist/collection/test/typography.e2e.playwright.js +12 -0
- package/dist/collection/test/typography.e2e.playwright.js.map +1 -0
- package/dist/collection/utils/behaviors.utils.js +1 -0
- package/dist/collection/utils/behaviors.utils.js.map +1 -0
- package/dist/collection/utils/behaviors.utils.spec.js +57 -0
- package/dist/collection/utils/behaviors.utils.spec.js.map +1 -0
- package/dist/collection/utils/components.utils.js +7 -0
- package/dist/collection/utils/components.utils.js.map +1 -0
- package/dist/collection/utils/components.utils.spec.js +128 -0
- package/dist/collection/utils/components.utils.spec.js.map +1 -0
- package/dist/collection/utils/e2e.test.utils.js +46 -0
- package/dist/collection/utils/e2e.test.utils.js.map +1 -0
- package/dist/collection/utils/locale.utils.js +1 -0
- package/dist/collection/utils/locale.utils.js.map +1 -0
- package/dist/collection/utils/locale.utils.spec.js +52 -0
- package/dist/collection/utils/locale.utils.spec.js.map +1 -0
- package/dist/collection/utils/playwright.e2e.test.utils.js +100 -0
- package/dist/collection/utils/playwright.e2e.test.utils.js.map +1 -0
- package/dist/collection/utils/stencil.e2e.test.utils.js +33 -0
- package/dist/collection/utils/stencil.e2e.test.utils.js.map +1 -0
- package/dist/collection/utils/unit.test.utils.js +2 -1
- package/dist/collection/utils/unit.test.utils.js.map +1 -0
- package/dist/components/MgInput.js +2 -0
- package/dist/components/MgInput.js.map +1 -0
- package/dist/components/components.utils.js +9 -1
- package/dist/components/components.utils.js.map +1 -0
- package/dist/components/index.d.ts +5 -37
- package/dist/components/index.js +3 -36
- package/dist/components/index.js.map +1 -0
- package/dist/components/index2.js +2 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/mg-action-more.js +14 -4
- package/dist/components/mg-action-more.js.map +1 -0
- package/dist/components/mg-badge.js +2 -0
- package/dist/components/mg-badge.js.map +1 -0
- package/dist/components/mg-badge2.js +8 -1
- package/dist/components/mg-badge2.js.map +1 -0
- package/dist/components/mg-button.js +2 -0
- package/dist/components/mg-button.js.map +1 -0
- package/dist/components/mg-button2.js +8 -1
- package/dist/components/mg-button2.js.map +1 -0
- package/dist/components/mg-card.js +2 -0
- package/dist/components/mg-card.js.map +1 -0
- package/dist/components/mg-card2.js +6 -1
- package/dist/components/mg-card2.js.map +1 -0
- package/dist/components/mg-character-left.js +2 -0
- package/dist/components/mg-character-left.js.map +1 -0
- package/dist/components/mg-character-left2.js +5 -1
- package/dist/components/mg-character-left2.js.map +1 -0
- package/dist/components/mg-details.js +7 -1
- package/dist/components/mg-details.js.map +1 -0
- package/dist/components/mg-divider.js +3 -1
- package/dist/components/mg-divider.js.map +1 -0
- package/dist/components/mg-form.js +7 -2
- package/dist/components/mg-form.js.map +1 -0
- package/dist/components/mg-icon.js +2 -0
- package/dist/components/mg-icon.js.map +1 -0
- package/dist/components/mg-icon2.js +21 -3
- package/dist/components/mg-icon2.js.map +1 -0
- package/dist/components/mg-illustrated-message.js +3 -1
- package/dist/components/mg-illustrated-message.js.map +1 -0
- package/dist/components/mg-input-checkbox-paginated.js +2 -0
- package/dist/components/mg-input-checkbox-paginated.js.map +1 -0
- package/dist/components/mg-input-checkbox-paginated2.js +6 -1
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -0
- package/dist/components/mg-input-checkbox.js +64 -14
- package/dist/components/mg-input-checkbox.js.map +1 -0
- package/dist/components/mg-input-date.js +51 -9
- package/dist/components/mg-input-date.js.map +1 -0
- package/dist/components/mg-input-numeric.js +82 -39
- package/dist/components/mg-input-numeric.js.map +1 -0
- package/dist/components/mg-input-password.js +53 -11
- package/dist/components/mg-input-password.js.map +1 -0
- package/dist/components/mg-input-radio.js +53 -10
- package/dist/components/mg-input-radio.js.map +1 -0
- package/dist/components/mg-input-select.js +2 -0
- package/dist/components/mg-input-select.js.map +1 -0
- package/dist/components/mg-input-select2.js +53 -10
- package/dist/components/mg-input-select2.js.map +1 -0
- package/dist/components/mg-input-text.js +2 -0
- package/dist/components/mg-input-text.js.map +1 -0
- package/dist/components/mg-input-text2.js +64 -23
- package/dist/components/mg-input-text2.js.map +1 -0
- package/dist/components/mg-input-textarea.js +69 -27
- package/dist/components/mg-input-textarea.js.map +1 -0
- package/dist/components/mg-input-title.js +2 -0
- package/dist/components/mg-input-title.js.map +1 -0
- package/dist/components/mg-input-title2.js +6 -1
- package/dist/components/mg-input-title2.js.map +1 -0
- package/dist/components/mg-input-toggle.js +11 -1
- package/dist/components/mg-input-toggle.js.map +1 -0
- package/dist/components/mg-item-more.js +7 -1
- package/dist/components/mg-item-more.js.map +1 -0
- package/dist/components/mg-menu-item.js +2 -0
- package/dist/components/mg-menu-item.js.map +1 -0
- package/dist/components/mg-menu-item2.js +9 -1
- package/dist/components/mg-menu-item2.js.map +1 -0
- package/dist/components/mg-menu.conf.js +2 -0
- package/dist/components/mg-menu.conf.js.map +1 -0
- package/dist/components/mg-menu.js +2 -0
- package/dist/components/mg-menu.js.map +1 -0
- package/dist/components/mg-menu2.js +8 -1
- package/dist/components/mg-menu2.js.map +1 -0
- package/dist/components/mg-message.js +8 -1
- package/dist/components/mg-message.js.map +1 -0
- package/dist/components/mg-modal.js +8 -2
- package/dist/components/mg-modal.js.map +1 -0
- package/dist/components/mg-pagination.js +2 -0
- package/dist/components/mg-pagination.js.map +1 -0
- package/dist/components/mg-pagination2.js +6 -1
- package/dist/components/mg-pagination2.js.map +1 -0
- package/dist/components/mg-panel.js +16 -7
- package/dist/components/mg-panel.js.map +1 -0
- package/dist/components/mg-popover-content.js +2 -0
- package/dist/components/mg-popover-content.js.map +1 -0
- package/dist/components/mg-popover-content2.js +3 -1
- package/dist/components/mg-popover-content2.js.map +1 -0
- package/dist/components/mg-popover.js +2 -0
- package/dist/components/mg-popover.js.map +1 -0
- package/dist/components/mg-popover2.js +40 -15
- package/dist/components/mg-popover2.js.map +1 -0
- package/dist/components/mg-skip-links.js +5 -1
- package/dist/components/mg-skip-links.js.map +1 -0
- package/dist/components/mg-tabs.js +8 -1
- package/dist/components/mg-tabs.js.map +1 -0
- package/dist/components/mg-tag.js +7 -1
- package/dist/components/mg-tag.js.map +1 -0
- package/dist/components/mg-tooltip-content.js +2 -0
- package/dist/components/mg-tooltip-content.js.map +1 -0
- package/dist/components/mg-tooltip-content2.js +3 -1
- package/dist/components/mg-tooltip-content2.js.map +1 -0
- package/dist/components/mg-tooltip.js +2 -0
- package/dist/components/mg-tooltip.js.map +1 -0
- package/dist/components/mg-tooltip2.js +37 -12
- package/dist/components/mg-tooltip2.js.map +1 -0
- package/dist/components/popper.js +2 -0
- package/dist/components/popper.js.map +1 -0
- package/dist/esm/{index-1d40b052.js → index-ce01e63b.js} +321 -68
- package/dist/esm/index-ce01e63b.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +6 -13
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/mg-action-more_34.entry.js +485 -163
- package/dist/esm/mg-action-more_34.entry.js.map +1 -0
- package/dist/esm/mg-components.js +6 -4
- package/dist/esm/mg-components.js.map +1 -0
- package/dist/esm/mg-item-more.entry.js +4 -2
- package/dist/esm/mg-item-more.entry.js.map +1 -0
- package/dist/esm/{mg-menu.conf-2cc079ae.js → mg-menu.conf-012fc9b4.js} +2 -0
- package/dist/esm/mg-menu.conf-012fc9b4.js.map +1 -0
- package/dist/mg-components/index.esm.js +2 -0
- package/dist/mg-components/index.esm.js.map +1 -0
- package/dist/mg-components/mg-components.esm.js +2 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -0
- package/dist/mg-components/p-1aa89acf.js +3 -0
- package/dist/mg-components/p-1aa89acf.js.map +1 -0
- package/dist/mg-components/p-1d7d6fa0.js +2 -0
- package/dist/mg-components/p-1d7d6fa0.js.map +1 -0
- package/dist/mg-components/p-9257e8f1.entry.js +2 -0
- package/dist/mg-components/p-9257e8f1.entry.js.map +1 -0
- package/dist/mg-components/p-ff3ca349.entry.js +2 -0
- package/dist/mg-components/p-ff3ca349.entry.js.map +1 -0
- package/dist/types/components/atoms/mg-badge/test/mg-badge.e2e.playwright.d.ts +1 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +2 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +22 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.e2e.playwright.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +17 -2
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +35 -20
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +16 -1
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +16 -1
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +16 -1
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +17 -5
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +17 -5
- package/dist/types/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.d.ts +2 -0
- package/dist/types/components/molecules/mg-details/test/mg-details.e2e.playwright.d.ts +1 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-item-more/test/mg-item-more.e2e.playwright.d.ts +1 -0
- package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.playwright.d.ts +1 -0
- package/dist/types/components/molecules/mg-modal/test/mg-modal.e2e.template.d.ts +12 -0
- package/dist/types/components/molecules/mg-modal/test/mg-modal.firefox.e2e.playwright.d.ts +1 -0
- package/dist/types/components/molecules/mg-pagination/test/mg-pagination.e2e.playwright.d.ts +1 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +1 -1
- package/dist/types/components/molecules/mg-panel/test/mg-panel.e2e.playwright.d.ts +1 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -0
- package/dist/types/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.d.ts +1 -0
- package/dist/types/components.d.ts +79 -11
- package/dist/types/stencil-public-runtime.d.ts +43 -17
- package/dist/types/test/typography.e2e.playwright.d.ts +1 -0
- package/dist/types/utils/components.utils.d.ts +6 -0
- package/dist/types/utils/e2e.test.utils.d.ts +22 -0
- package/dist/types/utils/stencil.e2e.test.utils.d.ts +14 -0
- package/loader/index.d.ts +2 -2
- package/package.json +5 -5
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/mg-components/p-067080e4.js +0 -1
- package/dist/mg-components/p-3286bc46.entry.js +0 -1
- package/dist/mg-components/p-3bf1e2f0.js +0 -2
- package/dist/mg-components/p-91f4a30d.entry.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h } from
|
|
2
|
-
import { MgInput } from
|
|
3
|
-
import { ClassList } from
|
|
4
|
-
import { initLocales } from
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { MgInput } from "../MgInput";
|
|
3
|
+
import { ClassList } from "../../../../utils/components.utils";
|
|
4
|
+
import { initLocales } from "../../../../locales";
|
|
5
5
|
export class MgInputPassword {
|
|
6
6
|
constructor() {
|
|
7
7
|
// hasDisplayedError (triggered by blur event)
|
|
@@ -27,20 +27,23 @@ export class MgInputPassword {
|
|
|
27
27
|
*/
|
|
28
28
|
this.checkValidity = () => {
|
|
29
29
|
var _a;
|
|
30
|
-
this.
|
|
31
|
-
this.invalid = !this.valid;
|
|
32
|
-
// We need to send valid event even if it is the same value
|
|
33
|
-
this.inputValid.emit(this.valid);
|
|
30
|
+
this.setValidity(this.readonly || this.disabled || (((_a = this.input) === null || _a === void 0 ? void 0 : _a.checkValidity) !== undefined ? this.input.checkValidity() : true));
|
|
34
31
|
};
|
|
35
32
|
/**
|
|
36
33
|
* Set input error message
|
|
34
|
+
* @param errorMessage - errorMessage override
|
|
37
35
|
*/
|
|
38
|
-
this.setErrorMessage = () => {
|
|
36
|
+
this.setErrorMessage = (errorMessage) => {
|
|
39
37
|
// Set error message
|
|
40
38
|
this.errorMessage = undefined;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
if (!this.valid) {
|
|
40
|
+
if (errorMessage !== undefined) {
|
|
41
|
+
this.errorMessage = errorMessage;
|
|
42
|
+
}
|
|
43
|
+
// required
|
|
44
|
+
else if (this.input.validity.valueMissing) {
|
|
45
|
+
this.errorMessage = this.messages.errors.required;
|
|
46
|
+
}
|
|
44
47
|
}
|
|
45
48
|
};
|
|
46
49
|
this.value = undefined;
|
|
@@ -75,13 +78,44 @@ export class MgInputPassword {
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
/**
|
|
78
|
-
*
|
|
81
|
+
* Display input error if it exists.
|
|
79
82
|
*/
|
|
80
83
|
async displayError() {
|
|
81
84
|
this.checkValidity();
|
|
82
85
|
this.setErrorMessage();
|
|
83
86
|
this.hasDisplayedError = this.invalid;
|
|
84
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Set an error and display a custom error message.
|
|
90
|
+
* This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.
|
|
91
|
+
* It must be paired with an error message to display for the given context.
|
|
92
|
+
* When used to set validity to `false`, you should use this method again to reset the validity to `true`.
|
|
93
|
+
* @param valid - value indicating the validity
|
|
94
|
+
* @param errorMessage - the error message to display
|
|
95
|
+
*/
|
|
96
|
+
async setError(valid, errorMessage) {
|
|
97
|
+
if (typeof valid !== 'boolean') {
|
|
98
|
+
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean');
|
|
99
|
+
}
|
|
100
|
+
else if (typeof errorMessage !== 'string' || errorMessage.trim() === '') {
|
|
101
|
+
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string');
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.setValidity(valid);
|
|
105
|
+
this.setErrorMessage(valid ? undefined : errorMessage);
|
|
106
|
+
this.hasDisplayedError = this.invalid;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Method to set validity values
|
|
111
|
+
* @param newValue - valid new value
|
|
112
|
+
*/
|
|
113
|
+
setValidity(newValue) {
|
|
114
|
+
this.valid = newValue;
|
|
115
|
+
this.invalid = !this.valid;
|
|
116
|
+
// We need to send valid event even if it is the same value
|
|
117
|
+
this.inputValid.emit(this.valid);
|
|
118
|
+
}
|
|
85
119
|
/*************
|
|
86
120
|
* Lifecycle *
|
|
87
121
|
*************/
|
|
@@ -307,7 +341,8 @@ export class MgInputPassword {
|
|
|
307
341
|
"references": {
|
|
308
342
|
"Width": {
|
|
309
343
|
"location": "import",
|
|
310
|
-
"path": "../MgInput.conf"
|
|
344
|
+
"path": "../MgInput.conf",
|
|
345
|
+
"id": "src/components/molecules/inputs/MgInput.conf.ts::Width"
|
|
311
346
|
}
|
|
312
347
|
}
|
|
313
348
|
},
|
|
@@ -438,15 +473,55 @@ export class MgInputPassword {
|
|
|
438
473
|
"parameters": [],
|
|
439
474
|
"references": {
|
|
440
475
|
"Promise": {
|
|
441
|
-
"location": "global"
|
|
476
|
+
"location": "global",
|
|
477
|
+
"id": "global::Promise"
|
|
442
478
|
}
|
|
443
479
|
},
|
|
444
480
|
"return": "Promise<void>"
|
|
445
481
|
},
|
|
446
482
|
"docs": {
|
|
447
|
-
"text": "
|
|
483
|
+
"text": "Display input error if it exists.",
|
|
448
484
|
"tags": []
|
|
449
485
|
}
|
|
486
|
+
},
|
|
487
|
+
"setError": {
|
|
488
|
+
"complexType": {
|
|
489
|
+
"signature": "(valid: MgInputPassword['valid'], errorMessage: string) => Promise<void>",
|
|
490
|
+
"parameters": [{
|
|
491
|
+
"tags": [{
|
|
492
|
+
"name": "param",
|
|
493
|
+
"text": "valid - value indicating the validity"
|
|
494
|
+
}],
|
|
495
|
+
"text": "- value indicating the validity"
|
|
496
|
+
}, {
|
|
497
|
+
"tags": [{
|
|
498
|
+
"name": "param",
|
|
499
|
+
"text": "errorMessage - the error message to display"
|
|
500
|
+
}],
|
|
501
|
+
"text": "- the error message to display"
|
|
502
|
+
}],
|
|
503
|
+
"references": {
|
|
504
|
+
"Promise": {
|
|
505
|
+
"location": "global",
|
|
506
|
+
"id": "global::Promise"
|
|
507
|
+
},
|
|
508
|
+
"MgInputPassword": {
|
|
509
|
+
"location": "global",
|
|
510
|
+
"id": "global::MgInputPassword"
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
"return": "Promise<void>"
|
|
514
|
+
},
|
|
515
|
+
"docs": {
|
|
516
|
+
"text": "Set an error and display a custom error message.\nThis method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\nIt must be paired with an error message to display for the given context.\nWhen used to set validity to `false`, you should use this method again to reset the validity to `true`.",
|
|
517
|
+
"tags": [{
|
|
518
|
+
"name": "param",
|
|
519
|
+
"text": "valid - value indicating the validity"
|
|
520
|
+
}, {
|
|
521
|
+
"name": "param",
|
|
522
|
+
"text": "errorMessage - the error message to display"
|
|
523
|
+
}]
|
|
524
|
+
}
|
|
450
525
|
}
|
|
451
526
|
};
|
|
452
527
|
}
|
|
@@ -467,3 +542,4 @@ export class MgInputPassword {
|
|
|
467
542
|
}];
|
|
468
543
|
}
|
|
469
544
|
}
|
|
545
|
+
//# sourceMappingURL=mg-input-password.js.map
|
package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mg-input-password.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-password/mg-input-password.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAgB,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,C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MgInput } from '../MgInput';\nimport { Width } from '../MgInput.conf';\nimport { ClassList } from '../../../../utils/components.utils';\nimport { initLocales } from '../../../../locales';\n\n@Component({\n tag: 'mg-input-password',\n styleUrl: 'mg-input-password.scss',\n shadow: true,\n})\nexport class MgInputPassword {\n /************\n * Internal *\n ************/\n\n // HTML selector\n private input: HTMLInputElement;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputPasswordElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true, reflect: true }) value: string;\n @Watch('value')\n handleValue(newValue: string): void {\n this.valueChange.emit(newValue);\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name: string = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop: boolean;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.\n */\n @Prop() placeholder: string;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input !== undefined) {\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n }\n\n /**\n * Define input width\n */\n @Prop() mgWidth: Width = 'full';\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip: string;\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText: string;\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-input--password']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<string>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<boolean>;\n\n /**\n * Display input error if it exists.\n */\n @Method()\n async displayError(): Promise<void> {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n }\n\n /**\n * Set an error and display a custom error message.\n * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\n * It must be paired with an error message to display for the given context.\n * When used to set validity to `false`, you should use this method again to reset the validity to `true`.\n * @param valid - value indicating the validity\n * @param errorMessage - the error message to display\n */\n @Method()\n async setError(valid: MgInputPassword['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-password> method \"setError()\" param \"valid\" must be a boolean');\n } else if (typeof errorMessage !== 'string' || errorMessage.trim() === '') {\n throw new Error('<mg-input-password> method \"setError()\" param \"errorMessage\" must be a string');\n } else {\n this.setValidity(valid);\n this.setErrorMessage(valid ? undefined : errorMessage);\n this.hasDisplayedError = this.invalid;\n }\n }\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputPassword['valid']) {\n this.valid = newValue;\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n this.inputValid.emit(this.valid);\n }\n\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n }\n this.value = this.input.value;\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n this.displayError();\n };\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(this.readonly || this.disabled || (this.input?.checkValidity !== undefined ? this.input.checkValidity() : true));\n };\n\n /**\n * Set input error message\n * @param errorMessage - errorMessage override\n */\n private setErrorMessage = (errorMessage?: string): void => {\n // Set error message\n this.errorMessage = undefined;\n if (!this.valid) {\n if (errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n }\n // required\n else if (this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <MgInput\n identifier={this.identifier}\n classCollection={this.classCollection}\n ariaDescribedbyIDs={[]}\n label={this.label}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n readonly={this.readonly}\n mgWidth={this.mgWidth}\n disabled={this.disabled}\n value={this.value}\n readonlyValue={this.value !== undefined ? '•'.repeat(this.value.length) : undefined}\n tooltip={this.tooltip}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n isFieldset={false}\n >\n <input\n type=\"password\"\n class=\"mg-input__box\"\n value={this.value}\n id={this.identifier}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n onInput={this.handleInput}\n onBlur={this.handleBlur}\n ref={(el: HTMLInputElement) => {\n if (el !== null) this.input = el;\n }}\n />\n </MgInput>\n );\n }\n}\n"]}
|
package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.e2e.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,EAAE;EACjC,QAAQ,CAAC,IAAI,CAAC;IACZ,+EAA+E;IAC/E,4FAA4F;IAC5F,0FAA0F;IAC1F,sIAAsI;GACvI,CAAC,CAAC,iBAAiB,EAAE,IAAI,CAAC,EAAE;IAC3B,IAAI,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;MACxB,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;MAEpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;MACrD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;MAE7D,6BAA6B;MAC7B,MAAM,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,CAAC,EAAE;QAC1C,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACpD,KAAK,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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
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
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
|
+
input.dispatchEvent(new CustomEvent('focus', { bubbles: true }));
|
|
75
|
+
await page.waitForChanges();
|
|
76
|
+
expect(page.root).toMatchSnapshot(); //Snapshot on focus
|
|
77
|
+
input.value = inputValue;
|
|
78
|
+
input.dispatchEvent(new CustomEvent('input', { bubbles: true }));
|
|
79
|
+
await page.waitForChanges();
|
|
80
|
+
expect(page.rootInstance.valueChange.emit).toHaveBeenCalledWith(inputValue);
|
|
81
|
+
});
|
|
82
|
+
describe.each(['readonly', 'disabled'])('validity, case next state is %s', nextState => {
|
|
83
|
+
test.each([
|
|
84
|
+
{ validity: true, valueMissing: false },
|
|
85
|
+
{ validity: false, valueMissing: true },
|
|
86
|
+
{ validity: false, valueMissing: false },
|
|
87
|
+
])('validity (%s), valueMissing (%s)', async ({ validity, valueMissing }) => {
|
|
88
|
+
const args = { label: 'label', identifier: 'identifier', patternErrorMessage: 'Non' };
|
|
89
|
+
const page = await getPage(args);
|
|
90
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
91
|
+
const input = element.shadowRoot.querySelector('input');
|
|
92
|
+
//mock validity
|
|
93
|
+
input.checkValidity = jest.fn(() => validity);
|
|
94
|
+
Object.defineProperty(input, 'validity', {
|
|
95
|
+
get: jest.fn(() => ({
|
|
96
|
+
valueMissing,
|
|
97
|
+
})),
|
|
98
|
+
});
|
|
99
|
+
input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
|
|
100
|
+
await page.waitForChanges();
|
|
101
|
+
if (validity) {
|
|
102
|
+
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
103
|
+
}
|
|
104
|
+
else if (valueMissing) {
|
|
105
|
+
expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);
|
|
106
|
+
}
|
|
107
|
+
expect(page.rootInstance.valid).toEqual(validity);
|
|
108
|
+
expect(page.rootInstance.invalid).toEqual(!validity);
|
|
109
|
+
if (valueMissing) {
|
|
110
|
+
expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled FALSE
|
|
111
|
+
element[nextState] = true;
|
|
112
|
+
await page.waitForChanges();
|
|
113
|
+
expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled TRUE
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
test("display error with displayError component's public method", async () => {
|
|
118
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
119
|
+
expect(page.root).toMatchSnapshot();
|
|
120
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
121
|
+
const input = element.shadowRoot.querySelector('input');
|
|
122
|
+
//mock validity
|
|
123
|
+
input.checkValidity = jest.fn(() => false);
|
|
124
|
+
Object.defineProperty(input, 'validity', {
|
|
125
|
+
get: jest.fn(() => ({
|
|
126
|
+
valueMissing: true,
|
|
127
|
+
})),
|
|
128
|
+
});
|
|
129
|
+
await element.displayError();
|
|
130
|
+
await page.waitForChanges();
|
|
131
|
+
expect(page.root).toMatchSnapshot();
|
|
132
|
+
});
|
|
133
|
+
test.each([
|
|
134
|
+
{
|
|
135
|
+
valid: true,
|
|
136
|
+
errorMessage: 'Override error',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
valid: false,
|
|
140
|
+
errorMessage: 'Override error',
|
|
141
|
+
},
|
|
142
|
+
])("should display override error with setError component's public method", async (params) => {
|
|
143
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
144
|
+
expect(page.root).toMatchSnapshot();
|
|
145
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
146
|
+
const input = element.shadowRoot.querySelector('input');
|
|
147
|
+
//mock validity
|
|
148
|
+
Object.defineProperty(input, 'validity', {
|
|
149
|
+
get: () => ({}),
|
|
150
|
+
});
|
|
151
|
+
await element.setError(params.valid, params.errorMessage);
|
|
152
|
+
await page.waitForChanges();
|
|
153
|
+
expect(page.root).toMatchSnapshot();
|
|
154
|
+
});
|
|
155
|
+
test.each([
|
|
156
|
+
{
|
|
157
|
+
valid: '',
|
|
158
|
+
errorMessage: 'Override error',
|
|
159
|
+
error: '<mg-input-password> method "setError()" param "valid" must be a boolean',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
valid: undefined,
|
|
163
|
+
errorMessage: 'Override error',
|
|
164
|
+
error: '<mg-input-password> method "setError()" param "valid" must be a boolean',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
valid: true,
|
|
168
|
+
errorMessage: ' ',
|
|
169
|
+
error: '<mg-input-password> method "setError()" param "errorMessage" must be a string',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
valid: true,
|
|
173
|
+
errorMessage: true,
|
|
174
|
+
error: '<mg-input-password> method "setError()" param "errorMessage" must be a string',
|
|
175
|
+
},
|
|
176
|
+
])("shloud throw error with setError component's public method invalid params", async (params) => {
|
|
177
|
+
expect.assertions(1);
|
|
178
|
+
try {
|
|
179
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
180
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
181
|
+
await element.setError(params.valid, params.errorMessage);
|
|
182
|
+
await page.waitForChanges();
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
expect(err.message).toMatch(params.error);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
test.each(['fr', 'xx'])('display error message with locale: %s', async (lang) => {
|
|
189
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true, lang });
|
|
190
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
191
|
+
const input = element.shadowRoot.querySelector('input');
|
|
192
|
+
//mock validity
|
|
193
|
+
input.checkValidity = jest.fn(() => false);
|
|
194
|
+
Object.defineProperty(input, 'validity', {
|
|
195
|
+
get: jest.fn(() => ({
|
|
196
|
+
valueMissing: true,
|
|
197
|
+
})),
|
|
198
|
+
});
|
|
199
|
+
await element.displayError();
|
|
200
|
+
await page.waitForChanges();
|
|
201
|
+
expect(page.root).toMatchSnapshot();
|
|
202
|
+
});
|
|
203
|
+
test('Should remove error on input', async () => {
|
|
204
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
205
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
206
|
+
const input = element.shadowRoot.querySelector('input');
|
|
207
|
+
//mock validity
|
|
208
|
+
input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);
|
|
209
|
+
Object.defineProperty(input, 'validity', {
|
|
210
|
+
get: jest
|
|
211
|
+
.fn()
|
|
212
|
+
.mockReturnValueOnce({
|
|
213
|
+
valueMissing: true,
|
|
214
|
+
})
|
|
215
|
+
.mockReturnValueOnce({
|
|
216
|
+
valueMissing: true,
|
|
217
|
+
})
|
|
218
|
+
.mockReturnValueOnce({
|
|
219
|
+
valueMissing: false,
|
|
220
|
+
})
|
|
221
|
+
.mockReturnValueOnce({
|
|
222
|
+
valueMissing: false,
|
|
223
|
+
}),
|
|
224
|
+
});
|
|
225
|
+
await element.displayError();
|
|
226
|
+
await page.waitForChanges();
|
|
227
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(true);
|
|
228
|
+
expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);
|
|
229
|
+
input.value = 'blu';
|
|
230
|
+
input.dispatchEvent(new CustomEvent('input', { bubbles: true }));
|
|
231
|
+
await page.waitForChanges();
|
|
232
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(true);
|
|
233
|
+
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
234
|
+
input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
|
|
235
|
+
await page.waitForChanges();
|
|
236
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(false);
|
|
237
|
+
});
|
|
238
|
+
test('Should remove error on input when required change dynamically', async () => {
|
|
239
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
240
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
241
|
+
const input = element.shadowRoot.querySelector('input');
|
|
242
|
+
//mock validity
|
|
243
|
+
input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);
|
|
244
|
+
Object.defineProperty(input, 'validity', {
|
|
245
|
+
get: jest
|
|
246
|
+
.fn()
|
|
247
|
+
.mockReturnValueOnce({
|
|
248
|
+
valueMissing: true,
|
|
249
|
+
})
|
|
250
|
+
.mockReturnValueOnce({
|
|
251
|
+
valueMissing: true,
|
|
252
|
+
})
|
|
253
|
+
.mockReturnValueOnce({
|
|
254
|
+
valueMissing: false,
|
|
255
|
+
})
|
|
256
|
+
.mockReturnValueOnce({
|
|
257
|
+
valueMissing: false,
|
|
258
|
+
}),
|
|
259
|
+
});
|
|
260
|
+
await element.displayError();
|
|
261
|
+
await page.waitForChanges();
|
|
262
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(true);
|
|
263
|
+
expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);
|
|
264
|
+
element.required = false;
|
|
265
|
+
await page.waitForChanges();
|
|
266
|
+
// Error message should disapear and change the hasDisplayedError status
|
|
267
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(false);
|
|
268
|
+
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
269
|
+
element.required = true;
|
|
270
|
+
await page.waitForChanges();
|
|
271
|
+
// If back on required the message is still not displayed
|
|
272
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(false);
|
|
273
|
+
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
274
|
+
});
|
|
275
|
+
test('Should update mg-width', async () => {
|
|
276
|
+
const page = await getPage({ label: 'label', identifier: 'identifier' });
|
|
277
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
278
|
+
element.mgWidth = 2;
|
|
279
|
+
await page.waitForChanges();
|
|
280
|
+
expect(page.root).toMatchSnapshot();
|
|
281
|
+
element.mgWidth = 4;
|
|
282
|
+
await page.waitForChanges();
|
|
283
|
+
expect(page.root).toMatchSnapshot();
|
|
284
|
+
element.mgWidth = 16;
|
|
285
|
+
await page.waitForChanges();
|
|
286
|
+
expect(page.root).toMatchSnapshot();
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
//# sourceMappingURL=mg-input-password.spec.js.map
|