fix tests, refactor repo-actions component

This commit is contained in:
Lisa P 2016-02-01 12:59:35 +01:00
parent cd7ab9b719
commit 1c4f748b2e
3 changed files with 17 additions and 34 deletions

View File

@ -1,3 +1,7 @@
import Ember from 'ember';
export default Ember.Component.extend({});
export default Ember.Component.extend({
classNames: ['repo-main-tools']
});

View File

@ -1,11 +1,7 @@
<div id="actions" class="repo-main-tools">
{{! TODO: when `component` helper is available we could just use
with a component name based on type that is passed here }}
{{#if job}}
{{job-repo-actions job=job user=user repo=repo}}
{{else}}
{{build-repo-actions build=build user=user repo=repo}}
{{/if}}
</div>
{{! TODO: when `component` helper is available we could just use
with a component name based on type that is passed here }}
{{#if job}}
{{job-repo-actions job=job user=user repo=repo}}
{{else}}
{{build-repo-actions build=build user=user repo=repo}}
{{/if}}

View File

@ -5,28 +5,11 @@ moduleForComponent('repo-actions', 'RepoActionsComponent', {
needs: ['component:build-repo-actions', 'component:job-repo-actions']
});
test('it displays code climate if the repo language is ruby', function() {
var component, repo;
repo = Ember.Object.create({
githubLanguage: 'Ruby'
});
component = this.subject({
repo: repo
});
this.append();
ok(component.get('displayCodeClimate'), 'component should try to display code climate');
return ok(component.$('a[name=code-climate]').length, 'component should render a code climate button');
});
test('it renders', function() {
test('it doesn\'t display code climate for other languages', function() {
var component, repo;
repo = Ember.Object.create({
githubLanguage: 'Go'
});
component = this.subject({
repo: repo
});
var component;
component = this.subject({});
this.append();
ok(!component.get('displayCodeClimate'), 'component should not try to display code climate');
return ok(!component.$('a[name=code-climate]').length, 'component should not render a code climate button');
return ok(component.$().hasClass('repo-main-tools'), 'component has class');
});