@@ -16,7 +16,6 @@ const getProps = (props = {}) => ({
1616 onMouseLeave : jest . fn ( ) ,
1717 onOpen : jest . fn ( ) ,
1818 style : props . style ,
19- testId : 'tip' ,
2019 text : 'I am the tooltip'
2120} ) ;
2221
@@ -31,16 +30,16 @@ describe('<Tooltip />', () => {
3130 it ( 'should render wrapper element' , ( ) => {
3231 const { getByTestId } = render ( renderTooltip ( getProps ( ) ) ) ;
3332
34- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
33+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
3534
36- expect ( tipWrapper ) . toBeInTheDocument ( ) ;
37- expect ( tipWrapper . tagName ) . toBe ( 'DIV' ) ;
35+ expect ( wrapper ) . toBeInTheDocument ( ) ;
36+ expect ( wrapper . tagName ) . toBe ( 'DIV' ) ;
3837 } ) ;
3938
4039 it ( 'should render inner tooltip' , ( ) => {
4140 const { getByTestId } = render ( renderTooltip ( getProps ( ) ) ) ;
4241
43- const tip = getByTestId ( 'tip ' ) ;
42+ const tip = getByTestId ( 'tooltip ' ) ;
4443
4544 expect ( tip ) . toBeInTheDocument ( ) ;
4645 expect ( tip . tagName ) . toBe ( 'SPAN' ) ;
@@ -64,7 +63,7 @@ describe('<Tooltip />', () => {
6463 )
6564 ) ;
6665
67- const tip = getByTestId ( 'tip ' ) ;
66+ const tip = getByTestId ( 'tooltip ' ) ;
6867
6968 expect ( tip . className . includes ( 'my-tip' ) ) . toBeTruthy ( ) ;
7069 } ) ;
@@ -88,9 +87,9 @@ describe('<Tooltip />', () => {
8887 )
8988 ) ;
9089
91- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
90+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
9291
93- fireEvent . focus ( tipWrapper ) ;
92+ fireEvent . focus ( wrapper ) ;
9493
9594 expect ( setTimeout ) . toHaveBeenCalledWith ( expect . any ( Function ) , 5 ) ;
9695 } ) ;
@@ -104,9 +103,9 @@ describe('<Tooltip />', () => {
104103 )
105104 ) ;
106105
107- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
106+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
108107
109- fireEvent . blur ( tipWrapper ) ;
108+ fireEvent . blur ( wrapper ) ;
110109
111110 expect ( setTimeout ) . toHaveBeenCalledWith ( expect . any ( Function ) , 6 ) ;
112111 } ) ;
@@ -118,10 +117,10 @@ describe('<Tooltip />', () => {
118117
119118 const { getByTestId } = render ( renderTooltip ( props ) ) ;
120119
121- const tip = getByTestId ( 'tip ' ) ;
122- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
120+ const tip = getByTestId ( 'tooltip ' ) ;
121+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
123122
124- fireEvent . focus ( tipWrapper ) ;
123+ fireEvent . focus ( wrapper ) ;
125124
126125 await waitForDomChange ( { container : tip } ) ;
127126
@@ -134,12 +133,12 @@ describe('<Tooltip />', () => {
134133
135134 const { getByTestId } = render ( renderTooltip ( props ) ) ;
136135
137- const tip = getByTestId ( 'tip ' ) ;
138- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
136+ const tip = getByTestId ( 'tooltip ' ) ;
137+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
139138
140- fireEvent . focus ( tipWrapper ) ;
139+ fireEvent . focus ( wrapper ) ;
141140 await waitForDomChange ( { container : tip } ) ;
142- fireEvent . blur ( tipWrapper ) ;
141+ fireEvent . blur ( wrapper ) ;
143142 await waitForDomChange ( { container : tip } ) ;
144143
145144 expect ( props . onBlur ) . toHaveBeenCalled ( ) ;
@@ -151,10 +150,10 @@ describe('<Tooltip />', () => {
151150
152151 const { getByTestId } = render ( renderTooltip ( props ) ) ;
153152
154- const tip = getByTestId ( 'tip ' ) ;
155- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
153+ const tip = getByTestId ( 'tooltip ' ) ;
154+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
156155
157- fireEvent . mouseEnter ( tipWrapper ) ;
156+ fireEvent . mouseEnter ( wrapper ) ;
158157 await waitForDomChange ( { container : tip } ) ;
159158
160159 expect ( props . onMouseEnter ) . toHaveBeenCalled ( ) ;
@@ -166,12 +165,12 @@ describe('<Tooltip />', () => {
166165
167166 const { getByTestId } = render ( renderTooltip ( props ) ) ;
168167
169- const tip = getByTestId ( 'tip ' ) ;
170- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
168+ const tip = getByTestId ( 'tooltip ' ) ;
169+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
171170
172- fireEvent . mouseEnter ( tipWrapper ) ;
171+ fireEvent . mouseEnter ( wrapper ) ;
173172 await waitForDomChange ( { container : tip } ) ;
174- fireEvent . mouseLeave ( tipWrapper ) ;
173+ fireEvent . mouseLeave ( wrapper ) ;
175174 await waitForDomChange ( { container : tip } ) ;
176175
177176 expect ( props . onMouseLeave ) . toHaveBeenCalled ( ) ;
@@ -183,9 +182,9 @@ describe('<Tooltip />', () => {
183182
184183 const { getByTestId } = render ( renderTooltip ( props ) ) ;
185184
186- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
185+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
187186
188- fireEvent . focus ( tipWrapper ) ;
187+ fireEvent . focus ( wrapper ) ;
189188
190189 expect ( props . onFocus ) . not . toHaveBeenCalled ( ) ;
191190 } ) ;
@@ -195,9 +194,9 @@ describe('<Tooltip />', () => {
195194
196195 const { getByTestId } = render ( renderTooltip ( props ) ) ;
197196
198- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
197+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
199198
200- fireEvent . blur ( tipWrapper ) ;
199+ fireEvent . blur ( wrapper ) ;
201200
202201 expect ( props . onBlur ) . not . toHaveBeenCalled ( ) ;
203202 } ) ;
@@ -207,9 +206,9 @@ describe('<Tooltip />', () => {
207206
208207 const { getByTestId } = render ( renderTooltip ( props ) ) ;
209208
210- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
209+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
211210
212- fireEvent . mouseEnter ( tipWrapper ) ;
211+ fireEvent . mouseEnter ( wrapper ) ;
213212
214213 expect ( props . onMouseEnter ) . not . toHaveBeenCalled ( ) ;
215214 } ) ;
@@ -219,9 +218,9 @@ describe('<Tooltip />', () => {
219218
220219 const { getByTestId } = render ( renderTooltip ( props ) ) ;
221220
222- const tipWrapper = getByTestId ( 'tipWrapper ' ) ;
221+ const wrapper = getByTestId ( 'tooltip-wrapper ' ) ;
223222
224- fireEvent . mouseLeave ( tipWrapper ) ;
223+ fireEvent . mouseLeave ( wrapper ) ;
225224
226225 expect ( props . onMouseLeave ) . not . toHaveBeenCalled ( ) ;
227226 } ) ;
0 commit comments