Make spec more comprehensive

This commit is contained in:
Antonio Scandurra
2016-01-05 11:08:30 +01:00
parent 1376afe17e
commit 8603ceb7e8

View File

@@ -2289,7 +2289,7 @@ describe "TextEditorPresenter", ->
presenter.setBlockDecorationDimensions(blockDecoration1, 0, 20)
expect(stateForBlockDecoration(presenter, blockDecoration1)).toBeUndefined()
it "contains state for block decorations, indicating the screen row they belong to both initially and when their markers move", ->
it "contains state for on-screen and unmeasured block decorations, both initially and when they are updated or destroyed", ->
item = {}
blockDecoration1 = addBlockDecorationForScreenRow(0, item)
blockDecoration2 = addBlockDecorationForScreenRow(4, item)
@@ -2375,6 +2375,17 @@ describe "TextEditorPresenter", ->
isVisible: true
}
blockDecoration1.destroy()
expect(stateForBlockDecoration(presenter, blockDecoration1)).toBeUndefined()
expect(stateForBlockDecoration(presenter, blockDecoration2)).toBeUndefined()
expect(stateForBlockDecoration(presenter, blockDecoration3)).toBeUndefined()
expectValues stateForBlockDecoration(presenter, blockDecoration4), {
decoration: blockDecoration4
screenRow: 10
isVisible: true
}
it "doesn't throw an error when setting the dimensions for a destroyed decoration", ->
blockDecoration = addBlockDecorationForScreenRow(0)
presenter = buildPresenter()