From 7cf6ac5c3e4a77eeda42e7992908ffe10d5fff6e Mon Sep 17 00:00:00 2001 From: untemps Date: Wed, 5 Oct 2022 21:25:44 +0200 Subject: [PATCH 1/2] chore: Improve dev application, #56 --- dev/src/App.svelte | 482 ++++++++++++++++++++---------------- dev/src/CloseIcon.svelte | 14 ++ dev/src/SettingsIcon.svelte | 14 ++ 3 files changed, 296 insertions(+), 214 deletions(-) create mode 100644 dev/src/CloseIcon.svelte create mode 100644 dev/src/SettingsIcon.svelte 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 @@ + + +
-
-
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ {/if} +
+ +
- Hover me -
- -
-

Settings

-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
- - + 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 From 4123e25577d561ce13f09d5190d0d9695a245577 Mon Sep 17 00:00:00 2001 From: untemps Date: Wed, 5 Oct 2022 21:54:08 +0200 Subject: [PATCH 2/2] fix: Reset target position on destroy, #56 --- src/Tooltip.js | 3 +++ src/__tests__/useTooltip.test.js | 1 + 2 files changed, 4 insertions(+) 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() })