diff --git a/tests/acceptance/simple-test.js b/tests/acceptance/simple-test.js index e96c530e..b183be67 100755 --- a/tests/acceptance/simple-test.js +++ b/tests/acceptance/simple-test.js @@ -2,6 +2,8 @@ import Ember from 'ember'; import { module, test } from 'qunit'; import startApp from '../helpers/start-app'; +const { run } = Ember; + let App; module('Simple Acceptance Test', { @@ -10,16 +12,17 @@ module('Simple Acceptance Test', { }, afterEach() { - Ember.run(App, 'destroy'); + run(App, 'destroy'); } }); -test('value of input', function(assert) { +test('ES6 features work correcly', function(assert) { visit('/'); andThen(() => { - assert.equal('Test Value', find('#test-input').val()); - assert.equal('one', find('#first-value').text()); - assert.equal('two', find('#last-value').text()); + assert.equal('Test Value', find('#test-input').val(), 'Has arrow functions and template string as ES6 feature'); + assert.equal('one', find('#first-value').text(), 'Has generatos as ES6 feature'); + assert.equal('two', find('#last-value').text(), 'Has generatos as ES6 feature'); + assert.equal('true', find('#proxy-value').text(), 'Has proxies as ES6 feature'); }); }); diff --git a/tests/dummy/app/controllers/application.js b/tests/dummy/app/controllers/application.js index c7947d8a..c2d47eac 100755 --- a/tests/dummy/app/controllers/application.js +++ b/tests/dummy/app/controllers/application.js @@ -1,9 +1,26 @@ import Ember from 'ember'; -export default Ember.Controller.extend({ +const { Controller, A, computed } = Ember; + +export default Controller.extend({ + // Just a very roundabout way of using some ES6 features value: ((test = 'Test') => `${test} ${'Value'}`)(), // jshint ignore:line // Test a generator (needs the regenerator runtime) and some ES6 constructs (requires the corejs polyfill) - values: Ember.A(Array.from({ *[Symbol.iterator]() { yield 'one'; yield 'two'; } })) // jshint ignore:line + values: A(Array.from({ *[Symbol.iterator]() { yield 'one'; yield 'two'; } })), // jshint ignore:line + + hasProxies: computed({ + get() { + const target = {}; + const handler = { + get: (receiver, name) => { + return `Hello, ${name}!`; + } + }; + + const p = new Proxy(target, handler); + return p.world === 'Hello, world!'; + } + }) }); diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index cdc25787..3031f8ab 100755 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -1,12 +1,14 @@ import Ember from 'ember'; import config from './config/environment'; -const Router = Ember.Router.extend({ +const { Router } = Ember; + +const EmRouter = Router.extend({ location: config.locationType, rootURL: config.rootURL }); -Router.map(function() { +EmRouter.map(() => { }); export default Router; diff --git a/tests/dummy/app/templates/application.hbs b/tests/dummy/app/templates/application.hbs index f7938db0..798f7ec5 100755 --- a/tests/dummy/app/templates/application.hbs +++ b/tests/dummy/app/templates/application.hbs @@ -4,5 +4,7 @@
{{values.firstObject}}
{{values.lastObject}}
+
{{nameValue}}
+
{{hasProxies}}
{{outlet}} \ No newline at end of file diff --git a/tests/helpers/destroy-app.js b/tests/helpers/destroy-app.js index c3d4d1ab..926d7563 100644 --- a/tests/helpers/destroy-app.js +++ b/tests/helpers/destroy-app.js @@ -1,5 +1,7 @@ import Ember from 'ember'; +const { run } = Ember; + export default function destroyApp(application) { - Ember.run(application, 'destroy'); + run(application, 'destroy'); } diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index 9a605eb8..d36dc47e 100755 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -2,11 +2,13 @@ import Ember from 'ember'; import Application from '../../app'; import config from '../../config/environment'; +const { merge, run } = Ember; + export default function startApp(attrs) { - let attributes = Ember.merge({}, config.APP); - attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; + let attributes = merge({}, config.APP); + attributes = merge(attributes, attrs); // use defaults, but you can override; - return Ember.run(() => { + return run(() => { let application = Application.create(attributes); application.setupForTesting(); application.injectTestHelpers();