From 1c4f748b2e289ee790cd7e89c19b7b61949a15d2 Mon Sep 17 00:00:00 2001 From: Lisa P Date: Mon, 1 Feb 2016 12:59:35 +0100 Subject: [PATCH] fix tests, refactor repo-actions component --- app/components/repo-actions.js | 6 ++++- app/templates/components/repo-actions.hbs | 18 ++++++--------- tests/unit/components/repo-actions-test.js | 27 ++++------------------ 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/app/components/repo-actions.js b/app/components/repo-actions.js index 6e705e67..9063460d 100644 --- a/app/components/repo-actions.js +++ b/app/components/repo-actions.js @@ -1,3 +1,7 @@ import Ember from 'ember'; -export default Ember.Component.extend({}); +export default Ember.Component.extend({ + + classNames: ['repo-main-tools'] + +}); diff --git a/app/templates/components/repo-actions.hbs b/app/templates/components/repo-actions.hbs index de2bd03e..f05be9f0 100644 --- a/app/templates/components/repo-actions.hbs +++ b/app/templates/components/repo-actions.hbs @@ -1,11 +1,7 @@ -
- - {{! 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}} - -
+{{! 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}} diff --git a/tests/unit/components/repo-actions-test.js b/tests/unit/components/repo-actions-test.js index c9eb770f..dbc7ab80 100644 --- a/tests/unit/components/repo-actions-test.js +++ b/tests/unit/components/repo-actions-test.js @@ -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'); + });