This commit is contained in:
Nathan Sobo
2012-02-13 15:35:06 -07:00
parent 2d3822dc90
commit b0c67741e0

View File

@@ -29,9 +29,9 @@ describe "LineWrapper", ->
describe "when the number of screen lines remains the same for the changed buffer line", ->
it "re-wraps the existing lines and emits a change event for all its screen lines", ->
buffer.insert([6, 28], '1234567')
expect(tokensText(wrapper.screenLineForRow(7).tokens)).toBe ' current < pivot ? left1234567.push(current) '
expect(tokensText(wrapper.screenLineForRow(8).tokens)).toBe ': right.push(current);'
expect(tokensText(wrapper.screenLineForRow(9).tokens)).toBe ' }'
expect(wrapper.screenLineForRow(7).text).toBe ' current < pivot ? left1234567.push(current) '
expect(wrapper.screenLineForRow(8).text).toBe ': right.push(current);'
expect(wrapper.screenLineForRow(9).text).toBe ' }'
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
@@ -41,10 +41,10 @@ describe "LineWrapper", ->
describe "when the number of screen lines increases for the changed buffer line", ->
it "re-wraps and adds an additional screen line and emits a change event for all screen lines", ->
buffer.insert([6, 28], '1234567890')
expect(tokensText(wrapper.screenLineForRow(7).tokens)).toBe ' current < pivot ? '
expect(tokensText(wrapper.screenLineForRow(8).tokens)).toBe 'left1234567890.push(current) : '
expect(tokensText(wrapper.screenLineForRow(9).tokens)).toBe 'right.push(current);'
expect(tokensText(wrapper.screenLineForRow(10).tokens)).toBe ' }'
expect(wrapper.screenLineForRow(7).text).toBe ' current < pivot ? '
expect(wrapper.screenLineForRow(8).text).toBe 'left1234567890.push(current) : '
expect(wrapper.screenLineForRow(9).text).toBe 'right.push(current);'
expect(wrapper.screenLineForRow(10).text).toBe ' }'
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
@@ -54,8 +54,8 @@ describe "LineWrapper", ->
describe "when the number of screen lines decreases for the changed buffer line", ->
it "re-wraps and removes a screen line and emits a change event for all screen lines", ->
buffer.change(new Range([6, 24], [6, 42]), '')
expect(tokensText(wrapper.screenLineForRow(7).tokens)).toBe ' current < pivot ? : right.push(current);'
expect(tokensText(wrapper.screenLineForRow(8).tokens)).toBe ' }'
expect(wrapper.screenLineForRow(7).text).toBe ' current < pivot ? : right.push(current);'
expect(wrapper.screenLineForRow(8).text).toBe ' }'
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
@@ -65,10 +65,10 @@ describe "LineWrapper", ->
describe "when buffer lines are inserted", ->
it "re-wraps existing and new screen lines and emits a change event", ->
buffer.insert([6, 21], '1234567890 abcdefghij 1234567890\nabcdefghij')
expect(tokensText(wrapper.screenLineForRow(7).tokens)).toBe ' current < pivot1234567890 abcdefghij '
expect(tokensText(wrapper.screenLineForRow(8).tokens)).toBe '1234567890'
expect(tokensText(wrapper.screenLineForRow(9).tokens)).toBe 'abcdefghij ? left.push(current) : '
expect(tokensText(wrapper.screenLineForRow(10).tokens)).toBe 'right.push(current);'
expect(wrapper.screenLineForRow(7).text).toBe ' current < pivot1234567890 abcdefghij '
expect(wrapper.screenLineForRow(8).text).toBe '1234567890'
expect(wrapper.screenLineForRow(9).text).toBe 'abcdefghij ? left.push(current) : '
expect(wrapper.screenLineForRow(10).text).toBe 'right.push(current);'
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]
@@ -78,10 +78,10 @@ describe "LineWrapper", ->
describe "when buffer lines are removed", ->
it "removes screen lines and emits a change event", ->
buffer.change(new Range([3, 21], [7, 5]), ';')
expect(tokensText(wrapper.screenLineForRow(3).tokens)).toBe ' var pivot = items;'
expect(tokensText(wrapper.screenLineForRow(4).tokens)).toBe ' return '
expect(tokensText(wrapper.screenLineForRow(5).tokens)).toBe 'sort(left).concat(pivot).concat(sort(right));'
expect(tokensText(wrapper.screenLineForRow(6).tokens)).toBe ' };'
expect(wrapper.screenLineForRow(3).text).toBe ' var pivot = items;'
expect(wrapper.screenLineForRow(4).text).toBe ' return '
expect(wrapper.screenLineForRow(5).text).toBe 'sort(left).concat(pivot).concat(sort(right));'
expect(wrapper.screenLineForRow(6).text).toBe ' };'
expect(changeHandler).toHaveBeenCalled()
[event] = changeHandler.argsForCall[0]