Skip to content

Commit 5e48bd5

Browse files
committed
Test new behaiour
1 parent ede7180 commit 5e48bd5

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

test/test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ describe('quote-selection', function () {
101101

102102
assert.equal(textarea.value, 'Has text\n\n> bold\n\n')
103103
})
104+
105+
it('allows processing the quoted text before inserting it', function () {
106+
const el = document.querySelector('#quotable')
107+
const selection = window.getSelection()
108+
window.getSelection = () => createSelection(selection, el)
109+
110+
const textarea = document.querySelector('#not-hidden-textarea')
111+
const quote = new Quote()
112+
quote.processSelectionTextFn = text => text.replace('Quotable', 'replaced')
113+
114+
quote.insert(textarea)
115+
116+
assert.equal(textarea.value, 'Has text\n\n> Test replaced text, bold.\n\n')
117+
})
104118
})
105119

106120
describe('with markdown enabled', function () {

0 commit comments

Comments
 (0)