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

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Velin92 committed Oct 18, 2023
1 parent 9b1b07b commit 2c9c886
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crates/wysiwyg/src/tests/test_mentions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,16 @@ fn get_mentions_state_for_at_room_mention() {
assert_eq!(model.get_mentions_state(), state)
}

#[test]
fn get_mentions_state_for_at_room_plain_mention() {
let model = cm("<p>hello @room|");
let state = MentionsState {
user_ids: Default::default(),
has_at_room_mention: true,
};
assert_eq!(model.get_mentions_state(), state)
}

#[test]
fn get_mentions_state_for_multiple_user_and_at_room_mentions() {
let model = cm("<p>hello <a data-mention-type=\"user\" href=\"https://matrix.to/#/@alice:matrix.org\" contenteditable=\"false\">Alice</a>, <a data-mention-type=\"user\" href=\"https://matrix.to/#/@bob:matrix.org\" contenteditable=\"false\">Bob</a> and <a data-mention-type=\"at-room\" href=\"#\" contenteditable=\"false\">@room</a>!|</p>");
Expand All @@ -645,6 +655,12 @@ fn get_mentions_state_for_user_mention_with_custom_link() {
assert_eq!(model.get_mentions_state(), state)
}

#[test]
fn get_mentions_state_empty_for_non_intentional_room_mention() {
let model = cm("<pre>hello @room!|</pre>");
assert_eq!(model.get_mentions_state(), MentionsState::default())
}

/**
* HELPER FUNCTIONS
*/
Expand Down

0 comments on commit 2c9c886

Please sign in to comment.