     # Simply selecting area between quote is that normal user expects.
     # it "applies operators inside the next string in operator-pending mode (if not in a string)", ->
     it "[Changed behavior] applies operators inside area between quote", ->
-      cursor [0, 29]
-      ensureKeystroke "di'",
+      set
+        cursor: [0, 29]
+      ensure "di'",
         text: "' something in here and in '' ' and over here"
         cursor: [0, 28]
 
     it "makes no change if past the last string on a line", ->
-      cursor [0, 39]
-      ensureKeystroke "di'",
+      set
+        cursor: [0, 39]
+      ensure "di'",
         text: "' something in here and in 'here' ' and over here"
         cursor: [0, 39]
 
   describe "the 'i\"' text object", ->
     beforeEach ->
-      text '" something in here and in "here" " and over here'
-      cursor [0, 9]
+      set
+        text: '" something in here and in "here" " and over here'
+        cursor: [0, 9]
 
     it "applies operators inside the current string in operator-pending mode", ->
-      ensureKeystroke 'di"',
+      ensure 'di"',
         text: '""here" " and over here'
         cursor: [0, 1]
 
     it "[Changed behavior] applies operators inside area between quote", ->
-      cursor [0, 29]
-      ensureKeystroke 'di"',
+      set
+        cursor: [0, 29]
+      ensure 'di"',
         text: '" something in here and in "" " and over here'
         cursor: [0, 28]
 
     it "makes no change if past the last string on a line", ->
-      cursor [0, 39]
-      ensureKeystroke 'di"',
+      set
+        cursor: [0, 39]
+      ensure 'di"',
         text: '" something in here and in "here" " and over here'
         cursor: [0, 39]
 
   describe "the 'aw' text object", ->
     beforeEach ->
-      text "12345 abcde ABCDE"
-      cursor [0, 9]
+      set
+        text: "12345 abcde ABCDE"
+        cursor: [0, 9]
 
     it "applies operators from the start of the current word to the start of the next word in operator-pending mode", ->
-      ensureKeystroke 'daw',
+      ensure 'daw',
         text: "12345 ABCDE"
         cursor: [0, 6]
         register: "abcde "
 
     it "selects from the start of the current word to the start of the next word in visual mode", ->
-      ensureKeystroke 'vaw',
+      ensure 'vaw',
         selectedScreenRange: [[0, 6], [0, 12]]
 
     it "doesn't span newlines", ->
-      text "12345\nabcde ABCDE"
-      cursor [0, 3]
-      ensureKeystroke 'vaw',
+      set
+        text: "12345\nabcde ABCDE"
+        cursor: [0, 3]
+      ensure 'vaw',
         selectedBufferRange: [[0, 0], [0, 5]]
 
     it "doesn't span special characters", ->
-      text "1(345\nabcde ABCDE"
-      cursor [0, 3]
-      ensureKeystroke 'vaw',
+      set
+        text: "1(345\nabcde ABCDE"
+        cursor: [0, 3]
+      ensure 'vaw',
         selectedBufferRange: [[0, 2], [0, 5]]
 
   describe "the 'aW' text object", ->
     beforeEach ->
-      text "12(45 ab'de ABCDE"
-      cursor [0, 9]
+      set
+        text: "12(45 ab'de ABCDE"
+        cursor: [0, 9]
 
     it "applies operators from the start of the current whole word to the start of the next whole word in operator-pending mode", ->
-      ensureKeystroke 'daW',
+      ensure 'daW',
         text: "12(45 ABCDE"
         cursor: [0, 6]
         register: "ab'de "
 
     it "selects from the start of the current whole word to the start of the next whole word in visual mode", ->
-      ensureKeystroke 'vaW',
+      ensure 'vaW',
         selectedScreenRange: [[0, 6], [0, 12]]
 
     it "doesn't span newlines", ->
-      text "12(45\nab'de ABCDE"
-      cursor [0, 4]
-      ensureKeystroke 'vaW',
+      set
+        text: "12(45\nab'de ABCDE"
+        cursor: [0, 4]
+      ensure 'vaW',
         selectedBufferRange: [[0, 0], [0, 5]]
 
   describe "the 'a(' text object", ->
     beforeEach ->
-      text "( something in here and in (here) )"
-      cursor [0, 9]
+      set
+        text: "( something in here and in (here) )"
+        cursor: [0, 9]
 
     it "applies operators around the current parentheses in operator-pending mode", ->
-      ensureKeystroke 'da(',
+      ensure 'da(',
         text: ''
         cursor: [0, 0]
 
     it "applies operators around the current parentheses in operator-pending mode (second test)", ->
-      cursor [0, 29]
-      ensureKeystroke 'da(',
+      set
+        cursor: [0, 29]
+      ensure 'da(',
         text: "( something in here and in  )"
         cursor: [0, 27]
 
   describe "the 'a{' text object", ->
     beforeEach ->
