mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-05 22:25:36 +00:00
Implement new renderNotificationDecoration from module API (#31389)
* Upgrade module api package * Add a wrapper component So that we can render the decoration component with just the room. * Implement module API method * Add more tests
This commit is contained in:
@@ -44,10 +44,26 @@ describe("ElementWebBuiltinsApi", () => {
|
||||
expect(container).toHaveTextContent("50");
|
||||
});
|
||||
|
||||
it("returns rendered NotificationDecoration component", () => {
|
||||
stubClient();
|
||||
const builtinsApi = new ElementWebBuiltinsApi();
|
||||
const NotificationDecoration = () => <div>notification decoration</div>;
|
||||
builtinsApi.setComponents({
|
||||
roomView: {},
|
||||
roomAvatar: Avatar,
|
||||
notificationDecoration: NotificationDecoration,
|
||||
} as any);
|
||||
const { container } = render(<> {builtinsApi.renderNotificationDecoration("!foo:m.org")}</>);
|
||||
expect(container).toHaveTextContent("notification decoration");
|
||||
});
|
||||
|
||||
it("should throw error if called before components are set", () => {
|
||||
stubClient();
|
||||
const builtinsApi = new ElementWebBuiltinsApi();
|
||||
expect(() => builtinsApi.renderRoomAvatar("!foo:m.org")).toThrow("No RoomAvatar component has been set");
|
||||
expect(() => builtinsApi.renderRoomView("!foo:m.org")).toThrow("No RoomView component has been set");
|
||||
expect(() => builtinsApi.renderNotificationDecoration("!foo:m.org")).toThrow(
|
||||
"No NotificationDecoration component has been set",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user