write some tests
This commit is contained in:
parent
23e719ed78
commit
126c767fe1
|
@ -14,7 +14,7 @@ Controller = Ember.Controller.extend
|
||||||
deletingDone = => @set('isDeleting', false)
|
deletingDone = => @set('isDeleting', false)
|
||||||
|
|
||||||
repo = @get('repo')
|
repo = @get('repo')
|
||||||
Ajax.ajax("/repos/#{repo.get('id')}/caches", "DELETE").then(deletingDone, deletingDone).then =>
|
Ajax.ajax("/repos/#{@get('cache.repository_id')}/caches", "DELETE").then(deletingDone, deletingDone).then =>
|
||||||
@set('model', {})
|
@set('model', {})
|
||||||
|
|
||||||
`export default Controller`
|
`export default Controller`
|
||||||
|
|
|
@ -7,7 +7,6 @@ Route = TravisRoute.extend
|
||||||
setupController: (controller) ->
|
setupController: (controller) ->
|
||||||
@_super.apply this, arguments
|
@_super.apply this, arguments
|
||||||
@controllerFor('repo').activate('caches')
|
@controllerFor('repo').activate('caches')
|
||||||
controller.set('repo', @controllerFor('repo').get('repo'))
|
|
||||||
|
|
||||||
model: ->
|
model: ->
|
||||||
repo = @modelFor('repo')
|
repo = @modelFor('repo')
|
||||||
|
|
|
@ -1,17 +1,23 @@
|
||||||
`import { test, moduleForComponent } from 'ember-qunit'`
|
`import { test, moduleForComponent } from 'ember-qunit'`
|
||||||
|
|
||||||
moduleForComponent 'caches-item', 'CachesItemComponent', {
|
moduleForComponent 'caches-item', 'CachesItemComponent', {
|
||||||
# specify the other units that are required for this test
|
needs: ['helper:format-time', 'helper:mb']
|
||||||
# needs: ['component:foo', 'helper:bar']
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test 'it renders', ->
|
test 'it renders', ->
|
||||||
expect 2
|
|
||||||
|
|
||||||
# creates the component instance
|
attributes = {
|
||||||
component = @subject()
|
repository_id: 10,
|
||||||
equal component._state, 'preRender'
|
size: 1024 * 1024,
|
||||||
|
branch: "master",
|
||||||
|
last_modified: "2015-04-16T11:25:00Z",
|
||||||
|
type: "push"
|
||||||
|
}
|
||||||
|
|
||||||
# appends the component to the page
|
component = @subject(cache: attributes)
|
||||||
@append()
|
@append()
|
||||||
equal component._state, 'inDOM'
|
|
||||||
|
ok component.$().hasClass('push'), 'component should have a type class (push)'
|
||||||
|
equal component.$('.caches-branch').text().trim(), 'master', 'branch name should be displayed'
|
||||||
|
# equal component.$('.caches-date').text().trim(), '', ''
|
||||||
|
equal component.$('.caches-size').text().trim(), '1.00MB', 'size should be displayed'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user