-      text "{ something in here and in {here} }"
-      cursor [0, 9]
+      set
+        text: "{ something in here and in {here} }"
+        cursor: [0, 9]
 
     it "applies operators around the current curly brackets in operator-pending mode", ->
-      ensureKeystroke 'da{',
+      ensure 'da{',
         text: ''
         cursor: [0, 0]
 
     it "applies operators around the current curly brackets in operator-pending mode (second test)", ->
-      cursor [0, 29]
-      ensureKeystroke 'da{',
+      set
+        cursor: [0, 29]
+      ensure 'da{',
         text: "{ something in here and in  }"
         cursor: [0, 27]
 
   describe "the 'a<' text object", ->
     beforeEach ->
-      text "< something in here and in <here> >"
-      cursor [0, 9]
+      set
+        text: "< something in here and in <here> >"
+        cursor: [0, 9]
 
     it "applies operators around the current angle brackets in operator-pending mode", ->
-      ensureKeystroke 'da<',
+      ensure 'da<',
         text: ''
         cursor: [0, 0]
 
     it "applies operators around the current angle brackets in operator-pending mode (second test)", ->
-      cursor [0, 29]
-      ensureKeystroke 'da<',
+      set
+        cursor: [0, 29]
+      ensure 'da<',
         text: "< something in here and in  >"
         cursor: [0, 27]
 
   describe "the 'a[' text object", ->
     beforeEach ->
-      text "[ something in here and in [here] ]"
-      cursor [0, 9]
+      set
+        text: "[ something in here and in [here] ]"
+        cursor: [0, 9]
 
     it "applies operators around the current square brackets in operator-pending mode", ->
-      ensureKeystroke 'da[',
+      ensure 'da[',
         text: ''
         cursor: [0, 0]
 
     it "applies operators around the current square brackets in operator-pending mode (second test)", ->
-      cursor [0, 29]
-      ensureKeystroke 'da[',
+      set
+        cursor: [0, 29]
+      ensure 'da[',
         text: "[ something in here and in  ]"
         cursor: [0, 27]
 
   describe "the 'a\'' text object", ->
     beforeEach ->
-      text "' something in here and in 'here' '"
-      cursor [0, 9]
+      set
+        text: "' something in here and in 'here' '"
+        cursor: [0, 9]
 
     it "applies operators around the current single quotes in operator-pending mode", ->
-      ensureKeystroke "da'",
+      ensure "da'",
         text: "here' '"
         cursor: [0, 0]
 
     it "applies operators around the current single quotes in operator-pending mode (second test)", ->
-      cursor [0, 29]
-      ensureKeystroke "da'",
+      set
+        cursor: [0, 29]
+      ensure "da'",
         text: "' something in here and in  '"
         cursor: [0, 27]
 
   describe "the 'a\"' text object", ->
     beforeEach ->
-      text '" something in here and in "here" "'
-      cursor [0, 9]
+      set
+        text: '" something in here and in "here" "'
+        cursor: [0, 9]
 
     it "applies operators around the current double quotes in operator-pending mode", ->
-      ensureKeystroke 'da"',
+      ensure 'da"',
         text: 'here" "'
         cursor: [0, 0]
 
     it "applies operators around the current double quotes in operator-pending mode (second test)", ->
-      cursor [0, 29]
-      ensureKeystroke 'da"',
+      set
+        cursor: [0, 29]
+      ensure 'da"',
         text: '" something in here and in  "'
         cursor: [0, 27]

helpers = require './spec-helper'

describe "TextObjects", ->
  [editor, editorElement, vimState] = []

  beforeEach ->


  describe "the 'iW' text object", ->
    beforeEach ->
      set
        text: "12(45 ab'de ABCDE"
        cursor: [0, 9]

    it "applies operators inside the current whole word in operator-pending mode", ->
      ensure 'diW',
        text:     "12(45  ABCDE"
        cursor:   [0, 6]
        register: "ab'de"

    it "selects inside the current whole word in visual mode", ->
      ensure 'viW',
        selectedScreenRange: [[0, 6], [0, 11]]

  describe "the 'i(' text object", ->
    beforeEach ->
      set
        text: "( something in here and in (here) )"
        cursor: [0, 9]

    it "applies operators inside the current word in operator-pending mode", ->
      ensure 'di(',
        text: "()"
        cursor: [0, 1]

    it "applies operators inside the current word in operator-pending mode (second test)", ->
      set
        cursor: [0, 29]
      ensure 'di(',
        text: "( something in here and in () )"
        cursor: [0, 28]

    it "works with multiple cursors", ->
      set
        text: "( a b ) cde ( f g h ) ijk"
        cursor: [0, 2]
        addCursor: [0, 18]
      ensure 'vi(',
        selectedBufferRanges: [
          [[0, 1],  [0, 6]]
          [[0, 13], [0, 20]]
