Skip to content

Commit

Permalink
Test new behaiour
Browse files Browse the repository at this point in the history
  • Loading branch information
alondahari committed Jun 4, 2024
1 parent ede7180 commit 5e48bd5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ describe('quote-selection', function () {

assert.equal(textarea.value, 'Has text\n\n> bold\n\n')
})

it('allows processing the quoted text before inserting it', function () {
const el = document.querySelector('#quotable')
const selection = window.getSelection()
window.getSelection = () => createSelection(selection, el)

const textarea = document.querySelector('#not-hidden-textarea')
const quote = new Quote()
quote.processSelectionTextFn = text => text.replace('Quotable', 'replaced')

quote.insert(textarea)

assert.equal(textarea.value, 'Has text\n\n> Test replaced text, bold.\n\n')
})
})

describe('with markdown enabled', function () {
Expand Down

0 comments on commit 5e48bd5

Please sign in to comment.