Another stab at fixing the tests.

This commit is contained in:
Scott Erickson 2014-08-14 14:22:02 -07:00
parent 2060bb5ac5
commit 9404c40b47

View file

@ -35,27 +35,31 @@ describe 'ThangComponentsEditView', ->
supermodel.registerModel(componentC)
view = new ThangComponentEditView({ components: [], supermodel: supermodel })
jasmine.Ajax.requests.sendResponses { '/db/thang.type': [] }
_.delay ->
_.defer ->
view.render()
view.componentsTreema.set('/', [ { original: 'C', majorVersion: 0 }])
spyOn(window, 'noty')
done()
success = jasmine.Ajax.requests.sendResponses(responses)
expect(success).toBeTruthy()
_.defer ->
done()
afterEach ->
view.destroy()
it 'loads dependencies when you add a component with the left side treema', ->
success = jasmine.Ajax.requests.sendResponses(responses)
expect(success).toBeTruthy()
expect(_.size(view.subviews)).toBe(3)
# TODO: Figure out why this is breaking karma but not always
xit 'adds dependencies to its components list', ->
jasmine.Ajax.requests.sendResponses(responses)
it 'adds dependencies to its components list', ->
# jasmine.Ajax.requests.sendResponses(responses)
componentOriginals = (c.original for c in view.components)
expect('A' in componentOriginals).toBeTruthy()
expect('B' in componentOriginals).toBeTruthy()
expect('C' in componentOriginals).toBeTruthy()
it 'removes components that are dependent on a removed component', ->
jasmine.Ajax.requests.sendResponses(responses)
# jasmine.Ajax.requests.sendResponses(responses)
view.components = (c for c in view.components when c.original isnt 'A')
view.onComponentsChanged()
expect(view.components.length).toBe(0)