Skip to content

Commit 050ff86

Browse files
committed
no need to ever throw if we try to remove and its already removed
1 parent 18c9875 commit 050ff86

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

packages/feedback/test/core/components/Actor.test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,24 @@ describe('Actor', () => {
6363
expect(actorAria.el.textContent).toBe('Button');
6464
expect(actorAria.el.ariaLabel).toBe('Aria');
6565
});
66+
67+
it('does not throw if removeFromDom() is called when it is not mounted', () => {
68+
const feedbackIntegration = buildFeedbackIntegration({
69+
lazyLoadIntegration: vi.fn(),
70+
});
71+
72+
const configuredIntegration = feedbackIntegration({});
73+
mockSdk({
74+
sentryOptions: {
75+
integrations: [configuredIntegration],
76+
},
77+
});
78+
79+
const feedback = getFeedback();
80+
81+
const actorComponent = feedback!.createWidget();
82+
83+
expect(() => actorComponent.removeFromDom()).not.toThrowError();
84+
expect(() => actorComponent.removeFromDom()).not.toThrowError();
85+
});
6686
});

0 commit comments

Comments
 (0)