-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: disable tooltip of select interaction (#1409)
* add possibility to disable tooltip * update SelectOptions type with `tooltip` * add test for disabling tooltip
- Loading branch information
1 parent
3ce2c85
commit 23e5297
Showing
5 changed files
with
73 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { html } from "lit"; | ||
import ecoRegionsFixture from "../../fixtures/ecoregions.json"; | ||
import vectorLayerStyleJson from "../../fixtures/hoverInteraction.json"; | ||
import { simulateEvent } from "../../utils/events"; | ||
|
||
/** | ||
* Tests to disable the default hover tooltip | ||
*/ | ||
const disableTooltip = () => { | ||
cy.intercept("https://openlayers.org/data/vector/ecoregions.json", (req) => { | ||
req.reply(ecoRegionsFixture); | ||
}); | ||
const layers = JSON.parse(JSON.stringify(vectorLayerStyleJson)); | ||
layers[0].interactions[0].options.tooltip = false; | ||
cy.mount( | ||
html`<eox-map .layers=${layers}> | ||
<eox-map-tooltip></eox-map-tooltip> | ||
</eox-map>`, | ||
).as("eox-map"); | ||
cy.get("eox-map").and(($el) => { | ||
const eoxMap = $el[0]; | ||
|
||
eoxMap.map.on("loadend", () => { | ||
simulateEvent(eoxMap.map, "pointermove", 120, -140); | ||
}); | ||
}); | ||
cy.get("eox-map") | ||
.shadow() | ||
.within(() => { | ||
cy.get("eox-map-tooltip").should("not.exist"); | ||
}); | ||
}; | ||
|
||
export default disableTooltip; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters