fix tests, refactor repo-actions component
This commit is contained in:
parent
cd7ab9b719
commit
1c4f748b2e
|
@ -1,3 +1,7 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
|
||||||
export default Ember.Component.extend({});
|
export default Ember.Component.extend({
|
||||||
|
|
||||||
|
classNames: ['repo-main-tools']
|
||||||
|
|
||||||
|
});
|
||||||
|
|
|
@ -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 }}
|
||||||
{{! TODO: when `component` helper is available we could just use
|
{{#if job}}
|
||||||
with a component name based on type that is passed here }}
|
{{job-repo-actions job=job user=user repo=repo}}
|
||||||
{{#if job}}
|
{{else}}
|
||||||
{{job-repo-actions job=job user=user repo=repo}}
|
{{build-repo-actions build=build user=user repo=repo}}
|
||||||
{{else}}
|
{{/if}}
|
||||||
{{build-repo-actions build=build user=user repo=repo}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -5,28 +5,11 @@ moduleForComponent('repo-actions', 'RepoActionsComponent', {
|
||||||
needs: ['component:build-repo-actions', 'component:job-repo-actions']
|
needs: ['component:build-repo-actions', 'component:job-repo-actions']
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it displays code climate if the repo language is ruby', function() {
|
test('it renders', 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 doesn\'t display code climate for other languages', function() {
|
var component;
|
||||||
var component, repo;
|
component = this.subject({});
|
||||||
repo = Ember.Object.create({
|
|
||||||
githubLanguage: 'Go'
|
|
||||||
});
|
|
||||||
component = this.subject({
|
|
||||||
repo: repo
|
|
||||||
});
|
|
||||||
this.append();
|
this.append();
|
||||||
ok(!component.get('displayCodeClimate'), 'component should not try to display code climate');
|
return ok(component.$().hasClass('repo-main-tools'), 'component has class');
|
||||||
return ok(!component.$('a[name=code-climate]').length, 'component should not render a code climate button');
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user