Skip to content

Commit 3dad7dc

Browse files
committed
test: add check to prevent error when nativeElement is not available
1 parent 1ef532e commit 3dad7dc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/index.spec.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,18 @@ describe('dialog', () => {
278278
document.querySelector<HTMLElement>('.rc-dialog').style['transform-origin'],
279279
).toBeTruthy();
280280
});
281+
282+
it('should not throw error when nativeElement is not available', () => {
283+
expect(() => {
284+
global.onAppearPrepare?.();
285+
}).not.toThrow();
286+
287+
render(<Dialog visible />);
288+
289+
expect(() => {
290+
global.onAppearPrepare?.();
291+
}).not.toThrow();
292+
});
281293
});
282294

283295
it('can get dom element before dialog first show when forceRender is set true ', () => {

0 commit comments

Comments
 (0)