Skip to content

Commit

Permalink
Test PreserveInlineStyle in links
Browse files Browse the repository at this point in the history
  • Loading branch information
amantoux committed Dec 5, 2023
1 parent 69317ce commit 5ad3be2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/parchment/test/heuristics/insert_rules_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,32 @@ void main() {
expect(expected, actual);
});

test('apply preserve link formatting within link', () {
final doc = Delta()
..insert('Doc with link')
..insert('http://fleather-editor.github.io',
{'a': 'http://fleather-editor.github.io'})
..insert(' link');
final actual = rule.apply(doc, 17, 's');
final expected = Delta()
..retain(17)
..insert('s', {'a': 'http://fleather-editor.github.io'});
expect(expected, actual);
});

test('apply remove link formatting on link boundaries', () {
final doc = Delta()
..insert('Doc with link')
..insert('http://fleather-editor.github.io',
{'a': 'http://fleather-editor.github.io'})
..insert(' link');
final actual = rule.apply(doc, 13, 'like this ');
final expected = Delta()
..retain(13)
..insert('like this ');
expect(expected, actual);
});

test('apply at the beginning of a document', () {
final doc = Delta()..insert('Doc with ');
final actual = rule.apply(doc, 0, 'A ');
Expand Down

0 comments on commit 5ad3be2

Please sign in to comment.