Skip to content

Commit

Permalink
fix tests for phantomjs
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Oct 26, 2014
1 parent c1f9f6f commit 0a669f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Editor

focus: ->
@selection.setRange(@selection.range) if dom.isIE(11)
@renderer.iframe.focus() if dom.isIOS()
@renderer.iframe.focus()
@root.focus()

getDelta: ->
Expand Down
4 changes: 3 additions & 1 deletion src/core/selection.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ class Selection
return unless selection
if startNode?
# Some reason need to focus before removing ranges otherwise cannot set them
@doc.root.focus() unless this.checkFocus()
unless this.checkFocus()
@iframe.focus()
@doc.root.focus()
nativeRange = this._getNativeRange()
if !nativeRange? or startNode != nativeRange.startContainer or startOffset != nativeRange.startOffset or endNode != nativeRange.endContainer or endOffset != nativeRange.endOffset
# IE9 requires removeAllRanges() regardless of value of
Expand Down
2 changes: 1 addition & 1 deletion test/unit/core/selection.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ describe('Selection', ->
expect(savedRange.end).toEqual(3)
@quill.focus()
range = @quill.getSelection()
expect(range).toBeTruthy()
expect(range).not.toEqual(null)
expect(range.start).toEqual(2)
expect(range.end).toEqual(3)
done()
Expand Down

0 comments on commit 0a669f0

Please sign in to comment.