Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: integrate Down in message cell * WIP: update MarkdownBarView * basic implementation of MarkdownTextView * swap out MarklightTextView with MarkdownTextView * tidy up * use staging backend * reset markdown when sending * parse attributed string when sending * refactor current attributes * automatically switch off header after newline * add comments * add support for different header types * update header icon automatically * only remove old headers if new one is selected * reset active markdown when in header and newline detected * allow designated init to be called for subclasses of TextView * add DownStyle presets * tidy up * improve how currentAttributes is calculated * tidy up * update currentAttributes only when activeMarkdown changes * adjust compact style * make method private * WIP: insertListItem stub * markdownAtCaret returns markdown from previous position * add Down via Carthage * add MarkdownTextStorage * tidy up * add methods to add & remove markdown over a range * selecting/deselecting header adds/removes MD over line * tidy up * tidy up * activate MarkdownTextView in drafts * improve markdownAtCaret * support adding/removing markdown over selections * tidy up * refactor * listen to notifications for text changes * post notification for selection changes * add method to calculate prev line range * remove list item stub * activate list button * automatic list generation * ensure only one type of header is active at a time * re-enable emoji substitution * refactor * detect link attachments from parsed string * prevent combination of code with bold or italic * refactor * remove Down from project file & switch off staging * tidy up MarkdownBarView * tidy up * fix compact style * update drafts * disable MarklightTextViewTests * process header attributes first * add tests * fix attributes creation order * more tests * more tests and some refactoring * still more tests * add button highlighting for lists * update list tests * add test stubs * improve lists * tidy up * more tests * tidy up * tidy up * tidy up * tidy up * add MarkdownTextStorageTests * fix Down import in tests * remove Marklight * update method name & remove unused method * fix typo * fix rendering for obfuscated messages * tidy up * trim trailing newline if present * update drafts to store attributed text * adjust paragraph style * tidy up * update buttons after validating list * adjust style * adjust style * update snapshot tests * uodate test * bump component * update third party notices * Bump Down.framework * Try #2 * Correct tag * Multi library approach
- Loading branch information
1 parent
0dcfdbd
commit 73d1a00
Showing
34 changed files
with
1,908 additions
and
1,296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//// | ||
// Wire | ||
// Copyright (C) 2018 Wire Swiss GmbH | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see http://www.gnu.org/licenses/. | ||
// | ||
|
||
import XCTest | ||
@testable import Wire | ||
import Down | ||
|
||
final class MarkdownTextStorageTests: XCTestCase { | ||
|
||
var sut: MarkdownTextStorage! | ||
|
||
override func setUp() { | ||
super.setUp() | ||
sut = MarkdownTextStorage() | ||
} | ||
|
||
override func tearDown() { | ||
sut = nil | ||
super.tearDown() | ||
} | ||
|
||
func testThatItCorrectlyAddsMarkdownIDAttributeAfterAutocorrect() { | ||
// GIVEN | ||
let correction = "their" | ||
let wholeRange = NSMakeRange(0, correction.characters.count) | ||
sut.currentMarkdown = .bold | ||
// WHEN: simulate inserting autocorrected text | ||
sut.replaceCharacters(in: NSMakeRange(0, 0), with: correction) | ||
sut.setAttributes([:], range: wholeRange) | ||
// THEN | ||
var effectiveRange = NSMakeRange(NSNotFound, 0) | ||
let result = sut.attribute(MarkdownIDAttributeName, at: 0, effectiveRange: &effectiveRange) as? Markdown | ||
XCTAssertEqual(.bold, result) | ||
XCTAssertEqual(wholeRange, effectiveRange) | ||
} | ||
|
||
} |
Oops, something went wrong.