Sha256: 729b272655176fba0f230d566234153b0e5178afbafd3037d324973f4e07e356
Contents?: true
Size: 1.38 KB
Versions: 5
Compression:
Stored size: 1.38 KB
Contents
Model = Lanes.Test.defineModel( props: {id: 'integer', code: 'string', name: 'string', notes: 'string'} ) describe "Lanes.Components.NetworkActivityOverlay", -> it "doesn't render unless requesting", -> na = LT.renderComponent(LC.NetworkActivityOverlay, props:{message: 'Lookout 4 Bears'}) expect(_.dom(na).el).toBe(null) it "renders message", -> na = LT.renderComponent(LC.NetworkActivityOverlay, props:{ visible: true, message: 'Lookout 4 Bears'}) expect(_.dom(na).qs('.message').text).toBe('Lookout 4 Bears') it 'chooses message based on request type', -> na = LT.renderComponent(LC.NetworkActivityOverlay, props:{visible:true}) na.setState(isRequesting: 'GET') expect(_.dom(na).qs('.message').text).toBe('Loading…') na.setState(isRequesting: 'POST') expect(_.dom(na).qs('.message').text).toBe('Saving…') na.setState(isRequesting: 'DELETE') expect(_.dom(na).qs('.message').text).toBe('Deleting…') it 'briefly displays an error message', (done) -> model = new Model na = LT.renderComponent(LC.NetworkActivityOverlay, props:{ errorTimeout: 2, model:model}) na.setDataState(hasError: true) expect(_.dom(na).qs('.message').text).toBe('Error') _.delay( -> expect(_.dom(na).el).toBe(null) done() , 3)
Version data entries
5 entries across 5 versions & 1 rubygems