add tests for builds-item
This commit is contained in:
parent
4e03709cca
commit
3d84a52dbc
|
@ -6,12 +6,29 @@ moduleForComponent 'builds-item', {
|
||||||
}
|
}
|
||||||
|
|
||||||
test 'it renders', (assert) ->
|
test 'it renders', (assert) ->
|
||||||
assert.expect 2
|
|
||||||
|
|
||||||
# creates the component instance
|
attributes = {
|
||||||
component = @subject()
|
id: 10000,
|
||||||
assert.equal component._state, 'preRender'
|
state: 'passed'
|
||||||
|
number: 11,
|
||||||
|
branch: 'foobarbranch',
|
||||||
|
message: undefined,
|
||||||
|
pullRequest: false,
|
||||||
|
eventType: 'push',
|
||||||
|
commit: {
|
||||||
|
sha: "a5e8093098f9c0fb46856b753fb8943c7fbf26f3",
|
||||||
|
branch: 'foobarbranch',
|
||||||
|
authorName: 'Test Author',
|
||||||
|
authorEmail: 'author@example.com'
|
||||||
|
}
|
||||||
|
repo: {
|
||||||
|
slug: 'foo/bar'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
component = @subject(build: attributes)
|
||||||
|
@append()
|
||||||
|
|
||||||
# renders the component to the page
|
ok component.$().hasClass('passed'), 'component has right status class'
|
||||||
@render()
|
equal component.$('.tile-main h2 small').text(), 'foobarbranch', 'component renders branch if event is push'
|
||||||
assert.equal component._state, 'inDOM'
|
equal component.$('.tile-author img').attr('src'), 'https://www.gravatar.com/avatar/5c1e6d6e64e12aca17657581a48005d1?s=40&d=https%3A%2F%2Ftravis-ci.org%2Fimages%2Fui%2Fdefault-avatar.png', 'component renders right gravatar image'
|
||||||
|
equal component.$('.build-status + p a').attr('href'), 'https://github.com/foo/bar/commit/a5e8093098f9c0fb46856b753fb8943c7fbf26f3', 'component generates right commit link'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user