Sha256: 18ed31e4ff952709083dfa2fb7245e8d939e655ca0f7ad2da8dcec6067238134

Contents?: true

Size: 866 Bytes

Versions: 4

Compression:

Stored size: 866 Bytes

Contents

{assert, test, testGroup} = Trix.TestHelpers

testGroup "Trix.Text", ->
  testGroup "#removeTextAtRange", ->
    test "removes text with range in single piece", ->
      text = new Trix.Text [new Trix.StringPiece("abc")]
      pieces = text.removeTextAtRange([0,1]).getPieces()
      assert.equal pieces.length, 1
      assert.equal pieces[0].toString(), "bc"
      assert.deepEqual pieces[0].getAttributes(), {}

    test "removes text with range spanning pieces", ->
      text = new Trix.Text [new Trix.StringPiece("abc"), new Trix.StringPiece("123", bold: true)]
      pieces = text.removeTextAtRange([2,4]).getPieces()
      assert.equal pieces.length, 2
      assert.equal pieces[0].toString(), "ab"
      assert.deepEqual pieces[0].getAttributes(), {}
      assert.equal pieces[1].toString(), "23"
      assert.deepEqual pieces[1].getAttributes(), bold: true

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vapid-0.1.3 lib/vapid/vendor/trix/test/src/unit/text_test.coffee
vapid-0.1.2 lib/vapid/vendor/trix/test/src/unit/text_test.coffee
vapid-0.1.1 lib/vapid/vendor/trix/test/src/unit/text_test.coffee
vapid-0.1.0 lib/vapid/vendor/trix/test/src/unit/text_test.coffee