From bec8d877cd35724ee0811213b5fe047a9621c16c Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Fri, 20 Oct 2023 10:30:15 +0200 Subject: [PATCH] lint and format --- ...ComposerViewModelTests+MentionsState.swift | 31 +++++++++++++++---- ...ygComposerViewModelTests+Suggestions.swift | 1 - 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/platforms/ios/lib/WysiwygComposer/Tests/WysiwygComposerTests/Components/WysiwygComposerView/WysiwygComposerViewModelTests+MentionsState.swift b/platforms/ios/lib/WysiwygComposer/Tests/WysiwygComposerTests/Components/WysiwygComposerView/WysiwygComposerViewModelTests+MentionsState.swift index 750c6b144..ecc76277b 100644 --- a/platforms/ios/lib/WysiwygComposer/Tests/WysiwygComposerTests/Components/WysiwygComposerView/WysiwygComposerViewModelTests+MentionsState.swift +++ b/platforms/ios/lib/WysiwygComposer/Tests/WysiwygComposerTests/Components/WysiwygComposerView/WysiwygComposerViewModelTests+MentionsState.swift @@ -1,4 +1,4 @@ -// +// // Copyright 2023 The Matrix.org Foundation C.I.C // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,7 +30,8 @@ extension WysiwygComposerViewModelTests { func testMentionsStatBySettingUserMention() { viewModel.setMention(url: "https://matrix.to/#/@alice:matrix.org", name: "Alice", mentionType: .user) - XCTAssertEqual(viewModel.getMentionsState(), MentionsState(userIds: ["@alice:matrix.org"], roomIds: [], roomAliases: [], hasAtRoomMention: false)) + XCTAssertEqual(viewModel.getMentionsState(), + MentionsState(userIds: ["@alice:matrix.org"], roomIds: [], roomAliases: [], hasAtRoomMention: false)) } func testMentionsStateBySettingUserMentionFromContent() { @@ -44,7 +45,8 @@ extension WysiwygComposerViewModelTests { func testMentionsStatBySettingRoomAliasMention() { viewModel.setMention(url: "https://matrix.to/#/#room:matrix.org", name: "Room", mentionType: .room) - XCTAssertEqual(viewModel.getMentionsState(), MentionsState(userIds: [], roomIds: [], roomAliases: ["#room:matrix.org"], hasAtRoomMention: false)) + XCTAssertEqual(viewModel.getMentionsState(), + MentionsState(userIds: [], roomIds: [], roomAliases: ["#room:matrix.org"], hasAtRoomMention: false)) } func testMentionsStateBySettingRoomAliasMentionFromContent() { @@ -87,18 +89,35 @@ extension WysiwygComposerViewModelTests { viewModel.setMention(url: "https://matrix.to/#/@alice:matrix.org", name: "Alice", mentionType: .user) viewModel.setMention(url: "https://matrix.to/#/@alice:matrix.org", name: "Alice", mentionType: .user) - XCTAssertEqual(viewModel.getMentionsState(), MentionsState(userIds: ["@alice:matrix.org"], roomIds: [], roomAliases: [], hasAtRoomMention: false)) + XCTAssertEqual(viewModel.getMentionsState(), + MentionsState(userIds: ["@alice:matrix.org"], roomIds: [], roomAliases: [], hasAtRoomMention: false)) } func testMultipleMentionsBySettingThemWithContent() { - viewModel.setHtmlContent("

Alice, Room, Bob, Room, @room

") + viewModel.setHtmlContent( + """ +

Alice, \ + Room, \ + Bob, \ + Room, \ + @room

+ """ + ) var mentionState = viewModel.getMentionsState() XCTAssertEqual(Set(mentionState.userIds), ["@alice:matrix.org", "@bob:matrix.org"]) XCTAssertEqual(mentionState.roomAliases, ["#room:matrix.org"]) XCTAssertEqual(mentionState.roomIds, ["!room:matrix.org"]) XCTAssertTrue(mentionState.hasAtRoomMention) - viewModel.setMarkdownContent("[Room](https://matrix.to/#/!room:matrix.org), [Room](https://matrix.to/#/#room:matrix.org), [Alice](https://matrix.to/#/@alice:matrix.org), [Bob](https://matrix.to/#/@bob:matrix.org), @room") + viewModel.setMarkdownContent( + """ + [Room](https://matrix.to/#/!room:matrix.org), \ + [Room](https://matrix.to/#/#room:matrix.org), \ + [Alice](https://matrix.to/#/@alice:matrix.org), \ + [Bob](https://matrix.to/#/@bob:matrix.org), \ + @room + """ + ) mentionState = viewModel.getMentionsState() XCTAssertEqual(Set(mentionState.userIds), ["@alice:matrix.org", "@bob:matrix.org"]) XCTAssertEqual(mentionState.roomAliases, ["#room:matrix.org"]) diff --git a/platforms/ios/lib/WysiwygComposer/Tests/WysiwygComposerTests/Components/WysiwygComposerView/WysiwygComposerViewModelTests+Suggestions.swift b/platforms/ios/lib/WysiwygComposer/Tests/WysiwygComposerTests/Components/WysiwygComposerView/WysiwygComposerViewModelTests+Suggestions.swift index 60266cf31..18cdcff52 100644 --- a/platforms/ios/lib/WysiwygComposer/Tests/WysiwygComposerTests/Components/WysiwygComposerView/WysiwygComposerViewModelTests+Suggestions.swift +++ b/platforms/ios/lib/WysiwygComposer/Tests/WysiwygComposerTests/Components/WysiwygComposerView/WysiwygComposerViewModelTests+Suggestions.swift @@ -98,7 +98,6 @@ extension WysiwygComposerViewModelTests { ) } - func testAtMentionWithNoSuggestionAtLeading() { _ = viewModel.replaceText(range: .zero, replacementText: "Text") viewModel.select(range: .init(location: 0, length: 0))