diff --git a/dev/src/App.svelte b/dev/src/App.svelte index 7571392..53c71b5 100644 --- a/dev/src/App.svelte +++ b/dev/src/App.svelte @@ -1,5 +1,10 @@ + + + + Hi! I'm a fancy tooltip! + - - + (showSettings = !showSettings)}> + + + + + + Tooltip Text Content: + + + + + + Use Custom Tooltip Class: + + + + + + Tooltip Position: + + Left + Right + Top + Bottom + + + + + + Animate tooltip: + + + + + + Use Custom Tooltip Animation Enter Class: + + + + + + Use Custom Tooltip Animation Leave Class: + + + + + + Tooltip Enter Delay (ms): + + + + + + Tooltip Leave Delay (ms): + + + + + + Tooltip Offset (px): + + + + + + Disable Tooltip: + + + + + + {/if} + + (showSettings = !showSettings)}> + + + - Hover me - - - Hi! I'm a fancy tooltip! - - - Settings - - - Tooltip Text Content: - - - - - - Use Custom Tooltip Class: - - - - - - Tooltip Position: - - Left - Right - Top - Bottom - - - - - - Animate tooltip: - - - - - - Use Custom Tooltip Animation Enter Class: - - - - - - Use Custom Tooltip Animation Leave Class: - - - - - - Tooltip Enter Delay (ms): - - - - - - Tooltip Leave Delay (ms): - - - - - - Tooltip Offset (px): - - - - - - Disable Tooltip: - - - - - - - - + class="target" + > + Hover me + + + \ No newline at end of file diff --git a/dev/src/CloseIcon.svelte b/dev/src/CloseIcon.svelte new file mode 100644 index 0000000..eb038f3 --- /dev/null +++ b/dev/src/CloseIcon.svelte @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/dev/src/SettingsIcon.svelte b/dev/src/SettingsIcon.svelte new file mode 100644 index 0000000..e37c13a --- /dev/null +++ b/dev/src/SettingsIcon.svelte @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/src/Tooltip.js b/src/Tooltip.js index b14dd2e..6851d63 100644 --- a/src/Tooltip.js +++ b/src/Tooltip.js @@ -128,6 +128,9 @@ class Tooltip { } async destroy() { + this.#target.setAttribute('style', 'position: null') + this.#target.setAttribute('aria-describedby', null) + await this.#removeTooltipFromTarget() this.#disableTarget() diff --git a/src/__tests__/useTooltip.test.js b/src/__tests__/useTooltip.test.js index d176cec..0fce0f5 100644 --- a/src/__tests__/useTooltip.test.js +++ b/src/__tests__/useTooltip.test.js @@ -124,6 +124,7 @@ describe('useTooltip', () => { it('Destroys tooltip', async () => { action = useTooltip(target, options) action.destroy(target) + expect(target).toHaveStyle('position: null') await _enter(target) expect(getElement('#content')).not.toBeInTheDocument() })