     expectedDelta = {
       ops: [{ insert: text }]
     }
-    browser.switchTo().defaultContent()
     expect(deltaOutput.getText()).toEqual(JSON.stringify(expectedDelta))
     # Selection should not change due to typing
     expect(startRange.getText()).toEqual('0')

  it('enter', ->
    editor.sendKeys(protractor.Key.RETURN)
    expectedDelta = { ops: [{ retain: 10 }, { insert: '\n' }] }
    browser.switchTo().defaultContent()
    expect(deltaOutput.getText()).toEqual(JSON.stringify(expectedDelta))
    browser.switchTo().frame('quill-1')

    editor.sendKeys(protractor.Key.RETURN)
    expectedDelta = { ops: [{ retain: 11 }, { insert: '\n' }] }
    browser.switchTo().defaultContent()
    expect(deltaOutput.getText()).toEqual(JSON.stringify(expectedDelta))
    browser.switchTo().frame('quill-1')

    text = 'Chapter 1. Loomings.'
    editor.sendKeys(text)
    updateEditor(false)
    # The previous newline inserts was assumed to be appended since the insertion character matches
    # the last character of the document. There is no such ambiguity here so the number of retains
    # is the same as the last delta
    expectedDelta = { ops: [{ retain: 11 }, { insert: "#{text}" }] }
    expect(deltaOutput.getText()).toEqual(JSON.stringify(expectedDelta))
    browser.switchTo().frame('quill-1')

    editor.sendKeys(protractor.Key.RETURN)
    expectedDelta = { ops: [{ retain: 32 }, { insert: '\n' }] }
    browser.switchTo().defaultContent()
    expect(deltaOutput.getText()).toEqual(JSON.stringify(expectedDelta))
    browser.switchTo().frame('quill-1')
    expect(editor.getInnerHtml().then(cleanLines)).toEqual([
      '<div>The Whale</div>'
      '<div><br></div>'


  it('move cursor', ->
    editor.sendKeys(protractor.Key.ARROW_LEFT)
    updateEditor()
    expect(startRange.getText()).toEqual('1529')
    expect(endRange.getText()).toEqual('1529')
    [0..15].forEach( ->   # More than enough times to get back to the top
      editor.sendKeys(protractor.Key.ARROW_UP)
    )
    updateEditor()
    expect(startRange.getText()).toEqual('0')
    expect(endRange.getText()).toEqual('0')
    [0..3].forEach( ->
      editor.sendKeys(protractor.Key.ARROW_RIGHT)
    )
    updateEditor()
    expect(startRange.getText()).toEqual('4')
    expect(endRange.getText()).toEqual('4')
  )
