@playpilot/tpi 7.0.3 → 7.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "7.0.3",
3
+ "version": "7.0.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -2,6 +2,7 @@ import { mount, unmount } from 'svelte'
2
2
  import Explore from '../routes/components/Explore/Explore.svelte'
3
3
 
4
4
  export const exploreParentSelector = '[data-playpilot-explore]'
5
+ export const explorePreConsentSelector = '[data-playpilot-pre-consent-explore]'
5
6
 
6
7
  let exploreInsertedComponent: object | null = null
7
8
 
@@ -14,6 +15,7 @@ export function insertExplore(): void {
14
15
  if (!target) return
15
16
 
16
17
  destroyExplore()
18
+ document.querySelector<HTMLElement>(explorePreConsentSelector)?.remove()
17
19
 
18
20
  target.innerHTML = ''
19
21
  exploreInsertedComponent = mount(Explore, { target })
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, vi, beforeEach } from 'vitest'
2
- import { destroyExplore, insertExplore, insertExploreIntoNavigation } from '$lib/explore'
2
+ import { destroyExplore, explorePreConsentSelector, insertExplore, insertExploreIntoNavigation } from '$lib/explore'
3
3
  import { mount, unmount } from 'svelte'
4
4
  vi.mock('svelte', () => ({
5
5
  mount: vi.fn(() => true),
@@ -36,6 +36,19 @@ describe('explore.js', () => {
36
36
 
37
37
  expect(document.querySelector('span')).not.toBeTruthy()
38
38
  })
39
+
40
+ it('Should remove pre-consent elements if present', () => {
41
+ document.body.innerHTML = `
42
+ <div data-playpilot-explore><span></span></div>
43
+ <div data-playpilot-pre-consent-explore></div>
44
+ `
45
+
46
+ expect(document.querySelector(explorePreConsentSelector)).toBeTruthy()
47
+
48
+ insertExplore()
49
+
50
+ expect(document.querySelector(explorePreConsentSelector)).not.toBeTruthy()
51
+ })
39
52
  })
40
53
 
41
54
  describe('destroyExplore', () => {