 
       it('empty document', ->
         @container.innerHTML = '<div></div>'
-        @doc = new Quill.Document(@container.firstChild, { formats: Quill.DEFAULTS.formats })
-        @selection = new Quill.Selection(@doc, @emitter)
-        index = @selection._positionToIndex(@doc.root, 0)
+        quill = new Quill(@container.firstChild)
+        index = quill.editor.selection._positionToIndex(quill.editor.doc.root, 0)
         expect(index).toEqual(0)
       )
     )

describe('Selection', ->
  beforeEach( ->
    @container = $('#editor-container').html('').get(0)
  )

  it('constructor', -> )
  it('checkFocus', -> )
  it('getRange', -> )
  it('preserve', -> )
  it('setRange', -> )
  it('shiftAfter', -> )
  it('update', -> )
  it('_getNativeRange', -> )
  it('_setNativeRange', -> )


  describe('helpers', ->
    beforeEach( ->
      @container.innerHTML = '
        <div>
          <div><span>0123</span></div>
          <div><br></div>
          <div><img></div>
          <div><b><s>89</s></b><i>ab</i></div>
        </div>
      '
      @doc = new Quill.Document(@container.firstChild, { formats: Quill.DEFAULTS.formats })
      @emitter = new Quill.Lib.EventEmitter2
      @selection = new Quill.Selection(@doc, @emitter)
    )

    tests =
      'text node':
        native: ->


      it('empty document', ->
        @container.innerHTML = '<div></div>'
        quill = new Quill(@container.firstChild)
        [resultNode, resultIndex] = quill.editor.selection._normalizePosition(quill.editor.doc.root, 0)
        expect(resultNode).toEqual(quill.editor.doc.root)
        expect(resultIndex).toEqual(0)
      )
    )
