This gist is an Ember Twiddle to demonstrate the problem in ember-testing where the "Ember.testing" flag is not set during imports.
See Ember issue #16006 at emberjs/ember.js#16006
import Ember from 'ember'; | |
const kIsTesting = Ember.testing; | |
export default Ember.Component.extend({ | |
loadedEmberTestingValue: kIsTesting, | |
emberTestingCompFunc: Ember.computed('',function() { | |
return Ember.testing; | |
}) | |
}); |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This gist is an Ember Twiddle to demonstrate the problem in ember-testing where the "Ember.testing" flag is not set during imports.
See Ember issue #16006 at emberjs/ember.js#16006
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 Ember from 'ember'; | |
import { moduleForComponent, test } from 'ember-qunit'; | |
import hbs from 'htmlbars-inline-precompile'; | |
moduleForComponent('my-component', 'Ember.testing', { | |
integration: true | |
}); | |
test('Ember.testing', function(assert) { | |
assert.ok(Ember.testing,'Ember.testing is set to true when inside test method'); | |
// Set any properties with this.set('myProperty', 'value'); | |
// Handle any actions with this.on('myAction', function(val) { ... }); | |
this.render(hbs`{{my-component}}`); | |
assert.equal(this.$().text().trim(), 'true\n/\ntrue', 'Ember.testing is set to true when initializing component'); | |
}); |
import resolver from './helpers/resolver'; | |
import { | |
setResolver | |
} from 'ember-qunit'; | |
setResolver(resolver); |
{ | |
"version": "0.12.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": true | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1" | |
} | |
} |