@mgdis/mg-components 5.15.0 → 5.17.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_32.cjs.entry.js → mg-action-more_34.cjs.entry.js} +341 -112
- 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 +8 -4
- 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 +184 -0
- package/dist/collection/collection-manifest.json +37 -35
- 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.css +43 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +50 -0
- 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.css +0 -43
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +64 -17
- 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 +132 -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 +264 -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.css +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +18 -12
- 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 +581 -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 +10 -8
- 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 +324 -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 +46 -23
- 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 +401 -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 +10 -7
- 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 +234 -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 +10 -7
- 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 +295 -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 +14 -9
- 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 +344 -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 +12 -8
- 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 +280 -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 +10 -7
- 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 +255 -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 +12 -9
- 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 +27 -14
- 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 +3 -2
- 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 +17 -7
- 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 +15 -9
- 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 +5 -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 +42 -8
- 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 +10 -7
- 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 +223 -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.css +135 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +101 -0
- 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.css +0 -111
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +47 -46
- 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 +148 -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 +130 -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 +9 -7
- package/dist/collection/utils/components.utils.js.map +1 -0
- package/dist/collection/utils/components.utils.spec.js +120 -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 +8 -6
- 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 +10 -7
- package/dist/components/components.utils.js.map +1 -0
- package/dist/components/index.d.ts +5 -35
- package/dist/components/index.js +3 -34
- 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 +42 -19
- 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 +8 -2
- 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 +17 -4
- 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 +87 -17
- 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 +24 -13
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -0
- package/dist/components/mg-input-checkbox.js +48 -25
- package/dist/components/mg-input-checkbox.js.map +1 -0
- package/dist/components/mg-input-date.js +23 -8
- package/dist/components/mg-input-date.js.map +1 -0
- package/dist/components/mg-input-numeric.js +58 -22
- package/dist/components/mg-input-numeric.js.map +1 -0
- package/dist/components/mg-input-password.js +21 -8
- package/dist/components/mg-input-password.js.map +1 -0
- package/dist/components/mg-input-radio.js +22 -8
- 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 +22 -8
- 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 +24 -10
- package/dist/components/mg-input-text2.js.map +1 -0
- package/dist/components/mg-input-textarea.js +24 -10
- 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 +23 -7
- package/dist/components/mg-input-toggle.js.map +1 -0
- package/dist/components/mg-item-more.js +31 -17
- 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 +27 -13
- 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 +24 -5
- 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 +22 -11
- package/dist/components/mg-pagination2.js.map +1 -0
- package/dist/components/mg-panel.js +30 -16
- package/dist/components/mg-panel.js.map +1 -0
- package/dist/components/mg-popover-content.d.ts +11 -0
- package/dist/components/mg-popover-content.js +8 -0
- package/dist/components/mg-popover-content.js.map +1 -0
- package/dist/components/mg-popover-content2.js +90 -0
- 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 +61 -48
- 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.d.ts +11 -0
- package/dist/components/mg-tooltip-content.js +8 -0
- package/dist/components/mg-tooltip-content.js.map +1 -0
- package/dist/components/mg-tooltip-content2.js +43 -0
- 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 +71 -16
- 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_32.entry.js → mg-action-more_34.entry.js} +340 -113
- 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 +8 -4
- 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.css +1 -1
- 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-caafc9cf.entry.js +2 -0
- package/dist/mg-components/p-caafc9cf.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-content/mg-tooltip-content.d.ts +14 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +7 -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-numeric/mg-input-numeric.d.ts +19 -0
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +6 -1
- 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 +8 -0
- 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/mg-modal.conf.d.ts +8 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +8 -2
- 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/test/mg-panel.e2e.playwright.d.ts +1 -0
- package/dist/types/components/molecules/mg-popover/mg-popover-content/mg-popover-content.d.ts +47 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +8 -11
- package/dist/types/components/molecules/mg-tabs/test/mg-tabs.e2e.playwright.d.ts +1 -0
- package/dist/types/components.d.ts +79 -0
- 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/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 +7 -7
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/mg-components/p-067080e4.js +0 -1
- package/dist/mg-components/p-3bf1e2f0.js +0 -2
- package/dist/mg-components/p-4ae1130f.entry.js +0 -1
- package/dist/mg-components/p-6672f590.entry.js +0 -1
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,CAAC,KAAK,CAAC,UAAU,GAAG,aAAa,CAAC;MACzC,CAAC,CAAC,CAAC;MAEH,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;MAExC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;MAC3C,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,EAAE,CAAC;MAE1C,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;MAEhC,MAAM,IAAI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,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;MAErD,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;MAExC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;MAC3C,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,IAAI,CAAC,IAAI,CAAC,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
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
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(['fr', 'xx'])('display error message with locale: %s', async (lang) => {
|
|
134
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true, lang });
|
|
135
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
136
|
+
const input = element.shadowRoot.querySelector('input');
|
|
137
|
+
//mock validity
|
|
138
|
+
input.checkValidity = jest.fn(() => false);
|
|
139
|
+
Object.defineProperty(input, 'validity', {
|
|
140
|
+
get: jest.fn(() => ({
|
|
141
|
+
valueMissing: true,
|
|
142
|
+
})),
|
|
143
|
+
});
|
|
144
|
+
await element.displayError();
|
|
145
|
+
await page.waitForChanges();
|
|
146
|
+
expect(page.root).toMatchSnapshot();
|
|
147
|
+
});
|
|
148
|
+
test('Should remove error on input', async () => {
|
|
149
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
150
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
151
|
+
const input = element.shadowRoot.querySelector('input');
|
|
152
|
+
//mock validity
|
|
153
|
+
input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);
|
|
154
|
+
Object.defineProperty(input, 'validity', {
|
|
155
|
+
get: jest
|
|
156
|
+
.fn()
|
|
157
|
+
.mockReturnValueOnce({
|
|
158
|
+
valueMissing: true,
|
|
159
|
+
})
|
|
160
|
+
.mockReturnValueOnce({
|
|
161
|
+
valueMissing: true,
|
|
162
|
+
})
|
|
163
|
+
.mockReturnValueOnce({
|
|
164
|
+
valueMissing: false,
|
|
165
|
+
})
|
|
166
|
+
.mockReturnValueOnce({
|
|
167
|
+
valueMissing: false,
|
|
168
|
+
}),
|
|
169
|
+
});
|
|
170
|
+
await element.displayError();
|
|
171
|
+
await page.waitForChanges();
|
|
172
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(true);
|
|
173
|
+
expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);
|
|
174
|
+
input.value = 'blu';
|
|
175
|
+
input.dispatchEvent(new CustomEvent('input', { bubbles: true }));
|
|
176
|
+
await page.waitForChanges();
|
|
177
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(true);
|
|
178
|
+
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
179
|
+
input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
|
|
180
|
+
await page.waitForChanges();
|
|
181
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(false);
|
|
182
|
+
});
|
|
183
|
+
test('Should remove error on input when required change dynamically', async () => {
|
|
184
|
+
const page = await getPage({ label: 'label', identifier: 'identifier', required: true });
|
|
185
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
186
|
+
const input = element.shadowRoot.querySelector('input');
|
|
187
|
+
//mock validity
|
|
188
|
+
input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);
|
|
189
|
+
Object.defineProperty(input, 'validity', {
|
|
190
|
+
get: jest
|
|
191
|
+
.fn()
|
|
192
|
+
.mockReturnValueOnce({
|
|
193
|
+
valueMissing: true,
|
|
194
|
+
})
|
|
195
|
+
.mockReturnValueOnce({
|
|
196
|
+
valueMissing: true,
|
|
197
|
+
})
|
|
198
|
+
.mockReturnValueOnce({
|
|
199
|
+
valueMissing: false,
|
|
200
|
+
})
|
|
201
|
+
.mockReturnValueOnce({
|
|
202
|
+
valueMissing: false,
|
|
203
|
+
}),
|
|
204
|
+
});
|
|
205
|
+
await element.displayError();
|
|
206
|
+
await page.waitForChanges();
|
|
207
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(true);
|
|
208
|
+
expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);
|
|
209
|
+
element.required = false;
|
|
210
|
+
await page.waitForChanges();
|
|
211
|
+
// Error message should disapear and change the hasDisplayedError status
|
|
212
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(false);
|
|
213
|
+
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
214
|
+
element.required = true;
|
|
215
|
+
await page.waitForChanges();
|
|
216
|
+
// If back on required the message is still not displayed
|
|
217
|
+
expect(page.rootInstance.hasDisplayedError).toEqual(false);
|
|
218
|
+
expect(page.rootInstance.errorMessage).toBeUndefined();
|
|
219
|
+
});
|
|
220
|
+
test('Should update mg-width', async () => {
|
|
221
|
+
const page = await getPage({ label: 'label', identifier: 'identifier' });
|
|
222
|
+
const element = page.doc.querySelector('mg-input-password');
|
|
223
|
+
element.mgWidth = 2;
|
|
224
|
+
await page.waitForChanges();
|
|
225
|
+
expect(page.root).toMatchSnapshot();
|
|
226
|
+
element.mgWidth = 4;
|
|
227
|
+
await page.waitForChanges();
|
|
228
|
+
expect(page.root).toMatchSnapshot();
|
|
229
|
+
element.mgWidth = 16;
|
|
230
|
+
await page.waitForChanges();
|
|
231
|
+
expect(page.root).toMatchSnapshot();
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
//# sourceMappingURL=mg-input-password.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAC;IACR,EAAE,KAAK,EAAE,OAAO,EAAE,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AY,CAAC,CAAC,aAAa,EAAE,CAAC;EACzD,CAAC,CAAC,CAAC;EAEH,IAAI,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;IACxC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,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\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\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(['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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mg-input-radio.conf.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * type RadioOption\n * use to match radio attributes\n */\nexport type RadioOption = {\n title: string;\n value: unknown;\n disabled?: boolean;\n};\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
2
2
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
import { h } from
|
|
5
|
-
import { MgInput } from
|
|
6
|
-
import { ClassList, allItemsAreString } from
|
|
7
|
-
import { initLocales } from
|
|
4
|
+
import { h } from "@stencil/core";
|
|
5
|
+
import { MgInput } from "../MgInput";
|
|
6
|
+
import { ClassList, allItemsAreString } from "../../../../utils/components.utils";
|
|
7
|
+
import { initLocales } from "../../../../locales";
|
|
8
8
|
/**
|
|
9
9
|
* type Option validation function
|
|
10
10
|
* @param option - radio option
|
|
@@ -141,7 +141,7 @@ export class MgInputRadio {
|
|
|
141
141
|
* @returns HTML Element
|
|
142
142
|
*/
|
|
143
143
|
render() {
|
|
144
|
-
return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }, role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: el => {
|
|
144
|
+
return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }, role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
|
|
145
145
|
if (el !== null)
|
|
146
146
|
this.inputs[index] = el;
|
|
147
147
|
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title)))))));
|
|
@@ -186,7 +186,8 @@ export class MgInputRadio {
|
|
|
186
186
|
"references": {
|
|
187
187
|
"RadioOption": {
|
|
188
188
|
"location": "import",
|
|
189
|
-
"path": "./mg-input-radio.conf"
|
|
189
|
+
"path": "./mg-input-radio.conf",
|
|
190
|
+
"id": "src/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.ts::RadioOption"
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
193
|
},
|
|
@@ -475,7 +476,8 @@ export class MgInputRadio {
|
|
|
475
476
|
"parameters": [],
|
|
476
477
|
"references": {
|
|
477
478
|
"Promise": {
|
|
478
|
-
"location": "global"
|
|
479
|
+
"location": "global",
|
|
480
|
+
"id": "global::Promise"
|
|
479
481
|
}
|
|
480
482
|
},
|
|
481
483
|
"return": "Promise<void>"
|
|
@@ -507,3 +509,4 @@ export class MgInputRadio {
|
|
|
507
509
|
}];
|
|
508
510
|
}
|
|
509
511
|
}
|
|
512
|
+
//# sourceMappingURL=mg-input-radio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mg-input-radio.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-radio/mg-input-radio.tsx"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sEAAsE;AACtE,uDAAuD;AACvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAgB,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,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AG,EAAE,CAAC,EAAoB,EAAE,EAAE;YAC5B,IAAI,EAAE,KAAK,IAAI;cAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;UAC3C,CAAC,GACD;QACF,aAAO,OAAO,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,KAAK,IAAG,KAAK,CAAC,KAAK,CAAS,CACjE,CACN,CAAC,CACC,CACG,CACX,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["/* eslint-disable jsx-a11y/no-redundant-roles */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Component, Element, Event, h, Prop, EventEmitter, State, Watch, Method } from '@stencil/core';\nimport { MgInput } from '../MgInput';\nimport { ClassList, allItemsAreString } from '../../../../utils/components.utils';\nimport { initLocales } from '../../../../locales';\nimport { RadioOption } from './mg-input-radio.conf';\n\n/**\n * type Option validation function\n * @param option - radio option\n * @returns radio option type is valid\n */\nconst isOption = (option: RadioOption): boolean => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;\n\n@Component({\n tag: 'mg-input-radio',\n styleUrl: 'mg-input-radio.scss',\n shadow: true,\n})\nexport class MgInputRadio {\n /************\n * Internal *\n ************/\n\n // HTML selector\n private inputs: 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: HTMLMgInputRadioElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true }) value: any;\n @Watch('value')\n handleValue(newValue: any): void {\n this.valueChange.emit(newValue);\n }\n\n /**\n * Items are the possible options to select\n */\n @Prop() items!: string[] | RadioOption[];\n @Watch('items')\n validateItems(newValue: string[] | RadioOption[]): void {\n // Validate if items have required min length\n if (typeof newValue === 'object' && newValue.length < 2) {\n throw new Error('<mg-input-radio> prop \"items\" require at least 2 items.');\n }\n // String array\n else if (allItemsAreString(newValue as string[])) {\n this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));\n }\n // Object array\n else if (newValue && (newValue as RadioOption[]).every(item => isOption(item))) {\n this.options = newValue as RadioOption[];\n } else {\n throw new Error('<mg-input-radio> prop \"items\" is required and all items must be the same type, string or RadioOption.');\n }\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 = false;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Define if inputs are display verticaly\n */\n @Prop() inputVerticalList = false;\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 this.inputs.forEach(input => {\n input[prop] = newValue;\n });\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\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--radio']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Formated items for display\n */\n @State() options: RadioOption[];\n\n /**\n * Emitted event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<any>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<boolean>;\n\n /**\n * Public method to display errors\n */\n @Method()\n async displayError(): Promise<void> {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n }\n\n /**\n * Handle input event\n * @param event - input event\n */\n private handleInput = (event: InputEvent & { target: HTMLInputElement }) => {\n this.checkValidity();\n this.value = this.options[event.target.value].value;\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n this.checkValidity();\n this.setErrorMessage();\n };\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.valid = this.readonly || this.disabled || this.getInvalidElement() === undefined;\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 * Set input error message\n */\n private setErrorMessage = (): void => {\n const invalidElement = this.getInvalidElement();\n\n // Set error message\n this.errorMessage = undefined;\n if (!this.valid && invalidElement.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n };\n\n /**\n * get invalid element\n * @returns element\n */\n private getInvalidElement = (): HTMLInputElement => this.inputs.find((input: HTMLInputElement) => !input.disabled && !input.readOnly && !input.checkValidity());\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 // Validate\n this.validateItems(this.items);\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 disabled={this.disabled}\n readonly={this.readonly}\n mgWidth={undefined}\n value={this.value as string}\n readonlyValue={this.value as string}\n tooltip={this.tooltip}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n isFieldset={true}\n >\n <ul class={{ 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }} role=\"list\">\n {this.options.map((input, index) => (\n <li key={input.title} class={{ 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled }}>\n <input\n type=\"radio\"\n id={this.identifier + '_' + index}\n name={this.identifier}\n value={index}\n checked={JSON.stringify(this.value) === JSON.stringify(this.options[index].value)}\n disabled={this.disabled || input.disabled}\n required={this.required}\n onBlur={this.handleBlur}\n onInput={this.handleInput}\n ref={(el: HTMLInputElement) => {\n if (el !== null) this.inputs[index] = el;\n }}\n />\n <label htmlFor={this.identifier + '_' + index}>{input.title}</label>\n </li>\n ))}\n </ul>\n </MgInput>\n );\n }\n}\n"]}
|