@mgdis/mg-components 5.17.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/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_34.cjs.entry.js +464 -157
- package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +31 -11
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js +6 -0
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.e2e.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +8 -0
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +92 -16
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +58 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +79 -8
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +109 -38
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +83 -10
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +82 -9
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +60 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +82 -9
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +55 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +94 -21
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +68 -5
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +100 -26
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +67 -4
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +2 -2
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +8 -6
- package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js +3 -13
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +34 -14
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js +13 -2
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.e2e.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js +12 -0
- package/dist/collection/components/molecules/mg-popover/test/mg-popover.spec.js.map +1 -1
- package/dist/collection/utils/components.utils.js +6 -0
- package/dist/collection/utils/components.utils.js.map +1 -1
- package/dist/collection/utils/components.utils.spec.js +9 -1
- package/dist/collection/utils/components.utils.spec.js.map +1 -1
- package/dist/components/components.utils.js +7 -1
- package/dist/components/components.utils.js.map +1 -1
- package/dist/components/mg-form.js +1 -1
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +52 -13
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +41 -8
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +71 -38
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +45 -10
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +44 -9
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select2.js +44 -9
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +56 -23
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +60 -26
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-panel.js +8 -7
- package/dist/components/mg-panel.js.map +1 -1
- package/dist/components/mg-popover2.js +33 -14
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-tooltip2.js +30 -11
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_34.entry.js +464 -157
- package/dist/esm/mg-action-more_34.entry.js.map +1 -1
- package/dist/esm/mg-components.js +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/p-ff3ca349.entry.js +2 -0
- package/dist/mg-components/p-ff3ca349.entry.js.map +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-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-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +1 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -0
- package/dist/types/components.d.ts +59 -11
- package/dist/types/utils/components.utils.d.ts +6 -0
- package/package.json +1 -1
- package/dist/mg-components/p-caafc9cf.entry.js +0 -2
- package/dist/mg-components/p-caafc9cf.entry.js.map +0 -1
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy(JSON.parse("[[\"mg-action-more_34.cjs\",[[1,\"mg-input-checkbox\",{\"value\":[1040],\"type\":[1025],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"inputVerticalList\":[4,\"input-vertical-list\"],\"required\":[4],\"readonly\":[4],\"displaySelectedValues\":[4,\"display-selected-values\"],\"disabled\":[4],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"checkboxItems\":[32],\"displaySearchInput\":[32],\"searchValue\":[32],\"searchResults\":[32],\"displayError\":[64]},null,{\"value\":[\"validateValue\"],\"type\":[\"validateType\"],\"displaySelectedValues\":[\"validateDisplaySelectedValues\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\",\"validateDisabled\"],\"checkboxItems\":[\"validateCheckboxItems\"],\"searchValue\":[\"validateSearchValue\"]}],[1,\"mg-action-more\",{\"icon\":[1040],\"button\":[16],\"items\":[16],\"displayChevron\":[4,\"display-chevron\"],\"expanded\":[32]},null,{\"icon\":[\"validateIcon\"],\"button\":[\"validateButton\"],\"items\":[\"validateItems\"],\"displayChevron\":[\"validateDisplayChevron\"]}],[1,\"mg-panel\",{\"identifier\":[1],\"panelTitle\":[1025,\"panel-title\"],\"titlePattern\":[1,\"title-pattern\"],\"titlePatternErrorMessage\":[1,\"title-pattern-error-message\"],\"titleEditable\":[1028,\"title-editable\"],\"titlePosition\":[1,\"title-position\"],\"expanded\":[1028],\"expandToggleDisplay\":[1,\"expand-toggle-display\"],\"expandToggleDisabled\":[4,\"expand-toggle-disabled\"],\"classCollection\":[32],\"isEditing\":[32],\"updatedPanelTitle\":[32]},null,{\"panelTitle\":[\"validatePanelTitle\"],\"titlePattern\":[\"validatetitlePattern\"],\"titlePosition\":[\"validateTitlePosition\"],\"expanded\":[\"handleExpanded\"],\"expandToggleDisplay\":[\"validateExpandToggleDisplay\"]}],[1,\"mg-input-textarea\",{\"value\":[1537],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"placeholder\":[1],\"maxlength\":[2],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"mgWidth\":[8,\"mg-width\"],\"pattern\":[1],\"patternErrorMessage\":[1,\"pattern-error-message\"],\"rows\":[2],\"tooltip\":[1],\"displayCharacterLeft\":[4,\"display-character-left\"],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"resizable\":[1],\"classCollection\":[32],\"errorMessage\":[32],\"displayError\":[64]},null,{\"value\":[\"handleValue\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"],\"displayCharacterLeft\":[\"validateDisplayCharacterLeft\"]}],[1,\"mg-input-date\",{\"value\":[1537],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"min\":[1],\"max\":[1],\"classCollection\":[32],\"errorMessage\":[32],\"displayError\":[64]},null,{\"value\":[\"validateValue\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"],\"min\":[\"validateMinMax\"],\"max\":[\"validateMinMax\"]}],[1,\"mg-input-numeric\",{\"value\":[1537],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"placeholder\":[1],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"mgWidth\":[8,\"mg-width\"],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"type\":[1],\"currency\":[1],\"max\":[2],\"min\":[2],\"integerLength\":[2,\"integer-length\"],\"decimalLength\":[2,\"decimal-length\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"hasFocus\":[32],\"displayError\":[64]},null,{\"value\":[\"validateValue\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"],\"type\":[\"validateType\"],\"integerLength\":[\"validateIntegerLength\"],\"decimalLength\":[\"validateDecimalLength\"]}],[1,\"mg-input-password\",{\"value\":[1537],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"placeholder\":[1],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"mgWidth\":[8,\"mg-width\"],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"displayError\":[64]},null,{\"value\":[\"handleValue\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"]}],[1,\"mg-input-radio\",{\"value\":[1032],\"items\":[16],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"inputVerticalList\":[4,\"input-vertical-list\"],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"options\":[32],\"displayError\":[64]},null,{\"value\":[\"handleValue\"],\"items\":[\"validateItems\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"]}],[1,\"mg-input-toggle\",{\"value\":[1032],\"items\":[16],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"isOnOff\":[4,\"is-on-off\"],\"isIcon\":[4,\"is-icon\"],\"readonly\":[4],\"disabled\":[4],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"classCollection\":[32],\"options\":[32],\"checked\":[32]},null,{\"value\":[\"handleValue\"],\"items\":[\"validateItems\"],\"isOnOff\":[\"handleIsOnOff\"],\"isIcon\":[\"handleIsIcon\"],\"readonly\":[\"handleReadonly\"],\"disabled\":[\"handleDisabled\"],\"checked\":[\"handleChecked\"]}],[1,\"mg-message\",{\"identifier\":[1],\"delay\":[2],\"variant\":[1],\"closeButton\":[1028,\"close-button\"],\"hide\":[1028],\"classCollection\":[32],\"hasActions\":[32]},null,{\"delay\":[\"validateDelay\"],\"variant\":[\"validateVariant\"],\"closeButton\":[\"validateCloseButton\"],\"hide\":[\"validateHide\"]}],[1,\"mg-modal\",{\"identifier\":[1],\"dialogRole\":[1,\"dialog-role\"],\"modalTitle\":[1,\"modal-title\"],\"closeButton\":[4,\"close-button\"],\"hide\":[1028],\"hasActions\":[32],\"hasContent\":[32],\"classCollection\":[32]},[[8,\"keydown\",\"handleKeyDown\"]],{\"dialogRole\":[\"validateDialogRole\"],\"modalTitle\":[\"validateModalTitle\"],\"hide\":[\"validateHide\"]}],[1,\"mg-tabs\",{\"identifier\":[1],\"label\":[1],\"size\":[1],\"items\":[16],\"activeTab\":[1538,\"active-tab\"],\"tabs\":[32],\"classCollection\":[32]},null,{\"label\":[\"validateLabel\"],\"size\":[\"validateSize\"],\"items\":[\"validateItems\"],\"activeTab\":[\"validateActiveTab\"]}],[1,\"mg-details\",{\"toggleClosed\":[1,\"toggle-closed\"],\"toggleOpened\":[1,\"toggle-opened\"],\"hideSummary\":[4,\"hide-summary\"],\"expanded\":[1028]},null,{\"toggleClosed\":[\"validateTitles\"],\"toggleOpened\":[\"validateTitles\"],\"expanded\":[\"handleExpanded\"]}],[1,\"mg-divider\",{\"size\":[1]}],[1,\"mg-form\",{\"identifier\":[1],\"name\":[1],\"readonly\":[4],\"disabled\":[4],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"requiredMessage\":[32],\"displayError\":[64]},null,{\"readonly\":[\"handleAttributeChange\"],\"disabled\":[\"handleAttributeChange\"]}],[1,\"mg-illustrated-message\",{\"size\":[1],\"direction\":[1]}],[1,\"mg-skip-links\",{\"links\":[16]},null,{\"links\":[\"validateLinks\"]}],[1,\"mg-tag\",{\"variant\":[1],\"outline\":[4],\"soft\":[4],\"classCollection\":[32]},null,{\"variant\":[\"validateVariant\"],\"outline\":[\"validateOutline\"],\"soft\":[\"validateSoft\"]}],[2,\"mg-input-checkbox-paginated\",{\"readonly\":[4],\"disabled\":[4],\"name\":[1],\"checkboxes\":[16],\"sectionKind\":[1,\"section-kind\"],\"messages\":[16],\"titleKind\":[32],\"currentPage\":[32],\"expanded\":[32]},null,{\"checkboxes\":[\"validateCheckboxes\"],\"sectionKind\":[\"validateSectionKind\"]}],[1,\"mg-menu-item\",{\"identifier\":[1],\"href\":[1],\"status\":[1537],\"expanded\":[1028],\"size\":[32],\"navigationButtonClassList\":[32],\"direction\":[32],\"isInMainMenu\":[32],\"isItemMore\":[32],\"hasChildren\":[32],\"displayNotificationBadge\":[32]},null,{\"status\":[\"validateStatus\"],\"expanded\":[\"validateExpanded\"],\"size\":[\"validateSize\"],\"direction\":[\"validateDirection\"],\"hasChildren\":[\"validateHasChildren\"]}],[1,\"mg-pagination\",{\"identifier\":[1],\"label\":[1025],\"hideNavigationLabels\":[4,\"hide-navigation-labels\"],\"hidePageCount\":[4,\"hide-page-count\"],\"totalPages\":[2,\"total-pages\"],\"currentPage\":[1538,\"current-page\"]},null,{\"totalPages\":[\"validateTotalPages\"],\"currentPage\":[\"validateCurrentPage\"]}],[1,\"mg-input-text\",{\"value\":[1537],\"identifier\":[1],\"name\":[1],\"label\":[1],\"type\":[1],\"icon\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"placeholder\":[1],\"maxlength\":[2],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"mgWidth\":[8,\"mg-width\"],\"pattern\":[1],\"patternErrorMessage\":[1,\"pattern-error-message\"],\"tooltip\":[1],\"displayCharacterLeft\":[4,\"display-character-left\"],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"setFocus\":[64],\"displayError\":[64]},null,{\"value\":[\"handleValue\"],\"icon\":[\"validateIcon\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"]}],[1,\"mg-menu\",{\"label\":[1],\"direction\":[513],\"itemmore\":[16],\"size\":[1],\"isChildMenu\":[32]},null,{\"label\":[\"validateLabel\"],\"direction\":[\"validateDirection\"],\"itemmore\":[\"validateItemMore\"],\"size\":[\"validateSize\"]}],[1,\"mg-input-select\",{\"value\":[1032],\"items\":[16],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"placeholder\":[1025],\"placeholderHide\":[4,\"placeholder-hide\"],\"placeholderDisabled\":[4,\"placeholder-disabled\"],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"mgWidth\":[520,\"mg-width\"],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"options\":[32],\"valueExist\":[32],\"readonlyValue\":[32],\"displayError\":[64]},null,{\"value\":[\"validateValue\"],\"items\":[\"validateItems\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"]}],[1,\"mg-popover\",{\"identifier\":[1],\"placement\":[1],\"arrowHide\":[4,\"arrow-hide\"],\"closeButton\":[4,\"close-button\"],\"display\":[1028],\"disabled\":[4]},null,{\"arrowHide\":[\"validateArrowHide\"],\"closeButton\":[\"validateCloseButton\"],\"display\":[\"handleDisplay\"]}],[1,\"mg-badge\",{\"value\":[8],\"label\":[1],\"variant\":[1],\"outline\":[4],\"classCollection\":[32]},null,{\"value\":[\"validateValue\"],\"label\":[\"validateLabel\"],\"variant\":[\"validateVariant\"],\"outline\":[\"validateOutline\"]}],[2,\"mg-character-left\",{\"identifier\":[1],\"characters\":[1],\"maxlength\":[2]},null,{\"maxlength\":[\"validateMaxlength\"]}],[1,\"mg-popover-content\",{\"closeButton\":[4,\"close-button\"],\"classCollection\":[32]}],[1,\"mg-card\",{\"variant\":[1],\"variantStyle\":[1025,\"variant-style\"],\"classCollection\":[32]},null,{\"variant\":[\"validateVariant\"],\"variantStyle\":[\"validateVariantStyle\"]}],[1,\"mg-button\",{\"variant\":[1],\"identifier\":[1],\"label\":[1],\"type\":[1],\"fullWidth\":[4,\"full-width\"],\"form\":[1],\"disabled\":[1028],\"isIcon\":[4,\"is-icon\"],\"disableOnClick\":[4,\"disable-on-click\"],\"loading\":[32],\"classCollection\":[32]},null,{\"variant\":[\"validateVariant\"],\"fullWidth\":[\"validateFullWidth\"],\"disabled\":[\"disabledHandler\"],\"loading\":[\"loadingHandler\"]}],[1,\"mg-tooltip\",{\"identifier\":[1],\"message\":[1],\"placement\":[1],\"display\":[1028],\"disabled\":[4]},null,{\"message\":[\"validateMessage\"],\"display\":[\"handleDisplay\"],\"disabled\":[\"validateDisabled\"]}],[6,\"mg-input-title\",{\"identifier\":[1],\"required\":[4],\"isLegend\":[4,\"is-legend\"],\"tagName\":[32]},null,{\"identifier\":[\"validateIdentifier\"],\"isLegend\":[\"validateIsLegend\"]}],[1,\"mg-tooltip-content\",{\"message\":[1]}],[1,\"mg-icon\",{\"icon\":[1],\"size\":[1],\"variant\":[1],\"variantStyle\":[1025,\"variant-style\"],\"spin\":[4],\"classCollection\":[32]},null,{\"icon\":[\"validateIcon\"],\"size\":[\"validateSize\"],\"variant\":[\"validateVariant\"],\"variantStyle\":[\"validateVariantStyle\"],\"spin\":[\"handleSpin\"]}]]],[\"mg-item-more.cjs\",[[1,\"mg-item-more\",{\"icon\":[16],\"slotlabel\":[16],\"size\":[1],\"parentMenu\":[32]},null,{\"icon\":[\"validateIcon\"],\"slotlabel\":[\"validateSlotLabel\"],\"size\":[\"validateSize\"]}]]]]"), options);
|
|
20
|
+
return index.bootstrapLazy(JSON.parse("[[\"mg-action-more_34.cjs\",[[1,\"mg-input-checkbox\",{\"value\":[1040],\"type\":[1025],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"inputVerticalList\":[4,\"input-vertical-list\"],\"required\":[4],\"readonly\":[4],\"displaySelectedValues\":[4,\"display-selected-values\"],\"disabled\":[4],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"checkboxItems\":[32],\"displaySearchInput\":[32],\"searchValue\":[32],\"searchResults\":[32],\"displayError\":[64],\"setError\":[64]},null,{\"value\":[\"validateValue\"],\"type\":[\"validateType\"],\"displaySelectedValues\":[\"validateDisplaySelectedValues\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\",\"validateDisabled\"],\"checkboxItems\":[\"validateCheckboxItems\"],\"searchValue\":[\"validateSearchValue\"]}],[1,\"mg-action-more\",{\"icon\":[1040],\"button\":[16],\"items\":[16],\"displayChevron\":[4,\"display-chevron\"],\"expanded\":[32]},null,{\"icon\":[\"validateIcon\"],\"button\":[\"validateButton\"],\"items\":[\"validateItems\"],\"displayChevron\":[\"validateDisplayChevron\"]}],[1,\"mg-panel\",{\"identifier\":[1],\"panelTitle\":[1025,\"panel-title\"],\"titlePattern\":[1,\"title-pattern\"],\"titlePatternErrorMessage\":[1,\"title-pattern-error-message\"],\"titleEditable\":[1028,\"title-editable\"],\"titlePosition\":[1,\"title-position\"],\"expanded\":[1028],\"expandToggleDisplay\":[1,\"expand-toggle-display\"],\"expandToggleDisabled\":[4,\"expand-toggle-disabled\"],\"classCollection\":[32],\"isEditing\":[32],\"updatedPanelTitle\":[32]},null,{\"panelTitle\":[\"validatePanelTitle\"],\"titlePattern\":[\"validateTitlePattern\"],\"titlePatternErrorMessage\":[\"validateTitlePattern\"],\"titlePosition\":[\"validateTitlePosition\"],\"expanded\":[\"handleExpanded\"],\"expandToggleDisplay\":[\"validateExpandToggleDisplay\"]}],[1,\"mg-input-textarea\",{\"value\":[1537],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"placeholder\":[1],\"maxlength\":[2],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"mgWidth\":[8,\"mg-width\"],\"pattern\":[1],\"patternErrorMessage\":[1,\"pattern-error-message\"],\"rows\":[2],\"tooltip\":[1],\"displayCharacterLeft\":[4,\"display-character-left\"],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"resizable\":[1],\"classCollection\":[32],\"errorMessage\":[32],\"displayError\":[64],\"setError\":[64]},null,{\"value\":[\"handleValue\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"],\"pattern\":[\"validatePattern\"],\"patternErrorMessage\":[\"validatePattern\"],\"displayCharacterLeft\":[\"validateDisplayCharacterLeft\"]}],[1,\"mg-input-date\",{\"value\":[1537],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"min\":[1],\"max\":[1],\"classCollection\":[32],\"errorMessage\":[32],\"displayError\":[64],\"setError\":[64]},null,{\"value\":[\"validateValue\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"],\"min\":[\"validateMinMax\"],\"max\":[\"validateMinMax\"]}],[1,\"mg-input-numeric\",{\"value\":[1537],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"placeholder\":[1],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"mgWidth\":[8,\"mg-width\"],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"type\":[1],\"currency\":[1],\"max\":[2],\"min\":[2],\"integerLength\":[2,\"integer-length\"],\"decimalLength\":[2,\"decimal-length\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"hasFocus\":[32],\"displayError\":[64],\"setError\":[64]},null,{\"value\":[\"validateValue\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"],\"type\":[\"validateType\"],\"integerLength\":[\"validateIntegerLength\"],\"decimalLength\":[\"validateDecimalLength\"]}],[1,\"mg-input-password\",{\"value\":[1537],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"placeholder\":[1],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"mgWidth\":[8,\"mg-width\"],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"displayError\":[64],\"setError\":[64]},null,{\"value\":[\"handleValue\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"]}],[1,\"mg-input-radio\",{\"value\":[1032],\"items\":[16],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"inputVerticalList\":[4,\"input-vertical-list\"],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"options\":[32],\"displayError\":[64],\"setError\":[64]},null,{\"value\":[\"handleValue\"],\"items\":[\"validateItems\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"]}],[1,\"mg-input-toggle\",{\"value\":[1032],\"items\":[16],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"isOnOff\":[4,\"is-on-off\"],\"isIcon\":[4,\"is-icon\"],\"readonly\":[4],\"disabled\":[4],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"classCollection\":[32],\"options\":[32],\"checked\":[32]},null,{\"value\":[\"handleValue\"],\"items\":[\"validateItems\"],\"isOnOff\":[\"handleIsOnOff\"],\"isIcon\":[\"handleIsIcon\"],\"readonly\":[\"handleReadonly\"],\"disabled\":[\"handleDisabled\"],\"checked\":[\"handleChecked\"]}],[1,\"mg-message\",{\"identifier\":[1],\"delay\":[2],\"variant\":[1],\"closeButton\":[1028,\"close-button\"],\"hide\":[1028],\"classCollection\":[32],\"hasActions\":[32]},null,{\"delay\":[\"validateDelay\"],\"variant\":[\"validateVariant\"],\"closeButton\":[\"validateCloseButton\"],\"hide\":[\"validateHide\"]}],[1,\"mg-modal\",{\"identifier\":[1],\"dialogRole\":[1,\"dialog-role\"],\"modalTitle\":[1,\"modal-title\"],\"closeButton\":[4,\"close-button\"],\"hide\":[1028],\"hasActions\":[32],\"hasContent\":[32],\"classCollection\":[32]},[[8,\"keydown\",\"handleKeyDown\"]],{\"dialogRole\":[\"validateDialogRole\"],\"modalTitle\":[\"validateModalTitle\"],\"hide\":[\"validateHide\"]}],[1,\"mg-tabs\",{\"identifier\":[1],\"label\":[1],\"size\":[1],\"items\":[16],\"activeTab\":[1538,\"active-tab\"],\"tabs\":[32],\"classCollection\":[32]},null,{\"label\":[\"validateLabel\"],\"size\":[\"validateSize\"],\"items\":[\"validateItems\"],\"activeTab\":[\"validateActiveTab\"]}],[1,\"mg-details\",{\"toggleClosed\":[1,\"toggle-closed\"],\"toggleOpened\":[1,\"toggle-opened\"],\"hideSummary\":[4,\"hide-summary\"],\"expanded\":[1028]},null,{\"toggleClosed\":[\"validateTitles\"],\"toggleOpened\":[\"validateTitles\"],\"expanded\":[\"handleExpanded\"]}],[1,\"mg-divider\",{\"size\":[1]}],[1,\"mg-form\",{\"identifier\":[1],\"name\":[1],\"readonly\":[4],\"disabled\":[4],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"requiredMessage\":[32],\"displayError\":[64]},null,{\"readonly\":[\"handleAttributeChange\"],\"disabled\":[\"handleAttributeChange\"]}],[1,\"mg-illustrated-message\",{\"size\":[1],\"direction\":[1]}],[1,\"mg-skip-links\",{\"links\":[16]},null,{\"links\":[\"validateLinks\"]}],[1,\"mg-tag\",{\"variant\":[1],\"outline\":[4],\"soft\":[4],\"classCollection\":[32]},null,{\"variant\":[\"validateVariant\"],\"outline\":[\"validateOutline\"],\"soft\":[\"validateSoft\"]}],[2,\"mg-input-checkbox-paginated\",{\"readonly\":[4],\"disabled\":[4],\"name\":[1],\"checkboxes\":[16],\"sectionKind\":[1,\"section-kind\"],\"messages\":[16],\"titleKind\":[32],\"currentPage\":[32],\"expanded\":[32]},null,{\"checkboxes\":[\"validateCheckboxes\"],\"sectionKind\":[\"validateSectionKind\"]}],[1,\"mg-menu-item\",{\"identifier\":[1],\"href\":[1],\"status\":[1537],\"expanded\":[1028],\"size\":[32],\"navigationButtonClassList\":[32],\"direction\":[32],\"isInMainMenu\":[32],\"isItemMore\":[32],\"hasChildren\":[32],\"displayNotificationBadge\":[32]},null,{\"status\":[\"validateStatus\"],\"expanded\":[\"validateExpanded\"],\"size\":[\"validateSize\"],\"direction\":[\"validateDirection\"],\"hasChildren\":[\"validateHasChildren\"]}],[1,\"mg-pagination\",{\"identifier\":[1],\"label\":[1025],\"hideNavigationLabels\":[4,\"hide-navigation-labels\"],\"hidePageCount\":[4,\"hide-page-count\"],\"totalPages\":[2,\"total-pages\"],\"currentPage\":[1538,\"current-page\"]},null,{\"totalPages\":[\"validateTotalPages\"],\"currentPage\":[\"validateCurrentPage\"]}],[1,\"mg-input-text\",{\"value\":[1537],\"identifier\":[1],\"name\":[1],\"label\":[1],\"type\":[1],\"icon\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"placeholder\":[1],\"maxlength\":[2],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"mgWidth\":[8,\"mg-width\"],\"pattern\":[1],\"patternErrorMessage\":[1,\"pattern-error-message\"],\"tooltip\":[1],\"displayCharacterLeft\":[4,\"display-character-left\"],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"setFocus\":[64],\"displayError\":[64],\"setError\":[64]},null,{\"value\":[\"handleValue\"],\"icon\":[\"validateIcon\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"],\"pattern\":[\"validatePattern\"],\"patternErrorMessage\":[\"validatePattern\"]}],[1,\"mg-menu\",{\"label\":[1],\"direction\":[513],\"itemmore\":[16],\"size\":[1],\"isChildMenu\":[32]},null,{\"label\":[\"validateLabel\"],\"direction\":[\"validateDirection\"],\"itemmore\":[\"validateItemMore\"],\"size\":[\"validateSize\"]}],[1,\"mg-input-select\",{\"value\":[1032],\"items\":[16],\"identifier\":[1],\"name\":[1],\"label\":[1],\"labelOnTop\":[4,\"label-on-top\"],\"labelHide\":[4,\"label-hide\"],\"placeholder\":[1025],\"placeholderHide\":[4,\"placeholder-hide\"],\"placeholderDisabled\":[4,\"placeholder-disabled\"],\"required\":[4],\"readonly\":[4],\"disabled\":[4],\"mgWidth\":[520,\"mg-width\"],\"tooltip\":[1],\"helpText\":[1,\"help-text\"],\"valid\":[1028],\"invalid\":[1028],\"classCollection\":[32],\"errorMessage\":[32],\"options\":[32],\"valueExist\":[32],\"readonlyValue\":[32],\"displayError\":[64],\"setError\":[64]},null,{\"value\":[\"validateValue\"],\"items\":[\"validateItems\"],\"required\":[\"handleValidityChange\"],\"readonly\":[\"handleValidityChange\"],\"disabled\":[\"handleValidityChange\"]}],[1,\"mg-popover\",{\"identifier\":[1],\"placement\":[1],\"arrowHide\":[4,\"arrow-hide\"],\"closeButton\":[4,\"close-button\"],\"display\":[1028],\"disabled\":[4]},null,{\"identifier\":[\"validateIdentifier\"],\"arrowHide\":[\"validateArrowHide\"],\"closeButton\":[\"validateCloseButton\"],\"display\":[\"handleDisplay\"]}],[1,\"mg-badge\",{\"value\":[8],\"label\":[1],\"variant\":[1],\"outline\":[4],\"classCollection\":[32]},null,{\"value\":[\"validateValue\"],\"label\":[\"validateLabel\"],\"variant\":[\"validateVariant\"],\"outline\":[\"validateOutline\"]}],[2,\"mg-character-left\",{\"identifier\":[1],\"characters\":[1],\"maxlength\":[2]},null,{\"maxlength\":[\"validateMaxlength\"]}],[1,\"mg-popover-content\",{\"closeButton\":[4,\"close-button\"],\"classCollection\":[32]}],[1,\"mg-card\",{\"variant\":[1],\"variantStyle\":[1025,\"variant-style\"],\"classCollection\":[32]},null,{\"variant\":[\"validateVariant\"],\"variantStyle\":[\"validateVariantStyle\"]}],[1,\"mg-button\",{\"variant\":[1],\"identifier\":[1],\"label\":[1],\"type\":[1],\"fullWidth\":[4,\"full-width\"],\"form\":[1],\"disabled\":[1028],\"isIcon\":[4,\"is-icon\"],\"disableOnClick\":[4,\"disable-on-click\"],\"loading\":[32],\"classCollection\":[32]},null,{\"variant\":[\"validateVariant\"],\"fullWidth\":[\"validateFullWidth\"],\"disabled\":[\"disabledHandler\"],\"loading\":[\"loadingHandler\"]}],[1,\"mg-tooltip\",{\"identifier\":[1],\"message\":[1],\"placement\":[1],\"display\":[1028],\"disabled\":[4]},null,{\"identifier\":[\"validateIdentifier\"],\"message\":[\"validateMessage\"],\"display\":[\"handleDisplay\"],\"disabled\":[\"validateDisabled\"]}],[6,\"mg-input-title\",{\"identifier\":[1],\"required\":[4],\"isLegend\":[4,\"is-legend\"],\"tagName\":[32]},null,{\"identifier\":[\"validateIdentifier\"],\"isLegend\":[\"validateIsLegend\"]}],[1,\"mg-tooltip-content\",{\"message\":[1]}],[1,\"mg-icon\",{\"icon\":[1],\"size\":[1],\"variant\":[1],\"variantStyle\":[1025,\"variant-style\"],\"spin\":[4],\"classCollection\":[32]},null,{\"icon\":[\"validateIcon\"],\"size\":[\"validateSize\"],\"variant\":[\"validateVariant\"],\"variantStyle\":[\"validateVariantStyle\"],\"spin\":[\"handleSpin\"]}]]],[\"mg-item-more.cjs\",[[1,\"mg-item-more\",{\"icon\":[16],\"slotlabel\":[16],\"size\":[1],\"parentMenu\":[32]},null,{\"icon\":[\"validateIcon\"],\"slotlabel\":[\"validateSlotLabel\"],\"size\":[\"validateSize\"]}]]]]"), options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
|
@@ -145,6 +145,12 @@ export class MgTooltip {
|
|
|
145
145
|
offset: [0, 8],
|
|
146
146
|
},
|
|
147
147
|
},
|
|
148
|
+
{
|
|
149
|
+
name: 'flip',
|
|
150
|
+
options: {
|
|
151
|
+
fallbackPlacements: ['auto'],
|
|
152
|
+
},
|
|
153
|
+
},
|
|
148
154
|
],
|
|
149
155
|
});
|
|
150
156
|
// Manage tooltipedElement focus/blur events
|
|
@@ -182,6 +188,10 @@ export class MgTooltip {
|
|
|
182
188
|
this.display = false;
|
|
183
189
|
this.disabled = false;
|
|
184
190
|
}
|
|
191
|
+
validateIdentifier() {
|
|
192
|
+
// use renderTooltipContent to update tooltip-content id
|
|
193
|
+
this.renderTooltipContent();
|
|
194
|
+
}
|
|
185
195
|
validateMessage(newValue) {
|
|
186
196
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
187
197
|
throw new Error('<mg-tooltip> prop "message" is required.');
|
|
@@ -207,16 +217,22 @@ export class MgTooltip {
|
|
|
207
217
|
/**
|
|
208
218
|
* Render tooltip content element
|
|
209
219
|
*/
|
|
210
|
-
|
|
211
|
-
const mgTooltipContent =
|
|
212
|
-
mgTooltipContent
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
+
renderTooltipContent() {
|
|
221
|
+
const mgTooltipContent = this.element.querySelector('mg-tooltip-content');
|
|
222
|
+
if (mgTooltipContent === null) {
|
|
223
|
+
const mgTooltipContent = document.createElement('mg-tooltip-content');
|
|
224
|
+
mgTooltipContent.setAttribute('slot', 'content');
|
|
225
|
+
mgTooltipContent.setAttribute('id', this.identifier);
|
|
226
|
+
const arrow = document.createElement('div');
|
|
227
|
+
arrow.setAttribute('slot', 'arrow');
|
|
228
|
+
arrow.dataset.popperArrow = '';
|
|
229
|
+
mgTooltipContent.appendChild(arrow);
|
|
230
|
+
// append tooltip element to component
|
|
231
|
+
this.element.appendChild(mgTooltipContent);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
mgTooltipContent.setAttribute('id', this.identifier);
|
|
235
|
+
}
|
|
220
236
|
}
|
|
221
237
|
/*************
|
|
222
238
|
* Lifecycle *
|
|
@@ -228,11 +244,12 @@ export class MgTooltip {
|
|
|
228
244
|
// Get windows to attach events
|
|
229
245
|
this.windows = getWindows(window);
|
|
230
246
|
// Get tooltip element
|
|
231
|
-
this.
|
|
247
|
+
this.renderTooltipContent();
|
|
232
248
|
this.mgTooltipContent = this.element.querySelector(`#${this.identifier}`);
|
|
233
249
|
//validate properties
|
|
234
250
|
this.validateDisabled(this.disabled);
|
|
235
251
|
this.validateMessage(this.message);
|
|
252
|
+
this.validateIdentifier();
|
|
236
253
|
}
|
|
237
254
|
/**
|
|
238
255
|
* Get slotted element
|
|
@@ -392,6 +409,9 @@ export class MgTooltip {
|
|
|
392
409
|
static get elementRef() { return "element"; }
|
|
393
410
|
static get watchers() {
|
|
394
411
|
return [{
|
|
412
|
+
"propName": "identifier",
|
|
413
|
+
"methodName": "validateIdentifier"
|
|
414
|
+
}, {
|
|
395
415
|
"propName": "message",
|
|
396
416
|
"methodName": "validateMessage"
|
|
397
417
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-tooltip.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-tooltip/mg-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAA8B,YAAY,EAAa,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAC,OAAgB,EAAkC,EAAE,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAE,OAAmB,CAAC,OAAO,CAAC,CAAC;AAOrK,MAAM,OAAO,SAAS;;IAuEpB;;OAEG;IACK,SAAI,GAAG,GAAS,EAAE;MACxB,2BAA2B;MAC3B,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC;MACxC,6BAA6B;MAC7B,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,iCAC7B,OAAO,KACV,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,IAC5E,CAAC,CAAC;MACJ,0BAA0B;MAC1B,gEAAgE;MAChE,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAmB,EAAE,EAAE;UAC3C,WAAW,CAAC,gBAAgB,CA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, Watch } from '@stencil/core';\nimport { createID, focusableElements, getWindows } from '../../../utils/components.utils';\nimport { Instance as PopperInstance, createPopper, Placement } from '@popperjs/core';\nimport { Guard } from './mg-tooltip.conf';\n\n/**\n * HTMLMgButtonElement type guard\n * @param element - element to check\n * @returns return true if type is HTMLMgButtonElement\n */\nconst isButton = (element: unknown): element is HTMLMgButtonElement => typeof element === 'object' && ['MG-BUTTON', 'BUTTON'].includes((element as Element).tagName);\n\n@Component({\n tag: 'mg-tooltip',\n styleUrl: 'mg-tooltip.scss',\n shadow: true,\n})\nexport class MgTooltip {\n /************\n * Internal *\n ************/\n\n private popper: PopperInstance;\n private mgTooltipContent: HTMLMgTooltipContentElement;\n private tooltipedElement: HTMLElement;\n private windows: Window[];\n private hasCustomTabIndex: boolean;\n\n // tooltip actions guards\n private guard: Guard;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgTooltipElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string = createID('mg-tooltip');\n\n /**\n * Displayed message in the tooltip\n */\n @Prop() message!: string;\n @Watch('message')\n validateMessage(newValue: string): void {\n if (typeof newValue !== 'string' || newValue.trim() === '') {\n throw new Error('<mg-tooltip> prop \"message\" is required.');\n }\n this.mgTooltipContent.message = newValue;\n }\n\n /**\n * Tooltip placement\n */\n @Prop() placement: Placement = 'bottom';\n\n /**\n * Display tooltip\n */\n @Prop({ mutable: true }) display = false;\n @Watch('display')\n handleDisplay(newValue: boolean): void {\n if (newValue) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n /**\n * Disable tooltip\n */\n @Prop() disabled = false;\n @Watch('disabled')\n validateDisabled(newValue: MgTooltip['disabled']): void {\n if (this.hasCustomTabIndex) {\n if (newValue) this.tooltipedElement.removeAttribute('tabindex');\n else if (this.tooltipedElement.getAttribute('tabindex') === null) this.tooltipedElement.setAttribute('tabindex', '0');\n }\n }\n\n /**\n * Show tooltip\n */\n private show = (): void => {\n // Make the tooltip visible\n this.mgTooltipContent.dataset.show = '';\n // Enable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }],\n }));\n // hide when click outside\n // setTimeout is used to prevent event to trigger after creation\n setTimeout(() => {\n this.windows.forEach((localWindow: Window) => {\n localWindow.addEventListener('click', this.clickOutside, false);\n localWindow.addEventListener('keydown', this.pressEscape, false);\n });\n }, 0);\n };\n\n /**\n * Hide tooltip\n */\n private hide = (): void => {\n // Hide the tooltip\n this.mgTooltipContent.removeAttribute('data-show');\n // Disable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }],\n }));\n // Remove event listener\n this.windows.forEach((localWindow: Window) => {\n localWindow.removeEventListener('click', this.clickOutside, false);\n localWindow.removeEventListener('keyboard', this.pressEscape, false);\n });\n };\n\n /**\n * Check if clicked outside of component and hidde tooltip\n * @param event - mouse event\n */\n private clickOutside = (event: MouseEvent & { target: HTMLElement }): void => {\n if (event.target.closest('mg-tooltip') !== this.element) this.setDisplay(false);\n };\n\n /**\n * Check if 'Escape' key is pressed of component and hidde tooltip\n * @param event - keyboard event\n */\n private pressEscape = (event: KeyboardEvent): void => {\n if (event.code === 'Escape') {\n this.setDisplay(false);\n this.resetGuard();\n }\n };\n\n /**\n * Method to set display prop\n * @param newValue - display prop new value\n * @param condition - additionnal condition to apply display prop newValue\n */\n private setDisplay = (newValue: boolean, condition = true): void => {\n if (!this.disabled && condition) this.display = newValue;\n };\n\n /**\n * Action for tooltip element and tooltiped element mouse listener\n * @param elementGuard - tooltip element guard\n * @param isMouseenter - mouseenter validation\n * @param conditionalGuard - guard condition\n */\n private tooltipMouseListenerAction = (elementGuard: Guard, isMouseenter: boolean, conditionalGuard: Guard): void => {\n // we mutate elementGuard\n if (this.guard !== Guard.FOCUS) {\n this.guard = elementGuard;\n if (!isMouseenter) {\n setTimeout(() => {\n this.setDisplay(isMouseenter, this.guard !== conditionalGuard);\n this.resetGuard();\n }, 100);\n } else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {\n this.setDisplay(isMouseenter);\n }\n }\n };\n\n /**\n * Method to reset guard value\n */\n private resetGuard = (): void => {\n this.guard = undefined;\n };\n\n /**\n * Update slot content when it is a mg-button\n * @param mgButton - slotted mg-button\n */\n private setMgButtonWrapper = (mgButton: HTMLMgButtonElement): void => {\n if (mgButton.disabled) {\n const div = document.createElement('div');\n div.classList.add('mg-tooltip__mg-button-wrapper');\n mgButton.parentNode.insertBefore(div, mgButton);\n div.appendChild(mgButton);\n this.tooltipedElement = div;\n } else if (mgButton.parentElement.classList.contains('mg-tooltip__mg-button-wrapper')) {\n this.element.firstElementChild.replaceWith(mgButton);\n this.tooltipedElement = mgButton;\n }\n };\n\n /**\n * Init tooltip\n * @param slotElement - slotted element\n * @param interactiveElement - interactive element\n */\n private initTooltip = (slotElement: HTMLElement, interactiveElement: HTMLElement): void => {\n // Add tabindex to slotted element if we can't find any interactive element\n if (!this.disabled && !Boolean(interactiveElement)) {\n this.hasCustomTabIndex = true;\n slotElement.tabIndex = 0;\n // Add role on non-interactive element to work with \"aria-describedby\" for screen readers\n slotElement.setAttribute('role', 'button');\n }\n // Set aria-describedby\n const ariaDescribedby = slotElement.getAttribute('aria-describedby');\n\n if (ariaDescribedby === null) {\n this.tooltipedElement.setAttribute('aria-describedby', this.identifier);\n } else {\n // We ensure to have uniq ids\n slotElement.setAttribute('aria-describedby', `${[...new Set([...ariaDescribedby.split(' '), this.identifier])].join(' ')}`);\n }\n\n // Create popperjs tooltip\n this.popper = createPopper(this.tooltipedElement, this.mgTooltipContent, {\n placement: this.placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 8],\n },\n },\n ],\n });\n\n // Manage tooltipedElement focus/blur events\n this.tooltipedElement.addEventListener('focus', () => {\n this.guard = Guard.FOCUS;\n this.setDisplay(true);\n });\n\n // as `click` event is the composition of `mousedown` and `mouseup` event,\n // and `click` event trigger `focus` event after a success `mousedown` wich set the `guard` to `Guard.FOCUS`\n // we reset the guard on `mouseup` event to unlock tooltip\n this.tooltipedElement.addEventListener('mouseup', () => {\n this.resetGuard();\n });\n\n this.tooltipedElement.addEventListener('blur', () => {\n this.resetGuard();\n this.setDisplay(false);\n });\n\n document.addEventListener('keydown', this.pressEscape);\n\n // manage tooltipElement & tooltipedElement mouseenter/mouseleave events\n ['mouseenter', 'mouseleave'].forEach(eventType => {\n const isMouseenter = eventType === 'mouseenter';\n [\n { element: this.mgTooltipContent, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIPED_ELEMENT) },\n { element: this.tooltipedElement, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIP_ELEMENT) },\n ].forEach(({ element, action }) => {\n element.addEventListener(eventType, () => {\n action();\n });\n });\n });\n };\n\n /**\n * Render tooltip content element\n */\n private renderTooltip(): void {\n const mgTooltipContent = document.createElement('mg-tooltip-content');\n mgTooltipContent.setAttribute('slot', 'content');\n mgTooltipContent.setAttribute('id', this.identifier);\n\n const arrow = document.createElement('div');\n arrow.setAttribute('slot', 'arrow');\n arrow.dataset.popperArrow = '';\n mgTooltipContent.appendChild(arrow);\n\n // append tooltip element to component\n this.element.appendChild(mgTooltipContent);\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * set variables\n */\n componentWillLoad(): void {\n // Get windows to attach events\n this.windows = getWindows(window);\n\n // Get tooltip element\n this.renderTooltip();\n this.mgTooltipContent = this.element.querySelector(`#${this.identifier}`);\n\n //validate properties\n this.validateDisabled(this.disabled);\n this.validateMessage(this.message);\n }\n\n /**\n * Get slotted element\n * Check if it already contain an interactive element, if not we need to add a tabIndex attribute\n * We need to attach the focused element to the tooltip (aria-describedby)\n */\n componentDidLoad(): void {\n // get slotted element wich is not the tooltip\n const slotElement: HTMLElement = this.element.querySelector(`*:not(#${this.identifier})`);\n\n // Get interactive element\n const interactiveElement: HTMLElement = slotElement.matches(focusableElements) ? slotElement : slotElement.shadowRoot?.querySelector(focusableElements);\n\n // define selected element to become tooltip selector\n this.tooltipedElement = interactiveElement || slotElement;\n\n // Check if slotted element is a disabled mg-button\n // In this case we wrap the mg-button into a div to enable the tooltip\n if (isButton(slotElement)) {\n new MutationObserver(mutationList => {\n if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName))) {\n this.setMgButtonWrapper(slotElement);\n // Since Firefox doesn't trigger a \"blur\" event when the \"disabled\" attribute is added or removed from a button\n // we have to manually unlock the guard because the \"blur\" handler of the tooltipedElement won't do it.\n this.resetGuard();\n this.initTooltip(slotElement, interactiveElement);\n }\n }).observe(slotElement, { attributes: true });\n this.setMgButtonWrapper(slotElement);\n }\n\n // Init Tooltip\n this.initTooltip(slotElement, interactiveElement);\n\n this.handleDisplay(this.display);\n }\n\n /**\n * update popper position after props change on component did update hook to benefit from render ended\n */\n componentDidUpdate(): void {\n this.popper.update();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <slot></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mg-tooltip.js","sourceRoot":"","sources":["../../../../src/components/atoms/mg-tooltip/mg-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAA8B,YAAY,EAAa,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C;;;;GAIG;AACH,MAAM,QAAQ,GAAG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1D,mDAAmD;IACnD,sEAAsE;IACtE,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE;MACzB,IAAI,gBAAgB,CAAC,YAAY,CAAC,EAAE;QAClC,IAAI,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAAE;UACjG,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;UACrC,+GAA+G;UAC/G,uGAAuG;UACvG,IAAI,CAAC,UAAU,EAAE,CAAC;UAClB,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;SACnD;MACH,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;MAC9C,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;KACtC;IAED,eAAe;IACf,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;IAElD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;EACnC,CAAC;EAED;;KAEG;EACH,kBAAkB;IAChB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;EACvB,CAAC;EAED;;;KAGG;EACH,MAAM;IACJ,OAAO,CACL,EAAC,IAAI;MACH,eAAa;MACb,YAAM,IAAI,EAAC,SAAS,GAAQ,CACvB,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\nimport { createID, focusableElements, getWindows } from '../../../utils/components.utils';\nimport { Instance as PopperInstance, createPopper, Placement } from '@popperjs/core';\nimport { Guard } from './mg-tooltip.conf';\n\n/**\n * HTMLMgButtonElement type guard\n * @param element - element to check\n * @returns return true if type is HTMLMgButtonElement\n */\nconst isButton = (element: unknown): element is HTMLMgButtonElement => typeof element === 'object' && ['MG-BUTTON', 'BUTTON'].includes((element as Element).tagName);\n\n@Component({\n tag: 'mg-tooltip',\n styleUrl: 'mg-tooltip.scss',\n shadow: true,\n})\nexport class MgTooltip {\n /************\n * Internal *\n ************/\n\n private popper: PopperInstance;\n private mgTooltipContent: HTMLMgTooltipContentElement;\n private tooltipedElement: HTMLElement;\n private windows: Window[];\n private hasCustomTabIndex: boolean;\n\n // tooltip actions guards\n private guard: Guard;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgTooltipElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string = createID('mg-tooltip');\n @Watch('identifier')\n validateIdentifier(): void {\n // use renderTooltipContent to update tooltip-content id\n this.renderTooltipContent();\n }\n\n /**\n * Displayed message in the tooltip\n */\n @Prop() message!: string;\n @Watch('message')\n validateMessage(newValue: string): void {\n if (typeof newValue !== 'string' || newValue.trim() === '') {\n throw new Error('<mg-tooltip> prop \"message\" is required.');\n }\n this.mgTooltipContent.message = newValue;\n }\n\n /**\n * Tooltip placement\n */\n @Prop() placement: Placement = 'bottom';\n\n /**\n * Display tooltip\n */\n @Prop({ mutable: true }) display = false;\n @Watch('display')\n handleDisplay(newValue: boolean): void {\n if (newValue) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n /**\n * Disable tooltip\n */\n @Prop() disabled = false;\n @Watch('disabled')\n validateDisabled(newValue: MgTooltip['disabled']): void {\n if (this.hasCustomTabIndex) {\n if (newValue) this.tooltipedElement.removeAttribute('tabindex');\n else if (this.tooltipedElement.getAttribute('tabindex') === null) this.tooltipedElement.setAttribute('tabindex', '0');\n }\n }\n\n /**\n * Show tooltip\n */\n private show = (): void => {\n // Make the tooltip visible\n this.mgTooltipContent.dataset.show = '';\n // Enable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }],\n }));\n // hide when click outside\n // setTimeout is used to prevent event to trigger after creation\n setTimeout(() => {\n this.windows.forEach((localWindow: Window) => {\n localWindow.addEventListener('click', this.clickOutside, false);\n localWindow.addEventListener('keydown', this.pressEscape, false);\n });\n }, 0);\n };\n\n /**\n * Hide tooltip\n */\n private hide = (): void => {\n // Hide the tooltip\n this.mgTooltipContent.removeAttribute('data-show');\n // Disable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }],\n }));\n // Remove event listener\n this.windows.forEach((localWindow: Window) => {\n localWindow.removeEventListener('click', this.clickOutside, false);\n localWindow.removeEventListener('keyboard', this.pressEscape, false);\n });\n };\n\n /**\n * Check if clicked outside of component and hidde tooltip\n * @param event - mouse event\n */\n private clickOutside = (event: MouseEvent & { target: HTMLElement }): void => {\n if (event.target.closest('mg-tooltip') !== this.element) this.setDisplay(false);\n };\n\n /**\n * Check if 'Escape' key is pressed of component and hidde tooltip\n * @param event - keyboard event\n */\n private pressEscape = (event: KeyboardEvent): void => {\n if (event.code === 'Escape') {\n this.setDisplay(false);\n this.resetGuard();\n }\n };\n\n /**\n * Method to set display prop\n * @param newValue - display prop new value\n * @param condition - additionnal condition to apply display prop newValue\n */\n private setDisplay = (newValue: boolean, condition = true): void => {\n if (!this.disabled && condition) this.display = newValue;\n };\n\n /**\n * Action for tooltip element and tooltiped element mouse listener\n * @param elementGuard - tooltip element guard\n * @param isMouseenter - mouseenter validation\n * @param conditionalGuard - guard condition\n */\n private tooltipMouseListenerAction = (elementGuard: Guard, isMouseenter: boolean, conditionalGuard: Guard): void => {\n // we mutate elementGuard\n if (this.guard !== Guard.FOCUS) {\n this.guard = elementGuard;\n if (!isMouseenter) {\n setTimeout(() => {\n this.setDisplay(isMouseenter, this.guard !== conditionalGuard);\n this.resetGuard();\n }, 100);\n } else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {\n this.setDisplay(isMouseenter);\n }\n }\n };\n\n /**\n * Method to reset guard value\n */\n private resetGuard = (): void => {\n this.guard = undefined;\n };\n\n /**\n * Update slot content when it is a mg-button\n * @param mgButton - slotted mg-button\n */\n private setMgButtonWrapper = (mgButton: HTMLMgButtonElement): void => {\n if (mgButton.disabled) {\n const div = document.createElement('div');\n div.classList.add('mg-tooltip__mg-button-wrapper');\n mgButton.parentNode.insertBefore(div, mgButton);\n div.appendChild(mgButton);\n this.tooltipedElement = div;\n } else if (mgButton.parentElement.classList.contains('mg-tooltip__mg-button-wrapper')) {\n this.element.firstElementChild.replaceWith(mgButton);\n this.tooltipedElement = mgButton;\n }\n };\n\n /**\n * Init tooltip\n * @param slotElement - slotted element\n * @param interactiveElement - interactive element\n */\n private initTooltip = (slotElement: HTMLElement, interactiveElement: HTMLElement): void => {\n // Add tabindex to slotted element if we can't find any interactive element\n if (!this.disabled && !Boolean(interactiveElement)) {\n this.hasCustomTabIndex = true;\n slotElement.tabIndex = 0;\n // Add role on non-interactive element to work with \"aria-describedby\" for screen readers\n slotElement.setAttribute('role', 'button');\n }\n // Set aria-describedby\n const ariaDescribedby = slotElement.getAttribute('aria-describedby');\n\n if (ariaDescribedby === null) {\n this.tooltipedElement.setAttribute('aria-describedby', this.identifier);\n } else {\n // We ensure to have uniq ids\n slotElement.setAttribute('aria-describedby', `${[...new Set([...ariaDescribedby.split(' '), this.identifier])].join(' ')}`);\n }\n\n // Create popperjs tooltip\n this.popper = createPopper(this.tooltipedElement, this.mgTooltipContent, {\n placement: this.placement,\n strategy: 'fixed',\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 8],\n },\n },\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['auto'],\n },\n },\n ],\n });\n\n // Manage tooltipedElement focus/blur events\n this.tooltipedElement.addEventListener('focus', () => {\n this.guard = Guard.FOCUS;\n this.setDisplay(true);\n });\n\n // as `click` event is the composition of `mousedown` and `mouseup` event,\n // and `click` event trigger `focus` event after a success `mousedown` wich set the `guard` to `Guard.FOCUS`\n // we reset the guard on `mouseup` event to unlock tooltip\n this.tooltipedElement.addEventListener('mouseup', () => {\n this.resetGuard();\n });\n\n this.tooltipedElement.addEventListener('blur', () => {\n this.resetGuard();\n this.setDisplay(false);\n });\n\n document.addEventListener('keydown', this.pressEscape);\n\n // manage tooltipElement & tooltipedElement mouseenter/mouseleave events\n ['mouseenter', 'mouseleave'].forEach(eventType => {\n const isMouseenter = eventType === 'mouseenter';\n [\n { element: this.mgTooltipContent, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIPED_ELEMENT) },\n { element: this.tooltipedElement, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIP_ELEMENT) },\n ].forEach(({ element, action }) => {\n element.addEventListener(eventType, () => {\n action();\n });\n });\n });\n };\n\n /**\n * Render tooltip content element\n */\n private renderTooltipContent(): void {\n const mgTooltipContent = this.element.querySelector('mg-tooltip-content');\n if (mgTooltipContent === null) {\n const mgTooltipContent = document.createElement('mg-tooltip-content');\n mgTooltipContent.setAttribute('slot', 'content');\n mgTooltipContent.setAttribute('id', this.identifier);\n\n const arrow = document.createElement('div');\n arrow.setAttribute('slot', 'arrow');\n arrow.dataset.popperArrow = '';\n mgTooltipContent.appendChild(arrow);\n\n // append tooltip element to component\n this.element.appendChild(mgTooltipContent);\n } else {\n mgTooltipContent.setAttribute('id', this.identifier);\n }\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * set variables\n */\n componentWillLoad(): void {\n // Get windows to attach events\n this.windows = getWindows(window);\n\n // Get tooltip element\n this.renderTooltipContent();\n this.mgTooltipContent = this.element.querySelector(`#${this.identifier}`);\n\n //validate properties\n this.validateDisabled(this.disabled);\n this.validateMessage(this.message);\n this.validateIdentifier();\n }\n\n /**\n * Get slotted element\n * Check if it already contain an interactive element, if not we need to add a tabIndex attribute\n * We need to attach the focused element to the tooltip (aria-describedby)\n */\n componentDidLoad(): void {\n // get slotted element wich is not the tooltip\n const slotElement: HTMLElement = this.element.querySelector(`*:not(#${this.identifier})`);\n\n // Get interactive element\n const interactiveElement: HTMLElement = slotElement.matches(focusableElements) ? slotElement : slotElement.shadowRoot?.querySelector(focusableElements);\n\n // define selected element to become tooltip selector\n this.tooltipedElement = interactiveElement || slotElement;\n\n // Check if slotted element is a disabled mg-button\n // In this case we wrap the mg-button into a div to enable the tooltip\n if (isButton(slotElement)) {\n new MutationObserver(mutationList => {\n if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName))) {\n this.setMgButtonWrapper(slotElement);\n // Since Firefox doesn't trigger a \"blur\" event when the \"disabled\" attribute is added or removed from a button\n // we have to manually unlock the guard because the \"blur\" handler of the tooltipedElement won't do it.\n this.resetGuard();\n this.initTooltip(slotElement, interactiveElement);\n }\n }).observe(slotElement, { attributes: true });\n this.setMgButtonWrapper(slotElement);\n }\n\n // Init Tooltip\n this.initTooltip(slotElement, interactiveElement);\n\n this.handleDisplay(this.display);\n }\n\n /**\n * update popper position after props change on component did update hook to benefit from render ended\n */\n componentDidUpdate(): void {\n this.popper.update();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <slot></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -107,6 +107,12 @@ describe('mg-tooltip', () => {
|
|
|
107
107
|
screenshot = await page.screenshot();
|
|
108
108
|
expect(screenshot).toMatchImageSnapshot();
|
|
109
109
|
});
|
|
110
|
+
test(`should position tooltip where it have enough place`, async () => {
|
|
111
|
+
const page = await createPage(`<style>mg-icon{position:fixed;left:0;bottom:0}</style>
|
|
112
|
+
<mg-tooltip message="Batman tooltip" display><mg-icon icon="user"></mg-icon></mg-tooltip>`, { width: 400, height: 100 });
|
|
113
|
+
const screenshot = await page.screenshot();
|
|
114
|
+
expect(screenshot).toMatchImageSnapshot();
|
|
115
|
+
});
|
|
110
116
|
test('Should display long tooltip with max width', async () => {
|
|
111
117
|
const page = await createPage('<mg-tooltip identifier="identifier" message="my very long content should return to line because of the max-width set to 400px in the design specification"><mg-icon icon="user"></mg-icon></mg-tooltip>');
|
|
112
118
|
const tooltipedElement = await page.find('mg-icon');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-tooltip.e2e.js","sourceRoot":"","sources":["../../../../../src/components/atoms/mg-tooltip/test/mg-tooltip.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,MAAM,KAAK,GAAG,wFAAwF,CAAC;AAEvG,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,QAAQ,CAAC,IAAI,CAAC;IACZ,MAAM;IACN,YAAY;IACZ,UAAU;IACV,KAAK;IACL,WAAW;IACX,SAAS;IACT,QAAQ;IACR,cAAc;IACd,YAAY;IACZ,OAAO;IACP,aAAa;IACb,WAAW;IACX,MAAM;IACN,YAAY;IACZ,UAAU;GACX,CAAC,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE;IAC7B,IAAI,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;MAC/B,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,GAAG,KAAK,8DAA8D,SAAS,uDAAuD,CAAC,CAAC;MAEtK,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;MAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;MAC1C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;MAEtD,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;MAE1C,MAAM,CA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AE;IACvE,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,GAAG,KAAK,kHAAkH,CAAC,CAAC;IAE1J,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAEpD,IAAI,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IACzC,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,EAAE,CAAC;IAE1C,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,SAA+B,EAAE,EAAE;MACjE,SAAS,CAAC,OAAO,GAAG,8GAA8G,CAAC;IACrI,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IACrC,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\nconst style = '<style>mg-icon{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}</style>';\n\ndescribe('mg-tooltip', () => {\n describe.each([\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'top-start',\n 'top-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'right',\n 'right-start',\n 'right-end',\n 'left',\n 'left-start',\n 'left-end',\n ])('placement %s', placement => {\n test('Should render', async () => {\n const page = await createPage(`${style}<mg-tooltip message=\"this is a tooltip message\" placement=\"${placement}\"><mg-icon icon=\"info-circle\"></mg-icon></mg-tooltip>`);\n\n const mgTooltip = await page.find('mg-tooltip');\n const mgIcon = await page.find('mg-icon');\n const tooltip = await page.find('mg-tooltip-content');\n\n expect(mgTooltip).toHaveClass('hydrated');\n\n mgIcon.triggerEvent('focus');\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n await page.setViewport({ width: 400, height: 400 });\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n mgIcon.triggerEvent('blur');\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n\n mgIcon.triggerEvent('mouseenter');\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n mgIcon.triggerEvent('mouseleave');\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n });\n\n describe.each([\n '<mg-tooltip message=\"my tooltip coucou\"><span>coucou</span></mg-tooltip>',\n `<mg-tooltip message=\"this is a tooltip message\"><mg-icon icon=\"info-circle\"></mg-icon></mg-tooltip>`,\n '<mg-tooltip message=\"my tooltip mg-button\"><mg-button>mg-button</mg-button></mg-tooltip>',\n '<mg-tooltip message=\"my tooltip native button\"><button class=\"mg-button mg-button--primary\" aria-describedby=\"blu\">native button</button></mg-tooltip>',\n ])('Keyboard navigation with template', template => {\n test.each(['Space', 'Enter'])('Should NOT navigate with keyboard, case key %s', async key => {\n const page = await createPage(template);\n\n const mgTooltip = await page.find('mg-tooltip');\n const tooltip = await page.find('mg-tooltip-content');\n\n expect(mgTooltip).toHaveClass('hydrated');\n\n await page.keyboard.down('Tab');\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n await page.keyboard.down(key as never);\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n });\n\n test('Should navigate with keyboard, case key \"Escape\"', async () => {\n const page = await createPage(template);\n\n const mgTooltip = await page.find('mg-tooltip');\n const tooltip = await page.find('mg-tooltip-content');\n\n expect(mgTooltip).toHaveClass('hydrated');\n\n await page.keyboard.down('Tab');\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n await page.keyboard.down('Escape');\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n });\n\n test('Should keep tooltip displaied when hover with mouse after focus event', async () => {\n const page = await createPage('<mg-tooltip identifier=\"identifier\" message=\"Batman tooltip\"><mg-icon icon=\"user\"></mg-icon></mg-tooltip>');\n\n const tooltipedElement = await page.find('mg-icon');\n const tooltipElement = await page.find('mg-tooltip-content');\n\n // 1. take focus on tooltipedElement and display tooltip\n tooltipedElement.triggerEvent('focus');\n await page.waitForChanges();\n\n expect(tooltipElement).toHaveAttribute('data-show');\n\n // 2. mouseenter on tooltipedElement and tooltip stay displaied\n tooltipedElement.triggerEvent('mouseenter');\n await page.waitForChanges();\n\n expect(tooltipElement).toHaveAttribute('data-show');\n\n // 3. mouseleave on tooltipedElement and tooltip stay displaied\n tooltipedElement.triggerEvent('mouseleave');\n await page.waitForChanges();\n\n expect(tooltipElement).toHaveAttribute('data-show');\n\n // 4. presse tab key and tooltip is hidden\n tooltipedElement.triggerEvent('blur');\n await page.waitForChanges();\n\n expect(tooltipElement).not.toHaveAttribute('data-show');\n });\n\n test('Should keep tooltip arrow when update message', async () => {\n const page = await createPage('<mg-tooltip message=\"Batman tooltip\"><mg-icon icon=\"user\"></mg-icon></mg-tooltip>');\n\n await page.keyboard.down('Tab');\n await page.waitForChanges();\n\n await page.setViewport({ width: 400, height: 100 });\n\n let screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n await page.$eval('mg-tooltip', elm => {\n (elm as HTMLMgTooltipElement).message = 'Joker is here';\n });\n await page.waitForChanges();\n\n screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n test('Should display long tooltip with max width', async () => {\n const page = await createPage(\n '<mg-tooltip identifier=\"identifier\" message=\"my very long content should return to line because of the max-width set to 400px in the design specification\"><mg-icon icon=\"user\"></mg-icon></mg-tooltip>',\n );\n\n const tooltipedElement = await page.find('mg-icon');\n\n await page.setViewport({ width: 500, height: 100 });\n\n tooltipedElement.triggerEvent('focus');\n await page.waitForChanges();\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n test('Should keep tooltip center when update \"message\" prop', async () => {\n const page = await createPage(`${style}<mg-tooltip identifier=\"identifier\" message=\"short tooltip\" display><mg-icon icon=\"user\"></mg-icon></mg-tooltip>`);\n\n await page.setViewport({ width: 400, height: 400 });\n\n let screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n await page.$eval('mg-tooltip', (mgTooltip: HTMLMgTooltipElement) => {\n mgTooltip.message = 'my very long content should return to line because of the max-width set to 400px in the design specification';\n });\n\n await page.waitForChanges();\n\n screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"mg-tooltip.e2e.js","sourceRoot":"","sources":["../../../../../src/components/atoms/mg-tooltip/test/mg-tooltip.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,MAAM,KAAK,GAAG,wFAAwF,CAAC;AAEvG,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,QAAQ,CAAC,IAAI,CAAC;IACZ,MAAM;IACN,YAAY;IACZ,UAAU;IACV,KAAK;IACL,WAAW;IACX,SAAS;IACT,QAAQ;IACR,cAAc;IACd,YAAY;IACZ,OAAO;IACP,aAAa;IACb,WAAW;IACX,MAAM;IACN,YAAY;IACZ,UAAU;GACX,CAAC,CAAC,cAAc,EAAE,SAAS,CAAC,EAAE;IAC7B,IAAI,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;MAC/B,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,GAAG,KAAK,8DAA8D,SAAS,uDAAuD,CAAC,CAAC;MAEtK,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;MAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;MAC1C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;MAEtD,MAAM,CAAC,S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,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAEpD,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3C,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,EAAE,CAAC;EAC5C,CAAC,CAAC,CAAC;EAEH,IAAI,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;IACvE,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,GAAG,KAAK,kHAAkH,CAAC,CAAC;IAE1J,MAAM,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;IAEpD,IAAI,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IACzC,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,EAAE,CAAC;IAE1C,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,SAA+B,EAAE,EAAE;MACjE,SAAS,CAAC,OAAO,GAAG,8GAA8G,CAAC;IACrI,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;IACrC,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\nconst style = '<style>mg-icon{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%)}</style>';\n\ndescribe('mg-tooltip', () => {\n describe.each([\n 'auto',\n 'auto-start',\n 'auto-end',\n 'top',\n 'top-start',\n 'top-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'right',\n 'right-start',\n 'right-end',\n 'left',\n 'left-start',\n 'left-end',\n ])('placement %s', placement => {\n test('Should render', async () => {\n const page = await createPage(`${style}<mg-tooltip message=\"this is a tooltip message\" placement=\"${placement}\"><mg-icon icon=\"info-circle\"></mg-icon></mg-tooltip>`);\n\n const mgTooltip = await page.find('mg-tooltip');\n const mgIcon = await page.find('mg-icon');\n const tooltip = await page.find('mg-tooltip-content');\n\n expect(mgTooltip).toHaveClass('hydrated');\n\n mgIcon.triggerEvent('focus');\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n await page.setViewport({ width: 400, height: 400 });\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n mgIcon.triggerEvent('blur');\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n\n mgIcon.triggerEvent('mouseenter');\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n mgIcon.triggerEvent('mouseleave');\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n });\n\n describe.each([\n '<mg-tooltip message=\"my tooltip coucou\"><span>coucou</span></mg-tooltip>',\n `<mg-tooltip message=\"this is a tooltip message\"><mg-icon icon=\"info-circle\"></mg-icon></mg-tooltip>`,\n '<mg-tooltip message=\"my tooltip mg-button\"><mg-button>mg-button</mg-button></mg-tooltip>',\n '<mg-tooltip message=\"my tooltip native button\"><button class=\"mg-button mg-button--primary\" aria-describedby=\"blu\">native button</button></mg-tooltip>',\n ])('Keyboard navigation with template', template => {\n test.each(['Space', 'Enter'])('Should NOT navigate with keyboard, case key %s', async key => {\n const page = await createPage(template);\n\n const mgTooltip = await page.find('mg-tooltip');\n const tooltip = await page.find('mg-tooltip-content');\n\n expect(mgTooltip).toHaveClass('hydrated');\n\n await page.keyboard.down('Tab');\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n await page.keyboard.down(key as never);\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n });\n\n test('Should navigate with keyboard, case key \"Escape\"', async () => {\n const page = await createPage(template);\n\n const mgTooltip = await page.find('mg-tooltip');\n const tooltip = await page.find('mg-tooltip-content');\n\n expect(mgTooltip).toHaveClass('hydrated');\n\n await page.keyboard.down('Tab');\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n await page.keyboard.down('Escape');\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n });\n\n test('Should keep tooltip displaied when hover with mouse after focus event', async () => {\n const page = await createPage('<mg-tooltip identifier=\"identifier\" message=\"Batman tooltip\"><mg-icon icon=\"user\"></mg-icon></mg-tooltip>');\n\n const tooltipedElement = await page.find('mg-icon');\n const tooltipElement = await page.find('mg-tooltip-content');\n\n // 1. take focus on tooltipedElement and display tooltip\n tooltipedElement.triggerEvent('focus');\n await page.waitForChanges();\n\n expect(tooltipElement).toHaveAttribute('data-show');\n\n // 2. mouseenter on tooltipedElement and tooltip stay displaied\n tooltipedElement.triggerEvent('mouseenter');\n await page.waitForChanges();\n\n expect(tooltipElement).toHaveAttribute('data-show');\n\n // 3. mouseleave on tooltipedElement and tooltip stay displaied\n tooltipedElement.triggerEvent('mouseleave');\n await page.waitForChanges();\n\n expect(tooltipElement).toHaveAttribute('data-show');\n\n // 4. presse tab key and tooltip is hidden\n tooltipedElement.triggerEvent('blur');\n await page.waitForChanges();\n\n expect(tooltipElement).not.toHaveAttribute('data-show');\n });\n\n test('Should keep tooltip arrow when update message', async () => {\n const page = await createPage('<mg-tooltip message=\"Batman tooltip\"><mg-icon icon=\"user\"></mg-icon></mg-tooltip>');\n\n await page.keyboard.down('Tab');\n await page.waitForChanges();\n\n await page.setViewport({ width: 400, height: 100 });\n\n let screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n await page.$eval('mg-tooltip', elm => {\n (elm as HTMLMgTooltipElement).message = 'Joker is here';\n });\n await page.waitForChanges();\n\n screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n test(`should position tooltip where it have enough place`, async () => {\n const page = await createPage(\n `<style>mg-icon{position:fixed;left:0;bottom:0}</style>\n <mg-tooltip message=\"Batman tooltip\" display><mg-icon icon=\"user\"></mg-icon></mg-tooltip>`,\n { width: 400, height: 100 },\n );\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n test('Should display long tooltip with max width', async () => {\n const page = await createPage(\n '<mg-tooltip identifier=\"identifier\" message=\"my very long content should return to line because of the max-width set to 400px in the design specification\"><mg-icon icon=\"user\"></mg-icon></mg-tooltip>',\n );\n\n const tooltipedElement = await page.find('mg-icon');\n\n await page.setViewport({ width: 500, height: 100 });\n\n tooltipedElement.triggerEvent('focus');\n await page.waitForChanges();\n\n const screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n\n test('Should keep tooltip center when update \"message\" prop', async () => {\n const page = await createPage(`${style}<mg-tooltip identifier=\"identifier\" message=\"short tooltip\" display><mg-icon icon=\"user\"></mg-icon></mg-tooltip>`);\n\n await page.setViewport({ width: 400, height: 400 });\n\n let screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n\n await page.$eval('mg-tooltip', (mgTooltip: HTMLMgTooltipElement) => {\n mgTooltip.message = 'my very long content should return to line because of the max-width set to 400px in the design specification';\n });\n\n await page.waitForChanges();\n\n screenshot = await page.screenshot();\n expect(screenshot).toMatchImageSnapshot();\n });\n});\n"]}
|
|
@@ -260,5 +260,13 @@ describe('mg-tooltip', () => {
|
|
|
260
260
|
await page.waitForChanges();
|
|
261
261
|
expect(spy).toHaveBeenCalled();
|
|
262
262
|
});
|
|
263
|
+
test('should update mg-popover-content id when "identifier" is updated', async () => {
|
|
264
|
+
const page = await getPage({ identifier: 'identifier', message: 'My tooltip message' }, h("mg-button", { identifier: "identifier", disabled: true }, "mg-button.disabled"));
|
|
265
|
+
expect(page.root).toMatchSnapshot();
|
|
266
|
+
const mgTooltip = page.doc.querySelector('mg-tooltip');
|
|
267
|
+
mgTooltip.identifier = 'new-identifier';
|
|
268
|
+
await page.waitForChanges();
|
|
269
|
+
expect(page.root).toMatchSnapshot();
|
|
270
|
+
});
|
|
263
271
|
});
|
|
264
272
|
//# sourceMappingURL=mg-tooltip.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-tooltip.spec.js","sourceRoot":"","sources":["../../../../../src/components/atoms/mg-tooltip/test/mg-tooltip.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,gBAAgB,EAAE,CAAC;AACnB,gBAAgB,EAAE,CAAC;AAEnB,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAChC,WAAW,CAAC;EACV,UAAU,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC;EAC3D,QAAQ,EAAE,GAAG,EAAE,CAAC,kCAAgB,IAAI,GAAG,OAAO,CAAc;CAC7D,CAAC,CAAC;AAEL,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,IAAI,MAAM,CAAC;EAEX,UAAU,CAAC,GAAG,EAAE;IACd,IAAI,CAAC,aAAa,EAAE,CAAC;IACrB,yBAAyB,CAAC;MACxB,OAAO,EAAE;QACP,MAAM,GAAG,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AAC,aAAa,CAAC,SAAS,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAA4C,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1F,QAAQ,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC1B,MAAM,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACpF,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;EACtC,CAAC,CAAC,CAAC;EAEH,IAAI,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;IAC1E,MAAM,IAAI,GAAG,MAAM,OAAO,CACxB,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAC3D,iBAAW,UAAU,EAAC,YAAY,EAAC,QAAQ,+BAE/B,CACb,CAAC;IAEF,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IACvD,SAAS,CAAC,OAAO,GAAG,gBAAgB,CAAC;IAErC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,CAAC;EACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgTooltip } from '../mg-tooltip';\nimport { MgButton } from '../../mg-button/mg-button';\nimport { MgIcon } from '../../mg-icon/mg-icon';\nimport { setupMutationObserverMock, mockWindowFrames, mockConsoleError } from '../../../../utils/unit.test.utils';\nimport { MgTooltipContent } from '../mg-tooltip-content/mg-tooltip-content';\n\nmockWindowFrames();\nmockConsoleError();\n\nconst getPage = (args, element) =>\n newSpecPage({\n components: [MgTooltip, MgTooltipContent, MgButton, MgIcon],\n template: () => <mg-tooltip {...args}>{element}</mg-tooltip>,\n });\n\ndescribe('mg-tooltip', () => {\n let fireMo;\n\n beforeEach(() => {\n jest.useFakeTimers();\n setupMutationObserverMock({\n observe: function () {\n fireMo = this.cb;\n },\n disconnect: function () {\n return null;\n },\n takeRecords: () => [],\n });\n });\n\n afterEach(() => jest.runOnlyPendingTimers());\n\n describe.each([\n () => <span>span</span>,\n () => <button aria-describedby=\"blu\">button</button>,\n () => <mg-icon icon=\"check-circle\"></mg-icon>,\n () => <mg-button identifier=\"identifier\">mg-button</mg-button>,\n () => (\n <mg-button identifier=\"identifier\" disabled>\n mg-button.disabled\n </mg-button>\n ),\n ])('render', element => {\n test.each([true, false])('Should render with tooltip', async disabled => {\n const page = await getPage({ identifier: 'identifier', message: 'My tooltip message', disabled }, element());\n expect(page.root).toMatchSnapshot();\n\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n mgTooltip.disabled = !disabled;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n mgTooltip.disabled = disabled;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n });\n\n test('Should render with element with given placement', async () => {\n const args = { identifier: 'identifier', message: 'My tooltip message', placement: 'auto' };\n const { root } = await getPage(args, <span>span</span>);\n expect(root).toMatchSnapshot();\n });\n\n test.each(['', ' ', undefined])('Should throw error, case invalid message prop', async message => {\n expect.assertions(1);\n try {\n await getPage({ message }, <span>span</span>);\n } catch (err) {\n expect(err.message).toContain('<mg-tooltip> prop \"message\" is required.');\n }\n });\n\n describe.each([\n { eventIn: 'mouseenter', eventOut: 'mouseleave' },\n { eventIn: 'focus', eventOut: 'blur' },\n { eventIn: 'mouseenter', eventOut: 'clickDocument' },\n ])('Should manage display on events enter with %s, leave with %s', ({ eventIn, eventOut }) => {\n test.each([\n <span>span</span>,\n <button aria-describedby=\"blu\">button</button>,\n <mg-icon icon=\"check-circle\"></mg-icon>,\n <mg-button identifier=\"identifier-mg-button\">mg-button</mg-button>,\n ])('element', async element => {\n const args = { identifier: 'identifier', message: 'blu' };\n const page = await getPage(args, element);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const linkedTooltipElement = mgTooltip.querySelector(`[aria-describedby*='${args.identifier}']`);\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n\n linkedTooltipElement.dispatchEvent(new CustomEvent(eventIn, { bubbles: true }));\n\n // flush windows addEventListener timeout\n jest.runOnlyPendingTimers();\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n expect(tooltip).toHaveAttribute('data-show');\n\n if (eventOut !== 'clickDocument') linkedTooltipElement.dispatchEvent(new CustomEvent(eventOut, { bubbles: true }));\n else page.doc.dispatchEvent(new Event('click', { bubbles: true }));\n\n if (eventOut !== 'blur') jest.runOnlyPendingTimers();\n\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n\n test.each([false, true])('should not call event methods when disabled and display:%s', async display => {\n const args = { identifier: 'identifier', message: 'blu', disabled: true, display };\n const page = await getPage(args, <span>span</span>);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const linkedTooltipElement = mgTooltip.querySelector(`[aria-describedby*='${args.identifier}']`);\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n\n [eventIn, eventOut].forEach(async event => {\n linkedTooltipElement.dispatchEvent(new CustomEvent(event, { bubbles: true }));\n await page.waitForChanges();\n if (display) {\n expect(tooltip).toHaveAttribute('data-show');\n } else {\n expect(tooltip).not.toHaveAttribute('data-show');\n }\n });\n });\n });\n\n test.each([\n <span>span</span>,\n <button aria-describedby=\"blu\">button</button>,\n <mg-icon icon=\"check-circle\"></mg-icon>,\n <mg-button identifier=\"identifier-mg-button\">mg-button</mg-button>,\n ])('should manage cross mouse and keyboard navigation', async element => {\n const args = { identifier: 'identifier', message: 'blu' };\n const page = await getPage(args, element);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const linkedTooltipElement = mgTooltip.querySelector(`[aria-describedby*='${args.identifier}']`);\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n\n linkedTooltipElement.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n expect(tooltip).toHaveAttribute('data-show');\n\n page.doc.dispatchEvent(new KeyboardEvent('keydown', { code: 'Escape' }));\n await page.waitForChanges();\n expect(tooltip).not.toHaveAttribute('data-show');\n\n linkedTooltipElement.dispatchEvent(new CustomEvent('mouseenter', { bubbles: true }));\n await page.waitForChanges();\n expect(tooltip).toHaveAttribute('data-show');\n\n linkedTooltipElement.dispatchEvent(new CustomEvent('mouseleave', { bubbles: true }));\n // flush windows addEventListener timeout\n jest.runOnlyPendingTimers();\n\n await page.waitForChanges();\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n\n test.each([true, false])('Should toogle tooltip from prop display, case display %s', async display => {\n const args = { identifier: 'identifier', message: 'batman', display };\n const page = await getPage(args, <span>batman</span>);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n\n expect(page.root).toMatchSnapshot();\n if (display) {\n expect(tooltip).toHaveAttribute('data-show');\n } else {\n expect(tooltip).not.toHaveAttribute('data-show');\n }\n\n page.rootInstance.display = !display;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n if (display) {\n expect(tooltip).not.toHaveAttribute('data-show');\n } else {\n expect(tooltip).toHaveAttribute('data-show');\n }\n });\n\n describe('hide method', () => {\n test.each(['Tab', 'Space', 'Enter', 'i'])('should prevent keyboardEvent, case not \"Escape\" code', async code => {\n const args = { identifier: 'identifier', message: 'batman' };\n const page = await getPage(args, <span id=\"batman\">batman</span>);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n const element = page.doc.getElementById('batman');\n\n element.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n page.doc.dispatchEvent(new KeyboardEvent('keydown', { code }));\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n });\n\n test('should hide tooltip with keyboardEvent, case \"Escape\" code', async () => {\n const args = { identifier: 'identifier', message: 'batman' };\n const page = await getPage(args, <span id=\"batman\">batman</span>);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n const element = page.doc.getElementById('batman');\n\n element.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n page.doc.dispatchEvent(new KeyboardEvent('keydown', { code: 'Escape' }));\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n });\n\n test('Should keep displayed tooltip when hover it', async () => {\n const element = <span>span</span>;\n const eventIn = 'mouseenter';\n const eventOut = 'mouseleave';\n const args = { identifier: 'identifier', message: 'blu' };\n const page = await getPage(args, element);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const linkedTooltipElement = mgTooltip.querySelector(`[aria-describedby*='${args.identifier}']`);\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n\n // 1. hover tooltipedElement and display tooltip\n linkedTooltipElement.dispatchEvent(new CustomEvent(eventIn, { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n expect(tooltip).toHaveAttribute('data-show');\n\n // 2.1 leave tooltipedElement and tooltip stay displayed\n linkedTooltipElement.dispatchEvent(new CustomEvent(eventOut, { bubbles: true }));\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n // 2.2 hover on tooltipedElement and tooltip stay displayed\n tooltip.dispatchEvent(new CustomEvent(eventIn, { bubbles: true }));\n await page.waitForChanges();\n\n // 2.3 flush promise to keep tooltip display thanks to guard\n jest.advanceTimersByTime(200);\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n // 3 leave tooltipElement\n tooltip.dispatchEvent(new CustomEvent(eventOut, { bubbles: true }));\n await page.waitForChanges();\n\n // 3.2 flush promise to pass tooltip guard and hide it\n jest.advanceTimersByTime(200);\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n\n test('Should prevent focus guard whith click event', async () => {\n const args = { identifier: 'identifier', message: 'batman' };\n const page = await getPage(args, <mg-button>batman</mg-button>);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n const element = page.doc.querySelector('mg-button');\n\n element.dispatchEvent(new MouseEvent('mouseenter', { bubbles: true }));\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n // recompose a click event as click event is not properly mock by jest `mousedown` + `focus` + `mouseup`\n for (const event of ['mousedown', 'focus', 'mouseup']) {\n const Constructor = event === 'focus' ? FocusEvent : MouseEvent;\n element.dispatchEvent(new Constructor(event, { bubbles: true }));\n await page.waitForChanges();\n }\n\n expect(tooltip).toHaveAttribute('data-show');\n\n element.dispatchEvent(new MouseEvent('mouseleave', { bubbles: true }));\n await page.waitForChanges();\n jest.runOnlyPendingTimers();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n\n test.each(['button', 'mg-button'])('Should update %s wrapper dynamically', async TagName => {\n const page = await getPage(\n { identifier: 'identifier', message: 'My tooltip message' },\n <TagName identifier=\"identifier\" disabled>\n {TagName}.disabled\n </TagName>,\n );\n\n expect(page.root).toMatchSnapshot();\n\n // Mock replaceWith\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n mgTooltip.firstElementChild.replaceWith = jest.fn(element => {\n mgTooltip.innerHTML = (element as Node).parentElement.innerHTML;\n });\n\n const mgButton: HTMLButtonElement | HTMLMgButtonElement = page.doc.querySelector(TagName);\n mgButton.disabled = false;\n fireMo([{ attributeName: TagName === 'MG-BUTTON' ? 'aria-disabled' : 'disabled' }]);\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test('Should update popper instance when \"message\" prop change', async () => {\n const page = await getPage(\n { identifier: 'identifier', message: 'My tooltip message' },\n <mg-button identifier=\"identifier\" disabled>\n mg-button.disabled\n </mg-button>,\n );\n\n const spy = jest.spyOn(page.rootInstance.popper, 'update');\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n mgTooltip.message = 'my new message';\n\n await page.waitForChanges();\n\n expect(spy).toHaveBeenCalled();\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"mg-tooltip.spec.js","sourceRoot":"","sources":["../../../../../src/components/atoms/mg-tooltip/test/mg-tooltip.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAClH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAE5E,gBAAgB,EAAE,CAAC;AACnB,gBAAgB,EAAE,CAAC;AAEnB,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAChC,WAAW,CAAC;EACV,UAAU,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC;EAC3D,QAAQ,EAAE,GAAG,EAAE,CAAC,kCAAgB,IAAI,GAAG,OAAO,CAAc;CAC7D,CAAC,CAAC;AAEL,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;EAC1B,IAA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O,CACxB,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAC3D,iBAAW,UAAU,EAAC,YAAY,EAAC,QAAQ,+BAE/B,CACb,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IACvD,SAAS,CAAC,UAAU,GAAG,gBAAgB,CAAC;IAExC,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 { MgTooltip } from '../mg-tooltip';\nimport { MgButton } from '../../mg-button/mg-button';\nimport { MgIcon } from '../../mg-icon/mg-icon';\nimport { setupMutationObserverMock, mockWindowFrames, mockConsoleError } from '../../../../utils/unit.test.utils';\nimport { MgTooltipContent } from '../mg-tooltip-content/mg-tooltip-content';\n\nmockWindowFrames();\nmockConsoleError();\n\nconst getPage = (args, element) =>\n newSpecPage({\n components: [MgTooltip, MgTooltipContent, MgButton, MgIcon],\n template: () => <mg-tooltip {...args}>{element}</mg-tooltip>,\n });\n\ndescribe('mg-tooltip', () => {\n let fireMo;\n\n beforeEach(() => {\n jest.useFakeTimers();\n setupMutationObserverMock({\n observe: function () {\n fireMo = this.cb;\n },\n disconnect: function () {\n return null;\n },\n takeRecords: () => [],\n });\n });\n\n afterEach(() => jest.runOnlyPendingTimers());\n\n describe.each([\n () => <span>span</span>,\n () => <button aria-describedby=\"blu\">button</button>,\n () => <mg-icon icon=\"check-circle\"></mg-icon>,\n () => <mg-button identifier=\"identifier\">mg-button</mg-button>,\n () => (\n <mg-button identifier=\"identifier\" disabled>\n mg-button.disabled\n </mg-button>\n ),\n ])('render', element => {\n test.each([true, false])('Should render with tooltip', async disabled => {\n const page = await getPage({ identifier: 'identifier', message: 'My tooltip message', disabled }, element());\n expect(page.root).toMatchSnapshot();\n\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n mgTooltip.disabled = !disabled;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n mgTooltip.disabled = disabled;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n });\n\n test('Should render with element with given placement', async () => {\n const args = { identifier: 'identifier', message: 'My tooltip message', placement: 'auto' };\n const { root } = await getPage(args, <span>span</span>);\n expect(root).toMatchSnapshot();\n });\n\n test.each(['', ' ', undefined])('Should throw error, case invalid message prop', async message => {\n expect.assertions(1);\n try {\n await getPage({ message }, <span>span</span>);\n } catch (err) {\n expect(err.message).toContain('<mg-tooltip> prop \"message\" is required.');\n }\n });\n\n describe.each([\n { eventIn: 'mouseenter', eventOut: 'mouseleave' },\n { eventIn: 'focus', eventOut: 'blur' },\n { eventIn: 'mouseenter', eventOut: 'clickDocument' },\n ])('Should manage display on events enter with %s, leave with %s', ({ eventIn, eventOut }) => {\n test.each([\n <span>span</span>,\n <button aria-describedby=\"blu\">button</button>,\n <mg-icon icon=\"check-circle\"></mg-icon>,\n <mg-button identifier=\"identifier-mg-button\">mg-button</mg-button>,\n ])('element', async element => {\n const args = { identifier: 'identifier', message: 'blu' };\n const page = await getPage(args, element);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const linkedTooltipElement = mgTooltip.querySelector(`[aria-describedby*='${args.identifier}']`);\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n\n linkedTooltipElement.dispatchEvent(new CustomEvent(eventIn, { bubbles: true }));\n\n // flush windows addEventListener timeout\n jest.runOnlyPendingTimers();\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n expect(tooltip).toHaveAttribute('data-show');\n\n if (eventOut !== 'clickDocument') linkedTooltipElement.dispatchEvent(new CustomEvent(eventOut, { bubbles: true }));\n else page.doc.dispatchEvent(new Event('click', { bubbles: true }));\n\n if (eventOut !== 'blur') jest.runOnlyPendingTimers();\n\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n\n test.each([false, true])('should not call event methods when disabled and display:%s', async display => {\n const args = { identifier: 'identifier', message: 'blu', disabled: true, display };\n const page = await getPage(args, <span>span</span>);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const linkedTooltipElement = mgTooltip.querySelector(`[aria-describedby*='${args.identifier}']`);\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n\n [eventIn, eventOut].forEach(async event => {\n linkedTooltipElement.dispatchEvent(new CustomEvent(event, { bubbles: true }));\n await page.waitForChanges();\n if (display) {\n expect(tooltip).toHaveAttribute('data-show');\n } else {\n expect(tooltip).not.toHaveAttribute('data-show');\n }\n });\n });\n });\n\n test.each([\n <span>span</span>,\n <button aria-describedby=\"blu\">button</button>,\n <mg-icon icon=\"check-circle\"></mg-icon>,\n <mg-button identifier=\"identifier-mg-button\">mg-button</mg-button>,\n ])('should manage cross mouse and keyboard navigation', async element => {\n const args = { identifier: 'identifier', message: 'blu' };\n const page = await getPage(args, element);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const linkedTooltipElement = mgTooltip.querySelector(`[aria-describedby*='${args.identifier}']`);\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n\n linkedTooltipElement.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n expect(tooltip).toHaveAttribute('data-show');\n\n page.doc.dispatchEvent(new KeyboardEvent('keydown', { code: 'Escape' }));\n await page.waitForChanges();\n expect(tooltip).not.toHaveAttribute('data-show');\n\n linkedTooltipElement.dispatchEvent(new CustomEvent('mouseenter', { bubbles: true }));\n await page.waitForChanges();\n expect(tooltip).toHaveAttribute('data-show');\n\n linkedTooltipElement.dispatchEvent(new CustomEvent('mouseleave', { bubbles: true }));\n // flush windows addEventListener timeout\n jest.runOnlyPendingTimers();\n\n await page.waitForChanges();\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n\n test.each([true, false])('Should toogle tooltip from prop display, case display %s', async display => {\n const args = { identifier: 'identifier', message: 'batman', display };\n const page = await getPage(args, <span>batman</span>);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n\n expect(page.root).toMatchSnapshot();\n if (display) {\n expect(tooltip).toHaveAttribute('data-show');\n } else {\n expect(tooltip).not.toHaveAttribute('data-show');\n }\n\n page.rootInstance.display = !display;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n if (display) {\n expect(tooltip).not.toHaveAttribute('data-show');\n } else {\n expect(tooltip).toHaveAttribute('data-show');\n }\n });\n\n describe('hide method', () => {\n test.each(['Tab', 'Space', 'Enter', 'i'])('should prevent keyboardEvent, case not \"Escape\" code', async code => {\n const args = { identifier: 'identifier', message: 'batman' };\n const page = await getPage(args, <span id=\"batman\">batman</span>);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n const element = page.doc.getElementById('batman');\n\n element.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n page.doc.dispatchEvent(new KeyboardEvent('keydown', { code }));\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n });\n\n test('should hide tooltip with keyboardEvent, case \"Escape\" code', async () => {\n const args = { identifier: 'identifier', message: 'batman' };\n const page = await getPage(args, <span id=\"batman\">batman</span>);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n const element = page.doc.getElementById('batman');\n\n element.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n page.doc.dispatchEvent(new KeyboardEvent('keydown', { code: 'Escape' }));\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n });\n\n test('Should keep displayed tooltip when hover it', async () => {\n const element = <span>span</span>;\n const eventIn = 'mouseenter';\n const eventOut = 'mouseleave';\n const args = { identifier: 'identifier', message: 'blu' };\n const page = await getPage(args, element);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const linkedTooltipElement = mgTooltip.querySelector(`[aria-describedby*='${args.identifier}']`);\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n\n // 1. hover tooltipedElement and display tooltip\n linkedTooltipElement.dispatchEvent(new CustomEvent(eventIn, { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n expect(tooltip).toHaveAttribute('data-show');\n\n // 2.1 leave tooltipedElement and tooltip stay displayed\n linkedTooltipElement.dispatchEvent(new CustomEvent(eventOut, { bubbles: true }));\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n // 2.2 hover on tooltipedElement and tooltip stay displayed\n tooltip.dispatchEvent(new CustomEvent(eventIn, { bubbles: true }));\n await page.waitForChanges();\n\n // 2.3 flush promise to keep tooltip display thanks to guard\n jest.advanceTimersByTime(200);\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n // 3 leave tooltipElement\n tooltip.dispatchEvent(new CustomEvent(eventOut, { bubbles: true }));\n await page.waitForChanges();\n\n // 3.2 flush promise to pass tooltip guard and hide it\n jest.advanceTimersByTime(200);\n await page.waitForChanges();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n\n test('Should prevent focus guard whith click event', async () => {\n const args = { identifier: 'identifier', message: 'batman' };\n const page = await getPage(args, <mg-button>batman</mg-button>);\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n const tooltip = mgTooltip.querySelector(`#${args.identifier}`);\n const element = page.doc.querySelector('mg-button');\n\n element.dispatchEvent(new MouseEvent('mouseenter', { bubbles: true }));\n await page.waitForChanges();\n\n expect(tooltip).toHaveAttribute('data-show');\n\n // recompose a click event as click event is not properly mock by jest `mousedown` + `focus` + `mouseup`\n for (const event of ['mousedown', 'focus', 'mouseup']) {\n const Constructor = event === 'focus' ? FocusEvent : MouseEvent;\n element.dispatchEvent(new Constructor(event, { bubbles: true }));\n await page.waitForChanges();\n }\n\n expect(tooltip).toHaveAttribute('data-show');\n\n element.dispatchEvent(new MouseEvent('mouseleave', { bubbles: true }));\n await page.waitForChanges();\n jest.runOnlyPendingTimers();\n\n expect(tooltip).not.toHaveAttribute('data-show');\n });\n\n test.each(['button', 'mg-button'])('Should update %s wrapper dynamically', async TagName => {\n const page = await getPage(\n { identifier: 'identifier', message: 'My tooltip message' },\n <TagName identifier=\"identifier\" disabled>\n {TagName}.disabled\n </TagName>,\n );\n\n expect(page.root).toMatchSnapshot();\n\n // Mock replaceWith\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n mgTooltip.firstElementChild.replaceWith = jest.fn(element => {\n mgTooltip.innerHTML = (element as Node).parentElement.innerHTML;\n });\n\n const mgButton: HTMLButtonElement | HTMLMgButtonElement = page.doc.querySelector(TagName);\n mgButton.disabled = false;\n fireMo([{ attributeName: TagName === 'MG-BUTTON' ? 'aria-disabled' : 'disabled' }]);\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test('Should update popper instance when \"message\" prop change', async () => {\n const page = await getPage(\n { identifier: 'identifier', message: 'My tooltip message' },\n <mg-button identifier=\"identifier\" disabled>\n mg-button.disabled\n </mg-button>,\n );\n\n const spy = jest.spyOn(page.rootInstance.popper, 'update');\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n mgTooltip.message = 'my new message';\n\n await page.waitForChanges();\n\n expect(spy).toHaveBeenCalled();\n });\n\n test('should update mg-popover-content id when \"identifier\" is updated', async () => {\n const page = await getPage(\n { identifier: 'identifier', message: 'My tooltip message' },\n <mg-button identifier=\"identifier\" disabled>\n mg-button.disabled\n </mg-button>,\n );\n\n expect(page.root).toMatchSnapshot();\n\n const mgTooltip = page.doc.querySelector('mg-tooltip');\n mgTooltip.identifier = 'new-identifier';\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
|