Skip to content

Commit

Permalink
add selection save/restore test
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Aug 20, 2014
1 parent e6ffc36 commit 1bf6c57
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/unit/core/selection.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,27 @@ describe('Selection', ->
)
)
)

describe('save / restore selection', ->
it('focus on another input', (done) ->
@container.innerHTML = '<input type="textbox"><div>0123</div>'
@quill = new Quill(@container.lastChild)
@quill.setSelection(2, 3)
@container.firstChild.focus()
_.defer( =>
expect(@quill.editor.selection.checkFocus()).not.toBeTruthy()
expect(@quill.getSelection()).not.toBeTruthy()
savedRange = @quill.editor.selection.getRange(true)
expect(savedRange).toBeTruthy()
expect(savedRange.start).toEqual(2)
expect(savedRange.end).toEqual(3)
@quill.focus()
range = @quill.getSelection()
expect(range).toBeTruthy()
expect(range.start).toEqual(2)
expect(range.end).toEqual(3)
done()
)
)
)
)

0 comments on commit 1bf6c57

Please sign in to comment.