Skip to content

Commit 0b56cbd

Browse files
test: wait for tooltip to have style set
1 parent ad39560 commit 0b56cbd

4 files changed

+19
-0
lines changed

src/test/__snapshots__/tooltip-attributes.spec.js.snap

+2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ exports[`tooltip attributes tooltip with place 1`] = `
3434
<div
3535
class="react-tooltip react-tooltip__place-right"
3636
role="tooltip"
37+
style="left: 10px; top: 5px;"
3738
>
3839
Hello World!
3940
<div
4041
class="react-tooltip-arrow"
42+
style="left: -4px; top: 5px;"
4143
/>
4244
</div>
4345
</div>

src/test/__snapshots__/tooltip-props.spec.js.snap

+8
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ exports[`tooltip props tooltip with custom position 1`] = `
5454
<div
5555
class="react-tooltip react-tooltip__place-top"
5656
role="tooltip"
57+
style="left: 5px; top: -10px;"
5758
>
5859
Hello World!
5960
<div
6061
class="react-tooltip-arrow"
62+
style="left: 5px; bottom: -4px;"
6163
/>
6264
</div>
6365
</div>
@@ -83,10 +85,12 @@ exports[`tooltip props tooltip with delay show 1`] = `
8385
<div
8486
class="react-tooltip react-tooltip__place-top"
8587
role="tooltip"
88+
style="left: 5px; top: -10px;"
8689
>
8790
Hello World!
8891
<div
8992
class="react-tooltip-arrow"
93+
style="left: 5px; bottom: -4px;"
9094
/>
9195
</div>
9296
</div>
@@ -123,6 +127,7 @@ exports[`tooltip props tooltip with html 1`] = `
123127
<div
124128
class="react-tooltip react-tooltip__place-top"
125129
role="tooltip"
130+
style="left: 5px; top: -10px;"
126131
>
127132
<span>
128133
<div>
@@ -132,6 +137,7 @@ exports[`tooltip props tooltip with html 1`] = `
132137
</span>
133138
<div
134139
class="react-tooltip-arrow"
140+
style="left: 5px; bottom: -4px;"
135141
/>
136142
</div>
137143
</div>
@@ -147,10 +153,12 @@ exports[`tooltip props tooltip with place 1`] = `
147153
<div
148154
class="react-tooltip react-tooltip__place-right"
149155
role="tooltip"
156+
style="left: 10px; top: 5px;"
150157
>
151158
Hello World!
152159
<div
153160
class="react-tooltip-arrow"
161+
style="left: -4px; top: 5px;"
154162
/>
155163
</div>
156164
</div>

src/test/tooltip-attributes.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('tooltip attributes', () => {
4343

4444
await waitFor(() => {
4545
tooltip = screen.getByRole('tooltip')
46+
expect(tooltip).toHaveAttribute('style')
4647
})
4748

4849
expect(anchorElement).toHaveAttribute('data-tooltip-content')
@@ -66,6 +67,7 @@ describe('tooltip attributes', () => {
6667

6768
await waitFor(() => {
6869
tooltip = screen.getByRole('tooltip')
70+
expect(tooltip).toHaveAttribute('style')
6971
})
7072

7173
expect(anchorElement).toHaveAttribute('data-tooltip-place')

src/test/tooltip-props.spec.js

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ describe('tooltip props', () => {
3939

4040
await waitFor(() => {
4141
tooltip = screen.getByRole('tooltip')
42+
expect(tooltip).toHaveAttribute('style')
4243
})
4344

4445
expect(tooltip).toBeInTheDocument()
@@ -57,6 +58,7 @@ describe('tooltip props', () => {
5758

5859
await waitFor(() => {
5960
tooltip = screen.getByRole('tooltip')
61+
expect(tooltip).toHaveAttribute('style')
6062
})
6163

6264
expect(tooltip).toBeInTheDocument()
@@ -73,6 +75,7 @@ describe('tooltip props', () => {
7375

7476
await waitFor(() => {
7577
tooltip = screen.getByRole('tooltip')
78+
expect(tooltip).toHaveAttribute('style')
7679
})
7780

7881
expect(tooltip).toBeInTheDocument()
@@ -101,6 +104,7 @@ describe('tooltip props', () => {
101104
await waitFor(() => {
102105
tooltip = screen.getByRole('tooltip')
103106
button = screen.getByRole('button')
107+
expect(tooltip).toHaveAttribute('style')
104108
})
105109

106110
await userEvent.click(button)
@@ -132,6 +136,7 @@ describe('tooltip props', () => {
132136

133137
await waitFor(() => {
134138
tooltip = screen.getByRole('tooltip')
139+
expect(tooltip).toHaveAttribute('style')
135140
})
136141

137142
expect(tooltip).toBeInTheDocument()
@@ -185,6 +190,7 @@ describe('tooltip props', () => {
185190

186191
await waitFor(() => {
187192
tooltip = screen.getByRole('tooltip')
193+
expect(tooltip).toHaveAttribute('style')
188194
})
189195

190196
expect(tooltip).toBeInTheDocument()
@@ -201,6 +207,7 @@ describe('tooltip props', () => {
201207

202208
await waitFor(() => {
203209
tooltip = screen.getByRole('tooltip')
210+
expect(tooltip).toHaveAttribute('style')
204211
})
205212

206213
expect(tooltip).toBeInTheDocument()

0 commit comments

Comments
 (0)