Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enabled optional selection of a github repo when creating a task, so …
…that task can be synced with a github issue
- Loading branch information
Showing
23 changed files
with
258 additions
and
51 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Ember from 'ember'; | ||
|
||
const { Component } = Ember; | ||
|
||
export default Component.extend({ | ||
classNames: ['select-github-repo'], | ||
|
||
githubRepos: null | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.select-github-repo select { | ||
width: 100%; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{{#x-select value=selectedRepo action=onSelected as |xs|}} | ||
{{#xs.option value=null}}None (default){{/xs.option}} | ||
{{#each githubRepos as |githubRepo|}} | ||
{{#xs.option value=githubRepo}}{{githubRepo.name}}{{/xs.option}} | ||
{{/each}} | ||
{{/x-select}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { Factory, faker } from 'ember-cli-mirage'; | ||
|
||
export default Factory.extend({ | ||
name: faker.internet.domainWord | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Factory } from 'ember-cli-mirage'; | ||
|
||
export default Factory.extend({ | ||
// ensures creation of associated records if they were not otherwise specified | ||
afterCreate(record, server) { | ||
if (!record.githubRepo) { | ||
record.githubRepo = server.create('github-repo'); | ||
record.save(); | ||
} | ||
|
||
if (!record.project) { | ||
record.project = server.create('project'); | ||
record.save(); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import Ember from 'ember'; | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
import selectGithubRepoComponent from '../../../pages/components/select/github-repo'; | ||
import PageObject from 'ember-cli-page-object'; | ||
|
||
const { get, run, set } = Ember; | ||
|
||
let page = PageObject.create(selectGithubRepoComponent); | ||
|
||
function renderPage() { | ||
page.render(hbs` | ||
{{select/github-repo | ||
githubRepos=githubRepos | ||
selectedRepo=selectedRepo | ||
onSelected=(action (mut selectedRepo)) | ||
}} | ||
`); | ||
} | ||
|
||
moduleForComponent('select/github-repo', 'Integration | Component | select/github repo', { | ||
integration: true, | ||
beforeEach() { | ||
page.setContext(this); | ||
}, | ||
afterEach() { | ||
page.removeContext(); | ||
} | ||
}); | ||
|
||
test('it renders options', function(assert) { | ||
assert.expect(3); | ||
|
||
let githubRepos = [ | ||
{ name: 'Repo 1', id: 1 }, | ||
{ name: 'Repo 2', id: 2 } | ||
]; | ||
|
||
set(this, 'githubRepos', githubRepos); | ||
|
||
renderPage(); | ||
|
||
assert.equal(page.select.options(0).text, 'None (default)', 'The default option of none renders.'); | ||
assert.equal(page.select.options(1).text, 'Repo 1'); | ||
assert.equal(page.select.options(2).text, 'Repo 2'); | ||
}); | ||
|
||
test('it triggers action on selection', function(assert) { | ||
assert.expect(2); | ||
|
||
let [repo1, repo2] = [ | ||
{ name: 'Repo 1', id: 1 }, | ||
{ name: 'Repo 2', id: 2 } | ||
]; | ||
|
||
set(this, 'githubRepos', [repo1, repo2]); | ||
|
||
renderPage(); | ||
|
||
run(() => page.select.fillIn('Repo 1')); | ||
run(() => { | ||
assert.deepEqual(get(this, 'selectedRepo'), repo1); | ||
}); | ||
|
||
run(() => page.select.fillIn('Repo 2')); | ||
run(() => { | ||
assert.deepEqual(get(this, 'selectedRepo'), repo2); | ||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { collection } from 'ember-cli-page-object'; | ||
import { fullScope } from 'ember-cli-page-object/extend'; | ||
import { select } from 'code-corps-ember/tests/helpers/x-select'; | ||
|
||
export default { | ||
scope: '.select-github-repo', | ||
|
||
select: { | ||
scope: 'select:eq(0)', | ||
|
||
fillIn(text) { | ||
let scope = fullScope(this, this.scope); | ||
select(scope, text); | ||
return this; | ||
}, | ||
|
||
options: collection({ | ||
itemScope: 'option' | ||
}) | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.