Skip to content

Instantly share code, notes, and snippets.

@noyesa
Last active March 26, 2018 23:29
Show Gist options
  • Select an option

  • Save noyesa/f45ddb2f50dd4cdf0b1149d757fe3c31 to your computer and use it in GitHub Desktop.

Select an option

Save noyesa/f45ddb2f50dd4cdf0b1149d757fe3c31 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
isFoo: true,
actions: {
toggleChildFoo() {
this.toggleProperty('isFoo');
}
}
});
import Ember from 'ember';
export default Ember.Component.extend({
isFoo: false,
actions: {
toggleParentFoo() {
this.toggleProperty('isFoo');
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
.foo {
border: 1px solid red;
}
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{parent-component}}
<br>
<br>
<p>I am the child</p>
<button {{action "toggleChildFoo"}}>Toggle child isFoo</button>
<p>I am the parent</p>
<button {{action "toggleParentFoo"}}>Toggle parent isFoo</button>
{{child-component classNameBindings="isFoo:foo"}}
import Ember from 'ember';
export default function destroyApp(application) {
Ember.run(application, 'destroy');
}
import Resolver from '../../resolver';
import config from '../../config/environment';
const resolver = Resolver.create();
resolver.namespace = {
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix
};
export default resolver;
import Ember from 'ember';
import Application from '../../app';
import config from '../../config/environment';
const { run } = Ember;
const assign = Ember.assign || Ember.merge;
export default function startApp(attrs) {
let application;
let attributes = assign({rootElement: "#test-root"}, config.APP);
attributes = assign(attributes, attrs); // use defaults, but you can override;
run(() => {
application = Application.create(attributes);
application.setupForTesting();
application.injectTestHelpers();
});
return application;
}
import resolver from './helpers/resolver';
import {
setResolver
} from 'ember-qunit';
setResolver(resolver);
{
"version": "0.13.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment