Skip to content

Commit 1f98d01

Browse files
YueyingLuYueying Lu
andauthored
chore: Update test utils wrappers snapshot (#90)
Co-authored-by: Yueying Lu <lyueying@amazon.com>
1 parent 2d6b379 commit 1f98d01

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

src/__tests__/__snapshots__/test-utils-wrappers.test.tsx.snap

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ findAllSupportPromptGroups(selector?: string): Array<SupportPromptGroupWrapper>;
104104
105105
106106
ElementWrapper.prototype.findAvatar = function(selector) {
107-
const rootSelector = \`.\${AvatarWrapper.rootSelector}\`;
107+
let rootSelector = \`.\${AvatarWrapper.rootSelector}\`;
108+
if("legacyRootSelector" in AvatarWrapper && AvatarWrapper.legacyRootSelector){
109+
rootSelector = \`:is(.\${AvatarWrapper.rootSelector}, .\${AvatarWrapper.legacyRootSelector})\`;
110+
}
108111
// casting to 'any' is needed to avoid this issue with generics
109112
// https://github.com/microsoft/TypeScript/issues/29132
110113
return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AvatarWrapper);
@@ -114,7 +117,10 @@ ElementWrapper.prototype.findAllAvatars = function(selector) {
114117
return this.findAllComponents(AvatarWrapper, selector);
115118
};
116119
ElementWrapper.prototype.findChatBubble = function(selector) {
117-
const rootSelector = \`.\${ChatBubbleWrapper.rootSelector}\`;
120+
let rootSelector = \`.\${ChatBubbleWrapper.rootSelector}\`;
121+
if("legacyRootSelector" in ChatBubbleWrapper && ChatBubbleWrapper.legacyRootSelector){
122+
rootSelector = \`:is(.\${ChatBubbleWrapper.rootSelector}, .\${ChatBubbleWrapper.legacyRootSelector})\`;
123+
}
118124
// casting to 'any' is needed to avoid this issue with generics
119125
// https://github.com/microsoft/TypeScript/issues/29132
120126
return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ChatBubbleWrapper);
@@ -124,7 +130,10 @@ ElementWrapper.prototype.findAllChatBubbles = function(selector) {
124130
return this.findAllComponents(ChatBubbleWrapper, selector);
125131
};
126132
ElementWrapper.prototype.findLoadingBar = function(selector) {
127-
const rootSelector = \`.\${LoadingBarWrapper.rootSelector}\`;
133+
let rootSelector = \`.\${LoadingBarWrapper.rootSelector}\`;
134+
if("legacyRootSelector" in LoadingBarWrapper && LoadingBarWrapper.legacyRootSelector){
135+
rootSelector = \`:is(.\${LoadingBarWrapper.rootSelector}, .\${LoadingBarWrapper.legacyRootSelector})\`;
136+
}
128137
// casting to 'any' is needed to avoid this issue with generics
129138
// https://github.com/microsoft/TypeScript/issues/29132
130139
return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LoadingBarWrapper);
@@ -134,7 +143,10 @@ ElementWrapper.prototype.findAllLoadingBars = function(selector) {
134143
return this.findAllComponents(LoadingBarWrapper, selector);
135144
};
136145
ElementWrapper.prototype.findSupportPromptGroup = function(selector) {
137-
const rootSelector = \`.\${SupportPromptGroupWrapper.rootSelector}\`;
146+
let rootSelector = \`.\${SupportPromptGroupWrapper.rootSelector}\`;
147+
if("legacyRootSelector" in SupportPromptGroupWrapper && SupportPromptGroupWrapper.legacyRootSelector){
148+
rootSelector = \`:is(.\${SupportPromptGroupWrapper.rootSelector}, .\${SupportPromptGroupWrapper.legacyRootSelector})\`;
149+
}
138150
// casting to 'any' is needed to avoid this issue with generics
139151
// https://github.com/microsoft/TypeScript/issues/29132
140152
return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SupportPromptGroupWrapper);
@@ -250,7 +262,10 @@ findAllSupportPromptGroups(selector?: string): MultiElementWrapper<SupportPrompt
250262
251263
252264
ElementWrapper.prototype.findAvatar = function(selector) {
253-
const rootSelector = \`.\${AvatarWrapper.rootSelector}\`;
265+
let rootSelector = \`.\${AvatarWrapper.rootSelector}\`;
266+
if("legacyRootSelector" in AvatarWrapper && AvatarWrapper.legacyRootSelector){
267+
rootSelector = \`:is(.\${AvatarWrapper.rootSelector}, .\${AvatarWrapper.legacyRootSelector})\`;
268+
}
254269
// casting to 'any' is needed to avoid this issue with generics
255270
// https://github.com/microsoft/TypeScript/issues/29132
256271
return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, AvatarWrapper);
@@ -260,7 +275,10 @@ ElementWrapper.prototype.findAllAvatars = function(selector) {
260275
return this.findAllComponents(AvatarWrapper, selector);
261276
};
262277
ElementWrapper.prototype.findChatBubble = function(selector) {
263-
const rootSelector = \`.\${ChatBubbleWrapper.rootSelector}\`;
278+
let rootSelector = \`.\${ChatBubbleWrapper.rootSelector}\`;
279+
if("legacyRootSelector" in ChatBubbleWrapper && ChatBubbleWrapper.legacyRootSelector){
280+
rootSelector = \`:is(.\${ChatBubbleWrapper.rootSelector}, .\${ChatBubbleWrapper.legacyRootSelector})\`;
281+
}
264282
// casting to 'any' is needed to avoid this issue with generics
265283
// https://github.com/microsoft/TypeScript/issues/29132
266284
return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, ChatBubbleWrapper);
@@ -270,7 +288,10 @@ ElementWrapper.prototype.findAllChatBubbles = function(selector) {
270288
return this.findAllComponents(ChatBubbleWrapper, selector);
271289
};
272290
ElementWrapper.prototype.findLoadingBar = function(selector) {
273-
const rootSelector = \`.\${LoadingBarWrapper.rootSelector}\`;
291+
let rootSelector = \`.\${LoadingBarWrapper.rootSelector}\`;
292+
if("legacyRootSelector" in LoadingBarWrapper && LoadingBarWrapper.legacyRootSelector){
293+
rootSelector = \`:is(.\${LoadingBarWrapper.rootSelector}, .\${LoadingBarWrapper.legacyRootSelector})\`;
294+
}
274295
// casting to 'any' is needed to avoid this issue with generics
275296
// https://github.com/microsoft/TypeScript/issues/29132
276297
return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, LoadingBarWrapper);
@@ -280,7 +301,10 @@ ElementWrapper.prototype.findAllLoadingBars = function(selector) {
280301
return this.findAllComponents(LoadingBarWrapper, selector);
281302
};
282303
ElementWrapper.prototype.findSupportPromptGroup = function(selector) {
283-
const rootSelector = \`.\${SupportPromptGroupWrapper.rootSelector}\`;
304+
let rootSelector = \`.\${SupportPromptGroupWrapper.rootSelector}\`;
305+
if("legacyRootSelector" in SupportPromptGroupWrapper && SupportPromptGroupWrapper.legacyRootSelector){
306+
rootSelector = \`:is(.\${SupportPromptGroupWrapper.rootSelector}, .\${SupportPromptGroupWrapper.legacyRootSelector})\`;
307+
}
284308
// casting to 'any' is needed to avoid this issue with generics
285309
// https://github.com/microsoft/TypeScript/issues/29132
286310
return (this as any).findComponent(selector ? appendSelector(selector, rootSelector) : rootSelector, SupportPromptGroupWrapper);

0 commit comments

Comments
 (0)