This repository was archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
improve component blueprint for octane #213
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5c57a58
improve component blueprint for octane
BryanCrotaz 9d721f8
remove unnecessary element definition
BryanCrotaz be2f7c1
add helpful comment in component args
BryanCrotaz 3e86833
Update blueprints/component/files/__root__/__path__/__name__.ts
BryanCrotaz d152c31
remove module unification files
BryanCrotaz 76d8a32
fix linting
BryanCrotaz 02217a6
remove ember-cli-shims and add peer dependencies
BryanCrotaz 9f0269e
use node 12 to build on travis
BryanCrotaz 8670fdf
Revert "fix linting"
BryanCrotaz 3c59cf8
fix no-prototype-builtins
BryanCrotaz 76c8799
fix typo
BryanCrotaz 58d6499
add extraneous modules
BryanCrotaz dc4c154
fix no-undef
BryanCrotaz ce84d15
move extraneous packages to dependencies
BryanCrotaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* eslint-env node */ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
65 changes: 35 additions & 30 deletions
65
blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.ts
This file contains hidden or 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 |
---|---|---|
@@ -1,31 +1,36 @@ | ||
import { moduleForComponent, test } from 'ember-qunit';<% if (testType === 'integration') { %> | ||
import hbs from 'htmlbars-inline-precompile';<% } %> | ||
|
||
moduleForComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>', { | ||
<% if (testType === 'integration' ) { %>integration: true<% } else if(testType === 'unit') { %>// Specify the other units that are required for this test | ||
// needs: ['component:foo', 'helper:bar'], | ||
unit: true<% } %> | ||
}); | ||
|
||
test('it renders', function(assert) { | ||
<% if (testType === 'integration' ) { %>// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.on('myAction', function(val) { ... }); | ||
|
||
this.render(hbs`{{<%= componentPathName %>}}`); | ||
|
||
assert.equal(this.$().text().trim(), ''); | ||
|
||
// Template block usage: | ||
this.render(hbs` | ||
{{#<%= componentPathName %>}} | ||
template block text | ||
{{/<%= componentPathName %>}} | ||
`); | ||
|
||
assert.equal(this.$().text().trim(), 'template block text');<% } else if(testType === 'unit') { %> | ||
// Creates the component instance | ||
/*let component =*/ this.subject(); | ||
// Renders the component to the page | ||
this.render(); | ||
assert.equal(this.$().text().trim(), '');<% } %> | ||
}); | ||
import hbs from 'htmlbars-inline-precompile';<% } %> | ||
import { TestContext } from 'ember-test-helpers'; | ||
|
||
type Context = TestContext & { | ||
// add your test properties here | ||
} | ||
|
||
moduleForComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>', { | ||
<% if (testType === 'integration' ) { %>integration: true<% } else if(testType === 'unit') { %>// Specify the other units that are required for this test | ||
// needs: ['component:foo', 'helper:bar'], | ||
unit: true<% } %> | ||
}); | ||
|
||
test('it renders', function(this: Context, assert: Assert) { | ||
<% if (testType === 'integration' ) { %>// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.on('myAction', function(val) { ... }); | ||
|
||
this.render(hbs`<%= selfCloseComponent(componentName) %>`); | ||
|
||
assert.equal(this.$().text().trim(), ''); | ||
|
||
// Template block usage: | ||
this.render(hbs` | ||
<%= openComponent(componentName) %> | ||
template block text | ||
<%= closeComponent(componentName) %> | ||
`); | ||
|
||
assert.equal(this.$().text().trim(), 'template block text');<% } else if(testType === 'unit') { %> | ||
// Creates the component instance | ||
/*let component =*/ this.subject(); | ||
// Renders the component to the page | ||
this.render(); | ||
assert.equal(this.$().text().trim(), '');<% } %> | ||
}); |
24 changes: 17 additions & 7 deletions
24
blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.ts
This file contains hidden or 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 |
---|---|---|
@@ -1,36 +1,46 @@ | ||
<% if (testType === 'integration') { %>import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { TestContext } from 'ember-test-helpers'; | ||
import { render } from '@ember/test-helpers'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
<%= hbsImportStatement %> | ||
|
||
type Context = TestContext & { | ||
// add your test properties here | ||
} | ||
|
||
module('<%= friendlyTestDescription %>', function(hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it renders', async function(assert) { | ||
test('it renders', async function(this: Context, assert: Assert) { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.set('myAction', function(val) { ... }); | ||
|
||
await render(hbs`{{<%= componentPathName %>}}`); | ||
await render(hbs`<%= selfCloseComponent(componentName) %>`); | ||
|
||
assert.equal(this.element.textContent.trim(), ''); | ||
|
||
// Template block usage: | ||
await render(hbs` | ||
{{#<%= componentPathName %>}} | ||
<%= openComponent(componentName) %> | ||
template block text | ||
{{/<%= componentPathName %>}} | ||
<%= closeComponent(componentName) %> | ||
`); | ||
|
||
assert.equal(this.element.textContent.trim(), 'template block text'); | ||
}); | ||
});<% } else if (testType === 'unit') { %>import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
import { TestContext } from 'ember-test-helpers'; | ||
|
||
type Context = TestContext & { | ||
// add your test properties here | ||
} | ||
|
||
module('<%= friendlyTestDescription %>', function(hooks) { | ||
setupTest(hooks); | ||
|
||
test('it exists', function(assert) { | ||
test('it exists', function(this: Context, assert: Assert) { | ||
let component = this.owner.factoryFor('component:<%= componentPathName %>').create(); | ||
assert.ok(component); | ||
}); | ||
});<% } %> | ||
});<% } %> |
This file contains hidden or 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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
import Component from '@ember/component'; | ||
<%= importTemplate %> | ||
export default class <%= classifiedModuleName %> extends Component.extend({ | ||
// anything which *must* be merged to prototype here | ||
}) {<%= contents %> | ||
// normal class body definition here | ||
export default class <%= classifiedModuleName %> extends Component { | ||
}; |
File renamed without changes.
8 changes: 6 additions & 2 deletions
8
blueprints/component/glimmer-files/__root__/__path__/__name__.ts
This file contains hidden or 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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import Component from '@glimmer/component'; | ||
|
||
interface <%= classifiedModuleName %>Args {} | ||
interface <%= classifiedModuleName %>Args { | ||
// define component arguments here | ||
} | ||
|
||
export default class <%= classifiedModuleName %> extends Component<<%= classifiedModuleName %>Args> {} | ||
export default class <%= classifiedModuleName %> extends Component<<%= classifiedModuleName %>Args> { | ||
BryanCrotaz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// class body definition here | ||
}; |
7 changes: 0 additions & 7 deletions
7
blueprints/component/module-unification-files/__root__/__path__/component.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
blueprints/component/module-unification-files/__root__/__path__/template.hbs
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 @@ | ||
{"compilerOptions":{"target":"es6","experimentalDecorators":true},"exclude":["node_modules","bower_components","tmp","vendor",".git","dist"]} |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thought: while we’re at it, we should, uhh, just get rid of the old-style
moduleFor*
blueprints. YIKES. I’d forgotten just how out of date our blueprints are. (Doesn’t have to be this PR.)