diff --git a/packages/ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js b/packages/ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js
index d6e5338ec0d..51e5ef3316f 100644
--- a/packages/ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js
+++ b/packages/ember-template-compiler/tests/plugins/assert-input-helper-without-block-test.js
@@ -1,16 +1,16 @@
import { compile } from '../../index';
+import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
-QUnit.module('ember-template-compiler: assert-input-helper-without-block');
+moduleFor('ember-template-compiler: assert-input-helper-without-block', class extends AbstractTestCase {
+ ['@test Using {{#input}}{{/input}} is not valid']() {
-QUnit.test('Using {{#input}}{{/input}} is not valid', function() {
- expect(1);
+ let expectedMessage =
+ `The {{input}} helper cannot be used in block form. ('baz/foo-bar' @ L1:C0) `;
- let expectedMessage =
- `The {{input}} helper cannot be used in block form. ('baz/foo-bar' @ L1:C0) `;
-
- expectAssertion(() => {
- compile('{{#input value="123"}}Completely invalid{{/input}}', {
- moduleName: 'baz/foo-bar'
- });
- }, expectedMessage);
+ expectAssertion(() => {
+ compile('{{#input value="123"}}Completely invalid{{/input}}', {
+ moduleName: 'baz/foo-bar'
+ });
+ }, expectedMessage);
+ }
});
diff --git a/packages/ember-template-compiler/tests/plugins/deprecate-render-model-test.js b/packages/ember-template-compiler/tests/plugins/deprecate-render-model-test.js
index e40336bd689..c4ce8466a74 100644
--- a/packages/ember-template-compiler/tests/plugins/deprecate-render-model-test.js
+++ b/packages/ember-template-compiler/tests/plugins/deprecate-render-model-test.js
@@ -1,17 +1,17 @@
import { compile } from '../../index';
+import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
-QUnit.module('ember-template-compiler: deprecate-model-render');
+moduleFor('ember-template-compiler: deprecate-model-render', class extends AbstractTestCase {
+ ['@test Using `{{render` with model provides a deprecation']() {
-QUnit.test('Using `{{render` with model provides a deprecation', function() {
- expect(1);
+ let expectedMessage =
+ `Please refactor \`{{render "foo-bar" coolModel}}\` to a component and` +
+ ` invoke via \`{{foo-bar model=coolModel}}\`. ('baz/foo-bar' @ L1:C0) `;
- let expectedMessage =
- `Please refactor \`{{render "foo-bar" coolModel}}\` to a component and` +
- ` invoke via \`{{foo-bar model=coolModel}}\`. ('baz/foo-bar' @ L1:C0) `;
-
- expectDeprecation(() => {
- compile('{{render "foo-bar" coolModel}}', {
- moduleName: 'baz/foo-bar'
- });
- }, expectedMessage);
+ expectDeprecation(() => {
+ compile('{{render "foo-bar" coolModel}}', {
+ moduleName: 'baz/foo-bar'
+ });
+ }, expectedMessage);
+ }
});
diff --git a/packages/ember-template-compiler/tests/plugins/deprecate-render-test.js b/packages/ember-template-compiler/tests/plugins/deprecate-render-test.js
index 96eafe19cb3..e253860d6a3 100644
--- a/packages/ember-template-compiler/tests/plugins/deprecate-render-test.js
+++ b/packages/ember-template-compiler/tests/plugins/deprecate-render-test.js
@@ -1,17 +1,17 @@
import { compile } from '../../index';
+import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
-QUnit.module('ember-template-compiler: deprecate-render');
+moduleFor('ember-template-compiler: deprecate-render', class extends AbstractTestCase {
+ ['@test Using `{{render` without a model provides a deprecation']() {
-QUnit.test('Using `{{render` without a model provides a deprecation', function() {
- expect(1);
+ let expectedMessage =
+ `Please refactor \`{{render "foo-bar"}}\` to a component and` +
+ ` invoke via \`{{foo-bar}}\`. ('baz/foo-bar' @ L1:C0) `;
- let expectedMessage =
- `Please refactor \`{{render "foo-bar"}}\` to a component and` +
- ` invoke via \`{{foo-bar}}\`. ('baz/foo-bar' @ L1:C0) `;
-
- expectDeprecation(() => {
- compile('{{render "foo-bar"}}', {
- moduleName: 'baz/foo-bar'
- });
- }, expectedMessage);
+ expectDeprecation(() => {
+ compile('{{render "foo-bar"}}', {
+ moduleName: 'baz/foo-bar'
+ });
+ }, expectedMessage);
+ }
});
diff --git a/packages/ember-template-compiler/tests/plugins/transform-dot-component-invocation-test.js b/packages/ember-template-compiler/tests/plugins/transform-dot-component-invocation-test.js
index eda5552db90..ee87fe2963b 100644
--- a/packages/ember-template-compiler/tests/plugins/transform-dot-component-invocation-test.js
+++ b/packages/ember-template-compiler/tests/plugins/transform-dot-component-invocation-test.js
@@ -1,25 +1,25 @@
import { compile } from '../../index';
+import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
-QUnit.module('ember-template-compiler: transforms dot component invocation');
+moduleFor('ember-template-compiler: transforms dot component invocation', class extends AbstractTestCase {
+ ['@test Does not throw a compiler error for path components'](assert) {
+ assert.expect(0);
-QUnit.test('Does not throw a compiler error for path components', function(assert) {
- assert.expect(1);
+ [
+ '{{this.modal open}}',
+ '{{this.modal isOpen=true}}',
+ '{{#this.modal}}Woot{{/this.modal}}',
+ '{{c.modal open}}',
+ '{{c.modal isOpen=true}}',
+ '{{#c.modal}}Woot{{/c.modal}}',
+ '{{#my-component as |c|}}{{c.a name="Chad"}}{{/my-component}}',
+ '{{#my-component as |c|}}{{c.a "Chad"}}{{/my-component}}',
+ '{{#my-component as |c|}}{{#c.a}}{{/c.a}}{{/my-component}}',
+ '', // GH#15740
+ '
| ' // GH#15217
+ ].forEach((layout, i) => {
+ compile(layout, { moduleName: `example-${i}` });
+ });
- [
- '{{this.modal open}}',
- '{{this.modal isOpen=true}}',
- '{{#this.modal}}Woot{{/this.modal}}',
- '{{c.modal open}}',
- '{{c.modal isOpen=true}}',
- '{{#c.modal}}Woot{{/c.modal}}',
- '{{#my-component as |c|}}{{c.a name="Chad"}}{{/my-component}}',
- '{{#my-component as |c|}}{{c.a "Chad"}}{{/my-component}}',
- '{{#my-component as |c|}}{{#c.a}}{{/c.a}}{{/my-component}}',
- '', // GH#15740
- ' | ' // GH#15217
- ].forEach((layout, i) => {
- compile(layout, { moduleName: `example-${i}` });
- });
-
- assert.ok(true);
+ }
});
diff --git a/packages/ember-template-compiler/tests/plugins/transform-inline-link-to-test.js b/packages/ember-template-compiler/tests/plugins/transform-inline-link-to-test.js
index 23c20721e5c..6758daa759e 100644
--- a/packages/ember-template-compiler/tests/plugins/transform-inline-link-to-test.js
+++ b/packages/ember-template-compiler/tests/plugins/transform-inline-link-to-test.js
@@ -1,11 +1,12 @@
import { compile } from '../../index';
+import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
-QUnit.module('ember-template-compiler: assert-no-view-and-controller-paths without legacy view support');
+moduleFor('ember-template-compiler: inline-link-to', class extends AbstractTestCase {
+ ['@test Can transform an inline {{link-to}} without error'](assert) {
+ assert.expect(0);
-QUnit.test('Can transform an inline {{link-to}} without error', function() {
- expect(0);
-
- compile(`{{link-to 'foo' 'index'}}`, {
- moduleName: 'foo/bar/baz'
- });
+ compile(`{{link-to 'foo' 'index'}}`, {
+ moduleName: 'foo/bar/baz'
+ });
+ }
});
diff --git a/packages/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js b/packages/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js
index c07802bb209..e4d29e4754b 100644
--- a/packages/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js
+++ b/packages/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js
@@ -1,21 +1,22 @@
import { compile } from '../../index';
+import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
-QUnit.module('ember-template-compiler: input type syntax');
+moduleFor('ember-template-compiler: input type syntax', class extends AbstractTestCase {
+ ['@test Can compile an {{input}} helper that has a sub-expression value as its type'](assert) {
+ assert.expect(0);
-QUnit.test('Can compile an {{input}} helper that has a sub-expression value as its type', function() {
- expect(0);
+ compile(`{{input type=(if true 'password' 'text')}}`);
+ }
- compile(`{{input type=(if true 'password' 'text')}}`);
-});
-
-QUnit.test('Can compile an {{input}} helper with a string literal type', function() {
- expect(0);
+ ['@test Can compile an {{input}} helper with a string literal type'](assert) {
+ assert.expect(0);
- compile(`{{input type='text'}}`);
-});
+ compile(`{{input type='text'}}`);
+ }
-QUnit.test('Can compile an {{input}} helper with a type stored in a var', function() {
- expect(0);
+ ['@test Can compile an {{input}} helper with a type stored in a var'](assert) {
+ assert.expect(0);
- compile(`{{input type=_type}}`);
+ compile(`{{input type=_type}}`);
+ }
});
diff --git a/packages/ember-template-compiler/tests/system/bootstrap-test.js b/packages/ember-template-compiler/tests/system/bootstrap-test.js
index a9c5e0d29c9..cdd3b880fe6 100644
--- a/packages/ember-template-compiler/tests/system/bootstrap-test.js
+++ b/packages/ember-template-compiler/tests/system/bootstrap-test.js
@@ -11,20 +11,22 @@ import bootstrap from '../../system/bootstrap';
import {
runAppend,
runDestroy,
- buildOwner
+ buildOwner,
+ moduleFor,
+ AbstractTestCase
} from 'internal-test-helpers';
const { trim } = jQuery;
let component, fixture;
-function checkTemplate(templateName) {
+function checkTemplate(templateName, assert) {
run(() => bootstrap({ context: fixture, hasTemplate, setTemplate }));
let template = getTemplate(templateName);
- ok(template, 'template is available on Ember.TEMPLATES');
- equal(jQuery('#qunit-fixture script').length, 0, 'script removed');
+ assert.ok(template, 'template is available on Ember.TEMPLATES');
+ assert.equal(jQuery('#qunit-fixture script').length, 0, 'script removed');
let owner = buildOwner();
owner.register('template:-top-level', template);
@@ -37,89 +39,91 @@ function checkTemplate(templateName) {
component = owner.lookup('component:-top-level');
runAppend(component);
- equal(jQuery('#qunit-fixture').text().trim(), 'Tobias takes teamocil', 'template works');
+ assert.equal(jQuery('#qunit-fixture').text().trim(), 'Tobias takes teamocil', 'template works');
runDestroy(component);
}
-QUnit.module('ember-templates: bootstrap', {
- setup() {
+moduleFor('ember-templates: bootstrap', class extends AbstractTestCase {
+ constructor() {
+ super();
+
fixture = document.getElementById('qunit-fixture');
- },
+ }
+
teardown() {
setTemplates({});
runDestroy(component);
}
-});
-QUnit.test('template with data-template-name should add a new template to Ember.TEMPLATES', function() {
- jQuery('#qunit-fixture').html('');
+ ['@test template with data-template-name should add a new template to Ember.TEMPLATES'](assert) {
+ jQuery('#qunit-fixture').html('');
- checkTemplate('funkyTemplate');
-});
+ checkTemplate('funkyTemplate', assert);
+ }
-QUnit.test('template with id instead of data-template-name should add a new template to Ember.TEMPLATES', function() {
- jQuery('#qunit-fixture').html('');
+ ['@test template with id instead of data-template-name should add a new template to Ember.TEMPLATES'](assert) {
+ jQuery('#qunit-fixture').html('');
- checkTemplate('funkyTemplate');
-});
+ checkTemplate('funkyTemplate', assert);
+ }
-QUnit.test('template without data-template-name or id should default to application', function() {
- jQuery('#qunit-fixture').html('');
+ ['@test template without data-template-name or id should default to application'](assert) {
+ jQuery('#qunit-fixture').html('');
- checkTemplate('application');
-});
+ checkTemplate('application', assert);
+ }
-if (typeof Handlebars === 'object') {
- QUnit.test('template with type text/x-raw-handlebars should be parsed', function() {
+ // Add this test case, only for typeof Handlebars === 'object';
+ [`${typeof Handlebars === 'object' ? '@test' : '@skip'} template with type text/x-raw-handlebars should be parsed`](assert) {
jQuery('#qunit-fixture').html('');
run(() => bootstrap({ context: fixture, hasTemplate, setTemplate }));
let template = getTemplate('funkyTemplate');
- ok(template, 'template with name funkyTemplate available');
+ assert.ok(template, 'template with name funkyTemplate available');
// This won't even work with Ember templates
- equal(trim(template({ name: 'Tobias' })), 'Tobias');
- });
-}
+ assert.equal(trim(template({ name: 'Tobias' })), 'Tobias');
+ }
-QUnit.test('duplicated default application templates should throw exception', function() {
- jQuery('#qunit-fixture').html('');
+ ['@test duplicated default application templates should throw exception'](assert) {
+ jQuery('#qunit-fixture').html('');
- throws(() => bootstrap({ context: fixture, hasTemplate, setTemplate }),
- /Template named "[^"]+" already exists\./,
- 'duplicate templates should not be allowed');
-});
+ assert.throws(() => bootstrap({ context: fixture, hasTemplate, setTemplate }),
+ /Template named "[^"]+" already exists\./,
+ 'duplicate templates should not be allowed');
+ }
-QUnit.test('default application template and id application template present should throw exception', function() {
- jQuery('#qunit-fixture').html('');
+ ['@test default default application template and id application template present should throw exception'](assert) {
+ jQuery('#qunit-fixture').html('');
- throws(() => bootstrap({ context: fixture, hasTemplate, setTemplate }),
- /Template named "[^"]+" already exists\./,
- 'duplicate templates should not be allowed');
-});
+ assert.throws(() => bootstrap({ context: fixture, hasTemplate, setTemplate }),
+ /Template named "[^"]+" already exists\./,
+ 'duplicate templates should not be allowed');
+ }
-QUnit.test('default application template and data-template-name application template present should throw exception', function() {
- jQuery('#qunit-fixture').html('');
+ ['@test default application template and data-template-name application template present should throw exception'](assert) {
+ jQuery('#qunit-fixture').html('');
- throws(() => bootstrap({ context: fixture, hasTemplate, setTemplate }),
- /Template named "[^"]+" already exists\./,
- 'duplicate templates should not be allowed');
-});
+ assert.throws(() => bootstrap({ context: fixture, hasTemplate, setTemplate }),
+ /Template named "[^"]+" already exists\./,
+ 'duplicate templates should not be allowed');
+ }
-QUnit.test('duplicated template id should throw exception', function() {
- jQuery('#qunit-fixture').html('');
+ ['@test duplicated template id should throw exception'](assert) {
+ jQuery('#qunit-fixture').html('');
- throws(() => bootstrap({ context: fixture, hasTemplate, setTemplate }),
- /Template named "[^"]+" already exists\./,
- 'duplicate templates should not be allowed');
-});
+ assert.throws(() => bootstrap({ context: fixture, hasTemplate, setTemplate }),
+ /Template named "[^"]+" already exists\./,
+ 'duplicate templates should not be allowed');
+ }
-QUnit.test('duplicated template data-template-name should throw exception', function() {
- jQuery('#qunit-fixture').html('');
+ ['@test duplicated template data-template-name should throw exception'](assert) {
+ jQuery('#qunit-fixture').html('');
- throws(() => bootstrap({ context: fixture, hasTemplate, setTemplate }),
- /Template named "[^"]+" already exists\./,
- 'duplicate templates should not be allowed');
+ assert.throws(() => bootstrap({ context: fixture, hasTemplate, setTemplate }),
+ /Template named "[^"]+" already exists\./,
+ 'duplicate templates should not be allowed');
+ }
});
diff --git a/packages/ember-template-compiler/tests/system/compile_options_test.js b/packages/ember-template-compiler/tests/system/compile_options_test.js
index d678b222507..ec6b86ff4e9 100644
--- a/packages/ember-template-compiler/tests/system/compile_options_test.js
+++ b/packages/ember-template-compiler/tests/system/compile_options_test.js
@@ -1,19 +1,20 @@
import { compileOptions } from '../../index';
import { defaultPlugins } from '../../index';
+import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
-QUnit.module('ember-template-compiler: default compile options');
-
-QUnit.test('default options are a new copy', function() {
- notEqual(compileOptions(), compileOptions());
-});
+moduleFor('ember-template-compiler: default compile options', class extends AbstractTestCase {
+ ['@test default options are a new copy'](assert) {
+ assert.notEqual(compileOptions(), compileOptions());
+ }
-QUnit.test('has default AST plugins', function(assert) {
- assert.expect(defaultPlugins.length);
+ ['@test has default AST plugins'](assert) {
+ assert.expect(defaultPlugins.length);
- let plugins = compileOptions().plugins.ast;
+ let plugins = compileOptions().plugins.ast;
- for (let i = 0; i < defaultPlugins.length; i++) {
- let plugin = defaultPlugins[i];
- assert.ok(plugins.indexOf(plugin) > -1, `includes ${plugin}`);
+ for (let i = 0; i < defaultPlugins.length; i++) {
+ let plugin = defaultPlugins[i];
+ assert.ok(plugins.indexOf(plugin) > -1, `includes ${plugin}`);
+ }
}
});