Skip to content

Instantly share code, notes, and snippets.

@ynotdraw
Created July 30, 2018 21:16
Show Gist options
  • Save ynotdraw/3fff1fecd4fba2b032eb6b4e99c63769 to your computer and use it in GitHub Desktop.
Save ynotdraw/3fff1fecd4fba2b032eb6b4e99c63769 to your computer and use it in GitHub Desktop.
All ember snippets
{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
/**
* Ember things
*/
"Ember: Setup new computed prop": {
"prefix": "e computed",
"body": [
"${1:computedName}: computed('${2:key}', function() {",
"\t//${3:TODO}",
"}),"
],
"description": "Snippet for generating a new computed property"
},
"Ember: Route model hook": {
"prefix": "e model",
"body": [
"model() {",
"\t${1://return this.get('store').findAll('foo');}",
"}${2:,}"
],
"description": "Snippet for generating a route's model hook"
},
"Ember: Route beforeModel hook": {
"prefix": "e beforeModel",
"body": [
"beforeModel(${1: /* transition */}) {",
"\t${2://this.transitionTo('foo');}",
"}${3:,}"
],
"description": "Snippet for generating a route's beforeModel hook"
},
"Ember: Route afterModel hook": {
"prefix": "e afterModel",
"body": [
"afterModel(${1: /* model, */} ${2: /* transition */}) {",
"\t${3://afterModel}",
"}${4:,}"
],
"description": "Snippet for generating a route's afterModel hook"
},
/**
* Ember Testing Snippets
*/
"Testing: Generate a new test": {
"prefix": "e test",
"body": [
"test('${1:test-description}', async function(assert) {",
"\tawait render(hbs`{{${2:component}}}}`);",
"\t${3:assert.ok(true);}",
"});"
],
"description": "Snippet for generating a new ember test"
},
"Testing: Find snippet": {
"prefix": "e find",
"body": [
"find('[${1:selector}]');"
],
"description": "Snippet for using the find test helper function"
},
"Testing: FillIn snippet": {
"prefix": "e fillIn",
"body": [
"await fillIn('[${1:selector}]', text);"
],
"description": "Snippet for using the fillIn test helper function"
},
"Testing: Click snippet": {
"prefix": "e click",
"body": [
"await click('[${1:selector}]');"
],
"description": "Snippet for using the click test helper function"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment