Skip to content

Commit

Permalink
IBX-4277: [UDW] Tooltips from left menu aren't visible (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabowskiM authored Dec 1, 2022
1 parent 5cf6727 commit 5f8f391
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
(function (global, doc, ibexa) {
ibexa.helpers.tooltips.parse();
ibexa.helpers.tooltips.observe();
})(window, window.document, window.ibexa);
16 changes: 13 additions & 3 deletions src/bundle/Resources/public/js/scripts/helpers/tooltips.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@
const observer = new MutationObserver((mutationsList) => {
if (lastInsertTooltipTarget) {
mutationsList.forEach((mutation) => {
const { removedNodes } = mutation;
const { addedNodes, removedNodes } = mutation;

if (addedNodes.length) {
addedNodes.forEach((addedNode) => {
if (addedNode instanceof Element) {
parse(addedNode);
}
});
}

if (removedNodes.length) {
removedNodes.forEach((removedNode) => {
Expand Down Expand Up @@ -159,11 +167,13 @@
bootstrap.Tooltip.getOrCreateInstance(tooltipNode).hide();
}
};

observer.observe(doc.querySelector('body'), observerConfig);
const observe = (baseElement = doc) => {
observer.observe(baseElement, observerConfig);
};

ibexa.addConfig('helpers.tooltips', {
parse,
hideAll,
observe,
});
})(window, window.document, window.ibexa, window.bootstrap);
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ const TabSelector = () => {
});

return (
<div className={className} key={tab.id} onClick={onClick} title={tab.label}>
<div
className={className}
key={tab.id}
onClick={onClick}
title={tab.label}
data-tooltip-container-selector=".c-udw-tab"
>
<Icon customPath={tab.icon} extraClasses="ibexa-icon--small-medium" />
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Behat/Component/UniversalDiscoveryWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function changeTab($tabName): void
$this->getHTMLPage()->findAll($this->getLocator('categoryTabSelector'))
->getByCriterion(new ElementAttributeCriterion('data-original-title', $tabName))->click();
$this->getHTMLPage()->findAll($this->getLocator('selectedTab'))
->getByCriterion(new ElementAttributeCriterion('title', $tabName))->assert()->isVisible();
->getByCriterion(new ElementAttributeCriterion('data-bs-original-title', $tabName))->assert()->isVisible();
}

public function selectBookmark(string $bookmarkName): void
Expand Down

0 comments on commit 5f8f391

Please sign in to comment.