Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Tests for RoomCreate #9997

Merged

Conversation

andybalaam
Copy link
Contributor

@andybalaam andybalaam commented Jan 26, 2023

Prep for MSC3946

Part of element-hq/element-web#24323


This change is marked as an internal change (Task), so will not be included in the changelog.

Copy link
Contributor

@artcodespace artcodespace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor (definitely non-blocking) comments

Comment on lines 66 to 70
const wrapper = getComponent(createEvent);
expect(wrapper.getByText("Click here to see older messages.")).toHaveAttribute(
"href",
"https://matrix.to/#/old_room_id/tombstone_event_id",
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A very minor point that adds very little here, but I think the 'right' way (think I picked this up from the creator of RTL, not the docs, in this post here: KCD) is to render the component then use screen for querying.

As I said, minimal gain here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion, applied - thanks.

it("Opens the old room on click", () => {
const wrapper = getComponent(createEvent);
const link = wrapper.getByText("Click here to see older messages.");
fireEvent.click(link);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you think to using userEvent here instead? I'd say a larger gain to doing that than the previous suggestion, as userEvent fires a few more events (mouseover, hover etc.) than purely the click action so is a better model of user interaction. It would be imported and then used as userEvent.click(link) so would read the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good - I was not aware of this - thanks!

@andybalaam andybalaam enabled auto-merge (squash) January 27, 2023 15:06
@andybalaam andybalaam merged commit 364c453 into matrix-org:develop Jan 27, 2023
@andybalaam andybalaam deleted the andybalaam/tests-for-RoomCreate branch January 27, 2023 15:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants