Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 24c0fbd

Browse files
committed
test: fix all test warning
1 parent 1bb327c commit 24c0fbd

File tree

4 files changed

+29
-57
lines changed

4 files changed

+29
-57
lines changed

packages/c-scroll-lock/tests/__snapshots__/vue-scroll-lock.test.ts.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ exports[`should block body 1`] = `
44
<DocumentFragment>
55
<div>
66
<section>
7-
<c-scroll-lock>
8-
<p>
9-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qu officia deserunt mollit anim id est laborum.
10-
</p>
11-
</c-scroll-lock>
7+
<p
8+
data-chakra-scroll-lock="false"
9+
>
10+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qu officia deserunt mollit anim id est laborum.
11+
</p>
1212
</section>
1313
</div>
1414
</DocumentFragment>
@@ -18,11 +18,11 @@ exports[`should render properly 1`] = `
1818
<DocumentFragment>
1919
<div>
2020
<section>
21-
<c-scroll-lock>
22-
<p>
23-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qu officia deserunt mollit anim id est laborum.
24-
</p>
25-
</c-scroll-lock>
21+
<p
22+
data-chakra-scroll-lock="false"
23+
>
24+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qu officia deserunt mollit anim id est laborum.
25+
</p>
2626
</section>
2727
</div>
2828
</DocumentFragment>

packages/c-scroll-lock/tests/vue-scroll-lock.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { CScrollLock } from '../src'
33

44
const renderComponent = (props?: {}) =>
55
render({
6+
components: { CScrollLock },
67
template: `
78
<div>
89
<section>

packages/utils/tests/dom.test.ts

Lines changed: 17 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
import { render, waitMs, screen } from '@chakra-ui/vue-test-utils/src'
2-
import { defineComponent, h, nextTick, onMounted } from '@vue/runtime-core'
2+
import { defineComponent, h, nextTick, onMounted } from 'vue'
33
import { useRef } from '../src/dom'
44

55
const ExampleComponent = defineComponent({
6-
template: `<button><slot /></button>`,
6+
setup(_, { slots }) {
7+
return () => h('button', {}, () => slots?.default?.())
8+
},
79
})
810

9-
let _containerEl: HTMLElement | null
10-
let _componentEl: HTMLElement | null
11-
12-
it('`useDOMRef` should bind components to template elements', async () => {
11+
const renderComponent = () =>
1312
render({
1413
components: { ExampleComponent },
1514
template: `
16-
<div>
17-
<div data-testid="divElement" :ref="container">Regular element</div>
18-
<ExampleComponent data-testid="buttonComponent" :ref="component" />
19-
</div>
20-
`,
15+
<div>
16+
<div data-testid="divElement" :ref="container">Regular element</div>
17+
<ExampleComponent data-testid="buttonComponent" :ref="component">Hello</ExampleComponent>
18+
</div>
19+
`,
2120
setup() {
2221
const [container, containerEl] = useRef()
2322
const [component, componentEl] = useRef()
@@ -36,48 +35,19 @@ it('`useDOMRef` should bind components to template elements', async () => {
3635
},
3736
})
3837

38+
let _containerEl: HTMLElement | null
39+
let _componentEl: HTMLElement | null
40+
41+
it('`useDOMRef` should bind components to template elements', async () => {
42+
renderComponent()
43+
3944
await waitMs(500)
4045
expect(screen.getByTestId('divElement')).toBe(_containerEl)
4146
expect(screen.getByTestId('buttonComponent')).toBe(_componentEl)
4247
})
4348

4449
it('`useDOMRef` should bind components to render function elements', async () => {
45-
render({
46-
components: { ExampleComponent },
47-
setup() {
48-
const [container, containerEl] = useRef()
49-
const [component, componentEl] = useRef()
50-
51-
onMounted(async () => {
52-
await nextTick()
53-
54-
_containerEl = containerEl.value
55-
_componentEl = componentEl.value
56-
})
57-
58-
return () =>
59-
h('div', [
60-
h(
61-
// @ts-ignore
62-
'div',
63-
{
64-
'data-testid': 'divElement',
65-
ref: container,
66-
},
67-
'Regular element'
68-
),
69-
h(
70-
// @ts-ignore
71-
ExampleComponent,
72-
{
73-
'data-testid': 'buttonComponent',
74-
ref: component,
75-
},
76-
'Click me'
77-
),
78-
])
79-
},
80-
})
50+
renderComponent()
8151

8252
await waitMs(500)
8353
expect(screen.getByTestId('divElement')).toBe(_containerEl)

packages/vue-composables/tests/use-id.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ it('`useIds` should create compound ids and patch once onMounted', async () => {
6868
modalId,
6969
headerId,
7070
bodyId,
71+
count,
7172
}
7273
},
7374
})

0 commit comments

Comments
 (0)