Skip to content

Commit 45144fb

Browse files
authored
chore: Update test util snapshots (#125)
1 parent 4040af7 commit 45144fb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ findCodeView(selector?: string): CodeViewWrapper | null;
3636
* @returns {Array<CodeViewWrapper>}
3737
*/
3838
findAllCodeViews(selector?: string): Array<CodeViewWrapper>;
39+
40+
/**
41+
* Returns the wrapper of the closest parent CodeView for the current element,
42+
* or the element itself if it is an instance of CodeView.
43+
* If no CodeView is found, returns \`null\`.
44+
*
45+
* @returns {CodeViewWrapper | null}
46+
*/
47+
findClosestCodeView(): CodeViewWrapper | null;
3948
}
4049
}
4150
@@ -54,6 +63,11 @@ ElementWrapper.prototype.findAllCodeViews = function(selector) {
5463
return this.findAllComponents(CodeViewWrapper, selector);
5564
};
5665
66+
ElementWrapper.prototype.findClosestCodeView = function() {
67+
// casting to 'any' is needed to avoid this issue with generics
68+
// https://github.com/microsoft/TypeScript/issues/29132
69+
return (this as any).findClosestComponent(CodeViewWrapper);
70+
};
5771
5872
export default function wrapper(root: Element = document.body) {
5973
if (document && document.body && !document.body.contains(root)) {

0 commit comments

Comments
 (0)