 
   it 'insert words correctly', ->
     rte1 = new Rte "is"
-    rte1.insertWords(0, ["This"])
+    rte1.insertWords(0, ["This "])
     rte1.val().should.equal "This is"
-    rte1.insertWords(2, ["sparta", "!"])
+    rte1.insertWords(2, [" sparta ", "!"])
     rte1.val().should.equal "This is sparta !"
 
   it 'delete words correctly', ->


    rte1 = new Rte "There is a mistake in this sentence! there"
    rte1.deleteWords(7, 8)
    rte1.val().should.equal "There is a mistake in this sentence!"

  it 'insert characters correctly at relative position', ->
    rte1 = new Rte "I lot the gam"
    rte1.insert({startPos: {word:1, pos:2}}, 's')
    rte1.val().should.equal "I lost the gam"


describe 'Selection object should', ->
  sel = rte = null
  it 'be initialized with two parameters', ->
    [a, b, c, d] = [1, 2, 3, 4]
    sel = new Selection({word: 1, pos: 2}, {word: 3, pos: 4})

    sel.startPos.word.should.equal a
    sel.startPos.pos.should.equal b
    sel.endPos.word.should.equal c
    sel.endPos.pos.should.equal d

  it 'be initialized with three parameters', ->
    rte = new Rte "Zero One two three four five"
    sel = new Selection 1, 7, rte

    sel.should.have.property('startPos')
    sel.should.have.deep.property('startPos.word', 0)
    sel.should.have.deep.property('startPos.pos', 1)

    sel.should.have.property('endPos')
    sel.should.have.deep.property('endPos.word', 0)
    sel.should.have.deep.property('endPos.pos', 1)

  it 'be initialized with four parameters', ->
    sel = new Selection 0, 1, 2, 3

    sel.should.have.property('startPos')
    sel.should.have.deep.property('startPos.word', 0)
    sel.should.have.deep.property('startPos.pos', 1)

    sel.should.have.property('endPos')
    sel.should.have.deep.property('endPos.word', 2)
    sel.should.have.deep.property('endPos.pos', 3)
