diff --git a/packages/ember-application/tests/system/application_test.js b/packages/ember-application/tests/system/application_test.js index 3e4eb27f209..e3b210e552e 100644 --- a/packages/ember-application/tests/system/application_test.js +++ b/packages/ember-application/tests/system/application_test.js @@ -226,11 +226,9 @@ QUnit.test('initialize application with stateManager via initialize call from Ro equal(jQuery('#qunit-fixture h1').text(), 'Hello!'); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('ApplicationView is inserted into the page', function() { +test('ApplicationView is inserted into the page', function() { run(function() { app = Application.create({ rootElement: '#qunit-fixture' @@ -250,8 +248,6 @@ QUnit.test('ApplicationView is inserted into the page', function() { equal(jQuery('#qunit-fixture h1').text(), 'Hello!'); }); -} - QUnit.test('Minimal Application initialized with just an application template', function() { jQuery('#qunit-fixture').html(''); run(function () { diff --git a/packages/ember-application/tests/system/dependency_injection/default_resolver_test.js b/packages/ember-application/tests/system/dependency_injection/default_resolver_test.js index a1ad9c999e5..577c1eae057 100644 --- a/packages/ember-application/tests/system/dependency_injection/default_resolver_test.js +++ b/packages/ember-application/tests/system/dependency_injection/default_resolver_test.js @@ -49,11 +49,9 @@ QUnit.test('the default resolver can look things up in other namespaces', functi ok(nav instanceof UserInterface.NavigationController, 'the result should be an instance of the specified class'); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('the default resolver looks up templates in Ember.TEMPLATES', function() { +test('the default resolver looks up templates in Ember.TEMPLATES', function() { function fooTemplate() {} function fooBarTemplate() {} function fooBarBazTemplate() {} @@ -67,8 +65,6 @@ QUnit.test('the default resolver looks up templates in Ember.TEMPLATES', functio equal(locator.lookup('template:fooBar.baz'), fooBarBazTemplate, 'resolves template:foo_bar.baz'); }); -} - QUnit.test('the default resolver looks up basic name as no prefix', function() { ok(Controller.detect(locator.lookup('controller:basic')), 'locator looks up correct controller'); }); diff --git a/packages/ember-application/tests/system/logging_test.js b/packages/ember-application/tests/system/logging_test.js index d798fb10f54..10340cc7101 100644 --- a/packages/ember-application/tests/system/logging_test.js +++ b/packages/ember-application/tests/system/logging_test.js @@ -205,11 +205,9 @@ QUnit.test('do not log when template and view are missing when flag is not true' }); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('log which view is used with a template', function() { +test('log which view is used with a template', function() { if (EmberDev && EmberDev.runningProdBuild) { ok(true, 'Logging does not occur in production builds'); return; @@ -227,8 +225,6 @@ QUnit.test('log which view is used with a template', function() { }); }); -} - QUnit.test('do not log which views are used with templates when flag is not true', function() { App.reopen({ LOG_VIEW_LOOKUPS: false diff --git a/packages/ember-application/tests/system/reset_test.js b/packages/ember-application/tests/system/reset_test.js index 1585a01a792..40cdabf9c74 100644 --- a/packages/ember-application/tests/system/reset_test.js +++ b/packages/ember-application/tests/system/reset_test.js @@ -129,11 +129,9 @@ QUnit.test('When an application is reset, the eventDispatcher is destroyed and r Registry.prototype.register = originalRegister; }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('When an application is reset, the ApplicationView is torn down', function() { +test('When an application is reset, the ApplicationView is torn down', function() { run(function() { application = Application.create(); application.ApplicationView = View.extend({ @@ -154,8 +152,6 @@ QUnit.test('When an application is reset, the ApplicationView is torn down', fun notStrictEqual(originalView, resettedView, 'The view object has changed'); }); -} - QUnit.test('When an application is reset, the router URL is reset to `/`', function() { var location, router; diff --git a/packages/ember-application/tests/system/visit_test.js b/packages/ember-application/tests/system/visit_test.js index 12a72b9b2b6..91be4b0f5be 100644 --- a/packages/ember-application/tests/system/visit_test.js +++ b/packages/ember-application/tests/system/visit_test.js @@ -340,11 +340,9 @@ QUnit.test('visit() returns a promise that resolves when the view has rendered', }); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('Views created via visit() are not added to the global views hash', function(assert) { +test('Views created via visit() are not added to the global views hash', function(assert) { run(function() { createApplication(); @@ -376,7 +374,7 @@ QUnit.test('Views created via visit() are not added to the global views hash', f }); -QUnit.module('Ember.Application - visit() Integration Tests', { +testModule('Ember.Application - visit() Integration Tests', { teardown() { if (instances) { run(instances, 'forEach', (i) => i.destroy()); @@ -390,7 +388,7 @@ QUnit.module('Ember.Application - visit() Integration Tests', { } }); -QUnit.test('Ember Islands-style setup', function(assert) { +test('Ember Islands-style setup', function(assert) { let xFooInitCalled = false; let xFooDidInsertElementCalled = false; @@ -526,5 +524,3 @@ QUnit.skip('Test setup', function(assert) { QUnit.skip('iframe setup', function(assert) { }); - -} diff --git a/packages/ember-glimmer/tests/utils/skip-if-glimmer.js b/packages/ember-glimmer/tests/utils/skip-if-glimmer.js new file mode 100644 index 00000000000..f1d386d4748 --- /dev/null +++ b/packages/ember-glimmer/tests/utils/skip-if-glimmer.js @@ -0,0 +1,23 @@ +import isEnabled from 'ember-metal/features'; + +export function test(name, fn) { + if (isEnabled('ember-glimmer')) { + QUnit.skip('[GLIMMER] ' + name, fn); + } else { + QUnit.test(name, fn); + } +} + +export function testModule(name, setup) { + if (!isEnabled('ember-glimmer')) { + QUnit.module(name, setup); + } +} + +export function asyncTest(name, fn) { + if (isEnabled('ember-glimmer')) { + QUnit.skip('[GLIMMER] ' + name, fn); + } else { + QUnit.asyncTest(name, fn); + } +} diff --git a/packages/ember-htmlbars/tests/attr_nodes/boolean_test.js b/packages/ember-htmlbars/tests/attr_nodes/boolean_test.js index 6ef88b9fef5..e3df6ee59b5 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/boolean_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/boolean_test.js @@ -9,11 +9,9 @@ function appendView(view) { run(function() { view.appendTo('#qunit-fixture'); }); } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-htmlbars: boolean attribute', { +testModule('ember-htmlbars: boolean attribute', { teardown() { if (view) { run(view, view.destroy); @@ -21,7 +19,7 @@ QUnit.module('ember-htmlbars: boolean attribute', { } }); -QUnit.test('disabled property can be set true', function() { +test('disabled property can be set true', function() { view = EmberView.create({ context: { isDisabled: true }, template: compile('') @@ -33,7 +31,7 @@ QUnit.test('disabled property can be set true', function() { 'boolean property is set true'); }); -QUnit.test('disabled property can be set false with a blank string', function() { +test('disabled property can be set false with a blank string', function() { view = EmberView.create({ context: { isDisabled: '' }, template: compile('') @@ -45,7 +43,7 @@ QUnit.test('disabled property can be set false with a blank string', function() 'boolean property is set false'); }); -QUnit.test('disabled property can be set false', function() { +test('disabled property can be set false', function() { view = EmberView.create({ context: { isDisabled: false }, template: compile('') @@ -58,7 +56,7 @@ QUnit.test('disabled property can be set false', function() { 'boolean property is set false'); }); -QUnit.test('disabled property can be set true with a string', function() { +test('disabled property can be set true with a string', function() { view = EmberView.create({ context: { isDisabled: 'oh, no a string' }, template: compile('') @@ -70,7 +68,7 @@ QUnit.test('disabled property can be set true with a string', function() { 'boolean property is set true'); }); -QUnit.test('disabled attribute turns a value to a string', function() { +test('disabled attribute turns a value to a string', function() { view = EmberView.create({ context: { isDisabled: false }, template: compile('') @@ -82,7 +80,7 @@ QUnit.test('disabled attribute turns a value to a string', function() { 'boolean property is set true'); }); -QUnit.test('disabled attribute preserves a blank string value', function() { +test('disabled attribute preserves a blank string value', function() { view = EmberView.create({ context: { isDisabled: '' }, template: compile('') @@ -94,5 +92,3 @@ QUnit.test('disabled attribute preserves a blank string value', function() { equal(view.element.firstChild.disabled, false, 'boolean property is set false'); }); - -} diff --git a/packages/ember-htmlbars/tests/attr_nodes/data_test.js b/packages/ember-htmlbars/tests/attr_nodes/data_test.js index 0c2d9d7c22f..b21ca351398 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/data_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/data_test.js @@ -6,20 +6,17 @@ import { InteractiveRenderer } from 'ember-metal-views'; import { equalInnerHTML } from 'htmlbars-test-helpers'; import { domHelper as dom } from 'ember-htmlbars/env'; import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var view, originalSetAttribute, setAttributeCalls, renderer; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-htmlbars: data attribute', { +testModule('ember-htmlbars: data attribute', { teardown() { runDestroy(view); } }); -QUnit.test('property is output', function() { +test('property is output', function() { view = EmberView.create({ context: { name: 'erik' }, template: compile('
Hi!
') @@ -29,7 +26,7 @@ QUnit.test('property is output', function() { equalInnerHTML(view.element, '
Hi!
', 'attribute is output'); }); -QUnit.test('property set before didInsertElement', function() { +test('property set before didInsertElement', function() { var matchingElement; view = EmberView.create({ didInsertElement() { @@ -44,7 +41,7 @@ QUnit.test('property set before didInsertElement', function() { equal(matchingElement.length, 1, 'element is in the DOM when didInsertElement'); }); -QUnit.test('quoted attributes are concatenated', function() { +test('quoted attributes are concatenated', function() { view = EmberView.create({ context: { firstName: 'max', lastName: 'jackson' }, template: compile('
Hi!
') @@ -54,7 +51,7 @@ QUnit.test('quoted attributes are concatenated', function() { equalInnerHTML(view.element, '
Hi!
', 'attribute is output'); }); -QUnit.test('quoted attributes are updated when changed', function() { +test('quoted attributes are updated when changed', function() { view = EmberView.create({ context: { firstName: 'max', lastName: 'jackson' }, template: compile('
Hi!
') @@ -68,7 +65,7 @@ QUnit.test('quoted attributes are updated when changed', function() { equalInnerHTML(view.element, '
Hi!
', 'attribute is output'); }); -QUnit.test('quoted attributes are not removed when value is null', function() { +test('quoted attributes are not removed when value is null', function() { view = EmberView.create({ context: { firstName: 'max', lastName: 'jackson' }, template: compile('
Hi!
') @@ -82,7 +79,7 @@ QUnit.test('quoted attributes are not removed when value is null', function() { equal(view.element.firstChild.getAttribute('data-name'), '', 'attribute is output'); }); -QUnit.test('unquoted attributes are removed when value is null', function() { +test('unquoted attributes are removed when value is null', function() { view = EmberView.create({ context: { firstName: 'max' }, template: compile('
Hi!
') @@ -96,7 +93,7 @@ QUnit.test('unquoted attributes are removed when value is null', function() { ok(!view.element.firstChild.hasAttribute('data-name'), 'attribute is removed output'); }); -QUnit.test('unquoted attributes that are null are not added', function() { +test('unquoted attributes that are null are not added', function() { view = EmberView.create({ context: { firstName: null }, template: compile('
Hi!
') @@ -106,7 +103,7 @@ QUnit.test('unquoted attributes that are null are not added', function() { equalInnerHTML(view.element, '
Hi!
', 'attribute is not present'); }); -QUnit.test('unquoted attributes are added when changing from null', function() { +test('unquoted attributes are added when changing from null', function() { view = EmberView.create({ context: { firstName: null }, template: compile('
Hi!
') @@ -120,7 +117,7 @@ QUnit.test('unquoted attributes are added when changing from null', function() { equalInnerHTML(view.element, '
Hi!
', 'attribute is added output'); }); -QUnit.test('property value is directly added to attribute', function() { +test('property value is directly added to attribute', function() { view = EmberView.create({ context: { name: '"" data-foo="blah"' }, template: compile('
Hi!
') @@ -130,7 +127,7 @@ QUnit.test('property value is directly added to attribute', function() { equal(view.element.firstChild.getAttribute('data-name'), '"" data-foo="blah"', 'attribute is output'); }); -QUnit.test('path is output', function() { +test('path is output', function() { view = EmberView.create({ context: { name: { firstName: 'erik' } }, template: compile('
Hi!
') @@ -140,7 +137,7 @@ QUnit.test('path is output', function() { equalInnerHTML(view.element, '
Hi!
', 'attribute is output'); }); -QUnit.test('changed property updates', function() { +test('changed property updates', function() { var context = EmberObject.create({ name: 'erik' }); view = EmberView.create({ context: context, @@ -155,7 +152,7 @@ QUnit.test('changed property updates', function() { equalInnerHTML(view.element, '
Hi!
', 'attribute is updated output'); }); -QUnit.test('updates are scheduled in the render queue', function() { +test('updates are scheduled in the render queue', function() { expect(4); var context = EmberObject.create({ name: 'erik' }); @@ -182,7 +179,7 @@ QUnit.test('updates are scheduled in the render queue', function() { equalInnerHTML(view.element, '
Hi!
', 'attribute is updated output'); }); -QUnit.test('updates fail silently after an element is destroyed', function() { +test('updates fail silently after an element is destroyed', function() { var context = EmberObject.create({ name: 'erik' }); view = EmberView.create({ context: context, @@ -198,7 +195,7 @@ QUnit.test('updates fail silently after an element is destroyed', function() { }); }); -QUnit.module('ember-htmlbars: {{attribute}} helper -- setAttribute', { +testModule('ember-htmlbars: {{attribute}} helper -- setAttribute', { setup() { renderer = InteractiveRenderer.create({ dom }); @@ -221,7 +218,7 @@ QUnit.module('ember-htmlbars: {{attribute}} helper -- setAttribute', { } }); -QUnit.test('calls setAttribute for new values', function() { +test('calls setAttribute for new values', function() { var context = EmberObject.create({ name: 'erik' }); view = EmberView.create({ renderer: renderer, @@ -240,7 +237,7 @@ QUnit.test('calls setAttribute for new values', function() { deepEqual(setAttributeCalls, expected); }); -QUnit.test('does not call setAttribute if the same value is set', function() { +test('does not call setAttribute if the same value is set', function() { var context = EmberObject.create({ name: 'erik' }); view = EmberView.create({ renderer: renderer, @@ -260,5 +257,3 @@ QUnit.test('does not call setAttribute if the same value is set', function() { deepEqual(setAttributeCalls, expected); }); - -} diff --git a/packages/ember-htmlbars/tests/attr_nodes/href_test.js b/packages/ember-htmlbars/tests/attr_nodes/href_test.js index 6c6849cd104..5e2e6b85d23 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/href_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/href_test.js @@ -2,6 +2,7 @@ import EmberView from 'ember-views/views/view'; import run from 'ember-metal/run_loop'; import compile from 'ember-template-compiler/system/compile'; import { equalInnerHTML } from 'htmlbars-test-helpers'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var view; @@ -9,11 +10,7 @@ function appendView(view) { run(function() { view.appendTo('#qunit-fixture'); }); } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-htmlbars: href attribute', { +testModule('ember-htmlbars: href attribute', { teardown() { if (view) { run(view, view.destroy); @@ -21,7 +18,7 @@ QUnit.module('ember-htmlbars: href attribute', { } }); -QUnit.test('href is set', function() { +test('href is set', function() { view = EmberView.create({ context: { url: 'http://example.com' }, template: compile('') @@ -31,5 +28,3 @@ QUnit.test('href is set', function() { equalInnerHTML(view.element, '', 'attribute is output'); }); - -} diff --git a/packages/ember-htmlbars/tests/attr_nodes/property_test.js b/packages/ember-htmlbars/tests/attr_nodes/property_test.js index 62d9b04970e..0b4f5ca7f73 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/property_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/property_test.js @@ -1,6 +1,7 @@ import EmberView from 'ember-views/views/view'; import run from 'ember-metal/run_loop'; import compile from 'ember-template-compiler/system/compile'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var view; @@ -15,11 +16,7 @@ function canSetFalsyMaxLength() { return input.maxLength === 0; } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-htmlbars: property', { +testModule('ember-htmlbars: property', { teardown() { if (view) { run(view, view.destroy); @@ -27,7 +24,7 @@ QUnit.module('ember-htmlbars: property', { } }); -QUnit.test('maxlength sets the property and attribute', function() { +test('maxlength sets the property and attribute', function() { view = EmberView.create({ context: { length: 5 }, template: compile('') @@ -40,7 +37,7 @@ QUnit.test('maxlength sets the property and attribute', function() { equal(view.element.firstChild.maxLength, 1); }); -QUnit.test('quoted maxlength sets the attribute and is reflected as a property', function() { +test('quoted maxlength sets the attribute and is reflected as a property', function() { view = EmberView.create({ context: { length: 5 }, template: compile('') @@ -58,7 +55,7 @@ QUnit.test('quoted maxlength sets the attribute and is reflected as a property', } }); -QUnit.test('array value can be set as property', function() { +test('array value can be set as property', function() { view = EmberView.create({ context: {}, template: compile('') @@ -69,5 +66,3 @@ QUnit.test('array value can be set as property', function() { run(view, view.set, 'context.items', [4, 5]); ok(true, 'no legacy assertion prohibited setting an array'); }); - -} diff --git a/packages/ember-htmlbars/tests/attr_nodes/sanitized_test.js b/packages/ember-htmlbars/tests/attr_nodes/sanitized_test.js index 277f399bf8d..0934a714464 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/sanitized_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/sanitized_test.js @@ -5,14 +5,11 @@ import compile from 'ember-template-compiler/system/compile'; import { SafeString } from 'ember-htmlbars/utils/string'; import { runDestroy } from 'ember-runtime/tests/utils'; import { environment } from 'ember-environment'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var view; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-htmlbars: sanitized attribute', { +testModule('ember-htmlbars: sanitized attribute', { teardown() { runDestroy(view); } @@ -68,7 +65,7 @@ for (var i = 0; i < badTags.length; i++) { return; } - QUnit.test(`${subject.tag} ${subject.attr} is sanitized when using blacklisted protocol`, function() { + test(`${subject.tag} ${subject.attr} is sanitized when using blacklisted protocol`, function() { view = EmberView.create({ context: { url: 'javascript://example.com' }, template: subject.unquotedTemplate @@ -81,7 +78,7 @@ for (var i = 0; i < badTags.length; i++) { 'attribute is output'); }); - QUnit.test(`${subject.tag} ${subject.attr} is sanitized when using quoted non-whitelisted protocol`, function() { + test(`${subject.tag} ${subject.attr} is sanitized when using quoted non-whitelisted protocol`, function() { view = EmberView.create({ context: { url: 'javascript://example.com' }, template: subject.quotedTemplate @@ -94,7 +91,7 @@ for (var i = 0; i < badTags.length; i++) { 'attribute is output'); }); - QUnit.test(`${subject.tag} ${subject.attr} is not sanitized when using non-whitelisted protocol with a SafeString`, function() { + test(`${subject.tag} ${subject.attr} is not sanitized when using non-whitelisted protocol with a SafeString`, function() { view = EmberView.create({ context: { url: new SafeString('javascript://example.com') }, template: subject.unquotedTemplate @@ -112,7 +109,7 @@ for (var i = 0; i < badTags.length; i++) { } }); - QUnit.test(`${subject.tag} ${subject.attr} is sanitized when using quoted+concat non-whitelisted protocol`, function() { + test(`${subject.tag} ${subject.attr} is sanitized when using quoted+concat non-whitelisted protocol`, function() { view = EmberView.create({ context: { protocol: 'javascript:', path: '//example.com' }, template: subject.multipartTemplate @@ -127,5 +124,3 @@ for (var i = 0; i < badTags.length; i++) { /* jshint +W083 */ } // jscs:enable disallowTrailingWhitespace - -} diff --git a/packages/ember-htmlbars/tests/attr_nodes/style_test.js b/packages/ember-htmlbars/tests/attr_nodes/style_test.js index 79f4aa64106..32189efc9f4 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/style_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/style_test.js @@ -6,13 +6,11 @@ import compile from 'ember-template-compiler/system/compile'; import { SafeString } from 'ember-htmlbars/utils/string'; import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; import { styleWarning } from 'ember-htmlbars/morphs/attr-morph'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var view, originalWarn, warnings; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable -QUnit.module('ember-htmlbars: style attribute', { +testModule('ember-htmlbars: style attribute', { setup() { warnings = []; originalWarn = getDebugFunction('warn'); @@ -30,7 +28,7 @@ QUnit.module('ember-htmlbars: style attribute', { }); if (!EmberDev.runningProdBuild) { - QUnit.test('specifying `
` generates a warning', function() { + test('specifying `
` generates a warning', function() { view = EmberView.create({ userValue: 'width: 42px', template: compile('
') @@ -41,7 +39,7 @@ if (!EmberDev.runningProdBuild) { deepEqual(warnings, [styleWarning]); }); - QUnit.test('specifying `attributeBindings: ["style"]` generates a warning', function() { + test('specifying `attributeBindings: ["style"]` generates a warning', function() { view = EmberView.create({ userValue: 'width: 42px', template: compile('
') @@ -53,7 +51,7 @@ if (!EmberDev.runningProdBuild) { }); } -QUnit.test('specifying `
` works properly without a warning', function() { +test('specifying `
` works properly without a warning', function() { view = EmberView.create({ userValue: 'width: 42px', template: compile('
') @@ -64,7 +62,7 @@ QUnit.test('specifying `
` works properly withou deepEqual(warnings, [ ]); }); -QUnit.test('specifying `
` works properly with a SafeString', function() { +test('specifying `
` works properly with a SafeString', function() { view = EmberView.create({ userValue: new SafeString('width: 42px'), template: compile('
') @@ -75,7 +73,7 @@ QUnit.test('specifying `
` works properly with a S deepEqual(warnings, [ ]); }); -QUnit.test('null value do not generate htmlsafe warning', function() { +test('null value do not generate htmlsafe warning', function() { view = EmberView.create({ userValue: null, template: compile('
') @@ -86,7 +84,7 @@ QUnit.test('null value do not generate htmlsafe warning', function() { deepEqual(warnings, [ ]); }); -QUnit.test('undefined value do not generate htmlsafe warning', function() { +test('undefined value do not generate htmlsafe warning', function() { view = EmberView.create({ template: compile('
') }); @@ -95,5 +93,3 @@ QUnit.test('undefined value do not generate htmlsafe warning', function() { deepEqual(warnings, [ ]); }); - -} diff --git a/packages/ember-htmlbars/tests/attr_nodes/svg_test.js b/packages/ember-htmlbars/tests/attr_nodes/svg_test.js index 5876f415e19..603ded52fd9 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/svg_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/svg_test.js @@ -2,6 +2,7 @@ import EmberView from 'ember-views/views/view'; import run from 'ember-metal/run_loop'; import compile from 'ember-template-compiler/system/compile'; import { equalInnerHTML } from 'htmlbars-test-helpers'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var view; @@ -9,11 +10,7 @@ function appendView(view) { run(function() { view.appendTo('#qunit-fixture'); }); } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-htmlbars: svg attribute', { +testModule('ember-htmlbars: svg attribute', { teardown() { if (view) { run(view, view.destroy); @@ -21,7 +18,7 @@ QUnit.module('ember-htmlbars: svg attribute', { } }); -QUnit.test('unquoted viewBox property is output', function() { +test('unquoted viewBox property is output', function() { var viewBoxString = '0 0 100 100'; view = EmberView.create({ context: { viewBoxString: viewBoxString }, @@ -35,7 +32,7 @@ QUnit.test('unquoted viewBox property is output', function() { equal(view.element.getAttribute('svg'), null, 'attribute is removed'); }); -QUnit.test('quoted viewBox property is output', function() { +test('quoted viewBox property is output', function() { var viewBoxString = '0 0 100 100'; view = EmberView.create({ context: { viewBoxString: viewBoxString }, @@ -46,7 +43,7 @@ QUnit.test('quoted viewBox property is output', function() { equalInnerHTML(view.element, ``, 'attribute is output'); }); -QUnit.test('quoted viewBox property is concat', function() { +test('quoted viewBox property is concat', function() { var viewBoxString = '100 100'; view = EmberView.create({ context: { viewBoxString: viewBoxString }, @@ -62,7 +59,7 @@ QUnit.test('quoted viewBox property is concat', function() { equalInnerHTML(view.element, ``, 'attribute is output'); }); -QUnit.test('class is output', function() { +test('class is output', function() { view = EmberView.create({ context: { color: 'blue' }, template: compile('') @@ -75,5 +72,3 @@ QUnit.test('class is output', function() { equalInnerHTML(view.element, '', 'attribute is output'); }); - -} diff --git a/packages/ember-htmlbars/tests/attr_nodes/value_test.js b/packages/ember-htmlbars/tests/attr_nodes/value_test.js index b19600c3b00..67bcbd73e89 100644 --- a/packages/ember-htmlbars/tests/attr_nodes/value_test.js +++ b/packages/ember-htmlbars/tests/attr_nodes/value_test.js @@ -1,6 +1,7 @@ import EmberView from 'ember-views/views/view'; import run from 'ember-metal/run_loop'; import compile from 'ember-template-compiler/system/compile'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var view; @@ -8,11 +9,7 @@ function appendView(view) { run(function() { view.appendTo('#qunit-fixture'); }); } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-htmlbars: value attribute', { +testModule('ember-htmlbars: value attribute', { teardown() { if (view) { run(view, view.destroy); @@ -20,7 +17,7 @@ QUnit.module('ember-htmlbars: value attribute', { } }); -QUnit.test('property is output', function() { +test('property is output', function() { view = EmberView.create({ context: { name: 'rick' }, template: compile('') @@ -32,7 +29,7 @@ QUnit.test('property is output', function() { 'property is set true'); }); -QUnit.test('string property is output', function() { +test('string property is output', function() { view = EmberView.create({ context: { name: 'rick' }, template: compile('') @@ -44,7 +41,7 @@ QUnit.test('string property is output', function() { 'property is set true'); }); -QUnit.test('blank property is output', function() { +test('blank property is output', function() { view = EmberView.create({ context: { name: '' }, template: compile('') @@ -55,5 +52,3 @@ QUnit.test('blank property is output', function() { equal(view.element.firstChild.value, '', 'property is set true'); }); - -} diff --git a/packages/ember-htmlbars/tests/compat/view_helper_test.js b/packages/ember-htmlbars/tests/compat/view_helper_test.js index 5f907e172a3..9eb741ee9c6 100644 --- a/packages/ember-htmlbars/tests/compat/view_helper_test.js +++ b/packages/ember-htmlbars/tests/compat/view_helper_test.js @@ -11,16 +11,13 @@ import AssertNoViewHelper from 'ember-template-compiler/plugins/assert-no-view-h import { registerKeyword, resetKeyword } from 'ember-htmlbars/tests/utils'; import viewKeyword from 'ember-htmlbars/keywords/view'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; let component, owner, originalViewKeyword; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - let originalLegacyViewSupport = ENV._ENABLE_LEGACY_VIEW_SUPPORT; -QUnit.module('ember-htmlbars: compat - view helper', { +testModule('ember-htmlbars: compat - view helper', { setup() { ENV._ENABLE_LEGACY_VIEW_SUPPORT = false; registerAstPlugin(AssertNoViewHelper); @@ -40,7 +37,7 @@ QUnit.module('ember-htmlbars: compat - view helper', { } }); -QUnit.test('using the view helper fails assertion', function(assert) { +test('using the view helper fails assertion', function(assert) { let ViewClass = EmberView.extend({ template: compile('fooView') }); @@ -56,7 +53,7 @@ QUnit.test('using the view helper fails assertion', function(assert) { }, /Using the `{{view "string"}}` helper/); }); -QUnit.module('ember-htmlbars: compat - view helper [LEGACY]', { +testModule('ember-htmlbars: compat - view helper [LEGACY]', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); @@ -71,7 +68,7 @@ QUnit.module('ember-htmlbars: compat - view helper [LEGACY]', { } }); -QUnit.test('using the view helper with a string (inline form) fails assertion [LEGACY]', function(assert) { +test('using the view helper with a string (inline form) fails assertion [LEGACY]', function(assert) { let ViewClass = EmberView.extend({ template: compile('fooView') }); @@ -89,7 +86,7 @@ QUnit.test('using the view helper with a string (inline form) fails assertion [L assert.equal(component.$().text(), 'fooView', 'view helper is still rendered'); }); -QUnit.test('using the view helper with a string (block form) fails assertion [LEGACY]', function(assert) { +test('using the view helper with a string (block form) fails assertion [LEGACY]', function(assert) { let ViewClass = EmberView.extend({ template: compile('Foo says: {{yield}}') }); @@ -106,5 +103,3 @@ QUnit.test('using the view helper with a string (block form) fails assertion [LE assert.equal(component.$().text(), 'Foo says: I am foo', 'view helper is still rendered'); }); - -} diff --git a/packages/ember-htmlbars/tests/compat/view_keyword_test.js b/packages/ember-htmlbars/tests/compat/view_keyword_test.js index 3300e2d8a98..17865bd94f7 100644 --- a/packages/ember-htmlbars/tests/compat/view_keyword_test.js +++ b/packages/ember-htmlbars/tests/compat/view_keyword_test.js @@ -5,16 +5,13 @@ import compile from 'ember-template-compiler/system/compile'; import { registerAstPlugin, removeAstPlugin } from 'ember-htmlbars/tests/utils'; import AssertNoViewAndControllerPaths from 'ember-template-compiler/plugins/assert-no-view-and-controller-paths'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; let component; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - let originalLegacyViewSupport = ENV._ENABLE_LEGACY_VIEW_SUPPORT; -QUnit.module('ember-htmlbars: compat - view keyword (use as a path)', { +testModule('ember-htmlbars: compat - view keyword (use as a path)', { setup() { ENV._ENABLE_LEGACY_VIEW_SUPPORT = false; registerAstPlugin(AssertNoViewAndControllerPaths); @@ -27,7 +24,7 @@ QUnit.module('ember-htmlbars: compat - view keyword (use as a path)', { } }); -QUnit.test('reading the view keyword fails assertion', function() { +test('reading the view keyword fails assertion', function() { var text = 'a-prop'; expectAssertion(function() { component = EmberComponent.extend({ @@ -38,5 +35,3 @@ QUnit.test('reading the view keyword fails assertion', function() { runAppend(component); }, /Using `{{view}}` or any path based on it .*/); }); - -} diff --git a/packages/ember-htmlbars/tests/helpers/-html-safe-test.js b/packages/ember-htmlbars/tests/helpers/-html-safe-test.js index b0712334023..9107072db31 100644 --- a/packages/ember-htmlbars/tests/helpers/-html-safe-test.js +++ b/packages/ember-htmlbars/tests/helpers/-html-safe-test.js @@ -6,14 +6,11 @@ import Component from 'ember-views/components/component'; import compile from 'ember-template-compiler/system/compile'; import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var component, registry, container, warnings, originalWarn; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-htmlbars: {{-html-safe}} helper', { +testModule('ember-htmlbars: {{-html-safe}} helper', { setup() { registry = new Registry(); container = registry.container(); @@ -35,7 +32,7 @@ QUnit.module('ember-htmlbars: {{-html-safe}} helper', { } }); -QUnit.test('adds the attribute to the element', function() { +test('adds the attribute to the element', function() { component = Component.create({ container, @@ -48,7 +45,7 @@ QUnit.test('adds the attribute to the element', function() { }); if (!EmberDev.runningProdBuild) { - QUnit.test('no warnings are triggered from setting style attribute', function() { + test('no warnings are triggered from setting style attribute', function() { component = Component.create({ container, @@ -60,5 +57,3 @@ if (!EmberDev.runningProdBuild) { deepEqual(warnings, [], 'no warnings were triggered'); }); } - -} diff --git a/packages/ember-htmlbars/tests/helpers/input_test.js b/packages/ember-htmlbars/tests/helpers/input_test.js index be6a5cbaf0c..d5da8c45d14 100644 --- a/packages/ember-htmlbars/tests/helpers/input_test.js +++ b/packages/ember-htmlbars/tests/helpers/input_test.js @@ -9,6 +9,7 @@ import Checkbox from 'ember-views/views/checkbox'; import EventDispatcher from 'ember-views/system/event_dispatcher'; import buildOwner from 'container/tests/test-helpers/build-owner'; import { OWNER } from 'container/owner'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var view; var controller, owner; @@ -24,11 +25,7 @@ function commonSetup() { dispatcher.setup({}, '#qunit-fixture'); } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('{{input type=\'text\'}}', { +testModule('{{input type=\'text\'}}', { setup() { commonSetup(); @@ -56,11 +53,11 @@ QUnit.module('{{input type=\'text\'}}', { } }); -QUnit.test('should insert a text field into DOM', function() { +test('should insert a text field into DOM', function() { equal(view.$('input').length, 1, 'A single text field was inserted'); }); -QUnit.test('should become disabled if the disabled attribute is true', function() { +test('should become disabled if the disabled attribute is true', function() { ok(view.$('input').is(':not(:disabled)'), 'There are no disabled text fields'); run(null, set, controller, 'disabled', true); @@ -70,7 +67,7 @@ QUnit.test('should become disabled if the disabled attribute is true', function( ok(view.$('input').is(':not(:disabled)'), 'There are no disabled text fields'); }); -QUnit.test('input value is updated when setting value property of view', function() { +test('input value is updated when setting value property of view', function() { equal(view.$('input').val(), 'hello', 'renders text field with value'); let id = view.$('input').prop('id'); @@ -81,37 +78,37 @@ QUnit.test('input value is updated when setting value property of view', functio equal(view.$('input').prop('id'), id, 'the component hasn\'t changed'); }); -QUnit.test('input placeholder is updated when setting placeholder property of view', function() { +test('input placeholder is updated when setting placeholder property of view', function() { equal(view.$('input').attr('placeholder'), 'Enter some text', 'renders text field with placeholder'); run(null, set, controller, 'place', 'Text, please enter it'); equal(view.$('input').attr('placeholder'), 'Text, please enter it', 'updates text field after placeholder changes'); }); -QUnit.test('input name is updated when setting name property of view', function() { +test('input name is updated when setting name property of view', function() { equal(view.$('input').attr('name'), 'some-name', 'renders text field with name'); run(null, set, controller, 'name', 'other-name'); equal(view.$('input').attr('name'), 'other-name', 'updates text field after name changes'); }); -QUnit.test('input maxlength is updated when setting maxlength property of view', function() { +test('input maxlength is updated when setting maxlength property of view', function() { equal(view.$('input').attr('maxlength'), '30', 'renders text field with maxlength'); run(null, set, controller, 'max', 40); equal(view.$('input').attr('maxlength'), '40', 'updates text field after maxlength changes'); }); -QUnit.test('input size is updated when setting size property of view', function() { +test('input size is updated when setting size property of view', function() { equal(view.$('input').attr('size'), '30', 'renders text field with size'); run(null, set, controller, 'size', 40); equal(view.$('input').attr('size'), '40', 'updates text field after size changes'); }); -QUnit.test('input tabindex is updated when setting tabindex property of view', function() { +test('input tabindex is updated when setting tabindex property of view', function() { equal(view.$('input').attr('tabindex'), '5', 'renders text field with the tabindex'); run(null, set, controller, 'tab', 3); equal(view.$('input').attr('tabindex'), '3', 'updates text field after tabindex changes'); }); -QUnit.test('cursor position is not lost when updating content', function() { +test('cursor position is not lost when updating content', function() { equal(view.$('input').val(), 'hello', 'precondition - renders text field with value'); var $input = view.$('input'); @@ -132,7 +129,7 @@ QUnit.test('cursor position is not lost when updating content', function() { equal(input.selectionEnd, 3, 'cursor position was not lost'); }); -QUnit.test('input can be updated multiple times', function() { +test('input can be updated multiple times', function() { equal(view.$('input').val(), 'hello', 'precondition - renders text field with value'); var $input = view.$('input'); @@ -153,7 +150,7 @@ QUnit.test('input can be updated multiple times', function() { }); -QUnit.module('{{input type=\'text\'}} - static values', { +testModule('{{input type=\'text\'}} - static values', { setup() { commonSetup(); @@ -174,39 +171,39 @@ QUnit.module('{{input type=\'text\'}} - static values', { } }); -QUnit.test('should insert a text field into DOM', function() { +test('should insert a text field into DOM', function() { equal(view.$('input').length, 1, 'A single text field was inserted'); }); -QUnit.test('should become disabled if the disabled attribute is true', function() { +test('should become disabled if the disabled attribute is true', function() { ok(view.$('input').is(':disabled'), 'The text field is disabled'); }); -QUnit.test('input value is updated when setting value property of view', function() { +test('input value is updated when setting value property of view', function() { equal(view.$('input').val(), 'hello', 'renders text field with value'); }); -QUnit.test('input placeholder is updated when setting placeholder property of view', function() { +test('input placeholder is updated when setting placeholder property of view', function() { equal(view.$('input').attr('placeholder'), 'Enter some text', 'renders text field with placeholder'); }); -QUnit.test('input name is updated when setting name property of view', function() { +test('input name is updated when setting name property of view', function() { equal(view.$('input').attr('name'), 'some-name', 'renders text field with name'); }); -QUnit.test('input maxlength is updated when setting maxlength property of view', function() { +test('input maxlength is updated when setting maxlength property of view', function() { equal(view.$('input').attr('maxlength'), '30', 'renders text field with maxlength'); }); -QUnit.test('input size is updated when setting size property of view', function() { +test('input size is updated when setting size property of view', function() { equal(view.$('input').attr('size'), '30', 'renders text field with size'); }); -QUnit.test('input tabindex is updated when setting tabindex property of view', function() { +test('input tabindex is updated when setting tabindex property of view', function() { equal(view.$('input').attr('tabindex'), '5', 'renders text field with the tabindex'); }); -QUnit.test('specifying `on="someevent" action="foo"` triggers the action', function() { +test('specifying `on="someevent" action="foo"` triggers the action', function() { expect(2); runDestroy(view); expectDeprecation(`Using '{{input on="focus-in" action="doFoo"}}' ('foo.hbs' @ L1:C0) is deprecated. Please use '{{input focus-in="doFoo"}}' instead.`); @@ -231,7 +228,7 @@ QUnit.test('specifying `on="someevent" action="foo"` triggers the action', funct }); }); -QUnit.module('{{input type=\'text\'}} - dynamic type', { +testModule('{{input type=\'text\'}} - dynamic type', { setup() { commonSetup(); @@ -254,11 +251,11 @@ QUnit.module('{{input type=\'text\'}} - dynamic type', { } }); -QUnit.test('should insert a text field into DOM', function() { +test('should insert a text field into DOM', function() { equal(view.$('input').attr('type'), 'password', 'a bound property can be used to determine type.'); }); -QUnit.test('should change if the type changes', function() { +test('should change if the type changes', function() { equal(view.$('input').attr('type'), 'password', 'a bound property can be used to determine type.'); run(function() { @@ -268,7 +265,7 @@ QUnit.test('should change if the type changes', function() { equal(view.$('input').attr('type'), 'text', 'it changes after the type changes'); }); -QUnit.module('{{input}} - default type', { +testModule('{{input}} - default type', { setup() { commonSetup(); @@ -289,11 +286,11 @@ QUnit.module('{{input}} - default type', { } }); -QUnit.test('should have the default type', function() { +test('should have the default type', function() { equal(view.$('input').attr('type'), 'text', 'Has a default text type'); }); -QUnit.module('{{input type=\'checkbox\'}}', { +testModule('{{input type=\'checkbox\'}}', { setup() { commonSetup(); @@ -318,35 +315,35 @@ QUnit.module('{{input type=\'checkbox\'}}', { } }); -QUnit.test('should append a checkbox', function() { +test('should append a checkbox', function() { equal(view.$('input[type=checkbox]').length, 1, 'A single checkbox is added'); }); -QUnit.test('should begin disabled if the disabled attribute is true', function() { +test('should begin disabled if the disabled attribute is true', function() { ok(view.$('input').is(':not(:disabled)'), 'The checkbox isn\'t disabled'); run(null, set, controller, 'disabled', true); ok(view.$('input').is(':disabled'), 'The checkbox is now disabled'); }); -QUnit.test('should support the tabindex property', function() { +test('should support the tabindex property', function() { equal(view.$('input').prop('tabindex'), '6', 'the initial checkbox tabindex is set in the DOM'); run(null, set, controller, 'tab', 3); equal(view.$('input').prop('tabindex'), '3', 'the checkbox tabindex changes when it is changed in the view'); }); -QUnit.test('checkbox name is updated', function() { +test('checkbox name is updated', function() { equal(view.$('input').attr('name'), 'hello', 'renders checkbox with the name'); run(null, set, controller, 'name', 'bye'); equal(view.$('input').attr('name'), 'bye', 'updates checkbox after name changes'); }); -QUnit.test('checkbox checked property is updated', function() { +test('checkbox checked property is updated', function() { equal(view.$('input').prop('checked'), false, 'the checkbox isn\'t checked yet'); run(null, set, controller, 'val', true); equal(view.$('input').prop('checked'), true, 'the checkbox is checked now'); }); -QUnit.module('{{input type=\'checkbox\'}} - prevent value= usage', { +testModule('{{input type=\'checkbox\'}} - prevent value= usage', { setup() { commonSetup(); @@ -363,13 +360,13 @@ QUnit.module('{{input type=\'checkbox\'}} - prevent value= usage', { } }); -QUnit.test('It asserts the presence of checked=', function() { +test('It asserts the presence of checked=', function() { expectAssertion(function() { runAppend(view); }, /you must use `checked=/); }); -QUnit.module('{{input type=boundType}}', { +testModule('{{input type=boundType}}', { setup() { commonSetup(); @@ -393,17 +390,17 @@ QUnit.module('{{input type=boundType}}', { } }); -QUnit.test('should append a checkbox', function() { +test('should append a checkbox', function() { equal(view.$('input[type=checkbox]').length, 1, 'A single checkbox is added'); }); // Checking for the checked property is a good way to verify that the correct // view was used. -QUnit.test('checkbox checked property is updated', function() { +test('checkbox checked property is updated', function() { equal(view.$('input').prop('checked'), true, 'the checkbox is checked'); }); -QUnit.module('{{input type=\'checkbox\'}} - static values', { +testModule('{{input type=\'checkbox\'}} - static values', { setup() { commonSetup(); @@ -428,23 +425,23 @@ QUnit.module('{{input type=\'checkbox\'}} - static values', { } }); -QUnit.test('should begin disabled if the disabled attribute is true', function() { +test('should begin disabled if the disabled attribute is true', function() { ok(view.$().is(':not(:disabled)'), 'The checkbox isn\'t disabled'); }); -QUnit.test('should support the tabindex property', function() { +test('should support the tabindex property', function() { equal(view.$('input').prop('tabindex'), '6', 'the initial checkbox tabindex is set in the DOM'); }); -QUnit.test('checkbox name is updated', function() { +test('checkbox name is updated', function() { equal(view.$('input').attr('name'), 'hello', 'renders checkbox with the name'); }); -QUnit.test('checkbox checked property is updated', function() { +test('checkbox checked property is updated', function() { equal(view.$('input').prop('checked'), false, 'the checkbox isn\'t checked yet'); }); -QUnit.module('{{input type=\'text\'}} - null/undefined values', { +testModule('{{input type=\'text\'}} - null/undefined values', { setup() { commonSetup(); }, @@ -455,7 +452,7 @@ QUnit.module('{{input type=\'text\'}} - null/undefined values', { } }); -QUnit.test('placeholder attribute bound to undefined is not present', function() { +test('placeholder attribute bound to undefined is not present', function() { view = View.extend({ [OWNER]: owner, controller: {}, @@ -471,7 +468,7 @@ QUnit.test('placeholder attribute bound to undefined is not present', function() equal(view.element.childNodes[1].getAttribute('placeholder'), 'foo', 'attribute is present'); }); -QUnit.test('placeholder attribute bound to null is not present', function() { +test('placeholder attribute bound to null is not present', function() { view = View.extend({ [OWNER]: owner, controller: { @@ -488,5 +485,3 @@ QUnit.test('placeholder attribute bound to null is not present', function() { equal(view.element.childNodes[1].getAttribute('placeholder'), 'foo', 'attribute is present'); }); - -} diff --git a/packages/ember-htmlbars/tests/helpers/view_test.js b/packages/ember-htmlbars/tests/helpers/view_test.js index 3f044d2f699..e3853abb940 100644 --- a/packages/ember-htmlbars/tests/helpers/view_test.js +++ b/packages/ember-htmlbars/tests/helpers/view_test.js @@ -47,11 +47,9 @@ function viewClass(options) { var firstChild = nthChild; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-htmlbars: {{#view}} helper', { +testModule('ember-htmlbars: {{#view}} helper', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); @@ -76,7 +74,7 @@ QUnit.module('ember-htmlbars: {{#view}} helper', { }); // https://github.com/emberjs/ember.js/issues/120 -QUnit.test('should not enter an infinite loop when binding an attribute in Handlebars', function() { +test('should not enter an infinite loop when binding an attribute in Handlebars', function() { var LinkView = EmberView.extend({ classNames: ['app-link'], tagName: 'a', @@ -105,7 +103,7 @@ QUnit.test('should not enter an infinite loop when binding an attribute in Handl runDestroy(parentView); }); -QUnit.test('By default view:toplevel is used', function() { +test('By default view:toplevel is used', function() { var DefaultView = viewClass({ elementId: 'toplevel-view', template: compile('hello world') @@ -123,7 +121,7 @@ QUnit.test('By default view:toplevel is used', function() { equal(jQuery('#toplevel-view').text(), 'hello world'); }); -QUnit.test('By default, without an owner, EmberView is used', function() { +test('By default, without an owner, EmberView is used', function() { view = EmberView.extend({ template: compile('{{view tagName="span"}}') }).create(); @@ -133,7 +131,7 @@ QUnit.test('By default, without an owner, EmberView is used', function() { ok(jQuery('#qunit-fixture').html().toUpperCase().match(/bold' @@ -499,7 +497,7 @@ QUnit.test('should escape HTML in normal mustaches', function() { equal(view.$('i').length, 0, 'does not create an element when value is updated'); }); -QUnit.test('should not escape HTML in triple mustaches', function() { +test('should not escape HTML in triple mustaches', function() { view = EmberView.create({ template: compile('{{{view.output}}}'), output: 'you need to be more bold' @@ -516,7 +514,7 @@ QUnit.test('should not escape HTML in triple mustaches', function() { equal(view.$('i').length, 1, 'creates an element when value is updated'); }); -QUnit.test('should not escape HTML if string is a Handlebars.SafeString', function() { +test('should not escape HTML if string is a Handlebars.SafeString', function() { view = EmberView.create({ template: compile('{{view.output}}'), output: new SafeString('you need to be more bold') @@ -533,7 +531,7 @@ QUnit.test('should not escape HTML if string is a Handlebars.SafeString', functi equal(view.$('i').length, 1, 'creates an element when value is updated'); }); -QUnit.test('should teardown observers from bound properties on rerender', function() { +test('should teardown observers from bound properties on rerender', function() { view = EmberView.create({ template: compile('{{view.foo}}'), foo: 'bar' @@ -550,7 +548,7 @@ QUnit.test('should teardown observers from bound properties on rerender', functi equal(observersFor(view, 'foo').length, 1); }); -QUnit.test('should update bound values after the view is removed and then re-appended', function() { +test('should update bound values after the view is removed and then re-appended', function() { view = EmberView.create({ template: compile('{{#if view.showStuff}}{{view.boundValue}}{{else}}Not true.{{/if}}'), showStuff: true, @@ -585,7 +583,7 @@ QUnit.test('should update bound values after the view is removed and then re-app equal(trim(view.$().text()), 'bar'); }); -QUnit.test('views set the template of their children to a passed block', function() { +test('views set the template of their children to a passed block', function() { owner.register('template:parent', compile('

{{#view}}It worked!{{/view}}

')); view = EmberView.create({ @@ -597,7 +595,7 @@ QUnit.test('views set the template of their children to a passed block', functio ok(view.$('h1:has(span)').length === 1, 'renders the passed template inside the parent template'); }); -QUnit.test('{{view}} should not override class bindings defined on a child view', function() { +test('{{view}} should not override class bindings defined on a child view', function() { var LabelView = EmberView.extend({ classNameBindings: ['something'], something: 'visible' @@ -618,7 +616,7 @@ QUnit.test('{{view}} should not override class bindings defined on a child view' ok(view.$('.visible').length > 0, 'class bindings are not overriden'); }); -QUnit.test('child views can be inserted using the {{view}} helper', function() { +test('child views can be inserted using the {{view}} helper', function() { owner.register('template:nester', compile('

Hello {{world}}

{{view view.labelView}}')); owner.register('template:nested', compile('
Goodbye {{cruel}} {{world}}
')); @@ -647,7 +645,7 @@ QUnit.test('child views can be inserted using the {{view}} helper', function() { ok(view.$().text().match(/Hello world!.*Goodbye cruel world\!/), 'parent view should appear before the child view'); }); -QUnit.test('should be able to explicitly set a view\'s context', function() { +test('should be able to explicitly set a view\'s context', function() { var context = EmberObject.create({ test: 'test' }); @@ -667,7 +665,7 @@ QUnit.test('should be able to explicitly set a view\'s context', function() { equal(view.$().text(), 'test'); }); -QUnit.test('Template views add an elementId to child views created using the view helper', function() { +test('Template views add an elementId to child views created using the view helper', function() { owner.register('template:parent', compile('
{{view view.childView}}
')); owner.register('template:child', compile('I can\'t believe it\'s not butter.')); @@ -687,7 +685,7 @@ QUnit.test('Template views add an elementId to child views created using the vie equal(view.$().children().first().children().first().attr('id'), get(childView, 'elementId')); }); -QUnit.test('Child views created using the view helper should have their parent view set properly', function() { +test('Child views created using the view helper should have their parent view set properly', function() { var template = '{{#view}}{{#view}}{{view}}{{/view}}{{/view}}'; view = EmberView.create({ @@ -700,7 +698,7 @@ QUnit.test('Child views created using the view helper should have their parent v equal(childView, get(firstChild(childView), 'parentView'), 'parent view is correct'); }); -QUnit.test('Child views created using the view helper should have their IDs registered for events', function() { +test('Child views created using the view helper should have their IDs registered for events', function() { var template = '{{view}}{{view id="templateViewTest"}}'; view = EmberView.create({ @@ -719,7 +717,7 @@ QUnit.test('Child views created using the view helper should have their IDs regi equal(EmberView.views[id], childView, 'childView with passed ID is registered with View.views so that it can properly receive events from EventDispatcher'); }); -QUnit.test('Child views created using the view helper and that have a viewName should be registered as properties on their parentView', function() { +test('Child views created using the view helper and that have a viewName should be registered as properties on their parentView', function() { var template = '{{#view}}{{view viewName="ohai"}}{{/view}}'; view = EmberView.create({ @@ -734,7 +732,7 @@ QUnit.test('Child views created using the view helper and that have a viewName s equal(get(parentView, 'ohai'), childView); }); -QUnit.test('{{view}} id attribute should set id on layer', function() { +test('{{view}} id attribute should set id on layer', function() { owner.register('template:foo', compile('{{#view view.idView id="bar"}}baz{{/view}}')); var IdView = EmberView; @@ -751,7 +749,7 @@ QUnit.test('{{view}} id attribute should set id on layer', function() { equal(view.$('#bar').text(), 'baz', 'emits content'); }); -QUnit.test('{{view}} tag attribute should set tagName of the view', function() { +test('{{view}} tag attribute should set tagName of the view', function() { owner.register('template:foo', compile('{{#view view.tagView tag="span"}}baz{{/view}}')); var TagView = EmberView; @@ -768,7 +766,7 @@ QUnit.test('{{view}} tag attribute should set tagName of the view', function() { equal(view.$('span').text(), 'baz', 'emits content'); }); -QUnit.test('{{view}} class attribute should set class on layer', function() { +test('{{view}} class attribute should set class on layer', function() { owner.register('template:foo', compile('{{#view view.idView class="bar"}}baz{{/view}}')); var IdView = EmberView; @@ -785,7 +783,7 @@ QUnit.test('{{view}} class attribute should set class on layer', function() { equal(view.$('.bar').text(), 'baz', 'emits content'); }); -QUnit.test('{{view}} should not allow attributeBindings to be set', function() { +test('{{view}} should not allow attributeBindings to be set', function() { expectAssertion(function() { view = EmberView.create({ template: compile('{{view attributeBindings="one two"}}') @@ -794,7 +792,7 @@ QUnit.test('{{view}} should not allow attributeBindings to be set', function() { }, /Setting 'attributeBindings' via template helpers is not allowed/); }); -QUnit.test('{{view}} should be able to point to a local view', function() { +test('{{view}} should be able to point to a local view', function() { view = EmberView.create({ template: compile('{{view view.common}}'), @@ -808,7 +806,7 @@ QUnit.test('{{view}} should be able to point to a local view', function() { equal(view.$().text(), 'common', 'tries to look up view name locally'); }); -QUnit.test('{{view}} should evaluate class bindings set in the current context', function() { +test('{{view}} should evaluate class bindings set in the current context', function() { view = EmberView.create({ isView: true, isEditable: true, @@ -837,7 +835,7 @@ QUnit.test('{{view}} should evaluate class bindings set in the current context', ok(view.$('input').hasClass('disabled'), 'evaluates ternary operator in classBindings'); }); -QUnit.test('{{view}} should evaluate other attributes bindings set in the current context', function() { +test('{{view}} should evaluate other attributes bindings set in the current context', function() { view = EmberView.create({ name: 'myView', textField: TextField, @@ -849,7 +847,7 @@ QUnit.test('{{view}} should evaluate other attributes bindings set in the curren equal(view.$('input').val(), 'myView', 'evaluates attributes bound in the current context'); }); -QUnit.test('{{view}} should be able to bind class names to truthy properties', function() { +test('{{view}} should be able to bind class names to truthy properties', function() { owner.register('template:template', compile('{{#view view.classBindingView classBinding="view.number:is-truthy"}}foo{{/view}}')); var ClassBindingView = EmberView.extend(); @@ -872,7 +870,7 @@ QUnit.test('{{view}} should be able to bind class names to truthy properties', f equal(view.$('.is-truthy').length, 0, 'removes class name if bound property is set to falsey'); }); -QUnit.test('{{view}} should be able to bind class names to truthy or falsy properties', function() { +test('{{view}} should be able to bind class names to truthy or falsy properties', function() { owner.register('template:template', compile('{{#view view.classBindingView classBinding="view.number:is-truthy:is-falsy"}}foo{{/view}}')); var ClassBindingView = EmberView.extend(); @@ -897,7 +895,7 @@ QUnit.test('{{view}} should be able to bind class names to truthy or falsy prope equal(view.$('.is-falsy').length, 1, 'sets class name to falsy value'); }); -QUnit.test('a view helper\'s bindings are to the parent context', function() { +test('a view helper\'s bindings are to the parent context', function() { var Subview = EmberView.extend({ classNameBindings: ['attrs.color'], controller: EmberObject.create({ @@ -923,7 +921,7 @@ QUnit.test('a view helper\'s bindings are to the parent context', function() { equal(view.$('h1 .mauve').text(), 'foo bar', 'renders property bound in template from subview context'); }); -QUnit.test('should expose a controller that can be used in the view instance', function() { +test('should expose a controller that can be used in the view instance', function() { var templateString = '{{#view view.childThing tagName="div"}}Stuff{{/view}}'; var controller = { foo: 'bar' @@ -947,7 +945,7 @@ QUnit.test('should expose a controller that can be used in the view instance', f equal(controller, childThingController, 'childThing should get the same controller as the outer scope'); }); -QUnit.test('should work with precompiled templates', function() { +test('should work with precompiled templates', function() { var templateString = precompile('{{view.value}}'); var compiledTemplate = template(eval(templateString)); @@ -967,7 +965,7 @@ QUnit.test('should work with precompiled templates', function() { equal(view.$().text(), 'updated', 'the precompiled template was updated'); }); -QUnit.test('bindings should be relative to the current context [DEPRECATED]', function() { +test('bindings should be relative to the current context [DEPRECATED]', function() { view = EmberView.create({ museumOpen: true, @@ -988,7 +986,7 @@ QUnit.test('bindings should be relative to the current context [DEPRECATED]', fu equal(trim(view.$().text()), 'Name: SFMoMA Price: $20', 'should print baz twice'); }); -QUnit.test('bindings should respect keywords [DEPRECATED]', function() { +test('bindings should respect keywords [DEPRECATED]', function() { view = EmberView.create({ museumOpen: true, @@ -1012,7 +1010,7 @@ QUnit.test('bindings should respect keywords [DEPRECATED]', function() { equal(trim(view.$().text()), 'Name: SFMoMA Price: $20', 'should print baz twice'); }); -QUnit.test('should respect keywords', function() { +test('should respect keywords', function() { view = EmberView.create({ museumOpen: true, @@ -1036,7 +1034,7 @@ QUnit.test('should respect keywords', function() { equal(trim(view.$().text()), 'Name: SFMoMA Price: $20', 'should print baz twice'); }); -QUnit.test('should bind to the property if no registered helper found for a mustache without parameters', function() { +test('should bind to the property if no registered helper found for a mustache without parameters', function() { view = EmberView.extend({ foobarProperty: computed(function() { return 'foobarProperty'; @@ -1050,7 +1048,7 @@ QUnit.test('should bind to the property if no registered helper found for a must ok(view.$().text() === 'foobarProperty', 'Property was bound to correctly'); }); -QUnit.test('{{view}} should be able to point to a local instance of view', function() { +test('{{view}} should be able to point to a local instance of view', function() { view = EmberView.create({ template: compile('{{view view.common}}'), @@ -1063,7 +1061,7 @@ QUnit.test('{{view}} should be able to point to a local instance of view', funct equal(view.$().text(), 'common', 'tries to look up view name locally'); }); -QUnit.test('{{view}} should be able to point to a local instance of subclass of view', function() { +test('{{view}} should be able to point to a local instance of subclass of view', function() { var MyView = EmberView.extend(); view = EmberView.create({ template: compile('{{view view.subclassed}}'), @@ -1076,7 +1074,7 @@ QUnit.test('{{view}} should be able to point to a local instance of subclass of equal(view.$().text(), 'subclassed', 'tries to look up view name locally'); }); -QUnit.test('{{view}} asserts that a view class is present', function() { +test('{{view}} asserts that a view class is present', function() { var MyView = EmberObject.extend(); view = EmberView.create({ template: compile('{{view view.notView}}'), @@ -1090,7 +1088,7 @@ QUnit.test('{{view}} asserts that a view class is present', function() { }, /must be a subclass or an instance of Ember.View/); }); -QUnit.test('{{view}} asserts that a view class is present off controller', function() { +test('{{view}} asserts that a view class is present off controller', function() { var MyView = EmberObject.extend(); view = EmberView.create({ template: compile('{{view notView}}'), @@ -1106,7 +1104,7 @@ QUnit.test('{{view}} asserts that a view class is present off controller', funct }, /must be a subclass or an instance of Ember.View/); }); -QUnit.test('{{view}} asserts that a view instance is present', function() { +test('{{view}} asserts that a view instance is present', function() { var MyView = EmberObject.extend(); view = EmberView.create({ template: compile('{{view view.notView}}'), @@ -1120,7 +1118,7 @@ QUnit.test('{{view}} asserts that a view instance is present', function() { }, /must be a subclass or an instance of Ember.View/); }); -QUnit.test('{{view}} asserts that a view subclass instance is present off controller', function() { +test('{{view}} asserts that a view subclass instance is present off controller', function() { var MyView = EmberObject.extend(); view = EmberView.create({ template: compile('{{view notView}}'), @@ -1136,7 +1134,7 @@ QUnit.test('{{view}} asserts that a view subclass instance is present off contro }, /must be a subclass or an instance of Ember.View/); }); -QUnit.test('Specifying `id` to {{view}} is set on the view.', function() { +test('Specifying `id` to {{view}} is set on the view.', function() { owner.register('view:derp', EmberView.extend({ template: compile('
{{view.id}}
{{view.elementId}}
') })); @@ -1154,7 +1152,7 @@ QUnit.test('Specifying `id` to {{view}} is set on the view.', function() { equal(view.$('#view-elementId').text(), 'bar', 'the views elementId property is set'); }); -QUnit.test('Specifying `id` to {{view}} does not allow bound id changes.', function() { +test('Specifying `id` to {{view}} does not allow bound id changes.', function() { owner.register('view:derp', EmberView.extend({ template: compile('
{{view.id}}
{{view.elementId}}
') })); @@ -1174,7 +1172,7 @@ QUnit.test('Specifying `id` to {{view}} does not allow bound id changes.', funct equal(view.$('#bar #view-id').text(), 'baz', 'the views id property is not changed'); }); -QUnit.test('using a bound view name does not change on view name property changes', function() { +test('using a bound view name does not change on view name property changes', function() { owner.register('view:foo', viewClass({ elementId: 'foo' })); @@ -1202,7 +1200,7 @@ QUnit.test('using a bound view name does not change on view name property change equal(view.$('#foo').length, 1, 'the originally rendered view is still present'); }); -QUnit.test('should have the correct action target', function() { +test('should have the correct action target', function() { owner.register('component:x-outer', EmberComponent.extend({ layout: compile('{{#x-middle}}{{view innerView dismiss="dismiss"}}{{/x-middle}}'), actions: { @@ -1235,7 +1233,7 @@ QUnit.test('should have the correct action target', function() { }); }); -QUnit.test('Throw an `Unsupported Content` error when attempting to bind to a function', () => { +test('Throw an `Unsupported Content` error when attempting to bind to a function', () => { view = EmberView.extend({ someFunction() {}, template: compile('{{view.someFunction}}') @@ -1247,5 +1245,3 @@ QUnit.test('Throw an `Unsupported Content` error when attempting to bind to a fu ok(error.message.indexOf('Unsupported Content: Cannot bind to function') > -1); } }); - -} diff --git a/packages/ember-htmlbars/tests/helpers/yield_test.js b/packages/ember-htmlbars/tests/helpers/yield_test.js index 0aba8360fbc..d47f74adcc0 100644 --- a/packages/ember-htmlbars/tests/helpers/yield_test.js +++ b/packages/ember-htmlbars/tests/helpers/yield_test.js @@ -8,6 +8,7 @@ import { registerKeyword, resetKeyword } from 'ember-htmlbars/tests/utils'; import viewKeyword from 'ember-htmlbars/keywords/view'; import buildOwner from 'container/tests/test-helpers/build-owner'; + var view, owner, originalViewKeyword; function commonSetup() { @@ -21,11 +22,9 @@ function commonTeardown() { owner = view = null; } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-htmlbars: Support for {{yield}} helper', { +testModule('ember-htmlbars: Support for {{yield}} helper', { setup() { commonSetup(); originalViewKeyword = registerKeyword('view', viewKeyword); @@ -37,7 +36,7 @@ QUnit.module('ember-htmlbars: Support for {{yield}} helper', { } }); -QUnit.test('view keyword works inside component yield', function () { +test('view keyword works inside component yield', function () { var component = Component.extend({ layout: compile('

{{yield}}

') }); @@ -52,5 +51,3 @@ QUnit.test('view keyword works inside component yield', function () { equal(view.$('div > p').text(), 'hello', 'view keyword inside component yield block should refer to the correct view'); }); - -} diff --git a/packages/ember-htmlbars/tests/htmlbars_test.js b/packages/ember-htmlbars/tests/htmlbars_test.js index 8e0706b4bf7..d39937c0c69 100644 --- a/packages/ember-htmlbars/tests/htmlbars_test.js +++ b/packages/ember-htmlbars/tests/htmlbars_test.js @@ -4,13 +4,11 @@ import { domHelper } from 'ember-htmlbars/env'; import { equalHTML } from 'htmlbars-test-helpers'; import assign from 'ember-metal/assign'; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-htmlbars: main'); +testModule('ember-htmlbars: main'); -QUnit.test('HTMLBars is present and can be executed', function() { +test('HTMLBars is present and can be executed', function() { var template = compile('ohai'); var env = assign({ dom: domHelper }, defaultEnv); @@ -19,4 +17,3 @@ QUnit.test('HTMLBars is present and can be executed', function() { equalHTML(output, 'ohai'); }); -} diff --git a/packages/ember-htmlbars/tests/integration/attribute_bindings_test.js b/packages/ember-htmlbars/tests/integration/attribute_bindings_test.js index f1f295d4e25..8b6453e79ea 100644 --- a/packages/ember-htmlbars/tests/integration/attribute_bindings_test.js +++ b/packages/ember-htmlbars/tests/integration/attribute_bindings_test.js @@ -7,17 +7,15 @@ import { set } from 'ember-metal/property_set'; var view; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-htmlbars: custom morph integration tests', { +testModule('ember-htmlbars: custom morph integration tests', { teardown() { runDestroy(view); } }); -QUnit.test('can properly re-render an if/else with attribute morphs', function() { +test('can properly re-render an if/else with attribute morphs', function() { view = EmberView.create({ trueClass: 'truthy', falseClass: 'falsey', @@ -37,7 +35,7 @@ QUnit.test('can properly re-render an if/else with attribute morphs', function() equal(view.$('.falsey').length, 1, 'inverse block rendered properly'); }); -QUnit.test('can properly re-render an if/else with element morphs', function() { +test('can properly re-render an if/else with element morphs', function() { view = EmberView.create({ trueClass: 'truthy', falseClass: 'falsey', @@ -56,5 +54,3 @@ QUnit.test('can properly re-render an if/else with element morphs', function() { equal(view.$('.falsey').length, 1, 'inverse block rendered properly'); }); - -} diff --git a/packages/ember-htmlbars/tests/integration/component_invocation_test.js b/packages/ember-htmlbars/tests/integration/component_invocation_test.js index 07c6a02d3c5..9c4c84a3f6f 100644 --- a/packages/ember-htmlbars/tests/integration/component_invocation_test.js +++ b/packages/ember-htmlbars/tests/integration/component_invocation_test.js @@ -20,11 +20,9 @@ function commonTeardown() { owner = component = null; } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('component - invocation', { +testModule('component - invocation', { setup() { commonSetup(); }, @@ -34,7 +32,7 @@ QUnit.module('component - invocation', { } }); -QUnit.test('moduleName is available on _renderNode when a layout is present', function() { +test('moduleName is available on _renderNode when a layout is present', function() { expect(1); var layoutModuleName = 'my-app-name/templates/components/sample-component'; @@ -56,7 +54,7 @@ QUnit.test('moduleName is available on _renderNode when a layout is present', fu runAppend(component); }); -QUnit.test('moduleName is available on _renderNode when no layout is present', function() { +test('moduleName is available on _renderNode when no layout is present', function() { expect(1); var templateModuleName = 'my-app-name/templates/application'; @@ -75,5 +73,3 @@ QUnit.test('moduleName is available on _renderNode when no layout is present', f runAppend(component); }); - -} diff --git a/packages/ember-htmlbars/tests/integration/component_lifecycle_test.js b/packages/ember-htmlbars/tests/integration/component_lifecycle_test.js index 4b8c6e38df2..6647b32e406 100644 --- a/packages/ember-htmlbars/tests/integration/component_lifecycle_test.js +++ b/packages/ember-htmlbars/tests/integration/component_lifecycle_test.js @@ -16,9 +16,7 @@ let styles = [{ class: Component }]; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; styles.forEach(style => { function invoke(name, hash = {}) { @@ -47,7 +45,7 @@ styles.forEach(style => { return { isString: true, value: val }; } - QUnit.module(`component - lifecycle hooks (${style.name})`, { + testModule(`component - lifecycle hooks (${style.name})`, { setup() { owner = buildOwner(); owner.registerOptionsForType('component', { singleton: false }); @@ -73,7 +71,7 @@ styles.forEach(style => { return { type: type, view: view, arg: arg }; } - QUnit.test('lifecycle hooks are invoked in a predictable order', function() { + test('lifecycle hooks are invoked in a predictable order', function() { var components = {}; function component(label) { @@ -227,7 +225,7 @@ styles.forEach(style => { ]); }); - QUnit.test('passing values through attrs causes lifecycle hooks to fire if the attribute values have changed', function() { + test('passing values through attrs causes lifecycle hooks to fire if the attribute values have changed', function() { var components = {}; function component(label) { @@ -363,7 +361,7 @@ styles.forEach(style => { ]); }); - QUnit.test('changing a component\'s displayed properties inside didInsertElement() is deprecated', function(assert) { + test('changing a component\'s displayed properties inside didInsertElement() is deprecated', function(assert) { let component; component = style.class.extend({ @@ -387,7 +385,7 @@ styles.forEach(style => { }); }); - QUnit.test('DEPRECATED: didInitAttrs is deprecated', function(assert) { + test('DEPRECATED: didInitAttrs is deprecated', function(assert) { let component; let componentClass = style.class.extend({ @@ -409,7 +407,7 @@ styles.forEach(style => { }); }); - QUnit.test('properties set during `init` are availabe in `didReceiveAttrs`', function(assert) { + test('properties set during `init` are availabe in `didReceiveAttrs`', function(assert) { assert.expect(1); owner.register('component:the-thing', style.class.extend({ @@ -437,5 +435,3 @@ styles.forEach(style => { // TODO: Write a test that involves deep mutability: the component plucks something // from inside the attrs hash out into state and passes it as attrs into a child // component. The hooks should run correctly. - -} diff --git a/packages/ember-htmlbars/tests/node-managers/view-node-manager-test.js b/packages/ember-htmlbars/tests/node-managers/view-node-manager-test.js index c5375bf0a5e..bd0990e8d75 100644 --- a/packages/ember-htmlbars/tests/node-managers/view-node-manager-test.js +++ b/packages/ember-htmlbars/tests/node-managers/view-node-manager-test.js @@ -1,12 +1,9 @@ import ViewNodeManager from 'ember-htmlbars/node-managers/view-node-manager'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +testModule('ember-htmlbars: node-managers - ViewNodeManager'); -QUnit.module('ember-htmlbars: node-managers - ViewNodeManager'); - -QUnit.test('create method should assert if component hasn\'t been found', assert => { +test('create method should assert if component hasn\'t been found', assert => { assert.expect(1); let found = { @@ -21,7 +18,7 @@ QUnit.test('create method should assert if component hasn\'t been found', assert }, 'HTMLBars error: Could not find component named "' + path + '" (no component or template with that name was found)'); }); -QUnit.test('create method shouldn\'t assert if `found.component` is truthy', assert => { +test('create method shouldn\'t assert if `found.component` is truthy', assert => { assert.expect(1); let found = { @@ -42,7 +39,7 @@ QUnit.test('create method shouldn\'t assert if `found.component` is truthy', ass ViewNodeManager.create(renderNode, env, attrs, found); }); -QUnit.test('create method shouldn\'t assert if `found.layout` is truthy', assert => { +test('create method shouldn\'t assert if `found.layout` is truthy', assert => { assert.expect(0); let found = { @@ -53,7 +50,7 @@ QUnit.test('create method shouldn\'t assert if `found.layout` is truthy', assert ViewNodeManager.create(null, null, null, found); }); -QUnit.test('create method shouldn\'t assert if `path` is falsy and `contentTemplate` is truthy', assert => { +test('create method shouldn\'t assert if `path` is falsy and `contentTemplate` is truthy', assert => { assert.expect(0); let found = { @@ -65,5 +62,3 @@ QUnit.test('create method shouldn\'t assert if `path` is falsy and `contentTempl ViewNodeManager.create(null, null, null, found, null, path, null, contentTemplate); }); - -} diff --git a/packages/ember-htmlbars/tests/system/bootstrap_test.js b/packages/ember-htmlbars/tests/system/bootstrap_test.js index 342aea9625f..37178c41806 100644 --- a/packages/ember-htmlbars/tests/system/bootstrap_test.js +++ b/packages/ember-htmlbars/tests/system/bootstrap_test.js @@ -32,11 +32,9 @@ function checkTemplate(templateName) { runDestroy(view); } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-htmlbars: bootstrap', { +testModule('ember-htmlbars: bootstrap', { setup() { context.lookup = lookup = {}; }, @@ -48,26 +46,26 @@ QUnit.module('ember-htmlbars: bootstrap', { } }); -QUnit.test('template with data-template-name should add a new template to Ember.TEMPLATES', function() { +test('template with data-template-name should add a new template to Ember.TEMPLATES', function() { jQuery('#qunit-fixture').html(''); checkTemplate('funkyTemplate'); }); -QUnit.test('template with id instead of data-template-name should add a new template to Ember.TEMPLATES', function() { +test('template with id instead of data-template-name should add a new template to Ember.TEMPLATES', function() { jQuery('#qunit-fixture').html(''); checkTemplate('funkyTemplate'); }); -QUnit.test('template without data-template-name or id should default to application', function() { +test('template without data-template-name or id should default to application', function() { jQuery('#qunit-fixture').html(''); checkTemplate('application'); }); if (typeof Handlebars === 'object') { - QUnit.test('template with type text/x-raw-handlebars should be parsed', function() { + test('template with type text/x-raw-handlebars should be parsed', function() { jQuery('#qunit-fixture').html(''); run(function() { @@ -83,7 +81,7 @@ if (typeof Handlebars === 'object') { }); } -QUnit.test('duplicated default application templates should throw exception', function() { +test('duplicated default application templates should throw exception', function() { jQuery('#qunit-fixture').html(''); throws(function () { @@ -93,7 +91,7 @@ QUnit.test('duplicated default application templates should throw exception', fu 'duplicate templates should not be allowed'); }); -QUnit.test('default application template and id application template present should throw exception', function() { +test('default application template and id application template present should throw exception', function() { jQuery('#qunit-fixture').html(''); throws(function () { @@ -103,7 +101,7 @@ QUnit.test('default application template and id application template present sho 'duplicate templates should not be allowed'); }); -QUnit.test('default application template and data-template-name application template present should throw exception', function() { +test('default application template and data-template-name application template present should throw exception', function() { jQuery('#qunit-fixture').html(''); throws(function () { @@ -113,7 +111,7 @@ QUnit.test('default application template and data-template-name application temp 'duplicate templates should not be allowed'); }); -QUnit.test('duplicated template id should throw exception', function() { +test('duplicated template id should throw exception', function() { jQuery('#qunit-fixture').html(''); throws(function () { @@ -123,7 +121,7 @@ QUnit.test('duplicated template id should throw exception', function() { 'duplicate templates should not be allowed'); }); -QUnit.test('duplicated template data-template-name should throw exception', function() { +test('duplicated template data-template-name should throw exception', function() { jQuery('#qunit-fixture').html(''); throws(function () { @@ -132,5 +130,3 @@ QUnit.test('duplicated template data-template-name should throw exception', func /Template named "[^"]+" already exists\./, 'duplicate templates should not be allowed'); }); - -} diff --git a/packages/ember-htmlbars/tests/system/lookup-helper_test.js b/packages/ember-htmlbars/tests/system/lookup-helper_test.js index 7802ef13316..483161d1f74 100644 --- a/packages/ember-htmlbars/tests/system/lookup-helper_test.js +++ b/packages/ember-htmlbars/tests/system/lookup-helper_test.js @@ -21,13 +21,11 @@ function generateOwner() { return owner; } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-htmlbars: lookupHelper hook'); +testModule('ember-htmlbars: lookupHelper hook'); -QUnit.test('looks for helpers in the provided `env.helpers`', function() { +test('looks for helpers in the provided `env.helpers`', function() { var env = generateEnv({ 'flubarb'() { } }); @@ -37,7 +35,7 @@ QUnit.test('looks for helpers in the provided `env.helpers`', function() { equal(actual, env.helpers.flubarb, 'helpers are looked up on env'); }); -QUnit.test('returns undefined if no container exists (and helper is not found in env)', function() { +test('returns undefined if no container exists (and helper is not found in env)', function() { var env = generateEnv(); var view = {}; @@ -46,7 +44,7 @@ QUnit.test('returns undefined if no container exists (and helper is not found in equal(actual, undefined, 'does not blow up if view does not have a container'); }); -QUnit.test('does not lookup in the container if the name does not contain a dash (and helper is not found in env)', function() { +test('does not lookup in the container if the name does not contain a dash (and helper is not found in env)', function() { var env = generateEnv(); var view = { container: { @@ -61,7 +59,7 @@ QUnit.test('does not lookup in the container if the name does not contain a dash equal(actual, undefined, 'does not blow up if view does not have a container'); }); -QUnit.test('does a lookup in the container if the name contains a dash (and helper is not found in env)', function() { +test('does a lookup in the container if the name contains a dash (and helper is not found in env)', function() { let owner = generateOwner(); var env = generateEnv(null, owner); var view = { @@ -76,7 +74,7 @@ QUnit.test('does a lookup in the container if the name contains a dash (and help ok(someName.detect(actual), 'helper is an instance of the helper class'); }); -QUnit.test('does a lookup in the container if the name is found in knownHelpers', function() { +test('does a lookup in the container if the name is found in knownHelpers', function() { let owner = generateOwner(); var env = generateEnv(null, owner); var view = { @@ -92,7 +90,7 @@ QUnit.test('does a lookup in the container if the name is found in knownHelpers' ok(t.detect(actual), 'helper is an instance of the helper class'); }); -QUnit.test('looks up a shorthand helper in the container', function() { +test('looks up a shorthand helper in the container', function() { expect(2); let owner = generateOwner(); var env = generateEnv(null, owner); @@ -115,7 +113,7 @@ QUnit.test('looks up a shorthand helper in the container', function() { ok(called, 'HTMLBars compatible wrapper is wraping the provided function'); }); -QUnit.test('fails with a useful error when resolving a function', function() { +test('fails with a useful error when resolving a function', function() { expect(1); let owner = generateOwner(); var env = generateEnv(null, owner); @@ -132,4 +130,3 @@ QUnit.test('fails with a useful error when resolving a function', function() { }, 'Expected to find an Ember.Helper with the name helper:some-name, but found an object of type function instead.'); }); -} diff --git a/packages/ember-htmlbars/tests/utils/string_test.js b/packages/ember-htmlbars/tests/utils/string_test.js index 02cebfdd5a3..3c404900ebb 100644 --- a/packages/ember-htmlbars/tests/utils/string_test.js +++ b/packages/ember-htmlbars/tests/utils/string_test.js @@ -1,30 +1,26 @@ import SafeString from 'htmlbars-util/safe-string'; import { htmlSafe } from 'ember-htmlbars/utils/string'; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-htmlbars: SafeString'); +testModule('ember-htmlbars: SafeString'); -QUnit.test('htmlSafe should return an instance of SafeString', function() { +test('htmlSafe should return an instance of SafeString', function() { var safeString = htmlSafe('you need to be more bold'); ok(safeString instanceof SafeString, 'should be a SafeString'); }); -QUnit.test('htmlSafe should return an empty string for null', function() { +test('htmlSafe should return an empty string for null', function() { var safeString = htmlSafe(null); equal(safeString instanceof SafeString, true, 'should be a SafeString'); equal(safeString.toString(), '', 'should return an empty string'); }); -QUnit.test('htmlSafe should return an empty string for undefined', function() { +test('htmlSafe should return an empty string for undefined', function() { var safeString = htmlSafe(); equal(safeString instanceof SafeString, true, 'should be a SafeString'); equal(safeString.toString(), '', 'should return an empty string'); }); - -} diff --git a/packages/ember-routing-htmlbars/tests/helpers/closure_action_test.js b/packages/ember-routing-htmlbars/tests/helpers/closure_action_test.js index b47004c4c78..bb3ed39a4ab 100644 --- a/packages/ember-routing-htmlbars/tests/helpers/closure_action_test.js +++ b/packages/ember-routing-htmlbars/tests/helpers/closure_action_test.js @@ -64,11 +64,10 @@ function appendViewFor(template, moduleName='', hash={}) { return view; } -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; let subscriber; -QUnit.module('ember-routing-htmlbars: action helper', { +testModule('ember-routing-htmlbars: action helper', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); owner = buildOwner({ @@ -99,7 +98,7 @@ QUnit.module('ember-routing-htmlbars: action helper', { }); if (isEnabled('ember-improved-instrumentation')) { - QUnit.test('action should fire interaction event', function(assert) { + test('action should fire interaction event', function(assert) { assert.expect(2); subscriber = subscribe('interaction.ember-action', { @@ -130,7 +129,7 @@ if (isEnabled('ember-improved-instrumentation')) { view.$('#instrument-button').trigger('click'); }); - QUnit.test('interaction event subscriber should be passed parameters', function(assert) { + test('interaction event subscriber should be passed parameters', function(assert) { assert.expect(2); let actionParam = 'So krispy'; @@ -164,7 +163,7 @@ if (isEnabled('ember-improved-instrumentation')) { view.$('#instrument-button').trigger('click'); }); - QUnit.test('interaction event subscriber should be passed target', function(assert) { + test('interaction event subscriber should be passed target', function(assert) { assert.expect(2); subscriber = subscribe('interaction.ember-action', { @@ -198,7 +197,7 @@ if (isEnabled('ember-improved-instrumentation')) { view.$('#instrument-button').trigger('click'); }); - QUnit.test('instrumented action should return value', function(assert) { + test('instrumented action should return value', function(assert) { assert.expect(1); var returnedValue = 'Chris P is so krispy'; @@ -227,7 +226,7 @@ if (isEnabled('ember-improved-instrumentation')) { }); } -QUnit.test('action should be called', function(assert) { +test('action should be called', function(assert) { assert.expect(1); innerComponent = EmberComponent.extend({ @@ -251,7 +250,7 @@ QUnit.test('action should be called', function(assert) { }); }); -QUnit.test('an error is triggered when bound action function is undefined', function(assert) { +test('an error is triggered when bound action function is undefined', function(assert) { assert.expect(1); innerComponent = EmberComponent.extend({ @@ -267,7 +266,7 @@ QUnit.test('an error is triggered when bound action function is undefined', func }, /An action could not be made for `somethingThatIsUndefined` in .*\. Please confirm that you are using either a quoted action name \(i\.e\. `\(action 'somethingThatIsUndefined'\)`\) or a function available in .*\./); }); -QUnit.test('[#12718] a nice error is shown when a bound action function is undefined and it is passed as attrs.foo', function(assert) { +test('[#12718] a nice error is shown when a bound action function is undefined and it is passed as attrs.foo', function(assert) { registerComponent('inner-component', EmberComponent.extend({ [OWNER]: owner })); @@ -283,7 +282,7 @@ QUnit.test('[#12718] a nice error is shown when a bound action function is undef }, /Action passed is null or undefined in \(action [^)]*\) from .*\./); }); -QUnit.test('action value is returned', function(assert) { +test('action value is returned', function(assert) { assert.expect(1); var returnedValue = 'terrible tom'; @@ -310,7 +309,7 @@ QUnit.test('action value is returned', function(assert) { }); }); -QUnit.test('action should be called on the correct scope', function(assert) { +test('action should be called on the correct scope', function(assert) { assert.expect(1); innerComponent = EmberComponent.extend({ @@ -335,7 +334,7 @@ QUnit.test('action should be called on the correct scope', function(assert) { }); }); -QUnit.test('arguments to action are passed, curry', function(assert) { +test('arguments to action are passed, curry', function(assert) { assert.expect(4); let first = 'mitch'; @@ -370,7 +369,7 @@ QUnit.test('arguments to action are passed, curry', function(assert) { }); }); -QUnit.test('arguments to action are bound', function(assert) { +test('arguments to action are bound', function(assert) { assert.expect(1); let value = 'lazy leah'; @@ -401,7 +400,7 @@ QUnit.test('arguments to action are bound', function(assert) { innerComponent.fireAction(); }); -QUnit.test('array arguments are passed correctly to action', function(assert) { +test('array arguments are passed correctly to action', function(assert) { assert.expect(3); let first = 'foo'; @@ -437,7 +436,7 @@ QUnit.test('array arguments are passed correctly to action', function(assert) { innerComponent.fireAction(); }); -QUnit.test('mut values can be wrapped in actions, are settable', function(assert) { +test('mut values can be wrapped in actions, are settable', function(assert) { assert.expect(1); var newValue = 'trollin trek'; @@ -464,7 +463,7 @@ QUnit.test('mut values can be wrapped in actions, are settable', function(assert }); }); -QUnit.test('mut values can be wrapped in actions, are settable with a curry', function(assert) { +test('mut values can be wrapped in actions, are settable with a curry', function(assert) { assert.expect(1); var newValue = 'trollin trek'; @@ -491,7 +490,7 @@ QUnit.test('mut values can be wrapped in actions, are settable with a curry', fu }); }); -QUnit.test('action can create closures over actions', function(assert) { +test('action can create closures over actions', function(assert) { assert.expect(3); var first = 'raging robert'; @@ -526,7 +525,7 @@ QUnit.test('action can create closures over actions', function(assert) { }); }); -QUnit.test('provides a helpful error if an action is not present', function(assert) { +test('provides a helpful error if an action is not present', function(assert) { assert.expect(1); innerComponent = EmberComponent.create(); @@ -550,7 +549,7 @@ QUnit.test('provides a helpful error if an action is not present', function(asse }, /An action named 'doesNotExist' was not found in /); }); -QUnit.test('provides a helpful error if actions hash is not present', function(assert) { +test('provides a helpful error if actions hash is not present', function(assert) { assert.expect(1); innerComponent = EmberComponent.create(); @@ -567,7 +566,7 @@ QUnit.test('provides a helpful error if actions hash is not present', function(a }, /An action named 'doesNotExist' was not found in /); }); -QUnit.test('action can create closures over actions with target', function(assert) { +test('action can create closures over actions with target', function(assert) { assert.expect(1); innerComponent = EmberComponent.extend({ @@ -599,7 +598,7 @@ QUnit.test('action can create closures over actions with target', function(asser }); }); -QUnit.test('value can be used with action over actions', function(assert) { +test('value can be used with action over actions', function(assert) { assert.expect(1); let newValue = 'yelping yehuda'; @@ -634,7 +633,7 @@ QUnit.test('value can be used with action over actions', function(assert) { }); }); -QUnit.test('action will read the value of a first property', function(assert) { +test('action will read the value of a first property', function(assert) { assert.expect(1); let newValue = 'irate igor'; @@ -664,7 +663,7 @@ QUnit.test('action will read the value of a first property', function(assert) { }); }); -QUnit.test('action will read the value of a curried first argument property', function(assert) { +test('action will read the value of a curried first argument property', function(assert) { assert.expect(1); let newValue = 'kissing kris'; @@ -695,7 +694,7 @@ QUnit.test('action will read the value of a curried first argument property', fu }); }); -QUnit.test('action closure does not get auto-mut wrapped', function(assert) { +test('action closure does not get auto-mut wrapped', function(assert) { assert.expect(3); var first = 'raging robert'; @@ -743,7 +742,7 @@ QUnit.test('action closure does not get auto-mut wrapped', function(assert) { }); }); -QUnit.test('action should be called within a run loop', function(assert) { +test('action should be called within a run loop', function(assert) { assert.expect(1); innerComponent = EmberComponent.extend({ @@ -767,7 +766,7 @@ QUnit.test('action should be called within a run loop', function(assert) { innerComponent.fireAction(); }); -QUnit.test('objects that define INVOKE can be casted to actions', function(assert) { +test('objects that define INVOKE can be casted to actions', function(assert) { assert.expect(2); innerComponent = EmberComponent.extend({ @@ -794,5 +793,3 @@ QUnit.test('objects that define INVOKE can be casted to actions', function(asser innerComponent.fireAction(); }); - -} diff --git a/packages/ember-routing-htmlbars/tests/helpers/element_action_test.js b/packages/ember-routing-htmlbars/tests/helpers/element_action_test.js index 81c2f246cdd..be9f3360d84 100644 --- a/packages/ember-routing-htmlbars/tests/helpers/element_action_test.js +++ b/packages/ember-routing-htmlbars/tests/helpers/element_action_test.js @@ -20,6 +20,7 @@ import viewKeyword from 'ember-htmlbars/keywords/view'; import ComponentLookup from 'ember-views/component_lookup'; import buildOwner from 'container/tests/test-helpers/build-owner'; import { OWNER } from 'container/owner'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; import { runAppend, @@ -29,11 +30,7 @@ import { var dispatcher, view, originalViewKeyword, owner; var originalRegisterAction = ActionHelper.registerAction; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-routing-htmlbars: action helper', { +testModule('ember-routing-htmlbars: action helper', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); dispatcher = EventDispatcher.create(); @@ -49,7 +46,7 @@ QUnit.module('ember-routing-htmlbars: action helper', { } }); -QUnit.test('should output a data attribute with a guid', function() { +test('should output a data attribute with a guid', function() { view = EmberView.create({ template: compile('edit') }); @@ -59,7 +56,7 @@ QUnit.test('should output a data attribute with a guid', function() { ok(view.$('a').attr('data-ember-action').match(/\d+/), 'A data-ember-action attribute with a guid was added'); }); -QUnit.test('should by default register a click event', function() { +test('should by default register a click event', function() { var registeredEventName; ActionHelper.registerAction = function({ eventName }) { @@ -75,7 +72,7 @@ QUnit.test('should by default register a click event', function() { equal(registeredEventName, 'click', 'The click event was properly registered'); }); -QUnit.test('should allow alternative events to be handled', function() { +test('should allow alternative events to be handled', function() { var registeredEventName; ActionHelper.registerAction = function({ eventName }) { @@ -91,7 +88,7 @@ QUnit.test('should allow alternative events to be handled', function() { equal(registeredEventName, 'mouseUp', 'The alternative mouseUp event was properly registered'); }); -QUnit.test('should by default target the view\'s controller', function() { +test('should by default target the view\'s controller', function() { var registeredTarget; var controller = {}; @@ -109,7 +106,7 @@ QUnit.test('should by default target the view\'s controller', function() { equal(registeredTarget, controller, 'The controller was registered as the target'); }); -QUnit.test('Inside a yield, the target points at the original target', function() { +test('Inside a yield, the target points at the original target', function() { var watted = false; var component = EmberComponent.extend({ @@ -140,7 +137,7 @@ QUnit.test('Inside a yield, the target points at the original target', function( equal(watted, true, 'The action was called on the right context'); }); -QUnit.test('should allow a target to be specified', function() { +test('should allow a target to be specified', function() { var registeredTarget; ActionHelper.registerAction = function({ node }) { @@ -162,7 +159,7 @@ QUnit.test('should allow a target to be specified', function() { runDestroy(anotherTarget); }); -QUnit.test('should lazily evaluate the target', function() { +test('should lazily evaluate the target', function() { var firstEdit = 0; var secondEdit = 0; var controller = {}; @@ -205,7 +202,7 @@ QUnit.test('should lazily evaluate the target', function() { equal(secondEdit, 1); }); -QUnit.test('should register an event handler', function() { +test('should register an event handler', function() { var eventHandlerWasCalled = false; var controller = EmberController.extend({ @@ -228,7 +225,7 @@ QUnit.test('should register an event handler', function() { ok(eventHandlerWasCalled, 'The event handler was called'); }); -QUnit.test('handles whitelisted modifier keys', function() { +test('handles whitelisted modifier keys', function() { var eventHandlerWasCalled = false; var shortcutHandlerWasCalled = false; @@ -263,7 +260,7 @@ QUnit.test('handles whitelisted modifier keys', function() { ok(shortcutHandlerWasCalled, 'The "any" shortcut\'s event handler was called'); }); -QUnit.test('handles whitelisted bound modifier keys', function() { +test('handles whitelisted bound modifier keys', function() { var eventHandlerWasCalled = false; var shortcutHandlerWasCalled = false; @@ -300,7 +297,7 @@ QUnit.test('handles whitelisted bound modifier keys', function() { ok(shortcutHandlerWasCalled, 'The "any" shortcut\'s event handler was called'); }); -QUnit.test('handles whitelisted bound modifier keys with current value', function(assert) { +test('handles whitelisted bound modifier keys with current value', function(assert) { var editHandlerWasCalled = false; var controller = EmberController.extend({ @@ -333,7 +330,7 @@ QUnit.test('handles whitelisted bound modifier keys with current value', functio ok(!editHandlerWasCalled, 'event handler was not called'); }); -QUnit.test('should be able to use action more than once for the same event within a view', function() { +test('should be able to use action more than once for the same event within a view', function() { var editWasCalled = false; var deleteWasCalled = false; var originalEventHandlerWasCalled = false; @@ -375,7 +372,7 @@ QUnit.test('should be able to use action more than once for the same event withi equal(deleteWasCalled, false, 'The delete action was not called'); }); -QUnit.test('the event should not bubble if `bubbles=false` is passed', function() { +test('the event should not bubble if `bubbles=false` is passed', function() { var editWasCalled = false; var deleteWasCalled = false; var originalEventHandlerWasCalled = false; @@ -420,7 +417,7 @@ QUnit.test('the event should not bubble if `bubbles=false` is passed', function( equal(originalEventHandlerWasCalled, true, 'The original event handler was called'); }); -QUnit.test('the event should not bubble if `bubbles=false` is passed bound', function() { +test('the event should not bubble if `bubbles=false` is passed bound', function() { var editWasCalled = false; var deleteWasCalled = false; var originalEventHandlerWasCalled = false; @@ -466,7 +463,7 @@ QUnit.test('the event should not bubble if `bubbles=false` is passed bound', fun equal(originalEventHandlerWasCalled, true, 'The original event handler was called'); }); -QUnit.test('the event bubbling depend on the bound parameter', function() { +test('the event bubbling depend on the bound parameter', function() { var editWasCalled = false; var originalEventHandlerWasCalled = false; @@ -504,7 +501,7 @@ QUnit.test('the event bubbling depend on the bound parameter', function() { equal(originalEventHandlerWasCalled, true, 'The original event handler was called'); }); -QUnit.test('should work properly in an #each block', function() { +test('should work properly in an #each block', function() { var eventHandlerWasCalled = false; var controller = EmberController.extend({ @@ -524,7 +521,7 @@ QUnit.test('should work properly in an #each block', function() { ok(eventHandlerWasCalled, 'The event handler was called'); }); -QUnit.test('should work properly in a {{#with foo as |bar|}} block', function() { +test('should work properly in a {{#with foo as |bar|}} block', function() { var eventHandlerWasCalled = false; var controller = EmberController.extend({ @@ -544,7 +541,7 @@ QUnit.test('should work properly in a {{#with foo as |bar|}} block', function() ok(eventHandlerWasCalled, 'The event handler was called'); }); -QUnit.test('should unregister event handlers on rerender', function() { +test('should unregister event handlers on rerender', function() { var eventHandlerWasCalled = false; view = EmberView.extend({ @@ -572,7 +569,7 @@ QUnit.test('should unregister event handlers on rerender', function() { ok(ActionManager.registeredActions[newActionId], 'After rerender completes, a new event handler was added'); }); -QUnit.test('should unregister event handlers on inside virtual views', function() { +test('should unregister event handlers on inside virtual views', function() { var things = emberA([ { name: 'Thingy' @@ -594,7 +591,7 @@ QUnit.test('should unregister event handlers on inside virtual views', function( ok(!ActionManager.registeredActions[actionId], 'After the virtual view was destroyed, the action was unregistered'); }); -QUnit.test('should properly capture events on child elements of a container with an action', function() { +test('should properly capture events on child elements of a container with an action', function() { var eventHandlerWasCalled = false; var controller = EmberController.extend({ @@ -613,7 +610,7 @@ QUnit.test('should properly capture events on child elements of a container with ok(eventHandlerWasCalled, 'Event on a child element triggered the action of its parent'); }); -QUnit.test('should allow bubbling of events from action helper to original parent event', function() { +test('should allow bubbling of events from action helper to original parent event', function() { var eventHandlerWasCalled = false; var originalEventHandlerWasCalled = false; @@ -634,7 +631,7 @@ QUnit.test('should allow bubbling of events from action helper to original paren ok(eventHandlerWasCalled && originalEventHandlerWasCalled, 'Both event handlers were called'); }); -QUnit.test('should not bubble an event from action helper to original parent event if `bubbles=false` is passed', function() { +test('should not bubble an event from action helper to original parent event if `bubbles=false` is passed', function() { var eventHandlerWasCalled = false; var originalEventHandlerWasCalled = false; @@ -656,7 +653,7 @@ QUnit.test('should not bubble an event from action helper to original parent eve ok(!originalEventHandlerWasCalled, 'The parent handler was not called'); }); -QUnit.test('should allow \'send\' as action name (#594)', function() { +test('should allow \'send\' as action name (#594)', function() { var eventHandlerWasCalled = false; var controller = EmberController.extend({ @@ -675,7 +672,7 @@ QUnit.test('should allow \'send\' as action name (#594)', function() { ok(eventHandlerWasCalled, 'The view\'s send method was called'); }); -QUnit.test('should send the view, event and current context to the action', function() { +test('should send the view, event and current context to the action', function() { var passedTarget; var passedContext; @@ -703,7 +700,7 @@ QUnit.test('should send the view, event and current context to the action', func strictEqual(passedContext, aContext, 'the parameter is passed along'); }); -QUnit.test('should only trigger actions for the event they were registered on', function() { +test('should only trigger actions for the event they were registered on', function() { var editWasCalled = false; view = EmberView.extend({ @@ -718,7 +715,7 @@ QUnit.test('should only trigger actions for the event they were registered on', ok(!editWasCalled, 'The action wasn\'t called'); }); -QUnit.test('should unwrap controllers passed as a context', function() { +test('should unwrap controllers passed as a context', function() { var passedContext; var model = EmberObject.create(); var controller = EmberController.extend({ @@ -742,7 +739,7 @@ QUnit.test('should unwrap controllers passed as a context', function() { equal(passedContext, model, 'the action was passed the unwrapped model'); }); -QUnit.test('should allow multiple contexts to be specified', function() { +test('should allow multiple contexts to be specified', function() { var passedContexts; var models = [EmberObject.create(), EmberObject.create()]; @@ -768,7 +765,7 @@ QUnit.test('should allow multiple contexts to be specified', function() { deepEqual(passedContexts, models, 'the action was called with the passed contexts'); }); -QUnit.test('should allow multiple contexts to be specified mixed with string args', function() { +test('should allow multiple contexts to be specified mixed with string args', function() { var passedParams; var model = EmberObject.create(); @@ -793,7 +790,7 @@ QUnit.test('should allow multiple contexts to be specified mixed with string arg deepEqual(passedParams, ['herp', model], 'the action was called with the passed contexts'); }); -QUnit.test('it does not trigger action with special clicks', function() { +test('it does not trigger action with special clicks', function() { var showCalled = false; view = EmberView.create({ @@ -836,7 +833,7 @@ QUnit.test('it does not trigger action with special clicks', function() { checkClick('which', undefined, true); // IE <9 }); -QUnit.test('it can trigger actions for keyboard events', function() { +test('it can trigger actions for keyboard events', function() { var showCalled = false; view = EmberView.create({ @@ -863,7 +860,7 @@ QUnit.test('it can trigger actions for keyboard events', function() { ok(showCalled, 'should call action with keyup'); }); -QUnit.test('a quoteless parameter should allow dynamic lookup of the actionName', function() { +test('a quoteless parameter should allow dynamic lookup of the actionName', function() { expect(4); var lastAction; var actionOrder = []; @@ -914,7 +911,7 @@ QUnit.test('a quoteless parameter should allow dynamic lookup of the actionName' deepEqual(actionOrder, ['whompWhomp', 'sloopyDookie', 'biggityBoom'], 'action name was looked up properly'); }); -QUnit.test('a quoteless parameter should lookup actionName in context [DEPRECATED]', function() { +test('a quoteless parameter should lookup actionName in context [DEPRECATED]', function() { expect(4); var lastAction; var actionOrder = []; @@ -965,7 +962,7 @@ QUnit.test('a quoteless parameter should lookup actionName in context [DEPRECATE deepEqual(actionOrder, ['whompWhomp', 'sloopyDookie', 'biggityBoom'], 'action name was looked up properly'); }); -QUnit.test('a quoteless string parameter should resolve actionName, including path', function() { +test('a quoteless string parameter should resolve actionName, including path', function() { expect(4); var lastAction; var actionOrder = []; @@ -1014,7 +1011,7 @@ QUnit.test('a quoteless string parameter should resolve actionName, including pa deepEqual(actionOrder, ['whompWhomp', 'sloopyDookie', 'biggityBoom'], 'action name was looked up properly'); }); -QUnit.test('a quoteless function parameter should be called, including arguments', function() { +test('a quoteless function parameter should be called, including arguments', function() { expect(2); var arg = 'rough ray'; @@ -1040,7 +1037,7 @@ QUnit.test('a quoteless function parameter should be called, including arguments }); }); -QUnit.test('a quoteless parameter that does not resolve to a value asserts', function() { +test('a quoteless parameter that does not resolve to a value asserts', function() { var controller = EmberController.extend({ actions: { ohNoeNotValid() {} @@ -1061,7 +1058,7 @@ QUnit.test('a quoteless parameter that does not resolve to a value asserts', fun 'Perhaps you meant to use a quoted actionName? (e.g. {{action \'save\'}}).'); }); -QUnit.test('allows multiple actions on a single element', function() { +test('allows multiple actions on a single element', function() { var clickActionWasCalled = false; var doubleClickActionWasCalled = false; @@ -1102,7 +1099,7 @@ QUnit.test('allows multiple actions on a single element', function() { ok(doubleClickActionWasCalled, 'The double click handler was called'); }); -QUnit.module('ember-routing-htmlbars: action helper - deprecated invoking directly on target', { +testModule('ember-routing-htmlbars: action helper - deprecated invoking directly on target', { setup() { dispatcher = EventDispatcher.create(); dispatcher.setup(); @@ -1114,7 +1111,7 @@ QUnit.module('ember-routing-htmlbars: action helper - deprecated invoking direct } }); -QUnit.test('should respect preventDefault=false option if provided', function() { +test('should respect preventDefault=false option if provided', function() { view = EmberView.create({ template: compile('Hi') }); @@ -1136,7 +1133,7 @@ QUnit.test('should respect preventDefault=false option if provided', function() equal(event.isDefaultPrevented(), false, 'should not preventDefault'); }); -QUnit.test('should respect preventDefault option if provided bound', function() { +test('should respect preventDefault option if provided bound', function() { view = EmberView.create({ template: compile('Hi') }); @@ -1168,7 +1165,7 @@ QUnit.test('should respect preventDefault option if provided bound', function() equal(event.isDefaultPrevented(), true, 'should preventDefault'); }); -QUnit.module('ember-routing-htmlbars: action helper - action target without `controller`', { +testModule('ember-routing-htmlbars: action helper - action target without `controller`', { setup() { owner = buildOwner(); owner.registerOptionsForType('template', { instantiate: false }); @@ -1192,7 +1189,7 @@ QUnit.module('ember-routing-htmlbars: action helper - action target without `con } }); -QUnit.test('should target the proper component when `action` is in yielded block [GH #12409]', function(assert) { +test('should target the proper component when `action` is in yielded block [GH #12409]', function(assert) { assert.expect(2); owner.register('template:components/x-outer', compile(` @@ -1232,5 +1229,3 @@ QUnit.test('should target the proper component when `action` is in yielded block var event = jQuery.Event('click'); view.$('button').trigger(event); }); - -} diff --git a/packages/ember-routing-htmlbars/tests/helpers/link-to_test.js b/packages/ember-routing-htmlbars/tests/helpers/link-to_test.js index 8961d4bd71b..90fb5df8541 100644 --- a/packages/ember-routing-htmlbars/tests/helpers/link-to_test.js +++ b/packages/ember-routing-htmlbars/tests/helpers/link-to_test.js @@ -10,7 +10,6 @@ import ComponentLookup from 'ember-views/component_lookup'; import LinkComponent from 'ember-routing-views/components/link-to'; import buildOwner from 'container/tests/test-helpers/build-owner'; import { OWNER } from 'container/owner'; -import isEnabled from 'ember-metal/features'; var owner, view; @@ -42,10 +41,9 @@ QUnit.module('ember-routing-htmlbars: link-to helper', { } }); -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('should be able to be inserted in DOM when the router is not present', function() { +test('should be able to be inserted in DOM when the router is not present', function() { var template = '{{#link-to \'index\'}}Go to Index{{/link-to}}'; view = EmberView.create({ [OWNER]: owner, @@ -57,7 +55,7 @@ QUnit.test('should be able to be inserted in DOM when the router is not present' equal(view.$().text(), 'Go to Index'); }); -QUnit.test('re-renders when title changes', function() { +test('re-renders when title changes', function() { var template = '{{link-to title routeName}}'; view = EmberView.create({ [OWNER]: owner, @@ -79,7 +77,7 @@ QUnit.test('re-renders when title changes', function() { equal(view.$().text(), 'bar'); }); -QUnit.test('can read bound title', function() { +test('can read bound title', function() { var template = '{{link-to title routeName}}'; view = EmberView.create({ [OWNER]: owner, @@ -95,7 +93,7 @@ QUnit.test('can read bound title', function() { equal(view.$().text(), 'foo'); }); -QUnit.test('escaped inline form (double curlies) escapes link title', function() { +test('escaped inline form (double curlies) escapes link title', function() { view = EmberView.create({ [OWNER]: owner, title: 'blah', @@ -107,11 +105,11 @@ QUnit.test('escaped inline form (double curlies) escapes link title', function() equal(view.$('b').length, 0, 'no were found'); }); -QUnit.test('escaped inline form with (-html-safe) does not escape link title', function() { +test('escaped inline form with (-html-safe) does not escape link title', function() { view = EmberView.create({ [OWNER]: owner, title: 'blah', - template: compile('{{link-to (-html-safe view.title) "index"}}'), + template: compile('{{link-to (-html-safe view.title) "index"}}') }); runAppend(view); @@ -119,7 +117,7 @@ QUnit.test('escaped inline form with (-html-safe) does not escape link title', f equal(view.$('b').length, 1, ' was found'); }); -QUnit.test('unescaped inline form (triple curlies) does not escape link title', function() { +test('unescaped inline form (triple curlies) does not escape link title', function() { view = EmberView.create({ [OWNER]: owner, title: 'blah', @@ -131,7 +129,7 @@ QUnit.test('unescaped inline form (triple curlies) does not escape link title', equal(view.$('b').length, 1, ' was found'); }); -QUnit.test('unwraps controllers', function() { +test('unwraps controllers', function() { var template = '{{#link-to \'index\' view.otherController}}Text{{/link-to}}'; view = EmberView.create({ @@ -149,7 +147,7 @@ QUnit.test('unwraps controllers', function() { equal(view.$().text(), 'Text'); }); -QUnit.test('able to safely extend the built-in component and use the normal path', function() { +test('able to safely extend the built-in component and use the normal path', function() { view = EmberView.create({ [OWNER]: owner, title: 'my custom link-to component', @@ -161,7 +159,7 @@ QUnit.test('able to safely extend the built-in component and use the normal path equal(view.$().text(), 'my custom link-to component', 'rendered a custom-link-to component'); }); -QUnit.test('[GH#13432] able to safely extend the built-in component and invoke it inline', function() { +test('[GH#13432] able to safely extend the built-in component and invoke it inline', function() { view = EmberView.create({ [OWNER]: owner, title: 'my custom link-to component', @@ -173,4 +171,3 @@ QUnit.test('[GH#13432] able to safely extend the built-in component and invoke i equal(view.$().text(), 'my custom link-to component', 'rendered a custom-link-to component'); }); -} diff --git a/packages/ember-routing-htmlbars/tests/helpers/outlet_test.js b/packages/ember-routing-htmlbars/tests/helpers/outlet_test.js index 0b1ef4913de..5a9b60af92a 100644 --- a/packages/ember-routing-htmlbars/tests/helpers/outlet_test.js +++ b/packages/ember-routing-htmlbars/tests/helpers/outlet_test.js @@ -5,16 +5,13 @@ import jQuery from 'ember-views/system/jquery'; import compile from 'ember-template-compiler/system/compile'; import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; import { buildAppInstance } from 'ember-routing-htmlbars/tests/utils'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var trim = jQuery.trim; var appInstance, top; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-routing-htmlbars: {{outlet}} helper', { +testModule('ember-routing-htmlbars: {{outlet}} helper', { setup() { appInstance = buildAppInstance(); var CoreOutlet = appInstance._lookupFactory('view:core-outlet'); @@ -28,7 +25,7 @@ QUnit.module('ember-routing-htmlbars: {{outlet}} helper', { } }); -QUnit.test('view should render the outlet when set after dom insertion', function() { +test('view should render the outlet when set after dom insertion', function() { var routerState = withTemplate('

HI

{{outlet}}'); top.setOutletState(routerState); runAppend(top); @@ -45,7 +42,7 @@ QUnit.test('view should render the outlet when set after dom insertion', functio equal(trim(top.$().text()), 'HIBYE'); }); -QUnit.test('a top-level outlet should always be a view', function() { +test('a top-level outlet should always be a view', function() { appInstance.register('view:toplevel', EmberView.extend({ elementId: 'top-level' })); @@ -58,7 +55,7 @@ QUnit.test('a top-level outlet should always be a view', function() { equal(trim(top.$('#top-level').text()), 'HIBYE'); }); -QUnit.test('view should render the outlet when set before dom insertion', function() { +test('view should render the outlet when set before dom insertion', function() { var routerState = withTemplate('

HI

{{outlet}}'); routerState.outlets.main = withTemplate('

BYE

'); top.setOutletState(routerState); @@ -69,7 +66,7 @@ QUnit.test('view should render the outlet when set before dom insertion', functi }); -QUnit.test('outlet should support an optional name', function() { +test('outlet should support an optional name', function() { var routerState = withTemplate('

HI

{{outlet \'mainView\'}}'); top.setOutletState(routerState); runAppend(top); @@ -86,7 +83,7 @@ QUnit.test('outlet should support an optional name', function() { equal(trim(top.$().text()), 'HIBYE'); }); -QUnit.test('Outlets bind to the current view, not the current concrete view', function() { +test('Outlets bind to the current view, not the current concrete view', function() { var routerState = withTemplate('

HI

{{outlet}}'); top.setOutletState(routerState); runAppend(top); @@ -103,7 +100,7 @@ QUnit.test('Outlets bind to the current view, not the current concrete view', fu equal(output, 'BOTTOM', 'all templates were rendered'); }); -QUnit.test('Outlets bind to the current template\'s view, not inner contexts [DEPRECATED]', function() { +test('Outlets bind to the current template\'s view, not inner contexts [DEPRECATED]', function() { var parentTemplate = '

HI

{{#if view.alwaysTrue}}{{outlet}}{{/if}}'; var bottomTemplate = '

BOTTOM

'; @@ -131,19 +128,19 @@ QUnit.test('Outlets bind to the current template\'s view, not inner contexts [DE equal(output, 'BOTTOM', 'all templates were rendered'); }); -QUnit.test('should not throw deprecations if {{outlet}} is used without a name', function() { +test('should not throw deprecations if {{outlet}} is used without a name', function() { expectNoDeprecation(); top.setOutletState(withTemplate('{{outlet}}')); runAppend(top); }); -QUnit.test('should not throw deprecations if {{outlet}} is used with a quoted name', function() { +test('should not throw deprecations if {{outlet}} is used with a quoted name', function() { expectNoDeprecation(); top.setOutletState(withTemplate('{{outlet "foo"}}')); runAppend(top); }); -QUnit.test('{{outlet}} should work with an unquoted name', function() { +test('{{outlet}} should work with an unquoted name', function() { var routerState = { render: { controller: Controller.create({ @@ -162,7 +159,7 @@ QUnit.test('{{outlet}} should work with an unquoted name', function() { equal(top.$().text().trim(), 'It\'s magic'); }); -QUnit.test('{{outlet}} should rerender when bound name changes', function() { +test('{{outlet}} should rerender when bound name changes', function() { var routerState = { render: { controller: Controller.create({ @@ -185,7 +182,7 @@ QUnit.test('{{outlet}} should rerender when bound name changes', function() { equal(top.$().text().trim(), 'second'); }); -QUnit.test('views created by {{outlet}} should get destroyed', function() { +test('views created by {{outlet}} should get destroyed', function() { let inserted = 0; let destroyed = 0; var routerState = { @@ -210,8 +207,6 @@ QUnit.test('views created by {{outlet}} should get destroyed', function() { equal(destroyed, 1, 'expected to see view destroyed'); }); -} - function withTemplate(string) { return { render: { diff --git a/packages/ember-routing-htmlbars/tests/helpers/render_test.js b/packages/ember-routing-htmlbars/tests/helpers/render_test.js index a6ecebebadb..3260eb4ab63 100644 --- a/packages/ember-routing-htmlbars/tests/helpers/render_test.js +++ b/packages/ember-routing-htmlbars/tests/helpers/render_test.js @@ -9,6 +9,8 @@ import { buildAppInstance } from 'ember-routing-htmlbars/tests/utils'; import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; import { OWNER } from 'container/owner'; import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; + function runSet(object, key, value) { run(function() { @@ -19,11 +21,7 @@ function runSet(object, key, value) { const ORIGINAL_LEGACY_CONTROLLER_FLAG = ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT; var view, appInstance; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-routing-htmlbars: {{render}} helper', { +testModule('ember-routing-htmlbars: {{render}} helper', { setup() { appInstance = buildAppInstance(); }, @@ -36,7 +34,7 @@ QUnit.module('ember-routing-htmlbars: {{render}} helper', { } }); -QUnit.test('{{render}} helper should render given template', function() { +test('{{render}} helper should render given template', function() { var template = '

HI

{{render \'home\'}}'; var controller = EmberController.extend(); @@ -56,7 +54,7 @@ QUnit.test('{{render}} helper should render given template', function() { ok(appInstance.lookup('router:main')._lookupActiveComponentNode('home'), 'should register home as active view'); }); -QUnit.test('{{render}} helper should render nested helpers', function() { +test('{{render}} helper should render nested helpers', function() { var template = '

HI

{{render \'foo\'}}'; var controller = EmberController.extend(); @@ -75,7 +73,7 @@ QUnit.test('{{render}} helper should render nested helpers', function() { equal(view.$().text(), 'HIFOOBARBAZ'); }); -QUnit.test('{{render}} helper should have assertion if neither template nor view exists', function() { +test('{{render}} helper should have assertion if neither template nor view exists', function() { var template = '

HI

{{render \'oops\'}}'; var controller = EmberController.extend(); @@ -90,7 +88,7 @@ QUnit.test('{{render}} helper should have assertion if neither template nor view }, 'You used `{{render \'oops\'}}`, but \'oops\' can not be found as either a template or a view.'); }); -QUnit.test('{{render}} helper should not have assertion if view exists without a template', function() { +test('{{render}} helper should not have assertion if view exists without a template', function() { var template = '

HI

{{render \'oops\'}}'; var controller = EmberController.extend(); @@ -107,7 +105,7 @@ QUnit.test('{{render}} helper should not have assertion if view exists without a equal(view.$().text(), 'HI'); }); -QUnit.test('{{render}} helper should render given template with a supplied model', function() { +test('{{render}} helper should render given template with a supplied model', function() { var template = '

HI

{{render \'post\' post}}'; var post = { title: 'Rails is omakase' @@ -151,7 +149,7 @@ QUnit.test('{{render}} helper should render given template with a supplied model deepEqual(postController.get('model'), { title: 'Rails is unagi' }); }); -QUnit.test('{{render}} helper with a supplied model should not fire observers on the controller', function () { +test('{{render}} helper with a supplied model should not fire observers on the controller', function () { var template = '

HI

{{render \'post\' post}}'; var post = { title: 'Rails is omakase' @@ -184,7 +182,7 @@ QUnit.test('{{render}} helper with a supplied model should not fire observers on equal(modelDidChange, 0, 'model observer did not fire'); }); -QUnit.test('{{render}} helper should raise an error when a given controller name does not resolve to a controller', function() { +test('{{render}} helper should raise an error when a given controller name does not resolve to a controller', function() { let template = '

HI

{{render "home" controller="postss"}}'; let Controller = EmberController.extend(); let controller = Controller.create({ @@ -206,7 +204,7 @@ QUnit.test('{{render}} helper should raise an error when a given controller name }, 'The controller name you supplied \'postss\' did not resolve to a controller.'); }); -QUnit.test('{{render}} helper should render with given controller', function() { +test('{{render}} helper should render with given controller', function() { var template = '{{render "home" controller="posts"}}'; var Controller = EmberController.extend(); let model = {}; @@ -241,7 +239,7 @@ QUnit.test('{{render}} helper should render with given controller', function() { equal(renderedModel, model, 'rendered with model on controller'); }); -QUnit.test('{{render}} helper should rerender with given controller', function() { +test('{{render}} helper should rerender with given controller', function() { let template = '{{render "home" controller="posts"}}'; let Controller = EmberController.extend(); let model = {}; @@ -280,7 +278,7 @@ QUnit.test('{{render}} helper should rerender with given controller', function() equal(renderedModel, model, 'rendered with model on controller'); }); -QUnit.test('{{render}} helper should render a template without a model only once', function() { +test('{{render}} helper should render a template without a model only once', function() { var template = '

HI

{{render \'home\'}}
{{render \'home\'}}'; var Controller = EmberController.extend(); let controller = Controller.create({ @@ -300,7 +298,7 @@ QUnit.test('{{render}} helper should render a template without a model only once }, /\{\{render\}\} helper once/i); }); -QUnit.test('{{render}} helper should render templates with models multiple times', function() { +test('{{render}} helper should render templates with models multiple times', function() { var template = '

HI

{{render \'post\' post1}} {{render \'post\' post2}}'; var post1 = { title: 'Me first' @@ -353,7 +351,7 @@ QUnit.test('{{render}} helper should render templates with models multiple times deepEqual(postController1.get('model'), { title: 'I am new' }); }); -QUnit.test('{{render}} helper should not leak controllers', function() { +test('{{render}} helper should not leak controllers', function() { var template = '

HI

{{render \'post\' post1}}'; var post1 = { title: 'Me first' @@ -393,7 +391,7 @@ QUnit.test('{{render}} helper should not leak controllers', function() { ok(postController.isDestroyed, 'expected postController to be destroyed'); }); -QUnit.test('{{render}} helper should not treat invocations with falsy contexts as context-less', function() { +test('{{render}} helper should not treat invocations with falsy contexts as context-less', function() { var template = '

HI

{{render \'post\' zero}} {{render \'post\' nonexistent}}'; let controller = EmberController.create({ @@ -431,7 +429,7 @@ QUnit.test('{{render}} helper should not treat invocations with falsy contexts a equal(postController2.get('model'), undefined); }); -QUnit.test('{{render}} helper should render templates both with and without models', function() { +test('{{render}} helper should render templates both with and without models', function() { var template = '

HI

{{render \'post\'}} {{render \'post\' post}}'; var post = { title: 'Rails is omakase' @@ -480,7 +478,7 @@ QUnit.test('{{render}} helper should render templates both with and without mode deepEqual(postController2.get('model'), { title: 'Rails is unagi' }); }); -QUnit.test('{{render}} helper should be able to render a template again when it was removed', function() { +test('{{render}} helper should be able to render a template again when it was removed', function() { let CoreOutlet = appInstance._lookupFactory('view:core-outlet'); let Controller = EmberController.extend(); let controller = Controller.create({ @@ -526,7 +524,7 @@ QUnit.test('{{render}} helper should be able to render a template again when it equal(view.$().text(), 'HI2BYE'); }); -QUnit.test('{{render}} works with dot notation', function() { +test('{{render}} works with dot notation', function() { var template = '{{render "blog.post"}}'; var ContextController = EmberController.extend(); @@ -559,7 +557,7 @@ QUnit.test('{{render}} works with dot notation', function() { equal(singletonController.uniqueId, view.$().html(), 'rendered with correct singleton controller'); }); -QUnit.test('throws an assertion if {{render}} is called with an unquoted template name', function() { +test('throws an assertion if {{render}} is called with an unquoted template name', function() { var template = '

HI

{{render home}}'; var Controller = EmberController.extend(); var controller = Controller.create({ @@ -578,7 +576,7 @@ QUnit.test('throws an assertion if {{render}} is called with an unquoted templat }, 'The first argument of {{render}} must be quoted, e.g. {{render "sidebar"}}.'); }); -QUnit.test('throws an assertion if {{render}} is called with a literal for a model', function() { +test('throws an assertion if {{render}} is called with a literal for a model', function() { var template = '

HI

{{render "home" "model"}}'; var Controller = EmberController.extend(); var controller = Controller.create({ @@ -598,7 +596,7 @@ QUnit.test('throws an assertion if {{render}} is called with a literal for a mod }, 'The second argument of {{render}} must be a path, e.g. {{render "post" post}}.'); }); -QUnit.test('{{render}} helper should let view provide its own template', function() { +test('{{render}} helper should let view provide its own template', function() { var template = '{{render \'fish\'}}'; var Controller = EmberController.extend(); var controller = Controller.create({ @@ -623,7 +621,7 @@ QUnit.test('{{render}} helper should let view provide its own template', functio equal(view.$().text(), 'Hello other!'); }); -QUnit.test('{{render}} helper should not require view to provide its own template', function() { +test('{{render}} helper should not require view to provide its own template', function() { var template = '{{render \'fish\'}}'; var Controller = EmberController.extend(); var controller = Controller.create({ @@ -645,7 +643,7 @@ QUnit.test('{{render}} helper should not require view to provide its own templat equal(view.$().text(), 'Hello fish!'); }); -QUnit.test('{{render}} helper should set router as target when parentController is not found', function() { +test('{{render}} helper should set router as target when parentController is not found', function() { expect(3); ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT = false; @@ -681,5 +679,3 @@ QUnit.test('{{render}} helper should set router as target when parentController postController.send('someAction'); }); - -} diff --git a/packages/ember-template-compiler/tests/plugins/assert-no-each-in-test.js b/packages/ember-template-compiler/tests/plugins/assert-no-each-in-test.js index e070b2dcdfc..fd2e95a75b3 100644 --- a/packages/ember-template-compiler/tests/plugins/assert-no-each-in-test.js +++ b/packages/ember-template-compiler/tests/plugins/assert-no-each-in-test.js @@ -1,13 +1,11 @@ import { ENV } from 'ember-environment'; import { compile } from 'ember-template-compiler'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -const legacyViewSupportOriginalValue = ENV._ENABLE_LEGACY_VIEW_SUPPORT; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +const legacyViewSupportOriginalValue = ENV._ENABLE_LEGACY_VIEW_SUPPORT; -QUnit.module('ember-template-compiler: assert-no-each-in-test without legacy view support', { +testModule('ember-template-compiler: assert-no-each-in-test without legacy view support', { setup() { ENV._ENABLE_LEGACY_VIEW_SUPPORT = false; }, @@ -17,7 +15,7 @@ QUnit.module('ember-template-compiler: assert-no-each-in-test without legacy vie } }); -QUnit.test('{{#each foo in bar}} is not allowed', function() { +test('{{#each foo in bar}} is not allowed', function() { expect(1); expectAssertion(function() { @@ -28,7 +26,7 @@ QUnit.test('{{#each foo in bar}} is not allowed', function() { }); -QUnit.module('ember-template-compiler: assert-no-each-in-test with legacy view support', { +testModule('ember-template-compiler: assert-no-each-in-test with legacy view support', { setup() { ENV._ENABLE_LEGACY_VIEW_SUPPORT = true; }, @@ -38,7 +36,7 @@ QUnit.module('ember-template-compiler: assert-no-each-in-test with legacy view s } }); -QUnit.test('{{#each foo in bar}} is allowed', function() { +test('{{#each foo in bar}} is allowed', function() { expect(1); compile('{{#each person in people}}{{person.name}}{{/each}}', { @@ -47,5 +45,3 @@ QUnit.test('{{#each foo in bar}} is allowed', function() { ok(true); }); - -} diff --git a/packages/ember-template-compiler/tests/plugins/deprecate-render-block-test.js b/packages/ember-template-compiler/tests/plugins/deprecate-render-block-test.js index fa4d94bfca9..8de9791ea62 100644 --- a/packages/ember-template-compiler/tests/plugins/deprecate-render-block-test.js +++ b/packages/ember-template-compiler/tests/plugins/deprecate-render-block-test.js @@ -1,20 +1,16 @@ import { compile } from 'ember-template-compiler'; -import isEnabled from 'ember-metal/features'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +testModule('ember-template-compiler: deprecate-render-block'); - QUnit.module('ember-template-compiler: deprecate-render-block'); +test('Using `render` with a block throws an error', function() { + expect(1); - QUnit.test('Using `render` with a block throws an error', function() { - expect(1); + let expectedMessage = `Usage of \`render\` in block form is unsupported ('baz/foo-bar' @ L1:C0) .`; - let expectedMessage = `Usage of \`render\` in block form is unsupported ('baz/foo-bar' @ L1:C0) .`; - - throws(function() { - compile('{{#render "foo-bar"}}{{/render}}', { - moduleName: 'baz/foo-bar' - }); - }, expectedMessage); - }); -} + throws(function() { + compile('{{#render "foo-bar"}}{{/render}}', { + 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 9773a1b51f0..30d04ac35ba 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,22 +1,20 @@ import { compile } from 'ember-template-compiler'; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; - QUnit.module('ember-template-compiler: deprecate-model-render'); - - QUnit.test('Using `{{render` with model provides a deprecation', function() { - expect(1); +testModule('ember-template-compiler: deprecate-model-render'); + +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) `; + + expectDeprecation(function() { + compile('{{render "foo-bar" coolModel}}', { + moduleName: 'baz/foo-bar' + }); + }, expectedMessage); +}); - let expectedMessage = - `Please refactor \`{{render "foo-bar" coolModel}}\` to a component and` + - ` invoke via \`{{foo-bar model=coolModel}}\`. ('baz/foo-bar' @ L1:C0) `; - - expectDeprecation(function() { - compile('{{render "foo-bar" coolModel}}', { - moduleName: 'baz/foo-bar' - }); - }, expectedMessage); - }); -} 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 4a3098e5262..297cfcfa14a 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 @@ -14,11 +14,9 @@ function removeAstPlugin(plugin) { let legacyViewSupportOriginalValue; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-template-compiler: assert-no-view-and-controller-paths without legacy view support', { +testModule('ember-template-compiler: assert-no-view-and-controller-paths without legacy view support', { setup() { legacyViewSupportOriginalValue = ENV._ENABLE_LEGACY_VIEW_SUPPORT; ENV._ENABLE_LEGACY_VIEW_SUPPORT = false; @@ -31,12 +29,10 @@ QUnit.module('ember-template-compiler: assert-no-view-and-controller-paths witho } }); -QUnit.test('Can transform an inline {{link-to}} without error', function() { +test('Can transform an inline {{link-to}} without error', function() { expect(0); compile(`{{link-to 'foo' 'index'}}`, { moduleName: 'foo/bar/baz' }); }); - -} diff --git a/packages/ember-template-compiler/tests/plugins/transform-input-on-test.js b/packages/ember-template-compiler/tests/plugins/transform-input-on-test.js index 428b4e77d10..be11e0091d4 100644 --- a/packages/ember-template-compiler/tests/plugins/transform-input-on-test.js +++ b/packages/ember-template-compiler/tests/plugins/transform-input-on-test.js @@ -1,12 +1,10 @@ import { compile } from 'ember-template-compiler'; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-template-compiler: transform-input-on'); +testModule('ember-template-compiler: transform-input-on'); -QUnit.test('Using `action` without `on` provides a deprecation', function() { +test('Using `action` without `on` provides a deprecation', function() { expect(1); expectDeprecation(function() { @@ -16,7 +14,7 @@ QUnit.test('Using `action` without `on` provides a deprecation', function() { }, `Using '{{input action="foo"}}' ('foo/bar/baz' @ L1:C0) is deprecated. Please use '{{input enter="foo"}}' instead.`); }); -QUnit.test('Using `action` with `on` provides a deprecation', function() { +test('Using `action` with `on` provides a deprecation', function() { expect(1); expectDeprecation(function() { @@ -26,7 +24,7 @@ QUnit.test('Using `action` with `on` provides a deprecation', function() { }, `Using '{{input on="focus-in" action="foo"}}' ('foo/bar/baz' @ L1:C0) is deprecated. Please use '{{input focus-in="foo"}}' instead.`); }); -QUnit.test('Using `on=\'keyPress\'` does not clobber `keyPress`', function() { +test('Using `on=\'keyPress\'` does not clobber `keyPress`', function() { expect(1); expectDeprecation(function() { @@ -36,7 +34,7 @@ QUnit.test('Using `on=\'keyPress\'` does not clobber `keyPress`', function() { }, `Using '{{input on="keyPress" action="foo"}}' ('foo/bar/baz' @ L1:C0) is deprecated. Please use '{{input key-press="foo"}}' instead.`); }); -QUnit.test('Using `on=\'foo\'` without `action=\'asdf\'` raises specific deprecation', function() { +test('Using `on=\'foo\'` without `action=\'asdf\'` raises specific deprecation', function() { expect(1); expectDeprecation(function() { @@ -45,5 +43,3 @@ QUnit.test('Using `on=\'foo\'` without `action=\'asdf\'` raises specific depreca }); }, `Using '{{input on="asdf" ...}}' without specifying an action ('foo/bar/baz' @ L1:C0) will do nothing.`); }); - -} diff --git a/packages/ember-template-compiler/tests/plugins_test.js b/packages/ember-template-compiler/tests/plugins_test.js index d8f42c8785a..742853ac789 100644 --- a/packages/ember-template-compiler/tests/plugins_test.js +++ b/packages/ember-template-compiler/tests/plugins_test.js @@ -5,12 +5,9 @@ import { import compile from 'ember-template-compiler/system/compile'; var originalASTPlugins; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('ember-htmlbars: Ember.HTMLBars.registerASTPlugin', { +testModule('ember-htmlbars: Ember.HTMLBars.registerASTPlugin', { setup() { originalASTPlugins = plugins.ast.slice(); }, @@ -20,7 +17,7 @@ QUnit.module('ember-htmlbars: Ember.HTMLBars.registerASTPlugin', { } }); -QUnit.test('registering a plugin adds it to htmlbars-compiler options', function() { +test('registering a plugin adds it to htmlbars-compiler options', function() { expect(2); function TestPlugin() { @@ -38,10 +35,8 @@ QUnit.test('registering a plugin adds it to htmlbars-compiler options', function compile('some random template'); }); -QUnit.test('registering an unknown type throws an error', function() { +test('registering an unknown type throws an error', function() { throws(function() { registerPlugin('asdf', 'whatever'); }, /Attempting to register "whatever" as "asdf" which is not a valid HTMLBars plugin type./); }); - -} diff --git a/packages/ember-template-compiler/tests/system/compile_test.js b/packages/ember-template-compiler/tests/system/compile_test.js index c5f0fa2fa82..860e55dbf49 100644 --- a/packages/ember-template-compiler/tests/system/compile_test.js +++ b/packages/ember-template-compiler/tests/system/compile_test.js @@ -4,13 +4,11 @@ import { } from 'htmlbars-compiler/compiler'; import VERSION from 'ember/version'; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-htmlbars: compile'); +testModule('ember-htmlbars: compile'); -QUnit.test('compiles the provided template with htmlbars', function() { +test('compiles the provided template with htmlbars', function() { var templateString = '{{foo}} -- {{some-bar blah=\'foo\'}}'; var actual = compile(templateString); @@ -19,7 +17,7 @@ QUnit.test('compiles the provided template with htmlbars', function() { equal(actual.toString(), expected.toString(), 'compile function matches content with htmlbars compile'); }); -QUnit.test('calls template on the compiled function', function() { +test('calls template on the compiled function', function() { var templateString = '{{foo}} -- {{some-bar blah=\'foo\'}}'; var actual = compile(templateString); @@ -28,7 +26,7 @@ QUnit.test('calls template on the compiled function', function() { ok(actual.isMethod === false, 'sets isMethod via template function'); }); -QUnit.test('includes the current revision in the compiled template', function() { +test('includes the current revision in the compiled template', function() { var templateString = '{{foo}} -- {{some-bar blah=\'foo\'}}'; var actual = compile(templateString); @@ -36,7 +34,7 @@ QUnit.test('includes the current revision in the compiled template', function() equal(actual.meta.revision, 'Ember@' + VERSION, 'revision is included in generated template'); }); -QUnit.test('the template revision is different than the HTMLBars default revision', function() { +test('the template revision is different than the HTMLBars default revision', function() { var templateString = '{{foo}} -- {{some-bar blah=\'foo\'}}'; var actual = compile(templateString); @@ -45,4 +43,3 @@ QUnit.test('the template revision is different than the HTMLBars default revisio ok(actual.meta.revision !== expected.meta.revision, 'revision differs from default'); }); -} diff --git a/packages/ember-template-compiler/tests/system/template_test.js b/packages/ember-template-compiler/tests/system/template_test.js index a53d6a17e2c..55845fe255d 100644 --- a/packages/ember-template-compiler/tests/system/template_test.js +++ b/packages/ember-template-compiler/tests/system/template_test.js @@ -1,12 +1,10 @@ import template from 'ember-template-compiler/system/template'; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-htmlbars: template'); +testModule('ember-htmlbars: template'); -QUnit.test('sets `isTop` on the provided function', function() { +test('sets `isTop` on the provided function', function() { function test() { } var result = template(test); @@ -14,12 +12,10 @@ QUnit.test('sets `isTop` on the provided function', function() { equal(result.isTop, true, 'sets isTop on the provided function'); }); -QUnit.test('sets `isMethod` on the provided function', function() { +test('sets `isMethod` on the provided function', function() { function test() { } var result = template(test); equal(result.isMethod, false, 'sets isMethod on the provided function'); }); - -} diff --git a/packages/ember-testing/tests/acceptance_test.js b/packages/ember-testing/tests/acceptance_test.js index 9e2ee30f381..ab56e44b460 100644 --- a/packages/ember-testing/tests/acceptance_test.js +++ b/packages/ember-testing/tests/acceptance_test.js @@ -13,11 +13,9 @@ import RSVP from 'ember-runtime/ext/rsvp'; var App, find, click, fillIn, currentRoute, currentURL, visit, originalAdapter, andThen, indexHitCount; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-testing Acceptance', { +testModule('ember-testing Acceptance', { setup() { jQuery('').appendTo('head'); jQuery('
').appendTo('body'); @@ -109,7 +107,7 @@ QUnit.module('ember-testing Acceptance', { } }); -QUnit.test('helpers can be chained with then', function() { +test('helpers can be chained with then', function() { expect(6); currentRoute = 'index'; @@ -136,7 +134,7 @@ QUnit.test('helpers can be chained with then', function() { // Keep this for backwards compatibility -QUnit.test('helpers can be chained to each other', function() { +test('helpers can be chained to each other', function() { expect(7); currentRoute = 'index'; @@ -161,7 +159,7 @@ QUnit.test('helpers can be chained to each other', function() { }); }); -QUnit.test('helpers don\'t need to be chained', function() { +test('helpers don\'t need to be chained', function() { expect(5); currentRoute = 'index'; @@ -186,7 +184,7 @@ QUnit.test('helpers don\'t need to be chained', function() { }); }); -QUnit.test('Nested async helpers', function() { +test('Nested async helpers', function() { expect(5); currentRoute = 'index'; @@ -213,7 +211,7 @@ QUnit.test('Nested async helpers', function() { }); }); -QUnit.test('Multiple nested async helpers', function() { +test('Multiple nested async helpers', function() { expect(3); visit('/posts'); @@ -232,7 +230,7 @@ QUnit.test('Multiple nested async helpers', function() { }); }); -QUnit.test('Helpers nested in thens', function() { +test('Helpers nested in thens', function() { expect(5); currentRoute = 'index'; @@ -259,7 +257,7 @@ QUnit.test('Helpers nested in thens', function() { }); }); -QUnit.test('Aborted transitions are not logged via Ember.Test.adapter#exception', function () { +test('Aborted transitions are not logged via Ember.Test.adapter#exception', function () { expect(0); Test.adapter = QUnitAdapter.create({ @@ -271,7 +269,7 @@ QUnit.test('Aborted transitions are not logged via Ember.Test.adapter#exception' visit('/abort_transition'); }); -QUnit.test('Unhandled exceptions are logged via Ember.Test.adapter#exception', function () { +test('Unhandled exceptions are logged via Ember.Test.adapter#exception', function () { expect(2); var asyncHandled; @@ -291,7 +289,7 @@ QUnit.test('Unhandled exceptions are logged via Ember.Test.adapter#exception', f asyncHandled = click('.does-not-exist'); }); -QUnit.test('Unhandled exceptions in `andThen` are logged via Ember.Test.adapter#exception', function () { +test('Unhandled exceptions in `andThen` are logged via Ember.Test.adapter#exception', function () { expect(1); Test.adapter = QUnitAdapter.create({ @@ -307,7 +305,7 @@ QUnit.test('Unhandled exceptions in `andThen` are logged via Ember.Test.adapter# }); }); -QUnit.test('should not start routing on the root URL when visiting another', function() { +test('should not start routing on the root URL when visiting another', function() { expect(4); visit('/posts'); @@ -320,7 +318,7 @@ QUnit.test('should not start routing on the root URL when visiting another', fun }); }); -QUnit.test('only enters the index route once when visiting /', function() { +test('only enters the index route once when visiting /', function() { expect(1); visit('/'); @@ -330,7 +328,7 @@ QUnit.test('only enters the index route once when visiting /', function() { }); }); -QUnit.test('test must not finish while asyncHelpers are pending', function () { +test('test must not finish while asyncHelpers are pending', function () { expect(2); var async = 0; @@ -366,7 +364,7 @@ QUnit.test('test must not finish while asyncHelpers are pending', function () { } }); -QUnit.test('visiting a URL that causes another transition should yield the correct URL', function () { +test('visiting a URL that causes another transition should yield the correct URL', function () { expect(1); visit('/redirect'); @@ -376,7 +374,7 @@ QUnit.test('visiting a URL that causes another transition should yield the corre }); }); -QUnit.test('visiting a URL and then visiting a second URL with a transition should yield the correct URL', function () { +test('visiting a URL and then visiting a second URL with a transition should yield the correct URL', function () { expect(2); visit('/posts'); @@ -392,9 +390,9 @@ QUnit.test('visiting a URL and then visiting a second URL with a transition shou }); }); -QUnit.module('ember-testing Acceptance – teardown'); +testModule('ember-testing Acceptance – teardown'); -QUnit.test('that the setup/teardown happens correct', function() { +test('that the setup/teardown happens correct', function() { expect(2); jQuery('').appendTo('head'); @@ -416,5 +414,3 @@ QUnit.test('that the setup/teardown happens correct', function() { Test.adapter = originalAdapter; indexHitCount = 0; }); - -} diff --git a/packages/ember-testing/tests/helpers_test.js b/packages/ember-testing/tests/helpers_test.js index 35ae446eb97..cc22ee3a2b0 100644 --- a/packages/ember-testing/tests/helpers_test.js +++ b/packages/ember-testing/tests/helpers_test.js @@ -348,11 +348,9 @@ QUnit.test('`wait` helper can be passed a resolution value', function() { }); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('`click` triggers appropriate events in order', function() { +test('`click` triggers appropriate events in order', function() { expect(5); var click, wait, events; @@ -423,7 +421,7 @@ QUnit.test('`click` triggers appropriate events in order', function() { }); }); -QUnit.test('`click` triggers native events with simulated X/Y coordinates', function() { +test('`click` triggers native events with simulated X/Y coordinates', function() { expect(15); var click, wait, events; @@ -461,7 +459,7 @@ QUnit.test('`click` triggers native events with simulated X/Y coordinates', func }); }); -QUnit.test('`triggerEvent` with mouseenter triggers native events with simulated X/Y coordinates', function() { +test('`triggerEvent` with mouseenter triggers native events with simulated X/Y coordinates', function() { expect(5); var triggerEvent, wait, evt; @@ -493,8 +491,6 @@ QUnit.test('`triggerEvent` with mouseenter triggers native events with simulated }); }); -} - QUnit.test('`wait` waits for outstanding timers', function() { expect(1); @@ -549,10 +545,7 @@ QUnit.test('`wait` does not error if routing has not begun', function() { }); }); -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.test('`triggerEvent accepts an optional options hash without context', function() { +test('`triggerEvent accepts an optional options hash without context', function() { expect(3); var triggerEvent, wait, event; @@ -581,7 +574,7 @@ QUnit.test('`triggerEvent accepts an optional options hash without context', fun }); }); -QUnit.test('`triggerEvent can limit searching for a selector to a scope', function() { +test('`triggerEvent can limit searching for a selector to a scope', function() { expect(2); var triggerEvent, wait, event; @@ -609,7 +602,7 @@ QUnit.test('`triggerEvent can limit searching for a selector to a scope', functi }); }); -QUnit.test('`triggerEvent` can be used to trigger arbitrary events', function() { +test('`triggerEvent` can be used to trigger arbitrary events', function() { expect(2); var triggerEvent, wait, event; @@ -637,7 +630,7 @@ QUnit.test('`triggerEvent` can be used to trigger arbitrary events', function() }); }); -QUnit.test('`fillIn` takes context into consideration', function() { +test('`fillIn` takes context into consideration', function() { expect(2); var fillIn, find, visit, andThen, wait; @@ -663,7 +656,7 @@ QUnit.test('`fillIn` takes context into consideration', function() { return wait(); }); -QUnit.test('`fillIn` focuses on the element', function() { +test('`fillIn` focuses on the element', function() { expect(2); var fillIn, find, visit, andThen, wait; @@ -696,7 +689,7 @@ QUnit.test('`fillIn` focuses on the element', function() { return wait(); }); -QUnit.test('`fillIn` fires `input` and `change` events in the proper order', function() { +test('`fillIn` fires `input` and `change` events in the proper order', function() { expect(1); var fillIn, visit, andThen, wait; @@ -732,7 +725,7 @@ QUnit.test('`fillIn` fires `input` and `change` events in the proper order', fun return wait(); }); -QUnit.test('`triggerEvent accepts an optional options hash and context', function() { +test('`triggerEvent accepts an optional options hash and context', function() { expect(3); var triggerEvent, wait, event; @@ -763,7 +756,6 @@ QUnit.test('`triggerEvent accepts an optional options hash and context', functio }); }); -} QUnit.module('ember-testing debugging helpers', { setup() { diff --git a/packages/ember-testing/tests/integration_test.js b/packages/ember-testing/tests/integration_test.js index d4a5f04880f..dc1b1ab42c5 100644 --- a/packages/ember-testing/tests/integration_test.js +++ b/packages/ember-testing/tests/integration_test.js @@ -85,11 +85,9 @@ QUnit.test('template is bound to empty array of people', function() { }); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('template is bound to array of 2 people', function() { +test('template is bound to array of 2 people', function() { App.Person.find = function() { var people = emberA(); var first = App.Person.create({ firstName: 'x' }); @@ -105,8 +103,6 @@ QUnit.test('template is bound to array of 2 people', function() { }); }); -} - QUnit.test('template is again bound to empty array of people', function() { App.Person.find = function() { return emberA(); diff --git a/packages/ember-views/tests/compat/attrs_proxy_test.js b/packages/ember-views/tests/compat/attrs_proxy_test.js index ad4525a623a..b5e06eb4534 100644 --- a/packages/ember-views/tests/compat/attrs_proxy_test.js +++ b/packages/ember-views/tests/compat/attrs_proxy_test.js @@ -13,11 +13,9 @@ import { OWNER } from 'container/owner'; var view, owner, originalViewKeyword; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('ember-views: attrs-proxy', { +testModule('ember-views: attrs-proxy', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); owner = buildOwner(); @@ -30,7 +28,7 @@ QUnit.module('ember-views: attrs-proxy', { } }); -QUnit.test('works with properties setup in root of view', function() { +test('works with properties setup in root of view', function() { owner.register('view:foo', View.extend({ bar: 'qux', @@ -47,7 +45,7 @@ QUnit.test('works with properties setup in root of view', function() { equal(view.$().text(), 'baz', 'value specified in the template is used'); }); -QUnit.test('works with undefined attributes', function() { +test('works with undefined attributes', function() { // TODO: attrs // expectDeprecation(); @@ -78,7 +76,7 @@ QUnit.test('works with undefined attributes', function() { equal(get(view, 'bar'), undefined, 'value is updated upstream'); }); -QUnit.test('an observer on an attribute in the root of the component is fired when attrs are set', function() { +test('an observer on an attribute in the root of the component is fired when attrs are set', function() { expect(2); owner.register('view:foo', View.extend({ @@ -108,5 +106,3 @@ QUnit.test('an observer on an attribute in the root of the component is fired wh equal(view.$().text(), 'qux - 2', 'observer is fired on update'); }); - -} diff --git a/packages/ember-views/tests/system/event_dispatcher_test.js b/packages/ember-views/tests/system/event_dispatcher_test.js index 4167efe9f32..c73d430fa49 100644 --- a/packages/ember-views/tests/system/event_dispatcher_test.js +++ b/packages/ember-views/tests/system/event_dispatcher_test.js @@ -22,11 +22,9 @@ var owner, view, originalViewKeyword; var dispatcher; import isEnabled from 'ember-metal/features'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('EventDispatcher', { +testModule('EventDispatcher', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); @@ -51,7 +49,7 @@ QUnit.module('EventDispatcher', { }); if (isEnabled('ember-improved-instrumentation')) { - QUnit.test('should instrument triggered events', function() { + test('should instrument triggered events', function() { let clicked = 0; run(function () { @@ -103,7 +101,7 @@ if (isEnabled('ember-improved-instrumentation')) { }); } -QUnit.test('should dispatch events to views', function() { +test('should dispatch events to views', function() { var receivedEvent; var parentMouseDownCalled = 0; var childKeyDownCalled = 0; @@ -156,7 +154,7 @@ QUnit.test('should dispatch events to views', function() { equal(parentKeyDownCalled, 0, 'does not call keyDown on parent if child handles event'); }); -QUnit.test('should not dispatch events to views not inDOM', function() { +test('should not dispatch events to views not inDOM', function() { var receivedEvent; view = View.extend({ @@ -192,7 +190,7 @@ QUnit.test('should not dispatch events to views not inDOM', function() { $element.remove(); }); -QUnit.test('should send change events up view hierarchy if view contains form elements', function() { +test('should send change events up view hierarchy if view contains form elements', function() { var receivedEvent; view = View.create({ template: compile(''), @@ -211,7 +209,7 @@ QUnit.test('should send change events up view hierarchy if view contains form el equal(receivedEvent.target, jQuery('#is-done')[0], 'target property is the element that was clicked'); }); -QUnit.test('events should stop propagating if the view is destroyed', function() { +test('events should stop propagating if the view is destroyed', function() { var parentComponentReceived, receivedEvent; owner.register('component:x-foo', Component.extend({ @@ -241,7 +239,7 @@ QUnit.test('events should stop propagating if the view is destroyed', function() ok(!parentComponentReceived, 'parent component does not receive the event'); }); -QUnit.test('should dispatch events to nearest event manager', function() { +test('should dispatch events to nearest event manager', function() { var receivedEvent = 0; view = View.create({ template: compile(''), @@ -263,7 +261,7 @@ QUnit.test('should dispatch events to nearest event manager', function() { equal(receivedEvent, 1, 'event should go to manager and not view'); }); -QUnit.test('event manager should be able to re-dispatch events to view', function() { +test('event manager should be able to re-dispatch events to view', function() { var receivedEvent = 0; owner.register('component:x-foo', Component.extend({ @@ -303,7 +301,7 @@ QUnit.test('event manager should be able to re-dispatch events to view', functio equal(receivedEvent, 2, 'event should go to manager and not view'); }); -QUnit.test('event handlers should be wrapped in a run loop', function() { +test('event handlers should be wrapped in a run loop', function() { expect(1); view = View.extend({ @@ -338,7 +336,7 @@ QUnit.module('EventDispatcher#setup', { } }); -QUnit.test('additional events which should be listened on can be passed', function () { +test('additional events which should be listened on can be passed', function () { expect(1); run(function () { @@ -355,7 +353,7 @@ QUnit.test('additional events which should be listened on can be passed', functi jQuery('#leView').trigger('myevent'); }); -QUnit.test('additional events and rootElement can be specified', function () { +test('additional events and rootElement can be specified', function () { expect(3); jQuery('#qunit-fixture').append('
'); @@ -377,7 +375,7 @@ QUnit.test('additional events and rootElement can be specified', function () { jQuery('#leView').trigger('myevent'); }); -QUnit.test('default events can be disabled via `customEvents`', function () { +test('default events can be disabled via `customEvents`', function () { expect(1); run(function () { @@ -407,5 +405,3 @@ QUnit.test('default events can be disabled via `customEvents`', function () { jQuery('#leView').trigger('click'); jQuery('#leView').trigger('dblclick'); }); - -} diff --git a/packages/ember-views/tests/system/ext_test.js b/packages/ember-views/tests/system/ext_test.js index 5c837fb3f28..6fe47bcf404 100644 --- a/packages/ember-views/tests/system/ext_test.js +++ b/packages/ember-views/tests/system/ext_test.js @@ -7,11 +7,9 @@ import viewKeyword from 'ember-htmlbars/keywords/view'; var originalViewKeyword; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('Ember.View additions to run queue', { +testModule('Ember.View additions to run queue', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); }, @@ -20,7 +18,7 @@ QUnit.module('Ember.View additions to run queue', { } }); -QUnit.test('View hierarchy is done rendering to DOM when functions queued in afterRender execute', function() { +test('View hierarchy is done rendering to DOM when functions queued in afterRender execute', function() { var didInsert = 0; var childView = View.create({ elementId: 'child_view', @@ -48,5 +46,3 @@ QUnit.test('View hierarchy is done rendering to DOM when functions queued in aft parentView.destroy(); }); }); - -} diff --git a/packages/ember-views/tests/views/view/append_to_test.js b/packages/ember-views/tests/views/view/append_to_test.js index 68cba3908be..aab3eb91446 100644 --- a/packages/ember-views/tests/views/view/append_to_test.js +++ b/packages/ember-views/tests/views/view/append_to_test.js @@ -12,7 +12,8 @@ import { OWNER } from 'container/owner'; import { registerKeyword, resetKeyword } from 'ember-htmlbars/tests/utils'; import viewKeyword from 'ember-htmlbars/keywords/view'; -import isEnabled from 'ember-metal/features'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; + var owner, View, view, otherView, willDestroyCalled, originalViewKeyword; @@ -74,10 +75,7 @@ QUnit.test('should be added to the specified element when calling appendTo()', f ok(viewElem.length > 0, 'creates and appends the view\'s element'); }); -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.test('should be added to the document body when calling append()', function() { +test('should be added to the document body when calling append()', function() { view = View.create({ template: compile('foo bar baz') }); @@ -92,8 +90,6 @@ QUnit.test('should be added to the document body when calling append()', functio ok(viewElem.length > 0, 'creates and appends the view\'s element'); }); -} - QUnit.test('raises an assert when a target does not exist in the DOM', function() { view = View.create(); @@ -104,10 +100,7 @@ QUnit.test('raises an assert when a target does not exist in the DOM', function( }); }); -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.test('append calls willInsertElement and didInsertElement callbacks', function() { +test('append calls willInsertElement and didInsertElement callbacks', function() { var willInsertElementCalled = false; var willInsertElementCalledInChild = false; var didInsertElementCalled = false; @@ -138,7 +131,7 @@ QUnit.test('append calls willInsertElement and didInsertElement callbacks', func ok(didInsertElementCalled, 'didInsertElement called'); }); -QUnit.test('a view calls its children\'s willInsertElement and didInsertElement', function() { +test('a view calls its children\'s willInsertElement and didInsertElement', function() { var parentView; var willInsertElementCalled = false; var didInsertElementCalled = false; @@ -177,7 +170,7 @@ QUnit.test('a view calls its children\'s willInsertElement and didInsertElement' }); }); -QUnit.test('replacing a view should invalidate childView elements', function() { +test('replacing a view should invalidate childView elements', function() { var elementOnDidInsert; view = EmberView.create({ @@ -209,7 +202,7 @@ QUnit.test('replacing a view should invalidate childView elements', function() { run(function() { view.destroy(); }); }); -QUnit.test('trigger rerender of parent and SimpleBoundView', function () { +test('trigger rerender of parent and SimpleBoundView', function () { var view = EmberView.create({ show: true, foo: 'bar', @@ -232,7 +225,6 @@ QUnit.test('trigger rerender of parent and SimpleBoundView', function () { }); }); -} QUnit.test('remove removes an element from the DOM', function() { willDestroyCalled = 0; @@ -289,10 +281,7 @@ QUnit.test('destroy more forcibly removes the view', function() { equal(willDestroyCalled, 1, 'the willDestroyElement hook was called once'); }); -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('EmberView - append() and appendTo() in a view hierarchy', { +testModule('EmberView - append() and appendTo() in a view hierarchy', { setup() { commonSetup(); @@ -311,7 +300,7 @@ QUnit.module('EmberView - append() and appendTo() in a view hierarchy', { } }); -QUnit.test('should be added to the specified element when calling appendTo()', function() { +test('should be added to the specified element when calling appendTo()', function() { jQuery('#qunit-fixture').html(''); view = View.create(); @@ -326,7 +315,7 @@ QUnit.test('should be added to the specified element when calling appendTo()', f ok(viewElem.length > 0, 'creates and appends the view\'s element'); }); -QUnit.test('should be added to the document body when calling append()', function() { +test('should be added to the document body when calling append()', function() { jQuery('#qunit-fixture').html(''); view = View.create(); @@ -338,5 +327,3 @@ QUnit.test('should be added to the document body when calling append()', functio var viewElem = jQuery('#child'); ok(viewElem.length > 0, 'creates and appends the view\'s element'); }); - -} diff --git a/packages/ember-views/tests/views/view/child_views_test.js b/packages/ember-views/tests/views/view/child_views_test.js index 15da70d60fb..eba2bf517a8 100644 --- a/packages/ember-views/tests/views/view/child_views_test.js +++ b/packages/ember-views/tests/views/view/child_views_test.js @@ -11,11 +11,9 @@ import { setOwner } from 'container/owner'; var originalViewKeyword; var parentView, childView; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('tests/views/view/child_views_tests.js', { +testModule('tests/views/view/child_views_tests.js', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); childView = EmberView.create({ @@ -41,7 +39,7 @@ QUnit.module('tests/views/view/child_views_tests.js', { // parent element // no parent element, no buffer, no element -QUnit.test('should render an inserted child view when the child is inserted before a DOM element is created', function() { +test('should render an inserted child view when the child is inserted before a DOM element is created', function() { run(function() { parentView.append(); }); @@ -49,7 +47,7 @@ QUnit.test('should render an inserted child view when the child is inserted befo equal(parentView.$().text(), 'Ember', 'renders the child view after the parent view'); }); -QUnit.test('should not duplicate childViews when rerendering', function() { +test('should not duplicate childViews when rerendering', function() { var InnerView = EmberView.extend(); var InnerView2 = EmberView.extend(); @@ -81,7 +79,7 @@ QUnit.test('should not duplicate childViews when rerendering', function() { }); }); -QUnit.test('should remove childViews inside {{if}} on destroy', function() { +test('should remove childViews inside {{if}} on destroy', function() { var outerView = EmberView.extend({ component: 'my-thing', value: false, @@ -120,7 +118,7 @@ QUnit.test('should remove childViews inside {{if}} on destroy', function() { }); }); -QUnit.test('should remove childViews inside {{each}} on destroy', function() { +test('should remove childViews inside {{each}} on destroy', function() { var outerView = EmberView.extend({ component: 'my-thing', init() { @@ -172,5 +170,3 @@ QUnit.test('should remove childViews inside {{each}} on destroy', function() { outerView.destroy(); }); }); - -} diff --git a/packages/ember-views/tests/views/view/create_element_test.js b/packages/ember-views/tests/views/view/create_element_test.js index 3afeb8431fb..e0afabdaf72 100644 --- a/packages/ember-views/tests/views/view/create_element_test.js +++ b/packages/ember-views/tests/views/view/create_element_test.js @@ -51,11 +51,10 @@ QUnit.test('should assert if `tagName` is an empty string and `classNameBindings view._renderNode = null; }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable -QUnit.test('calls render and turns resultant string into element', function() { +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; + +test('calls render and turns resultant string into element', function() { view = EmberView.create({ tagName: 'span', template: compile('foo') @@ -71,5 +70,3 @@ QUnit.test('calls render and turns resultant string into element', function() { equal(elem.innerHTML, 'foo', 'has innerHTML from context'); equal(elem.tagName.toString().toLowerCase(), 'span', 'has tagName from view'); }); - -} diff --git a/packages/ember-views/tests/views/view/jquery_test.js b/packages/ember-views/tests/views/view/jquery_test.js index a5517d4a057..ff332f4a6d3 100644 --- a/packages/ember-views/tests/views/view/jquery_test.js +++ b/packages/ember-views/tests/views/view/jquery_test.js @@ -35,11 +35,9 @@ QUnit.test('returns jQuery object selecting element if provided', function() { equal(jquery[0], get(view, 'element'), 'element should be element'); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('returns jQuery object selecting element inside element if provided', function() { +test('returns jQuery object selecting element inside element if provided', function() { ok(get(view, 'element'), 'precond - should have element'); var jquery = view.$('span'); @@ -47,8 +45,6 @@ QUnit.test('returns jQuery object selecting element inside element if provided', equal(jquery[0].parentNode, get(view, 'element'), 'element should be in element'); }); -} - QUnit.test('returns empty jQuery object if filter passed that does not match item in parent', function() { ok(get(view, 'element'), 'precond - should have element'); diff --git a/packages/ember-views/tests/views/view/layout_test.js b/packages/ember-views/tests/views/view/layout_test.js index e980d9cc6c5..5f3de6c01f1 100644 --- a/packages/ember-views/tests/views/view/layout_test.js +++ b/packages/ember-views/tests/views/view/layout_test.js @@ -36,11 +36,9 @@ QUnit.test('Layout views return throw if their layout cannot be found', function }, /cantBeFound/); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('should use the template of the associated layout', function() { +test('should use the template of the associated layout', function() { var templateCalled = 0; var layoutCalled = 0; @@ -69,7 +67,7 @@ QUnit.test('should use the template of the associated layout', function() { equal(layoutCalled, 1, 'layout is called when layout is present'); }); -QUnit.test('should use the associated template with itself as the context', function() { +test('should use the associated template with itself as the context', function() { owner.register('template:testTemplate', compile( '

template was called for {{personName}}

' )); @@ -90,7 +88,7 @@ QUnit.test('should use the associated template with itself as the context', func 'the named template was called with the view as the data source'); }); -QUnit.test('should fall back to defaultLayout if neither template nor templateName are provided', function() { +test('should fall back to defaultLayout if neither template nor templateName are provided', function() { var View = EmberView.extend({ defaultLayout: compile('used default layout') }); @@ -105,7 +103,7 @@ QUnit.test('should fall back to defaultLayout if neither template nor templateNa 'the named template was called with the view as the data source'); }); -QUnit.test('should not use defaultLayout if layout is provided', function() { +test('should not use defaultLayout if layout is provided', function() { var View = EmberView.extend({ layout: compile('used layout'), defaultLayout: compile('used default layout') @@ -118,5 +116,3 @@ QUnit.test('should not use defaultLayout if layout is provided', function() { equal('used layout', view.$().text(), 'default layout was not printed'); }); - -} diff --git a/packages/ember-views/tests/views/view/nearest_of_type_test.js b/packages/ember-views/tests/views/view/nearest_of_type_test.js index 26d3cc08ce8..e523e9d9dbb 100644 --- a/packages/ember-views/tests/views/view/nearest_of_type_test.js +++ b/packages/ember-views/tests/views/view/nearest_of_type_test.js @@ -13,11 +13,9 @@ var originalViewKeyword; var Mixin, Parent; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('View#nearest*', { +testModule('View#nearest*', { setup() { removeAstPlugin(AssertNoViewAndControllerPaths); originalViewKeyword = registerKeyword('view', viewKeyword); @@ -36,7 +34,7 @@ QUnit.module('View#nearest*', { } }); -QUnit.test('nearestOfType should find the closest view by view class', function() { +test('nearestOfType should find the closest view by view class', function() { var child; run(function() { @@ -48,7 +46,7 @@ QUnit.test('nearestOfType should find the closest view by view class', function( equal(child.nearestOfType(Parent), parentView, 'finds closest view in the hierarchy by class'); }); -QUnit.test('nearestOfType should find the closest view by mixin', function() { +test('nearestOfType should find the closest view by mixin', function() { var child; run(function() { @@ -60,7 +58,7 @@ QUnit.test('nearestOfType should find the closest view by mixin', function() { equal(child.nearestOfType(Mixin), parentView, 'finds closest view in the hierarchy by class'); }); -QUnit.test('nearestWithProperty should search immediate parent', function() { +test('nearestWithProperty should search immediate parent', function() { var childView; view = View.create({ @@ -76,7 +74,7 @@ QUnit.test('nearestWithProperty should search immediate parent', function() { equal(childView.nearestWithProperty('myProp'), view); }); -QUnit.test('nearestChildOf should be deprecated', function() { +test('nearestChildOf should be deprecated', function() { var child; run(function() { @@ -90,4 +88,3 @@ QUnit.test('nearestChildOf should be deprecated', function() { }, 'nearestChildOf has been deprecated.'); }); -} diff --git a/packages/ember-views/tests/views/view/remove_test.js b/packages/ember-views/tests/views/view/remove_test.js index 089ae5bcfeb..d5f5b315feb 100644 --- a/packages/ember-views/tests/views/view/remove_test.js +++ b/packages/ember-views/tests/views/view/remove_test.js @@ -13,15 +13,13 @@ import { runAppend, runDestroy } from 'ember-runtime/tests/utils'; var parentView, child; var originalViewKeyword; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { -// jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; // ....................................................... // removeAllChildren() // var view, childViews; -QUnit.module('View#removeAllChildren', { +testModule('View#removeAllChildren', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); @@ -46,21 +44,21 @@ QUnit.module('View#removeAllChildren', { } }); -QUnit.test('removes all child views', function() { +test('removes all child views', function() { equal(get(view, 'childViews.length'), 3, 'precond - has child views'); view.removeAllChildren(); equal(get(view, 'childViews.length'), 0, 'removed all children'); }); -QUnit.test('returns receiver', function() { +test('returns receiver', function() { equal(view.removeAllChildren(), view, 'receiver'); }); // ....................................................... // removeFromParent() // -QUnit.module('View#removeFromParent', { +testModule('View#removeFromParent', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); }, @@ -74,7 +72,7 @@ QUnit.module('View#removeFromParent', { } }); -QUnit.test('removes view from parent view', function() { +test('removes view from parent view', function() { parentView = View.extend({ template: compile('{{view view.childView}}'), childView: View.extend({ @@ -97,7 +95,7 @@ QUnit.test('removes view from parent view', function() { equal(parentView.$('div').length, 0, 'removes DOM element from parent'); }); -QUnit.test('returns receiver', function() { +test('returns receiver', function() { parentView = View.extend({ template: compile('{{view view.childView}}'), childView: View.extend({ @@ -113,7 +111,7 @@ QUnit.test('returns receiver', function() { equal(removed, child, 'receiver'); }); -QUnit.test('does nothing if not in parentView', function() { +test('does nothing if not in parentView', function() { child = View.create(); // monkey patch for testing... @@ -126,7 +124,7 @@ QUnit.test('does nothing if not in parentView', function() { }); }); -QUnit.test('the DOM element is gone after doing append and remove in two separate runloops', function() { +test('the DOM element is gone after doing append and remove in two separate runloops', function() { view = View.create(); run(function() { view.append(); @@ -139,7 +137,7 @@ QUnit.test('the DOM element is gone after doing append and remove in two separat ok(viewElem.length === 0, 'view\'s element doesn\'t exist in DOM'); }); -QUnit.test('the DOM element is gone after doing append and remove in a single runloop', function() { +test('the DOM element is gone after doing append and remove in a single runloop', function() { view = View.create(); run(function() { view.append(); @@ -149,5 +147,3 @@ QUnit.test('the DOM element is gone after doing append and remove in a single ru var viewElem = jQuery('#' + get(view, 'elementId')); ok(viewElem.length === 0, 'view\'s element doesn\'t exist in DOM'); }); - -} diff --git a/packages/ember-views/tests/views/view/render_to_element_test.js b/packages/ember-views/tests/views/view/render_to_element_test.js index f8a451fcb69..feefc524e9c 100644 --- a/packages/ember-views/tests/views/view/render_to_element_test.js +++ b/packages/ember-views/tests/views/view/render_to_element_test.js @@ -3,14 +3,11 @@ import run from 'ember-metal/run_loop'; import EmberView from 'ember-views/views/view'; import compile from 'ember-template-compiler/system/compile'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var View, view; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.module('EmberView - renderToElement()', { +testModule('EmberView - renderToElement()', { setup() { View = EmberView.extend({ template: compile('

hello world

goodbye world') @@ -24,7 +21,7 @@ QUnit.module('EmberView - renderToElement()', { } }); -QUnit.test('should render into and return a body element', function() { +test('should render into and return a body element', function() { view = View.create(); ok(!get(view, 'element'), 'precond - should not have an element'); @@ -41,7 +38,7 @@ QUnit.test('should render into and return a body element', function() { equal(element.firstChild.firstChild.nextSibling.nodeValue, ' goodbye world', 'renders the text node'); }); -QUnit.test('should create and render into an element with a provided tagName', function() { +test('should create and render into an element with a provided tagName', function() { view = View.create(); ok(!get(view, 'element'), 'precond - should not have an element'); @@ -57,5 +54,3 @@ QUnit.test('should create and render into an element with a provided tagName', f equal(element.firstChild.firstChild.tagName, 'H1', 'renders the view div'); equal(element.firstChild.firstChild.nextSibling.nodeValue, ' goodbye world', 'renders the text node'); }); - -} diff --git a/packages/ember-views/tests/views/view/replace_in_test.js b/packages/ember-views/tests/views/view/replace_in_test.js index 4d8764a6dbd..f7ec8624f00 100644 --- a/packages/ember-views/tests/views/view/replace_in_test.js +++ b/packages/ember-views/tests/views/view/replace_in_test.js @@ -84,11 +84,9 @@ QUnit.test('should move the view to the inDOM state after replacing', function() equal(view._currentState, view._states.inDOM, 'the view is in the inDOM state'); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('EmberView - replaceIn() in a view hierarchy', { +testModule('EmberView - replaceIn() in a view hierarchy', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); @@ -108,7 +106,7 @@ QUnit.module('EmberView - replaceIn() in a view hierarchy', { } }); -QUnit.test('should be added to the specified element when calling replaceIn()', function() { +test('should be added to the specified element when calling replaceIn()', function() { jQuery('#qunit-fixture').html(''); view = View.create(); @@ -122,5 +120,3 @@ QUnit.test('should be added to the specified element when calling replaceIn()', var viewElem = jQuery('#menu #child'); ok(viewElem.length > 0, 'creates and replaces the view\'s element'); }); - -} diff --git a/packages/ember-views/tests/views/view/template_test.js b/packages/ember-views/tests/views/view/template_test.js index f426b8bcc8f..f8b56299bbb 100644 --- a/packages/ember-views/tests/views/view/template_test.js +++ b/packages/ember-views/tests/views/view/template_test.js @@ -34,11 +34,9 @@ QUnit.test('Template views return throw if their template cannot be found', func }, /cantBeFound/); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('should call the function of the associated template', function() { +test('should call the function of the associated template', function() { owner.register('template:testTemplate', compile( '

template was called

' )); @@ -55,7 +53,7 @@ QUnit.test('should call the function of the associated template', function() { ok(view.$('#twas-called').length, 'the named template was called'); }); -QUnit.test('should call the function of the associated template with itself as the context', function() { +test('should call the function of the associated template with itself as the context', function() { owner.register('template:testTemplate', compile( '

template was called for {{personName}}

' )); @@ -76,7 +74,7 @@ QUnit.test('should call the function of the associated template with itself as t 'the named template was called with the view as the data source'); }); -QUnit.test('should fall back to defaultTemplate if neither template nor templateName are provided', function() { +test('should fall back to defaultTemplate if neither template nor templateName are provided', function() { var View; View = EmberView.extend({ @@ -99,7 +97,7 @@ QUnit.test('should fall back to defaultTemplate if neither template nor template 'the named template was called with the view as the data source'); }); -QUnit.test('should not use defaultTemplate if template is provided', function() { +test('should not use defaultTemplate if template is provided', function() { var View = EmberView.extend({ template: compile('foo'), defaultTemplate: compile( @@ -115,7 +113,7 @@ QUnit.test('should not use defaultTemplate if template is provided', function() equal('foo', view.$().text(), 'default template was not printed'); }); -QUnit.test('should not use defaultTemplate if template is provided', function() { +test('should not use defaultTemplate if template is provided', function() { owner.register('template:foobar', compile('foo')); var View = EmberView.extend({ @@ -136,8 +134,6 @@ QUnit.test('should not use defaultTemplate if template is provided', function() equal('foo', view.$().text(), 'default template was not printed'); }); -} - QUnit.test('should render an empty element if no template is specified', function() { view = EmberView.create(); run(function() { diff --git a/packages/ember-views/tests/views/view/view_lifecycle_test.js b/packages/ember-views/tests/views/view/view_lifecycle_test.js index 4b80fc261f0..3a67323f267 100644 --- a/packages/ember-views/tests/views/view/view_lifecycle_test.js +++ b/packages/ember-views/tests/views/view/view_lifecycle_test.js @@ -13,12 +13,9 @@ var originalLookup = context.lookup; var originalViewKeyword; var lookup, view; -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; - -QUnit.module('views/view/view_lifecycle_test - pre-render', { +testModule('views/view/view_lifecycle_test - pre-render', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); context.lookup = lookup = {}; @@ -35,7 +32,7 @@ QUnit.module('views/view/view_lifecycle_test - pre-render', { } }); -QUnit.test('should create and append a DOM element after bindings have synced', function() { +test('should create and append a DOM element after bindings have synced', function() { var ViewTest; lookup.ViewTest = ViewTest = {}; @@ -65,7 +62,7 @@ QUnit.test('should create and append a DOM element after bindings have synced', equal(view.$().text(), 'controllerPropertyValue', 'renders and appends after bindings have synced'); }); -QUnit.test('should throw an exception if trying to append a child before rendering has begun', function() { +test('should throw an exception if trying to append a child before rendering has begun', function() { run(function() { view = EmberView.create(); }); @@ -75,7 +72,7 @@ QUnit.test('should throw an exception if trying to append a child before renderi }, null, 'throws an error when calling appendChild()'); }); -QUnit.test('should not affect rendering if rerender is called before initial render happens', function() { +test('should not affect rendering if rerender is called before initial render happens', function() { run(function() { view = EmberView.create({ template: compile('Rerender me!') @@ -88,7 +85,7 @@ QUnit.test('should not affect rendering if rerender is called before initial ren equal(view.$().text(), 'Rerender me!', 'renders correctly if rerender is called first'); }); -QUnit.test('should not affect rendering if destroyElement is called before initial render happens', function() { +test('should not affect rendering if destroyElement is called before initial render happens', function() { run(function() { view = EmberView.create({ template: compile('Don\'t destroy me!') @@ -101,7 +98,7 @@ QUnit.test('should not affect rendering if destroyElement is called before initi equal(view.$().text(), 'Don\'t destroy me!', 'renders correctly if destroyElement is called first'); }); -QUnit.module('views/view/view_lifecycle_test - in render', { +testModule('views/view/view_lifecycle_test - in render', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); }, @@ -115,7 +112,7 @@ QUnit.module('views/view/view_lifecycle_test - in render', { } }); -QUnit.test('rerender of top level view during rendering should throw', function() { +test('rerender of top level view during rendering should throw', function() { registerHelper('throw', function() { view.rerender(); }); @@ -131,7 +128,7 @@ QUnit.test('rerender of top level view during rendering should throw', function( ); }); -QUnit.test('rerender of non-top level view during rendering should throw', function() { +test('rerender of non-top level view during rendering should throw', function() { let innerView = EmberView.create({ template: compile('{{throw}}') }); @@ -151,7 +148,7 @@ QUnit.test('rerender of non-top level view during rendering should throw', funct ); }); -QUnit.module('views/view/view_lifecycle_test - hasElement', { +testModule('views/view/view_lifecycle_test - hasElement', { teardown() { if (view) { run(function() { @@ -161,7 +158,7 @@ QUnit.module('views/view/view_lifecycle_test - hasElement', { } }); -QUnit.test('createElement puts the view into the hasElement state', function() { +test('createElement puts the view into the hasElement state', function() { var hasCalledInsertElement = false; view = EmberView.create({ didInsertElement() { @@ -177,7 +174,7 @@ QUnit.test('createElement puts the view into the hasElement state', function() { equal(view.element.tagName, 'DIV', 'content is rendered'); }); -QUnit.test('trigger rerender on a view in the hasElement state doesn\'t change its state to inDOM', function() { +test('trigger rerender on a view in the hasElement state doesn\'t change its state to inDOM', function() { var hasCalledInsertElement = false; view = EmberView.create({ didInsertElement() { @@ -195,7 +192,7 @@ QUnit.test('trigger rerender on a view in the hasElement state doesn\'t change i }); -QUnit.module('views/view/view_lifecycle_test - in DOM', { +testModule('views/view/view_lifecycle_test - in DOM', { teardown() { if (view) { run(function() { @@ -205,7 +202,7 @@ QUnit.module('views/view/view_lifecycle_test - in DOM', { } }); -QUnit.test('should throw an exception when calling appendChild when DOM element exists', function() { +test('should throw an exception when calling appendChild when DOM element exists', function() { run(function() { view = EmberView.create({ template: compile('Wait for the kick') @@ -221,7 +218,7 @@ QUnit.test('should throw an exception when calling appendChild when DOM element }, null, 'throws an exception when calling appendChild after element is created'); }); -QUnit.test('should replace DOM representation if rerender() is called after element is created', function() { +test('should replace DOM representation if rerender() is called after element is created', function() { run(function() { view = EmberView.extend({ rerender() { @@ -252,7 +249,7 @@ QUnit.test('should replace DOM representation if rerender() is called after elem 'rerenders DOM element when rerender() is called'); }); -QUnit.test('should destroy DOM representation when destroyElement is called', function() { +test('should destroy DOM representation when destroyElement is called', function() { run(function() { view = EmberView.create({ template: compile('Don\'t fear the reaper') @@ -270,7 +267,7 @@ QUnit.test('should destroy DOM representation when destroyElement is called', fu ok(!view.get('element'), 'destroys view when destroyElement() is called'); }); -QUnit.test('should destroy DOM representation when destroy is called', function() { +test('should destroy DOM representation when destroy is called', function() { run(function() { view = EmberView.create({ template: compile('
Don\'t fear the reaper
') @@ -288,7 +285,7 @@ QUnit.test('should destroy DOM representation when destroy is called', function( ok(jQuery('#warning').length === 0, 'destroys element when destroy() is called'); }); -QUnit.test('should throw an exception if trying to append an element that is already in DOM', function() { +test('should throw an exception if trying to append an element that is already in DOM', function() { run(function() { view = EmberView.create({ template: compile('Broseidon, King of the Brocean') @@ -306,9 +303,9 @@ QUnit.test('should throw an exception if trying to append an element that is alr }, null, 'raises an exception on second append'); }); -QUnit.module('views/view/view_lifecycle_test - destroyed'); +testModule('views/view/view_lifecycle_test - destroyed'); -QUnit.test('should throw an exception when calling appendChild after view is destroyed', function() { +test('should throw an exception when calling appendChild after view is destroyed', function() { run(function() { view = EmberView.create({ template: compile('Wait for the kick') @@ -328,7 +325,7 @@ QUnit.test('should throw an exception when calling appendChild after view is des }, null, 'throws an exception when calling appendChild'); }); -QUnit.test('should throw an exception when rerender is called after view is destroyed', function() { +test('should throw an exception when rerender is called after view is destroyed', function() { run(function() { view = EmberView.create({ template: compile('foo') @@ -346,7 +343,7 @@ QUnit.test('should throw an exception when rerender is called after view is dest }, null, 'throws an exception when calling rerender'); }); -QUnit.test('should throw an exception when destroyElement is called after view is destroyed', function() { +test('should throw an exception when destroyElement is called after view is destroyed', function() { run(function() { view = EmberView.create({ template: compile('foo') @@ -364,7 +361,7 @@ QUnit.test('should throw an exception when destroyElement is called after view i }, null, 'throws an exception when calling destroyElement'); }); -QUnit.test('trigger rerender on a view in the inDOM state keeps its state as inDOM', function() { +test('trigger rerender on a view in the inDOM state keeps its state as inDOM', function() { run(function() { view = EmberView.create({ template: compile('foo') @@ -383,5 +380,3 @@ QUnit.test('trigger rerender on a view in the inDOM state keeps its state as inD view.destroy(); }); }); - -} diff --git a/packages/ember-views/tests/views/view_test.js b/packages/ember-views/tests/views/view_test.js index c65f8d0a964..a70461551a6 100644 --- a/packages/ember-views/tests/views/view_test.js +++ b/packages/ember-views/tests/views/view_test.js @@ -63,11 +63,9 @@ QUnit.test('should allow tagName to be a computed property [DEPRECATED]', functi equal(view.element.tagName, 'SPAN', 'the tagName cannot be changed after initial render'); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('should re-render if the context is changed', function() { +test('should re-render if the context is changed', function() { view = EmberView.create({ elementId: 'template-context-test', context: { foo: 'bar' }, @@ -89,7 +87,7 @@ QUnit.test('should re-render if the context is changed', function() { equal(jQuery('#qunit-fixture #template-context-test').text(), 'bang baz', 're-renders the view with the updated context'); }); -QUnit.test('renders a contained view with omitted start tag and tagless parent view context', function() { +test('renders a contained view with omitted start tag and tagless parent view context', function() { view = EmberView.create({ tagName: 'table', template: compile('{{view view.pivot}}'), @@ -113,7 +111,7 @@ QUnit.test('renders a contained view with omitted start tag and tagless parent v ok(view.$('tr').length, 'inner view is tr'); }); -QUnit.test('propagates dependent-key invalidated sets upstream', function() { +test('propagates dependent-key invalidated sets upstream', function() { view = EmberView.create({ parentProp: 'parent-value', template: compile('{{view view.childView childProp=view.parentProp}}'), @@ -135,7 +133,7 @@ QUnit.test('propagates dependent-key invalidated sets upstream', function() { equal(view.get('parentProp'), 'new-value', 'new value is propagated across template'); }); -QUnit.test('propagates dependent-key invalidated bindings upstream', function() { +test('propagates dependent-key invalidated bindings upstream', function() { view = EmberView.create({ parentProp: 'parent-value', template: compile('{{view view.childView childProp=view.parentProp}}'), @@ -162,5 +160,3 @@ QUnit.test('propagates dependent-key invalidated bindings upstream', function() equal(childView.get('childProp'), 'new-value', 'pre-cond - new value is propagated to CP'); equal(view.get('parentProp'), 'new-value', 'new value is propagated across template'); }); - -} diff --git a/packages/ember/tests/application_lifecycle_test.js b/packages/ember/tests/application_lifecycle_test.js index dc7218327c4..98cd173cfb2 100644 --- a/packages/ember/tests/application_lifecycle_test.js +++ b/packages/ember/tests/application_lifecycle_test.js @@ -3,7 +3,6 @@ import Route from 'ember-routing/system/route'; import run from 'ember-metal/run_loop'; import Component from 'ember-views/components/component'; import jQuery from 'ember-views/system/jquery'; -import isEnabled from 'ember-metal/features'; import { compile } from 'ember-template-compiler'; import { getTemplates, setTemplates } from 'ember-htmlbars/template_registry'; import controllerFor from 'ember-routing/system/controller_for'; @@ -126,10 +125,9 @@ QUnit.test('Destroying the application resets the router before the appInstance equal(controllerFor(appInstance, 'application').get('selectedMenuItem'), null); }); -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('initializers can augment an applications customEvents hash', function(assert) { +test('initializers can augment an applications customEvents hash', function(assert) { assert.expect(1); run(App, 'destroy'); @@ -163,7 +161,7 @@ QUnit.test('initializers can augment an applications customEvents hash', functio }); }); -QUnit.test('instanceInitializers can augment an the customEvents hash', function(assert) { +test('instanceInitializers can augment an the customEvents hash', function(assert) { assert.expect(1); run(App, 'destroy'); @@ -196,5 +194,3 @@ QUnit.test('instanceInitializers can augment an the customEvents hash', function jQuery('#herky-thingy').trigger('herky'); }); }); - -} diff --git a/packages/ember/tests/component_registration_test.js b/packages/ember/tests/component_registration_test.js index 38cae57e158..2d4c3b1bf21 100644 --- a/packages/ember/tests/component_registration_test.js +++ b/packages/ember/tests/component_registration_test.js @@ -9,8 +9,8 @@ import { OutletView } from 'ember-routing-views/views/outlet'; import Component from 'ember-views/components/component'; import jQuery from 'ember-views/system/jquery'; import { A as emberA } from 'ember-runtime/system/native_array'; -import isEnabled from 'ember-metal/features'; import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var App, appInstance; var originalHelpers; @@ -83,10 +83,7 @@ QUnit.test('The helper becomes the body of the component', function() { equal(jQuery('div.ember-view > div.ember-view', '#qunit-fixture').text(), 'hello world', 'The component is composed correctly'); }); -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.test('If a component is registered, it is used', function() { +test('If a component is registered, it is used', function() { boot(function() { appInstance.register('component:expand-it', Component.extend({ classNames: 'testing123' @@ -96,12 +93,7 @@ QUnit.test('If a component is registered, it is used', function() { equal(jQuery('div.testing123', '#qunit-fixture').text(), 'hello world', 'The component is composed correctly'); }); -} - -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.test('Late-registered components can be rendered with custom `layout` property', function() { +test('Late-registered components can be rendered with custom `layout` property', function() { setTemplate('application', compile('
there goes {{my-hero}}
')); boot(function() { @@ -115,7 +107,7 @@ QUnit.test('Late-registered components can be rendered with custom `layout` prop ok(!helpers['my-hero'], 'Component wasn\'t saved to global helpers hash'); }); -QUnit.test('Late-registered components can be rendered with template registered on the container', function() { +test('Late-registered components can be rendered with template registered on the container', function() { setTemplate('application', compile('
hello world {{sally-rutherford}}-{{#sally-rutherford}}!!!{{/sally-rutherford}}
')); boot(function() { @@ -127,8 +119,6 @@ QUnit.test('Late-registered components can be rendered with template registered ok(!helpers['sally-rutherford'], 'Component wasn\'t saved to global helpers hash'); }); -} - QUnit.test('Late-registered components can be rendered with ONLY the template registered on the container', function() { setTemplate('application', compile('
hello world {{borf-snorlax}}-{{#borf-snorlax}}!!!{{/borf-snorlax}}
')); @@ -152,10 +142,7 @@ QUnit.test('Component-like invocations are treated as bound paths if neither tem equal(jQuery('#wrapper').text(), 'machty hello world', 'The component is composed correctly'); }); -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.test('Assigning layoutName to a component should setup the template as a layout', function() { +test('Assigning layoutName to a component should setup the template as a layout', function() { expect(1); setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); @@ -175,7 +162,7 @@ QUnit.test('Assigning layoutName to a component should setup the template as a l equal(jQuery('#wrapper').text(), 'inner-outer', 'The component is composed correctly'); }); -QUnit.test('Assigning layoutName and layout to a component should use the `layout` value', function() { +test('Assigning layoutName and layout to a component should use the `layout` value', function() { expect(1); setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); @@ -196,7 +183,7 @@ QUnit.test('Assigning layoutName and layout to a component should use the `layou equal(jQuery('#wrapper').text(), 'inner-outer', 'The component is composed correctly'); }); -QUnit.test('Assigning defaultLayout to a component should set it up as a layout if no layout was found [DEPRECATED]', function() { +test('Assigning defaultLayout to a component should set it up as a layout if no layout was found [DEPRECATED]', function() { expect(2); setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); @@ -217,7 +204,7 @@ QUnit.test('Assigning defaultLayout to a component should set it up as a layout equal(jQuery('#wrapper').text(), 'inner-outer', 'The component is composed correctly'); }); -QUnit.test('Assigning defaultLayout to a component should set it up as a layout if layout was found [DEPRECATED]', function() { +test('Assigning defaultLayout to a component should set it up as a layout if layout was found [DEPRECATED]', function() { expect(2); setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); @@ -239,7 +226,7 @@ QUnit.test('Assigning defaultLayout to a component should set it up as a layout equal(jQuery('#wrapper').text(), 'inner-outer', 'The component is composed correctly'); }); -QUnit.test('Using name of component that does not exist', function () { +test('Using name of component that does not exist', function () { setTemplate('application', compile('
{{#no-good}} {{/no-good}}
')); expectAssertion(function () { @@ -247,12 +234,12 @@ QUnit.test('Using name of component that does not exist', function () { }, /A helper named 'no-good' could not be found/); }); -QUnit.module('Application Lifecycle - Component Context', { +testModule('Application Lifecycle - Component Context', { setup: prepare, teardown: cleanup }); -QUnit.test('Components with a block should have the proper content when a template is provided', function() { +test('Components with a block should have the proper content when a template is provided', function() { setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); setTemplate('components/my-component', compile('{{text}}-{{yield}}')); @@ -269,7 +256,7 @@ QUnit.test('Components with a block should have the proper content when a templa equal(jQuery('#wrapper').text(), 'inner-outer', 'The component is composed correctly'); }); -QUnit.test('Components with a block should yield the proper content without a template provided', function() { +test('Components with a block should yield the proper content without a template provided', function() { setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); boot(function() { @@ -285,7 +272,7 @@ QUnit.test('Components with a block should yield the proper content without a te equal(jQuery('#wrapper').text(), 'outer', 'The component is composed correctly'); }); -QUnit.test('Components without a block should have the proper content when a template is provided', function() { +test('Components without a block should have the proper content when a template is provided', function() { setTemplate('application', compile('
{{my-component}}
')); setTemplate('components/my-component', compile('{{text}}')); @@ -302,7 +289,7 @@ QUnit.test('Components without a block should have the proper content when a tem equal(jQuery('#wrapper').text(), 'inner', 'The component is composed correctly'); }); -QUnit.test('Components without a block should have the proper content', function() { +test('Components without a block should have the proper content', function() { setTemplate('application', compile('
{{my-component}}
')); boot(function() { @@ -321,7 +308,7 @@ QUnit.test('Components without a block should have the proper content', function }); // The test following this one is the non-deprecated version -QUnit.test('properties of a component without a template should not collide with internal structures [DEPRECATED]', function() { +test('properties of a component without a template should not collide with internal structures [DEPRECATED]', function() { setTemplate('application', compile('
{{my-component data=foo}}
')); boot(function() { @@ -340,7 +327,7 @@ QUnit.test('properties of a component without a template should not collide with equal(jQuery('#wrapper').text(), 'Some text inserted by jQuery', 'The component is composed correctly'); }); -QUnit.test('attrs property of a component without a template should not collide with internal structures', function() { +test('attrs property of a component without a template should not collide with internal structures', function() { setTemplate('application', compile('
{{my-component attrs=foo}}
')); boot(function() { @@ -360,7 +347,7 @@ QUnit.test('attrs property of a component without a template should not collide equal(jQuery('#wrapper').text(), 'Some text inserted by jQuery', 'The component is composed correctly'); }); -QUnit.test('Components trigger actions in the parents context when called from within a block', function() { +test('Components trigger actions in the parents context when called from within a block', function() { setTemplate('application', compile('
{{#my-component}}Fizzbuzz{{/my-component}}
')); boot(function() { @@ -380,7 +367,7 @@ QUnit.test('Components trigger actions in the parents context when called from w }); }); -QUnit.test('Components trigger actions in the components context when called from within its template', function() { +test('Components trigger actions in the components context when called from within its template', function() { setTemplate('application', compile('
{{#my-component}}{{text}}{{/my-component}}
')); setTemplate('components/my-component', compile('Fizzbuzz')); @@ -405,7 +392,7 @@ QUnit.test('Components trigger actions in the components context when called fro jQuery('#fizzbuzz', '#wrapper').click(); }); -QUnit.test('Components receive the top-level view as their ownerView', function(assert) { +test('Components receive the top-level view as their ownerView', function(assert) { setTemplate('application', compile('{{outlet}}')); setTemplate('index', compile('{{my-component}}')); setTemplate('components/my-component', compile('
')); @@ -431,5 +418,3 @@ QUnit.test('Components receive the top-level view as their ownerView', function( assert.ok(ownerView._outlets, 'owner view has an internal array of outlets'); }); - -} diff --git a/packages/ember/tests/controller_test.js b/packages/ember/tests/controller_test.js index 24ae14abd8e..6295a71acf6 100644 --- a/packages/ember/tests/controller_test.js +++ b/packages/ember/tests/controller_test.js @@ -6,7 +6,6 @@ import Application from 'ember-application/system/application'; import EmberView from 'ember-views/views/view'; import Component from 'ember-views/components/component'; import jQuery from 'ember-views/system/jquery'; -import isEnabled from 'ember-metal/features'; import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; /* @@ -49,10 +48,9 @@ QUnit.module('Template scoping examples', { } }); -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('Actions inside an outlet go to the associated controller', function() { +test('Actions inside an outlet go to the associated controller', function() { expect(1); setTemplate('index', compile('{{component-with-action action=\'componentAction\'}}')); @@ -77,7 +75,7 @@ QUnit.test('Actions inside an outlet go to the associated controller', function( $fixture.find('.component-with-action').click(); }); -QUnit.test('the controller property is provided to route driven views', function() { +test('the controller property is provided to route driven views', function() { var applicationController, applicationViewController; App.ApplicationController = Controller.extend({ @@ -99,8 +97,6 @@ QUnit.test('the controller property is provided to route driven views', function equal(applicationViewController, applicationController, 'application view should get its controller set properly'); }); -} - function bootApp() { run(App, 'advanceReadiness'); } diff --git a/packages/ember/tests/helpers/helper_registration_test.js b/packages/ember/tests/helpers/helper_registration_test.js index 73a564cc429..20d1556a091 100644 --- a/packages/ember/tests/helpers/helper_registration_test.js +++ b/packages/ember/tests/helpers/helper_registration_test.js @@ -8,7 +8,6 @@ import Router from 'ember-routing/system/router'; import Service from 'ember-runtime/system/service'; import jQuery from 'ember-views/system/jquery'; import inject from 'ember-runtime/inject'; -import isEnabled from 'ember-metal/features'; import { registerKeyword, resetKeyword } from 'ember-htmlbars/tests/utils'; import viewKeyword from 'ember-htmlbars/keywords/view'; import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; @@ -106,11 +105,10 @@ QUnit.test('Undashed helpers registered on the container can be invoked', functi equal(jQuery('#wrapper').text(), 'OMG|boo|ya', 'The helper was invoked from the container'); }); -if (!isEnabled('ember-glimmer')) { -// jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; // needs glimmer Helper -QUnit.test('Helpers can receive injections', function() { +test('Helpers can receive injections', function() { setTemplate('application', compile('
{{full-name}}
')); var serviceCalled = false; @@ -130,5 +128,3 @@ QUnit.test('Helpers can receive injections', function() { ok(serviceCalled, 'service was injected, method called'); }); - -} diff --git a/packages/ember/tests/helpers/link_to_test.js b/packages/ember/tests/helpers/link_to_test.js index fe39a67133a..3ac92dc0632 100644 --- a/packages/ember/tests/helpers/link_to_test.js +++ b/packages/ember/tests/helpers/link_to_test.js @@ -78,10 +78,9 @@ function sharedTeardown() { setTemplates({}); } -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('The {{link-to}} helper', { +testModule('The {{link-to}} helper', { setup() { run(function() { sharedSetup(); @@ -107,7 +106,7 @@ QUnit.module('The {{link-to}} helper', { // These two tests are designed to simulate the context of an ember-qunit/ember-test-helpers component integration test, // so the container is available but it does not boot the entire app -QUnit.test('Using {{link-to}} does not cause an exception if it is rendered before the router has started routing', function(assert) { +test('Using {{link-to}} does not cause an exception if it is rendered before the router has started routing', function(assert) { Router.map(function() { this.route('about'); }); @@ -129,7 +128,7 @@ QUnit.test('Using {{link-to}} does not cause an exception if it is rendered befo assert.strictEqual(component.$('a').length, 1, 'the link is rendered'); }); -QUnit.test('Using {{link-to}} does not cause an exception if it is rendered without a router.js instance', function(assert) { +test('Using {{link-to}} does not cause an exception if it is rendered without a router.js instance', function(assert) { appInstance.register('component-lookup:main', ComponentLookup); let component = Component.extend({ @@ -144,7 +143,7 @@ QUnit.test('Using {{link-to}} does not cause an exception if it is rendered with assert.strictEqual(component.$('a').length, 1, 'the link is rendered'); }); -QUnit.test('The {{link-to}} helper moves into the named route', function() { +test('The {{link-to}} helper moves into the named route', function() { Router.map(function(match) { this.route('about'); }); @@ -168,7 +167,7 @@ QUnit.test('The {{link-to}} helper moves into the named route', function() { equal(jQuery('#home-link:not(.active)', '#qunit-fixture').length, 1, 'The other link was rendered without active class'); }); -QUnit.test('The {{link-to}} helper supports URL replacement', function() { +test('The {{link-to}} helper supports URL replacement', function() { setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link' replace=true}}About{{/link-to}}`)); Router.map(function() { @@ -192,7 +191,7 @@ QUnit.test('The {{link-to}} helper supports URL replacement', function() { equal(replaceCount, 1, 'replaceURL should be called once'); }); -QUnit.test('The {{link-to}} helper supports URL replacement via replace=boundTruthyThing', function() { +test('The {{link-to}} helper supports URL replacement via replace=boundTruthyThing', function() { setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link' replace=boundTruthyThing}}About{{/link-to}}`)); App.IndexController = Controller.extend({ @@ -220,7 +219,7 @@ QUnit.test('The {{link-to}} helper supports URL replacement via replace=boundTru equal(replaceCount, 1, 'replaceURL should be called once'); }); -QUnit.test('The {{link-to}} helper supports setting replace=boundFalseyThing', function() { +test('The {{link-to}} helper supports setting replace=boundFalseyThing', function() { setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link' replace=boundFalseyThing}}About{{/link-to}}`)); App.IndexController = Controller.extend({ @@ -248,7 +247,9 @@ QUnit.test('The {{link-to}} helper supports setting replace=boundFalseyThing', f equal(replaceCount, 0, 'replaceURL should not be called'); }); -QUnit.test("the {{link-to}} helper doesn't add an href when the tagName isn't 'a'", function() { +// jscs:disable + +test("the {{link-to}} helper doesn't add an href when the tagName isn't 'a'", function() { setTemplate('index', compile(`{{#link-to 'about' id='about-link' tagName='div'}}About{{/link-to}}`)); Router.map(function() { @@ -265,7 +266,7 @@ QUnit.test("the {{link-to}} helper doesn't add an href when the tagName isn't 'a }); -QUnit.test("the {{link-to}} applies a 'disabled' class when disabled", function () { +test("the {{link-to}} applies a 'disabled' class when disabled", function () { setTemplate('index', compile(` {{#link-to "about" id="about-link-static" disabledWhen="shouldDisable"}}About{{/link-to}} {{#link-to "about" id="about-link-dynamic" disabledWhen=dynamicDisabledWhen}}About{{/link-to}} @@ -296,7 +297,7 @@ QUnit.test("the {{link-to}} applies a 'disabled' class when disabled", function equal(jQuery('#about-link-dynamic.disabled', '#qunit-fixture').length, 0, 'The dynamic link is re-enabled when its disabledWhen becomes false'); }); -QUnit.test("the {{link-to}} doesn't apply a 'disabled' class if disabledWhen is not provided", function () { +test("the {{link-to}} doesn't apply a 'disabled' class if disabledWhen is not provided", function () { setTemplate('index', compile(`{{#link-to "about" id="about-link"}}About{{/link-to}}`)); Router.map(function() { @@ -312,7 +313,7 @@ QUnit.test("the {{link-to}} doesn't apply a 'disabled' class if disabledWhen is ok(!jQuery('#about-link', '#qunit-fixture').hasClass('disabled'), 'The link is not disabled if disabledWhen not provided'); }); -QUnit.test('the {{link-to}} helper supports a custom disabledClass', function () { +test('the {{link-to}} helper supports a custom disabledClass', function () { setTemplate('index', compile('{{#link-to "about" id="about-link" disabledWhen=true disabledClass="do-not-want"}}About{{/link-to}}')); Router.map(function() { @@ -328,7 +329,7 @@ QUnit.test('the {{link-to}} helper supports a custom disabledClass', function () equal(jQuery('#about-link.do-not-want', '#qunit-fixture').length, 1, 'The link can apply a custom disabled class'); }); -QUnit.test('the {{link-to}} helper supports a custom disabledClass set via bound param', function () { +test('the {{link-to}} helper supports a custom disabledClass set via bound param', function () { setTemplate('index', compile('{{#link-to "about" id="about-link" disabledWhen=true disabledClass=disabledClass}}About{{/link-to}}')); Router.map(function() { @@ -348,7 +349,7 @@ QUnit.test('the {{link-to}} helper supports a custom disabledClass set via bound equal(jQuery('#about-link.do-not-want', '#qunit-fixture').length, 1, 'The link can apply a custom disabled class via bound param'); }); -QUnit.test('the {{link-to}} helper does not respond to clicks when disabled', function () { +test('the {{link-to}} helper does not respond to clicks when disabled', function () { setTemplate('index', compile('{{#link-to "about" id="about-link" disabledWhen=true}}About{{/link-to}}')); Router.map(function() { @@ -368,7 +369,7 @@ QUnit.test('the {{link-to}} helper does not respond to clicks when disabled', fu equal(jQuery('h3:contains(About)', '#qunit-fixture').length, 0, 'Transitioning did not occur'); }); -QUnit.test('the {{link-to}} helper responds to clicks according to its disabledWhen bound param', function () { +test('the {{link-to}} helper responds to clicks according to its disabledWhen bound param', function () { setTemplate('index', compile('{{#link-to "about" id="about-link" disabledWhen=disabledWhen}}About{{/link-to}}')); Router.map(function() { @@ -401,7 +402,7 @@ QUnit.test('the {{link-to}} helper responds to clicks according to its disabledW equal(jQuery('h3:contains(About)', '#qunit-fixture').length, 1, 'Transitioning did occur when disabledWhen became false'); }); -QUnit.test('The {{link-to}} helper supports a custom activeClass', function() { +test('The {{link-to}} helper supports a custom activeClass', function() { setTemplate('index', compile("

Home

{{#link-to 'about' id='about-link'}}About{{/link-to}}{{#link-to 'index' id='self-link' activeClass='zomg-active'}}Self{{/link-to}}")); Router.map(function() { @@ -419,7 +420,7 @@ QUnit.test('The {{link-to}} helper supports a custom activeClass', function() { equal(jQuery('#about-link:not(.active)', '#qunit-fixture').length, 1, 'The other link was rendered without active class'); }); -QUnit.test('The {{link-to}} helper supports a custom activeClass from a bound param', function() { +test('The {{link-to}} helper supports a custom activeClass from a bound param', function() { setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link'}}About{{/link-to}}{{#link-to 'index' id='self-link' activeClass=activeClass}}Self{{/link-to}}`)); Router.map(function() { @@ -441,7 +442,7 @@ QUnit.test('The {{link-to}} helper supports a custom activeClass from a bound pa equal(jQuery('#about-link:not(.active)', '#qunit-fixture').length, 1, 'The other link was rendered without active class'); }); -QUnit.test("The {{link-to}} helper supports 'classNameBindings' with custom values [GH #11699]", function() { +test("The {{link-to}} helper supports 'classNameBindings' with custom values [GH #11699]", function() { setTemplate('index', compile(`

Home

{{#link-to 'about' id='about-link' classNameBindings='foo:foo-is-true:foo-is-false'}}About{{/link-to}}`)); Router.map(function() { @@ -468,7 +469,7 @@ QUnit.test("The {{link-to}} helper supports 'classNameBindings' with custom valu equal(jQuery('#about-link.foo-is-true', '#qunit-fixture').length, 1, 'The about-link was rendered with the truthy class after toggling the property'); }); -QUnit.test('The {{link-to}} helper supports leaving off .index for nested routes', function() { +test('The {{link-to}} helper supports leaving off .index for nested routes', function() { Router.map(function() { this.route('about', function() { this.route('item'); @@ -486,7 +487,7 @@ QUnit.test('The {{link-to}} helper supports leaving off .index for nested routes equal(normalizeUrl(jQuery('#item a', '#qunit-fixture').attr('href')), '/about'); }); -QUnit.test('The {{link-to}} helper supports currentWhen (DEPRECATED)', function() { +test('The {{link-to}} helper supports currentWhen (DEPRECATED)', function() { expectDeprecation('Usage of `currentWhen` is deprecated, use `current-when` instead.'); Router.map(function(match) { @@ -509,7 +510,7 @@ QUnit.test('The {{link-to}} helper supports currentWhen (DEPRECATED)', function( equal(jQuery('#other-link.active', '#qunit-fixture').length, 1, 'The link is active since current-when is a parent route'); }); -QUnit.test('The {{link-to}} helper supports custom, nested, current-when', function() { +test('The {{link-to}} helper supports custom, nested, current-when', function() { Router.map(function(match) { this.route('index', { path: '/' }, function() { this.route('about'); @@ -530,7 +531,7 @@ QUnit.test('The {{link-to}} helper supports custom, nested, current-when', funct equal(jQuery('#other-link.active', '#qunit-fixture').length, 1, 'The link is active since current-when is a parent route'); }); -QUnit.test('The {{link-to}} helper does not disregard current-when when it is given explicitly for a route', function() { +test('The {{link-to}} helper does not disregard current-when when it is given explicitly for a route', function() { Router.map(function(match) { this.route('index', { path: '/' }, function() { this.route('about'); @@ -553,7 +554,7 @@ QUnit.test('The {{link-to}} helper does not disregard current-when when it is gi equal(jQuery('#other-link.active', '#qunit-fixture').length, 1, 'The link is active when current-when is given for explicitly for a route'); }); -QUnit.test('The {{link-to}} helper does not disregard current-when when it is set via a bound param', function() { +test('The {{link-to}} helper does not disregard current-when when it is set via a bound param', function() { Router.map(function(match) { this.route('index', { path: '/' }, function() { this.route('about'); @@ -580,7 +581,7 @@ QUnit.test('The {{link-to}} helper does not disregard current-when when it is se equal(jQuery('#other-link.active', '#qunit-fixture').length, 1, 'The link is active when current-when is given for explicitly for a route'); }); -QUnit.test('The {{link-to}} helper supports multiple current-when routes', function() { +test('The {{link-to}} helper supports multiple current-when routes', function() { Router.map(function(match) { this.route('index', { path: '/' }, function() { this.route('about'); @@ -615,7 +616,7 @@ QUnit.test('The {{link-to}} helper supports multiple current-when routes', funct equal(jQuery('#link3.active', '#qunit-fixture').length, 0, 'The link is not active since current-when does not contain the active route'); }); -QUnit.test('The {{link-to}} helper defaults to bubbling', function() { +test('The {{link-to}} helper defaults to bubbling', function() { setTemplate('about', compile("
{{#link-to 'about.contact' id='about-contact'}}About{{/link-to}}
{{outlet}}")); setTemplate('about/contact', compile("

Contact

")); @@ -650,7 +651,7 @@ QUnit.test('The {{link-to}} helper defaults to bubbling', function() { equal(hidden, 1, 'The link bubbles'); }); -QUnit.test('The {{link-to}} helper supports bubbles=false', function() { +test('The {{link-to}} helper supports bubbles=false', function() { setTemplate('about', compile("
{{#link-to 'about.contact' id='about-contact' bubbles=false}}About{{/link-to}}
{{outlet}}")); setTemplate('about/contact', compile("

Contact

")); @@ -685,7 +686,7 @@ QUnit.test('The {{link-to}} helper supports bubbles=false', function() { equal(hidden, 0, "The link didn't bubble"); }); -QUnit.test('The {{link-to}} helper supports bubbles=boundFalseyThing', function() { +test('The {{link-to}} helper supports bubbles=boundFalseyThing', function() { setTemplate('about', compile("
{{#link-to 'about.contact' id='about-contact' bubbles=boundFalseyThing}}About{{/link-to}}
{{outlet}}")); setTemplate('about/contact', compile("

Contact

")); @@ -724,7 +725,7 @@ QUnit.test('The {{link-to}} helper supports bubbles=boundFalseyThing', function( equal(hidden, 0, "The link didn't bubble"); }); -QUnit.test('The {{link-to}} helper moves into the named route with context', function() { +test('The {{link-to}} helper moves into the named route with context', function() { Router.map(function(match) { this.route('about'); this.route('item', { path: '/item/:id' }); @@ -773,7 +774,7 @@ QUnit.test('The {{link-to}} helper moves into the named route with context', fun equal(jQuery('p', '#qunit-fixture').text(), 'Erik Brynroflsson', 'The name is correct'); }); -QUnit.test('The {{link-to}} helper binds some anchor html tag common attributes', function() { +test('The {{link-to}} helper binds some anchor html tag common attributes', function() { setTemplate('index', compile("

Home

{{#link-to 'index' id='self-link' title='title-attr' rel='rel-attr' tabindex='-1'}}Self{{/link-to}}")); bootApplication(); @@ -787,7 +788,7 @@ QUnit.test('The {{link-to}} helper binds some anchor html tag common attributes' equal(link.attr('tabindex'), '-1', 'The self-link contains tabindex attribute'); }); -QUnit.test('The {{link-to}} helper supports `target` attribute', function() { +test('The {{link-to}} helper supports `target` attribute', function() { setTemplate('index', compile("

Home

{{#link-to 'index' id='self-link' target='_blank'}}Self{{/link-to}}")); bootApplication(); @@ -799,7 +800,7 @@ QUnit.test('The {{link-to}} helper supports `target` attribute', function() { equal(link.attr('target'), '_blank', 'The self-link contains `target` attribute'); }); -QUnit.test('The {{link-to}} helper supports `target` attribute specified as a bound param', function() { +test('The {{link-to}} helper supports `target` attribute specified as a bound param', function() { setTemplate('index', compile("

Home

{{#link-to 'index' id='self-link' target=boundLinkTarget}}Self{{/link-to}}")); App.IndexController = Controller.extend({ @@ -816,7 +817,7 @@ QUnit.test('The {{link-to}} helper supports `target` attribute specified as a bo equal(link.attr('target'), '_blank', 'The self-link contains `target` attribute'); }); -QUnit.test('The {{link-to}} helper does not call preventDefault if `target` attribute is provided', function() { +test('The {{link-to}} helper does not call preventDefault if `target` attribute is provided', function() { setTemplate('index', compile("

Home

{{#link-to 'index' id='self-link' target='_blank'}}Self{{/link-to}}")); bootApplication(); @@ -830,7 +831,7 @@ QUnit.test('The {{link-to}} helper does not call preventDefault if `target` attr equal(event.isDefaultPrevented(), false, 'should not preventDefault when target attribute is specified'); }); -QUnit.test('The {{link-to}} helper should preventDefault when `target = _self`', function() { +test('The {{link-to}} helper should preventDefault when `target = _self`', function() { setTemplate('index', compile("

Home

{{#link-to 'index' id='self-link' target='_self'}}Self{{/link-to}}")); bootApplication(); @@ -844,7 +845,7 @@ QUnit.test('The {{link-to}} helper should preventDefault when `target = _self`', equal(event.isDefaultPrevented(), true, 'should preventDefault when target attribute is `_self`'); }); -QUnit.test('The {{link-to}} helper should not transition if target is not equal to _self or empty', function() { +test('The {{link-to}} helper should not transition if target is not equal to _self or empty', function() { setTemplate('index', compile("{{#link-to 'about' id='about-link' replace=true target='_blank'}}About{{/link-to}}")); Router.map(function() { @@ -864,7 +865,7 @@ QUnit.test('The {{link-to}} helper should not transition if target is not equal notEqual(appInstance.lookup('controller:application').get('currentRouteName'), 'about', 'link-to should not transition if target is not equal to _self or empty'); }); -QUnit.test('The {{link-to}} helper accepts string/numeric arguments', function() { +test('The {{link-to}} helper accepts string/numeric arguments', function() { Router.map(function() { this.route('filter', { path: '/filters/:filter' }); this.route('post', { path: '/post/:post_id' }); @@ -891,7 +892,7 @@ QUnit.test('The {{link-to}} helper accepts string/numeric arguments', function() equal(normalizeUrl(jQuery('#repo-object-link', '#qunit-fixture').attr('href')), '/repo/ember/ember.js'); }); -QUnit.test("Issue 4201 - Shorthand for route.index shouldn't throw errors about context arguments", function() { +test("Issue 4201 - Shorthand for route.index shouldn't throw errors about context arguments", function() { expect(2); Router.map(function() { this.route('lobby', function() { @@ -916,7 +917,7 @@ QUnit.test("Issue 4201 - Shorthand for route.index shouldn't throw errors about shouldBeActive('#lobby-link'); }); -QUnit.test('The {{link-to}} helper unwraps controllers', function() { +test('The {{link-to}} helper unwraps controllers', function() { expect(5); var indexObject = { filter: 'popular' }; @@ -968,7 +969,7 @@ QUnit.test('The {{link-to}} helper unwraps controllers', function() { jQuery('#link', '#qunit-fixture').trigger('click'); }); -QUnit.test("The {{link-to}} helper doesn't change view context", function() { +test("The {{link-to}} helper doesn't change view context", function() { App.IndexView = EmberView.extend({ elementId: 'index', name: 'test', @@ -986,7 +987,7 @@ QUnit.test("The {{link-to}} helper doesn't change view context", function() { equal(jQuery('#index', '#qunit-fixture').text(), 'test-Link: test-test', 'accesses correct view'); }); -QUnit.test('Quoteless route param performs property lookup', function() { +test('Quoteless route param performs property lookup', function() { setTemplate('index', compile("{{#link-to 'index' id='string-link'}}string{{/link-to}}{{#link-to foo id='path-link'}}path{{/link-to}}{{#link-to view.foo id='view-link'}}{{view.foo}}{{/link-to}}")); function assertEquality(href) { @@ -1024,7 +1025,7 @@ QUnit.test('Quoteless route param performs property lookup', function() { assertEquality('/about'); }); -QUnit.test('link-to with null/undefined dynamic parameters are put in a loading state', function() { +test('link-to with null/undefined dynamic parameters are put in a loading state', function() { expect(19); var oldWarn = Logger.warn; @@ -1113,7 +1114,7 @@ QUnit.test('link-to with null/undefined dynamic parameters are put in a loading Logger.warn = oldWarn; }); -QUnit.test('The {{link-to}} helper refreshes href element when one of params changes', function() { +test('The {{link-to}} helper refreshes href element when one of params changes', function() { Router.map(function() { this.route('post', { path: '/posts/:post_id' }); }); @@ -1144,7 +1145,7 @@ QUnit.test('The {{link-to}} helper refreshes href element when one of params cha }); -QUnit.test('The {{link-to}} helper is active when a route is active', function() { +test('The {{link-to}} helper is active when a route is active', function() { Router.map(function() { this.route('about', function() { this.route('item'); @@ -1168,7 +1169,7 @@ QUnit.test('The {{link-to}} helper is active when a route is active', function() equal(jQuery('#item-link.active', '#qunit-fixture').length, 1, 'The item route link is active'); }); -QUnit.test("The {{link-to}} helper works in an #each'd array of string route names", function() { +test("The {{link-to}} helper works in an #each'd array of string route names", function() { Router.map(function() { this.route('foo'); this.route('bar'); @@ -1208,7 +1209,7 @@ QUnit.test("The {{link-to}} helper works in an #each'd array of string route nam linksEqual(jQuery('a', '#qunit-fixture'), ['/bar', '/rar', '/bar', '/rar', '/rar', '/foo']); }); -QUnit.test('The non-block form {{link-to}} helper moves into the named route', function() { +test('The non-block form {{link-to}} helper moves into the named route', function() { expect(3); Router.map(function(match) { this.route('contact'); @@ -1228,7 +1229,7 @@ QUnit.test('The non-block form {{link-to}} helper moves into the named route', f equal(jQuery('#home-link:not(.active)', '#qunit-fixture').length, 1, 'The other link was rendered without active class'); }); -QUnit.test('The non-block form {{link-to}} helper updates the link text when it is a binding', function() { +test('The non-block form {{link-to}} helper updates the link text when it is a binding', function() { expect(8); Router.map(function(match) { this.route('contact'); @@ -1276,7 +1277,7 @@ QUnit.test('The non-block form {{link-to}} helper updates the link text when it equal(jQuery('#contact-link:contains(Robert)', '#qunit-fixture').length, 1, 'The link title is correctly updated when the route changes'); }); -QUnit.test('The non-block form {{link-to}} helper moves into the named route with context', function() { +test('The non-block form {{link-to}} helper moves into the named route with context', function() { expect(5); Router.map(function(match) { @@ -1312,7 +1313,7 @@ QUnit.test('The non-block form {{link-to}} helper moves into the named route wit equal(normalizeUrl(jQuery('li a:contains(Erik)').attr('href')), '/item/erik'); }); -QUnit.test('The non-block form {{link-to}} performs property lookup', function() { +test('The non-block form {{link-to}} performs property lookup', function() { setTemplate('index', compile("{{link-to 'string' 'index' id='string-link'}}{{link-to path foo id='path-link'}}{{link-to view.foo view.foo id='view-link'}}")); function assertEquality(href) { @@ -1350,7 +1351,7 @@ QUnit.test('The non-block form {{link-to}} performs property lookup', function() assertEquality('/about'); }); -QUnit.test('The non-block form {{link-to}} protects against XSS', function() { +test('The non-block form {{link-to}} protects against XSS', function() { setTemplate('application', compile("{{link-to display 'index' id='link'}}")); App.ApplicationController = Controller.extend({ @@ -1372,7 +1373,7 @@ QUnit.test('The non-block form {{link-to}} protects against XSS', function() { equal(jQuery('b', '#qunit-fixture').length, 0); }); -QUnit.test('the {{link-to}} helper calls preventDefault', function() { +test('the {{link-to}} helper calls preventDefault', function() { Router.map(function() { this.route('about'); }); @@ -1387,7 +1388,7 @@ QUnit.test('the {{link-to}} helper calls preventDefault', function() { equal(event.isDefaultPrevented(), true, 'should preventDefault'); }); -QUnit.test('the {{link-to}} helper does not call preventDefault if `preventDefault=false` is passed as an option', function() { +test('the {{link-to}} helper does not call preventDefault if `preventDefault=false` is passed as an option', function() { setTemplate('index', compile("{{#link-to 'about' id='about-link' preventDefault=false}}About{{/link-to}}")); Router.map(function() { @@ -1404,7 +1405,7 @@ QUnit.test('the {{link-to}} helper does not call preventDefault if `preventDefau equal(event.isDefaultPrevented(), false, 'should not preventDefault'); }); -QUnit.test('the {{link-to}} helper does not call preventDefault if `preventDefault=boundFalseyThing` is passed as an option', function() { +test('the {{link-to}} helper does not call preventDefault if `preventDefault=boundFalseyThing` is passed as an option', function() { setTemplate('index', compile("{{#link-to 'about' id='about-link' preventDefault=boundFalseyThing}}About{{/link-to}}")); App.IndexController = Controller.extend({ @@ -1425,7 +1426,7 @@ QUnit.test('the {{link-to}} helper does not call preventDefault if `preventDefau equal(event.isDefaultPrevented(), false, 'should not preventDefault'); }); -QUnit.test('the {{link-to}} helper does not throw an error if its route has exited', function() { +test('the {{link-to}} helper does not throw an error if its route has exited', function() { expect(0); setTemplate('application', compile("{{#link-to 'index' id='home-link'}}Home{{/link-to}}{{#link-to 'post' defaultPost id='default-post-link'}}Default Post{{/link-to}}{{#if currentPost}}{{#link-to 'post' id='post-link'}}Post{{/link-to}}{{/if}}")); @@ -1456,7 +1457,7 @@ QUnit.test('the {{link-to}} helper does not throw an error if its route has exit }); }); -QUnit.test('{{link-to}} active property respects changing parent route context', function() { +test('{{link-to}} active property respects changing parent route context', function() { setTemplate('application', compile( "{{link-to 'OMG' 'things' 'omg' id='omg-link'}} " + "{{link-to 'LOL' 'things' 'lol' id='lol-link'}} ")); @@ -1480,7 +1481,7 @@ QUnit.test('{{link-to}} active property respects changing parent route context', }); -QUnit.test('{{link-to}} populates href with default query param values even without query-params object', function() { +test('{{link-to}} populates href with default query param values even without query-params object', function() { if (isEnabled('ember-routing-route-configured-query-params')) { App.IndexRoute = Route.extend({ queryParams: { @@ -1501,7 +1502,7 @@ QUnit.test('{{link-to}} populates href with default query param values even with equal(jQuery('#the-link').attr('href'), '/', 'link has right href'); }); -QUnit.test('{{link-to}} populates href with default query param values with empty query-params object', function() { +test('{{link-to}} populates href with default query param values with empty query-params object', function() { if (isEnabled('ember-routing-route-configured-query-params')) { App.IndexRoute = Route.extend({ queryParams: { @@ -1522,7 +1523,7 @@ QUnit.test('{{link-to}} populates href with default query param values with empt equal(jQuery('#the-link').attr('href'), '/', 'link has right href'); }); -QUnit.test('{{link-to}} populates href with supplied query param values', function() { +test('{{link-to}} populates href with supplied query param values', function() { if (isEnabled('ember-routing-route-configured-query-params')) { App.IndexRoute = Route.extend({ queryParams: { @@ -1543,7 +1544,7 @@ QUnit.test('{{link-to}} populates href with supplied query param values', functi equal(jQuery('#the-link').attr('href'), '/?foo=456', 'link has right href'); }); -QUnit.test('{{link-to}} populates href with partially supplied query param values', function() { +test('{{link-to}} populates href with partially supplied query param values', function() { if (isEnabled('ember-routing-route-configured-query-params')) { App.IndexRoute = Route.extend({ queryParams: { @@ -1568,7 +1569,7 @@ QUnit.test('{{link-to}} populates href with partially supplied query param value equal(jQuery('#the-link').attr('href'), '/?foo=456', 'link has right href'); }); -QUnit.test('{{link-to}} populates href with partially supplied query param values, but omits if value is default value', function() { +test('{{link-to}} populates href with partially supplied query param values, but omits if value is default value', function() { if (isEnabled('ember-routing-route-configured-query-params')) { App.IndexRoute = Route.extend({ queryParams: { @@ -1589,7 +1590,7 @@ QUnit.test('{{link-to}} populates href with partially supplied query param value equal(jQuery('#the-link').attr('href'), '/', 'link has right href'); }); -QUnit.test('{{link-to}} populates href with fully supplied query param values', function() { +test('{{link-to}} populates href with fully supplied query param values', function() { if (isEnabled('ember-routing-route-configured-query-params')) { App.IndexRoute = Route.extend({ queryParams: { @@ -1614,7 +1615,7 @@ QUnit.test('{{link-to}} populates href with fully supplied query param values', equal(jQuery('#the-link').attr('href'), '/?bar=NAW&foo=456', 'link has right href'); }); -QUnit.test('{{link-to}} with only query-params and a block updates when route changes', function() { +test('{{link-to}} with only query-params and a block updates when route changes', function() { Router.map(function() { this.route('about'); }); @@ -1648,7 +1649,7 @@ QUnit.test('{{link-to}} with only query-params and a block updates when route ch equal(jQuery('#the-link').attr('href'), '/about?bar=NAW&foo=456', 'link has right href'); }); -QUnit.test('Block-less {{link-to}} with only query-params updates when route changes', function() { +test('Block-less {{link-to}} with only query-params updates when route changes', function() { Router.map(function() { this.route('about'); }); @@ -1682,7 +1683,7 @@ QUnit.test('Block-less {{link-to}} with only query-params updates when route cha equal(jQuery('#the-link').attr('href'), '/about?bar=NAW&foo=456', 'link has right href'); }); -QUnit.test('The {{link-to}} helper can use dynamic params', function() { +test('The {{link-to}} helper can use dynamic params', function() { Router.map(function(match) { this.route('foo', { path: 'foo/:some/:thing' }); this.route('bar', { path: 'bar/:some/:thing/:else' }); @@ -1731,7 +1732,7 @@ QUnit.test('The {{link-to}} helper can use dynamic params', function() { equal(link.attr('href'), '/bar/one/two/three'); }); -QUnit.test('GJ: {{link-to}} to a parent root model hook which performs a `transitionTo` has correct active class #13256', function() { +test('GJ: {{link-to}} to a parent root model hook which performs a `transitionTo` has correct active class #13256', function() { expect(1); Router.map(function() { @@ -1757,4 +1758,3 @@ QUnit.test('GJ: {{link-to}} to a parent root model hook which performs a `transi shouldBeActive('#parent-link'); }); -} diff --git a/packages/ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js b/packages/ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js index fab5a69f282..6c7bb56a7e5 100644 --- a/packages/ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js +++ b/packages/ember/tests/helpers/link_to_test/link_to_transitioning_classes_test.js @@ -6,7 +6,6 @@ import { compile } from 'ember-template-compiler'; import Application from 'ember-application/system/application'; import jQuery from 'ember-views/system/jquery'; import NoneLocation from 'ember-routing/location/none_location'; -import isEnabled from 'ember-metal/features'; import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; var Router, App, router, registry, container; @@ -63,9 +62,9 @@ function sharedTeardown() { setTemplates({}); } -if (!isEnabled('ember-glimmer')) { - // jscs:disable -QUnit.module('The {{link-to}} helper: .transitioning-in .transitioning-out CSS classes', { +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; + +testModule('The {{link-to}} helper: .transitioning-in .transitioning-out CSS classes', { setup() { run(function() { sharedSetup(); @@ -102,7 +101,7 @@ QUnit.module('The {{link-to}} helper: .transitioning-in .transitioning-out CSS c } }); -QUnit.test('while a transition is underway', function() { +test('while a transition is underway', function() { expect(18); bootApplication(); @@ -123,7 +122,7 @@ QUnit.test('while a transition is underway', function() { assertHasClass('ember-transitioning-out', $index, false, $about, false, $other, false); }); -QUnit.test('while a transition is underway with nested link-to\'s', function() { +test('while a transition is underway with nested link-to\'s', function() { expect(54); Router.map(function() { @@ -202,5 +201,3 @@ QUnit.test('while a transition is underway with nested link-to\'s', function() { assertHasClass('ember-transitioning-in', $index, false, $about, false, $other, false); assertHasClass('ember-transitioning-out', $index, false, $about, false, $other, false); }); - -} diff --git a/packages/ember/tests/helpers/link_to_test/link_to_with_query_params_test.js b/packages/ember/tests/helpers/link_to_test/link_to_with_query_params_test.js index 32d45b73277..a116330adce 100644 --- a/packages/ember/tests/helpers/link_to_test/link_to_with_query_params_test.js +++ b/packages/ember/tests/helpers/link_to_test/link_to_with_query_params_test.js @@ -65,11 +65,10 @@ function sharedTeardown() { setTemplates({}); } -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; if (isEnabled('ember-routing-route-configured-query-params')) { - QUnit.module('The {{link-to}} helper: invoking with query params when defined on a route', { + testModule('The {{link-to}} helper: invoking with query params when defined on a route', { setup() { run(function() { sharedSetup(); @@ -110,7 +109,9 @@ if (isEnabled('ember-routing-route-configured-query-params')) { teardown: sharedTeardown }); - QUnit.test("doesn't update controller QP properties on current route when invoked", function() { + // jscs:disable + + test("doesn't update controller QP properties on current route when invoked", function() { setTemplate('index', compile("{{#link-to 'index' id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -119,7 +120,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar'), { foo: '123', bar: 'abc' }, 'controller QP properties not'); }); - QUnit.test("doesn't update controller QP properties on current route when invoked (empty query-params obj)", function() { + test("doesn't update controller QP properties on current route when invoked (empty query-params obj)", function() { setTemplate('index', compile("{{#link-to 'index' (query-params) id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -128,14 +129,14 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar'), { foo: '123', bar: 'abc' }, 'controller QP properties not'); }); - QUnit.test('link-to with no params throws', function() { + test('link-to with no params throws', function() { setTemplate('index', compile("{{#link-to id='the-link'}}Index{{/link-to}}")); expectAssertion(function() { bootApplication(); }, /one or more/); }); - QUnit.test("doesn't update controller QP properties on current route when invoked (empty query-params obj, inferred route)", function() { + test("doesn't update controller QP properties on current route when invoked (empty query-params obj, inferred route)", function() { setTemplate('index', compile("{{#link-to (query-params) id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -144,7 +145,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar'), { foo: '123', bar: 'abc' }, 'controller QP properties not'); }); - QUnit.test('updates controller QP properties on current route when invoked', function() { + test('updates controller QP properties on current route when invoked', function() { setTemplate('index', compile("{{#link-to 'index' (query-params foo='456') id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -153,7 +154,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar'), { foo: '456', bar: 'abc' }, 'controller QP properties updated'); }); - QUnit.test('updates controller QP properties on current route when invoked (inferred route)', function() { + test('updates controller QP properties on current route when invoked (inferred route)', function() { setTemplate('index', compile("{{#link-to (query-params foo='456') id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -162,7 +163,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar'), { foo: '456', bar: 'abc' }, 'controller QP properties updated'); }); - QUnit.test('updates controller QP properties on other route after transitioning to that route', function() { + test('updates controller QP properties on other route after transitioning to that route', function() { Router.map(function() { this.route('about'); }); @@ -178,7 +179,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(container.lookup('controller:application').get('currentPath'), 'about'); }); - QUnit.test('supplied QP properties can be bound', function() { + test('supplied QP properties can be bound', function() { setTemplate('index', compile("{{#link-to (query-params foo=boundThing) id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -190,7 +191,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(jQuery('#the-link').attr('href'), '/?foo=ASL'); }); - QUnit.test('supplied QP properties can be bound (booleans)', function() { + test('supplied QP properties can be bound (booleans)', function() { var indexController = container.lookup('controller:index'); setTemplate('index', compile("{{#link-to (query-params abool=boundThing) id='the-link'}}Index{{/link-to}}")); @@ -205,7 +206,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar', 'abool'), { foo: '123', bar: 'abc', abool: false }); }); - QUnit.test('href updates when unsupplied controller QP props change', function() { + test('href updates when unsupplied controller QP props change', function() { setTemplate('index', compile("{{#link-to (query-params foo='lol') id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -219,7 +220,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(jQuery('#the-link').attr('href'), '/?bar=BORF&foo=lol'); }); - QUnit.test('The {{link-to}} with only query params always transitions to the current route with the query params applied', function() { + test('The {{link-to}} with only query params always transitions to the current route with the query params applied', function() { // Test harness for bug #12033 setTemplate('cars', compile( @@ -269,7 +270,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { }); }); - QUnit.test('The {{link-to}} applies activeClass when query params are not changed', function() { + test('The {{link-to}} applies activeClass when query params are not changed', function() { setTemplate('index', compile( "{{#link-to (query-params foo='cat') id='cat-link'}}Index{{/link-to}} " + "{{#link-to (query-params foo='dog') id='dog-link'}}Index{{/link-to}} " + @@ -369,7 +370,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { shouldNotBeActive('#change-search-same-sort-child-and-parent'); }); - QUnit.test('The {{link-to}} applies active class when query-param is number', function() { + test('The {{link-to}} applies active class when query-param is number', function() { setTemplate('index', compile( "{{#link-to (query-params page=pageNumber) id='page-link'}}Index{{/link-to}} ")); @@ -392,7 +393,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { shouldBeActive('#page-link'); }); - QUnit.test('The {{link-to}} applies active class when query-param is array', function() { + test('The {{link-to}} applies active class when query-param is array', function() { setTemplate('index', compile( "{{#link-to (query-params pages=pagesArray) id='array-link'}}Index{{/link-to}} " + "{{#link-to (query-params pages=biggerArray) id='bigger-link'}}Index{{/link-to}} " + @@ -431,7 +432,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { shouldNotBeActive('#empty-link'); }); - QUnit.test('The {{link-to}} helper applies active class to parent route', function() { + test('The {{link-to}} helper applies active class to parent route', function() { App.Router.map(function() { this.route('parent', function() { this.route('child'); @@ -462,7 +463,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { shouldNotBeActive('#parent-link-qp'); }); - QUnit.test('The {{link-to}} helper disregards query-params in activeness computation when current-when specified', function() { + test('The {{link-to}} helper disregards query-params in activeness computation when current-when specified', function() { App.Router.map(function() { this.route('parent'); }); @@ -501,7 +502,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/parent'); }); } else { - QUnit.module('The {{link-to}} helper: invoking with query params', { + testModule('The {{link-to}} helper: invoking with query params', { setup() { run(function() { sharedSetup(); @@ -529,7 +530,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { teardown: sharedTeardown }); - QUnit.test("doesn't update controller QP properties on current route when invoked", function() { + test("doesn't update controller QP properties on current route when invoked", function() { setTemplate('index', compile("{{#link-to 'index' id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -538,7 +539,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar'), { foo: '123', bar: 'abc' }, 'controller QP properties not'); }); - QUnit.test("doesn't update controller QP properties on current route when invoked (empty query-params obj)", function() { + test("doesn't update controller QP properties on current route when invoked (empty query-params obj)", function() { setTemplate('index', compile("{{#link-to 'index' (query-params) id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -547,14 +548,14 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar'), { foo: '123', bar: 'abc' }, 'controller QP properties not'); }); - QUnit.test('link-to with no params throws', function() { + test('link-to with no params throws', function() { setTemplate('index', compile("{{#link-to id='the-link'}}Index{{/link-to}}")); expectAssertion(function() { bootApplication(); }, /one or more/); }); - QUnit.test("doesn't update controller QP properties on current route when invoked (empty query-params obj, inferred route)", function() { + test("doesn't update controller QP properties on current route when invoked (empty query-params obj, inferred route)", function() { setTemplate('index', compile("{{#link-to (query-params) id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -563,7 +564,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar'), { foo: '123', bar: 'abc' }, 'controller QP properties not'); }); - QUnit.test('updates controller QP properties on current route when invoked', function() { + test('updates controller QP properties on current route when invoked', function() { setTemplate('index', compile("{{#link-to 'index' (query-params foo='456') id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -572,7 +573,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar'), { foo: '456', bar: 'abc' }, 'controller QP properties updated'); }); - QUnit.test('updates controller QP properties on current route when invoked (inferred route)', function() { + test('updates controller QP properties on current route when invoked (inferred route)', function() { setTemplate('index', compile("{{#link-to (query-params foo='456') id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -581,7 +582,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar'), { foo: '456', bar: 'abc' }, 'controller QP properties updated'); }); - QUnit.test('updates controller QP properties on other route after transitioning to that route', function() { + test('updates controller QP properties on other route after transitioning to that route', function() { Router.map(function() { this.route('about'); }); @@ -597,7 +598,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(container.lookup('controller:application').get('currentPath'), 'about'); }); - QUnit.test('supplied QP properties can be bound', function() { + test('supplied QP properties can be bound', function() { var indexController = container.lookup('controller:index'); setTemplate('index', compile("{{#link-to (query-params foo=boundThing) id='the-link'}}Index{{/link-to}}")); @@ -608,7 +609,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(jQuery('#the-link').attr('href'), '/?foo=ASL'); }); - QUnit.test('supplied QP properties can be bound (booleans)', function() { + test('supplied QP properties can be bound (booleans)', function() { var indexController = container.lookup('controller:index'); setTemplate('index', compile("{{#link-to (query-params abool=boundThing) id='the-link'}}Index{{/link-to}}")); @@ -623,7 +624,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(indexController.getProperties('foo', 'bar', 'abool'), { foo: '123', bar: 'abc', abool: false }); }); - QUnit.test('href updates when unsupplied controller QP props change', function() { + test('href updates when unsupplied controller QP props change', function() { setTemplate('index', compile("{{#link-to (query-params foo='lol') id='the-link'}}Index{{/link-to}}")); bootApplication(); @@ -636,7 +637,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(jQuery('#the-link').attr('href'), '/?bar=BORF&foo=lol'); }); - QUnit.test('The {{link-to}} with only query params always transitions to the current route with the query params applied', function() { + test('The {{link-to}} with only query params always transitions to the current route with the query params applied', function() { // Test harness for bug #12033 setTemplate('cars', compile( @@ -687,7 +688,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { }); }); - QUnit.test('The {{link-to}} applies activeClass when query params are not changed', function() { + test('The {{link-to}} applies activeClass when query params are not changed', function() { setTemplate('index', compile( "{{#link-to (query-params foo='cat') id='cat-link'}}Index{{/link-to}} " + "{{#link-to (query-params foo='dog') id='dog-link'}}Index{{/link-to}} " + @@ -777,7 +778,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { shouldNotBeActive('#change-search-same-sort-child-and-parent'); }); - QUnit.test('The {{link-to}} applies active class when query-param is number', function() { + test('The {{link-to}} applies active class when query-param is number', function() { setTemplate('index', compile( "{{#link-to (query-params page=pageNumber) id='page-link'}}Index{{/link-to}} ")); @@ -794,7 +795,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { shouldBeActive('#page-link'); }); - QUnit.test('The {{link-to}} applies active class when query-param is array', function() { + test('The {{link-to}} applies active class when query-param is array', function() { setTemplate('index', compile( "{{#link-to (query-params pages=pagesArray) id='array-link'}}Index{{/link-to}} " + "{{#link-to (query-params pages=biggerArray) id='bigger-link'}}Index{{/link-to}} " + @@ -826,7 +827,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { shouldNotBeActive('#empty-link'); }); - QUnit.test('The {{link-to}} helper applies active class to parent route', function() { + test('The {{link-to}} helper applies active class to parent route', function() { App.Router.map(function() { this.route('parent', function() { this.route('child'); @@ -854,7 +855,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { shouldNotBeActive('#parent-link-qp'); }); - QUnit.test('The {{link-to}} helper disregards query-params in activeness computation when current-when specified', function() { + test('The {{link-to}} helper disregards query-params in activeness computation when current-when specified', function() { App.Router.map(function() { this.route('parent'); }); @@ -891,4 +892,3 @@ if (isEnabled('ember-routing-route-configured-query-params')) { }); } -} diff --git a/packages/ember/tests/integration/multiple-app-test.js b/packages/ember/tests/integration/multiple-app-test.js index 1deea2e5974..f2fd4890cfa 100644 --- a/packages/ember/tests/integration/multiple-app-test.js +++ b/packages/ember/tests/integration/multiple-app-test.js @@ -56,11 +56,9 @@ QUnit.module('View Integration', { } }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('booting multiple applications can properly handle events', function(assert) { +test('booting multiple applications can properly handle events', function(assert) { run(App1, 'advanceReadiness'); run(App2, 'advanceReadiness'); @@ -72,5 +70,3 @@ QUnit.test('booting multiple applications can properly handle events', function( assert.deepEqual(actions, ['#app-2', '#app-1']); }); - -} diff --git a/packages/ember/tests/integration/view_test.js b/packages/ember/tests/integration/view_test.js index b28b0cca0d1..bb9de875185 100644 --- a/packages/ember/tests/integration/view_test.js +++ b/packages/ember/tests/integration/view_test.js @@ -25,11 +25,9 @@ function handleURL(path) { return run(router, 'handleURL', path); } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('View Integration', { +testModule('View Integration', { setup() { originalViewKeyword = registerKeyword('view', viewKeyword); run(function() { @@ -56,7 +54,7 @@ QUnit.module('View Integration', { } }); -QUnit.test('invoking `{{view}} from a non-view backed (aka only template) template provides the correct controller to the view instance`', function(assert) { +test('invoking `{{view}} from a non-view backed (aka only template) template provides the correct controller to the view instance`', function(assert) { var controllerInMyFoo, indexController; setTemplate('index', compile('{{view "my-foo"}}', { moduleName: 'my-foo' })); @@ -82,5 +80,3 @@ QUnit.test('invoking `{{view}} from a non-view backed (aka only template) templa assert.strictEqual(controllerInMyFoo, indexController, 'controller is provided to `{{view}}`'); }); - -} diff --git a/packages/ember/tests/routing/basic_test.js b/packages/ember/tests/routing/basic_test.js index a756240b2fb..1b214267623 100644 --- a/packages/ember/tests/routing/basic_test.js +++ b/packages/ember/tests/routing/basic_test.js @@ -65,10 +65,9 @@ function handleURLRejectsWith(path, expectedReason) { }); } -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule, asyncTest } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('Basic Routing', { +testModule('Basic Routing', { setup() { run(function() { App = Application.create({ @@ -110,7 +109,7 @@ QUnit.module('Basic Routing', { } }); -QUnit.test('warn on URLs not included in the route set', function () { +test('warn on URLs not included in the route set', function () { Router.map(function() { this.route('home', { path: '/' }); }); @@ -125,7 +124,7 @@ QUnit.test('warn on URLs not included in the route set', function () { }, 'The URL \'/what-is-this-i-dont-even\' did not match any routes in your application'); }); -QUnit.test('The Homepage', function() { +test('The Homepage', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -147,7 +146,7 @@ QUnit.test('The Homepage', function() { equal(jQuery('h3:contains(Hours)', '#qunit-fixture').length, 1, 'The home template was rendered'); }); -QUnit.test('The Home page and the Camelot page with multiple Router.map calls', function() { +test('The Home page and the Camelot page with multiple Router.map calls', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -189,7 +188,7 @@ QUnit.test('The Home page and the Camelot page with multiple Router.map calls', equal(jQuery('h3:contains(Hours)', '#qunit-fixture').length, 1, 'The home template was rendered'); }); -QUnit.test('The Homepage with explicit template name in renderTemplate', function() { +test('The Homepage with explicit template name in renderTemplate', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -205,7 +204,7 @@ QUnit.test('The Homepage with explicit template name in renderTemplate', functio equal(jQuery('h3:contains(Megatroll)', '#qunit-fixture').length, 1, 'The homepage template was rendered'); }); -QUnit.test('An alternate template will pull in an alternate controller', function() { +test('An alternate template will pull in an alternate controller', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -227,7 +226,7 @@ QUnit.test('An alternate template will pull in an alternate controller', functio equal(jQuery('h3:contains(Megatroll) + p:contains(Comes from homepage)', '#qunit-fixture').length, 1, 'The homepage template was rendered'); }); -QUnit.test('An alternate template will pull in an alternate controller instead of controllerName', function() { +test('An alternate template will pull in an alternate controller instead of controllerName', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -256,7 +255,7 @@ QUnit.test('An alternate template will pull in an alternate controller instead o equal(jQuery('h3:contains(Megatroll) + p:contains(Comes from homepage)', '#qunit-fixture').length, 1, 'The homepage template was rendered'); }); -QUnit.test('The template will pull in an alternate controller via key/value', function() { +test('The template will pull in an alternate controller via key/value', function() { Router.map(function() { this.route('homepage', { path: '/' }); }); @@ -278,7 +277,7 @@ QUnit.test('The template will pull in an alternate controller via key/value', fu equal(jQuery('h3:contains(Megatroll) + p:contains(Comes from home.)', '#qunit-fixture').length, 1, 'The homepage template was rendered from data from the HomeController'); }); -QUnit.test('The Homepage with explicit template name in renderTemplate and controller', function() { +test('The Homepage with explicit template name in renderTemplate and controller', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -300,7 +299,7 @@ QUnit.test('The Homepage with explicit template name in renderTemplate and contr equal(jQuery('h3:contains(Megatroll) + p:contains(YES I AM HOME)', '#qunit-fixture').length, 1, 'The homepage template was rendered'); }); -QUnit.test('Model passed via renderTemplate model is set as controller\'s model', function() { +test('Model passed via renderTemplate model is set as controller\'s model', function() { setTemplate('bio', compile('

{{model.name}}

')); App.BioController = Controller.extend(); @@ -323,7 +322,7 @@ QUnit.test('Model passed via renderTemplate model is set as controller\'s model' }); if (isEnabled('ember-routing-routable-components')) { - QUnit.test('Renders the GlimmerComponent for the route', function() { + test('Renders the GlimmerComponent for the route', function() { setTemplate('home', null); setTemplate('components/home', compile('

{{name}}

')); @@ -343,7 +342,7 @@ if (isEnabled('ember-routing-routable-components')) { equal(jQuery('p:contains(Home)', '#qunit-fixture').length, 1, 'The home component was rendered'); }); - QUnit.test('Must be a GlimmerComponent to prevent component naming collisions', function() { + test('Must be a GlimmerComponent to prevent component naming collisions', function() { setTemplate('home', null); setTemplate('components/home', compile('

{{name}}

')); @@ -363,7 +362,7 @@ if (isEnabled('ember-routing-routable-components')) { equal(jQuery('p:contains(Home)', '#qunit-fixture').length, 0, 'The home component was not rendered'); }); - QUnit.test('Favors existing templates/views over the component for the route', function() { + test('Favors existing templates/views over the component for the route', function() { setTemplate('home', compile('PASS')); setTemplate('components/home', compile('FAIL')); @@ -382,7 +381,7 @@ if (isEnabled('ember-routing-routable-components')) { equal(jQuery('#qunit-fixture').text(), 'PASS', 'The home view was rendered instead of the component'); }); - QUnit.test('Renders the component given in the component option', function() { + test('Renders the component given in the component option', function() { setTemplate('home', null); setTemplate('components/home', compile('

{{name}}

')); @@ -406,7 +405,7 @@ if (isEnabled('ember-routing-routable-components')) { equal(jQuery('p:contains(Home)', '#qunit-fixture').length, 1, 'The home component was rendered'); }); - QUnit.test('Routable components get passed model in their attrs', function() { + test('Routable components get passed model in their attrs', function() { setTemplate('home', null); setTemplate('components/home', compile('

{{attrs.model.name}}

')); @@ -432,7 +431,7 @@ if (isEnabled('ember-routing-routable-components')) { }); } -QUnit.test('Renders correct view with slash notation', function() { +test('Renders correct view with slash notation', function() { setTemplate('home/page', compile('

{{view.name}}

')); Router.map(function() { @@ -454,7 +453,7 @@ QUnit.test('Renders correct view with slash notation', function() { equal(jQuery('p:contains(Home/Page)', '#qunit-fixture').length, 1, 'The homepage template was rendered'); }); -QUnit.test('Renders the view given in the view option', function() { +test('Renders the view given in the view option', function() { setTemplate('home', compile('

{{view.name}}

')); Router.map(function() { @@ -476,7 +475,7 @@ QUnit.test('Renders the view given in the view option', function() { equal(jQuery('p:contains(Home/Page)', '#qunit-fixture').length, 1, 'The homepage view was rendered'); }); -QUnit.test('render does not replace templateName if user provided', function() { +test('render does not replace templateName if user provided', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -496,7 +495,7 @@ QUnit.test('render does not replace templateName if user provided', function() { equal(jQuery('p', '#qunit-fixture').text(), 'THIS IS THE REAL HOME', 'The homepage template was rendered'); }); -QUnit.test('render does not replace template if user provided', function () { +test('render does not replace template if user provided', function () { Router.map(function () { this.route('home', { path: '/' }); }); @@ -516,7 +515,7 @@ QUnit.test('render does not replace template if user provided', function () { equal(jQuery('p', '#qunit-fixture').text(), 'THIS IS THE REAL HOME', 'The homepage template was rendered'); }); -QUnit.test('render uses templateName from route', function() { +test('render uses templateName from route', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -535,7 +534,7 @@ QUnit.test('render uses templateName from route', function() { equal(jQuery('p', '#qunit-fixture').text(), 'THIS IS THE REAL HOME', 'The homepage template was rendered'); }); -QUnit.test('defining templateName allows other templates to be rendered', function() { +test('defining templateName allows other templates to be rendered', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -571,7 +570,7 @@ QUnit.test('defining templateName allows other templates to be rendered', functi equal(jQuery('.alert-box', '#qunit-fixture').text(), 'Invader!', 'Template for alert was render into outlet'); }); -QUnit.test('Specifying a name to render should have precedence over everything else', function() { +test('Specifying a name to render should have precedence over everything else', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -610,7 +609,7 @@ QUnit.test('Specifying a name to render should have precedence over everything e equal(jQuery('span', '#qunit-fixture').text(), 'Outertroll', 'The homepage view was used'); }); -QUnit.test('The Homepage with a `setupController` hook', function() { +test('The Homepage with a `setupController` hook', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -634,7 +633,7 @@ QUnit.test('The Homepage with a `setupController` hook', function() { equal(jQuery('ul li', '#qunit-fixture').eq(2).text(), 'Sunday: Noon to 6pm', 'The template was rendered with the hours context'); }); -QUnit.test('The route controller is still set when overriding the setupController hook', function() { +test('The route controller is still set when overriding the setupController hook', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -653,7 +652,7 @@ QUnit.test('The route controller is still set when overriding the setupControlle deepEqual(container.lookup('route:home').controller, container.lookup('controller:home'), 'route controller is the home controller'); }); -QUnit.test('The route controller can be specified via controllerName', function() { +test('The route controller can be specified via controllerName', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -676,7 +675,7 @@ QUnit.test('The route controller can be specified via controllerName', function( equal(jQuery('p', '#qunit-fixture').text(), 'foo', 'The homepage template was rendered with data from the custom controller'); }); -QUnit.test('The route controller specified via controllerName is used in render', function() { +test('The route controller specified via controllerName is used in render', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -702,7 +701,7 @@ QUnit.test('The route controller specified via controllerName is used in render' equal(jQuery('p', '#qunit-fixture').text(), 'alternative home: foo', 'The homepage template was rendered with data from the custom controller'); }); -QUnit.test('The route controller specified via controllerName is used in render even when a controller with the routeName is available', function() { +test('The route controller specified via controllerName is used in render even when a controller with the routeName is available', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -729,7 +728,7 @@ QUnit.test('The route controller specified via controllerName is used in render equal(jQuery('p', '#qunit-fixture').text(), 'home: myController', 'The homepage template was rendered with data from the custom controller'); }); -QUnit.test('The Homepage with a `setupController` hook modifying other controllers', function() { +test('The Homepage with a `setupController` hook modifying other controllers', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -753,7 +752,7 @@ QUnit.test('The Homepage with a `setupController` hook modifying other controlle equal(jQuery('ul li', '#qunit-fixture').eq(2).text(), 'Sunday: Noon to 6pm', 'The template was rendered with the hours context'); }); -QUnit.test('The Homepage with a computed context that does not get overridden', function() { +test('The Homepage with a computed context that does not get overridden', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -777,7 +776,7 @@ QUnit.test('The Homepage with a computed context that does not get overridden', equal(jQuery('ul li', '#qunit-fixture').eq(2).text(), 'Sunday: Noon to 6pm', 'The template was rendered with the context intact'); }); -QUnit.test('The Homepage getting its controller context via model', function() { +test('The Homepage getting its controller context via model', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -807,7 +806,7 @@ QUnit.test('The Homepage getting its controller context via model', function() { equal(jQuery('ul li', '#qunit-fixture').eq(2).text(), 'Sunday: Noon to 6pm', 'The template was rendered with the hours context'); }); -QUnit.test('The Specials Page getting its controller context by deserializing the params hash', function() { +test('The Specials Page getting its controller context by deserializing the params hash', function() { Router.map(function() { this.route('home', { path: '/' }); this.route('special', { path: '/specials/:menu_item_id' }); @@ -838,7 +837,7 @@ QUnit.test('The Specials Page getting its controller context by deserializing th equal(jQuery('p', '#qunit-fixture').text(), '1', 'The model was used to render the template'); }); -QUnit.test('The Specials Page defaults to looking models up via `find`', function() { +test('The Specials Page defaults to looking models up via `find`', function() { Router.map(function() { this.route('home', { path: '/' }); this.route('special', { path: '/specials/:menu_item_id' }); @@ -872,7 +871,7 @@ QUnit.test('The Specials Page defaults to looking models up via `find`', functio equal(jQuery('p', '#qunit-fixture').text(), '1', 'The model was used to render the template'); }); -QUnit.test('The Special Page returning a promise puts the app into a loading state until the promise is resolved', function() { +test('The Special Page returning a promise puts the app into a loading state until the promise is resolved', function() { Router.map(function() { this.route('home', { path: '/' }); this.route('special', { path: '/specials/:menu_item_id' }); @@ -924,7 +923,7 @@ QUnit.test('The Special Page returning a promise puts the app into a loading sta equal(jQuery('p', '#qunit-fixture').text(), '1', 'The app is now in the specials state'); }); -QUnit.test('The loading state doesn\'t get entered for promises that resolve on the same run loop', function() { +test('The loading state doesn\'t get entered for promises that resolve on the same run loop', function() { Router.map(function() { this.route('home', { path: '/' }); this.route('special', { path: '/specials/:menu_item_id' }); @@ -1002,7 +1001,7 @@ asyncTest("The Special page returning an error fires the error hook on SpecialRo }); */ -QUnit.test('The Special page returning an error invokes SpecialRoute\'s error handler', function() { +test('The Special page returning an error invokes SpecialRoute\'s error handler', function() { Router.map(function() { this.route('home', { path: '/' }); this.route('special', { path: '/specials/:menu_item_id' }); @@ -1088,7 +1087,7 @@ let testOverridableErrorHandler = function(handlersName) { }); }; -QUnit.test('ApplicationRoute\'s default error handler can be overridden', function() { +test('ApplicationRoute\'s default error handler can be overridden', function() { testOverridableErrorHandler('actions'); }); @@ -1274,7 +1273,7 @@ asyncTest('Nested callbacks are not exited when moving to siblings', function() }); }); -QUnit.asyncTest('Events are triggered on the controller if a matching action name is implemented', function() { +asyncTest('Events are triggered on the controller if a matching action name is implemented', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -1318,7 +1317,7 @@ QUnit.asyncTest('Events are triggered on the controller if a matching action nam action.handler(event); }); -QUnit.asyncTest('Events are triggered on the current state when defined in `actions` object', function() { +asyncTest('Events are triggered on the current state when defined in `actions` object', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -1352,7 +1351,7 @@ QUnit.asyncTest('Events are triggered on the current state when defined in `acti action.handler(event); }); -QUnit.asyncTest('Events defined in `actions` object are triggered on the current state when routes are nested', function() { +asyncTest('Events defined in `actions` object are triggered on the current state when routes are nested', function() { Router.map(function() { this.route('root', { path: '/' }, function() { this.route('index', { path: '/' }); @@ -1390,7 +1389,7 @@ QUnit.asyncTest('Events defined in `actions` object are triggered on the current action.handler(event); }); -QUnit.test('Events can be handled by inherited event handlers', function() { +test('Events can be handled by inherited event handlers', function() { expect(4); App.SuperRoute = Route.extend({ @@ -1428,7 +1427,7 @@ QUnit.test('Events can be handled by inherited event handlers', function() { router.send('baz'); }); -QUnit.asyncTest('Actions are not triggered on the controller if a matching action name is implemented as a method', function() { +asyncTest('Actions are not triggered on the controller if a matching action name is implemented as a method', function() { Router.map(function() { this.route('home', { path: '/' }); }); @@ -1471,7 +1470,7 @@ QUnit.asyncTest('Actions are not triggered on the controller if a matching actio action.handler(event); }); -QUnit.asyncTest('actions can be triggered with multiple arguments', function() { +asyncTest('actions can be triggered with multiple arguments', function() { Router.map(function() { this.route('root', { path: '/' }, function() { this.route('index', { path: '/' }); @@ -1510,7 +1509,7 @@ QUnit.asyncTest('actions can be triggered with multiple arguments', function() { action.handler(event); }); -QUnit.test('transitioning multiple times in a single run loop only sets the URL once', function() { +test('transitioning multiple times in a single run loop only sets the URL once', function() { Router.map(function() { this.route('root', { path: '/' }); this.route('foo'); @@ -1537,7 +1536,7 @@ QUnit.test('transitioning multiple times in a single run loop only sets the URL equal(router.get('location').getURL(), '/bar'); }); -QUnit.test('navigating away triggers a url property change', function() { +test('navigating away triggers a url property change', function() { expect(3); Router.map(function() { @@ -1559,7 +1558,7 @@ QUnit.test('navigating away triggers a url property change', function() { }); }); -QUnit.test('using replaceWith calls location.replaceURL if available', function() { +test('using replaceWith calls location.replaceURL if available', function() { var setCount = 0; var replaceCount = 0; @@ -1596,7 +1595,7 @@ QUnit.test('using replaceWith calls location.replaceURL if available', function( equal(router.get('location').getURL(), '/foo'); }); -QUnit.test('using replaceWith calls setURL if location.replaceURL is not defined', function() { +test('using replaceWith calls setURL if location.replaceURL is not defined', function() { var setCount = 0; Router.reopen({ @@ -1625,7 +1624,7 @@ QUnit.test('using replaceWith calls setURL if location.replaceURL is not defined equal(router.get('location').getURL(), '/foo'); }); -QUnit.test('Route inherits model from parent route', function() { +test('Route inherits model from parent route', function() { expect(9); Router.map(function() { @@ -1700,7 +1699,7 @@ QUnit.test('Route inherits model from parent route', function() { handleURL('/posts/3/shares/3'); }); -QUnit.test('Routes with { resetNamespace: true } inherits model from parent route', function() { +test('Routes with { resetNamespace: true } inherits model from parent route', function() { expect(6); Router.map(function() { @@ -1747,7 +1746,7 @@ QUnit.test('Routes with { resetNamespace: true } inherits model from parent rout handleURL('/posts/3/comments'); }); -QUnit.test('It is possible to get the model from a parent route', function() { +test('It is possible to get the model from a parent route', function() { expect(9); Router.map(function() { @@ -1793,7 +1792,7 @@ QUnit.test('It is possible to get the model from a parent route', function() { handleURL('/posts/3/comments'); }); -QUnit.test('A redirection hook is provided', function() { +test('A redirection hook is provided', function() { Router.map(function() { this.route('choose', { path: '/' }); this.route('home'); @@ -1823,7 +1822,7 @@ QUnit.test('A redirection hook is provided', function() { equal(getOwner(router).lookup('controller:application').get('currentPath'), 'home'); }); -QUnit.test('Redirecting from the middle of a route aborts the remainder of the routes', function() { +test('Redirecting from the middle of a route aborts the remainder of the routes', function() { expect(3); Router.map(function() { @@ -1858,7 +1857,7 @@ QUnit.test('Redirecting from the middle of a route aborts the remainder of the r equal(router.get('location').getURL(), '/home'); }); -QUnit.test('Redirecting to the current target in the middle of a route does not abort initial routing', function() { +test('Redirecting to the current target in the middle of a route does not abort initial routing', function() { expect(5); Router.map(function() { @@ -1897,7 +1896,7 @@ QUnit.test('Redirecting to the current target in the middle of a route does not equal(successCount, 1, 'transitionTo success handler was called once'); }); -QUnit.test('Redirecting to the current target with a different context aborts the remainder of the routes', function() { +test('Redirecting to the current target with a different context aborts the remainder of the routes', function() { expect(4); Router.map(function() { @@ -1937,7 +1936,7 @@ QUnit.test('Redirecting to the current target with a different context aborts th equal(router.get('location').getURL(), '/foo/bar/2/baz'); }); -QUnit.test('Transitioning from a parent event does not prevent currentPath from being set', function() { +test('Transitioning from a parent event does not prevent currentPath from being set', function() { Router.map(function() { this.route('foo', function() { this.route('bar', { resetNamespace: true }, function() { @@ -1971,7 +1970,7 @@ QUnit.test('Transitioning from a parent event does not prevent currentPath from equal(router.get('location').getURL(), '/foo/qux'); }); -QUnit.test('Generated names can be customized when providing routes with dot notation', function() { +test('Generated names can be customized when providing routes with dot notation', function() { expect(4); setTemplate('index', compile('
Index
')); @@ -2017,7 +2016,7 @@ QUnit.test('Generated names can be customized when providing routes with dot not equal(jQuery('.main .middle .bottom p', '#qunit-fixture').text(), 'BarBazBottom!', 'The templates were rendered into their appropriate parents'); }); -QUnit.test('Child routes render into their parent route\'s template by default', function() { +test('Child routes render into their parent route\'s template by default', function() { setTemplate('index', compile('
Index
')); setTemplate('application', compile('

Home

{{outlet}}
')); setTemplate('top', compile('
{{outlet}}
')); @@ -2039,7 +2038,7 @@ QUnit.test('Child routes render into their parent route\'s template by default', equal(jQuery('.main .middle .bottom p', '#qunit-fixture').text(), 'Bottom!', 'The templates were rendered into their appropriate parents'); }); -QUnit.test('Child routes render into specified template', function() { +test('Child routes render into specified template', function() { setTemplate('index', compile('
Index
')); setTemplate('application', compile('

Home

{{outlet}}
')); setTemplate('top', compile('
{{outlet}}
')); @@ -2068,7 +2067,7 @@ QUnit.test('Child routes render into specified template', function() { equal(jQuery('.main .middle > p', '#qunit-fixture').text(), 'Bottom!', 'The template was rendered into the top template'); }); -QUnit.test('Rendering into specified template with slash notation', function() { +test('Rendering into specified template with slash notation', function() { setTemplate('person/profile', compile('profile {{outlet}}')); setTemplate('person/details', compile('details!')); @@ -2088,7 +2087,7 @@ QUnit.test('Rendering into specified template with slash notation', function() { equal(jQuery('#qunit-fixture:contains(profile details!)').length, 1, 'The templates were rendered'); }); -QUnit.test('Parent route context change', function() { +test('Parent route context change', function() { var editCount = 0; var editedPostIds = emberA(); @@ -2158,7 +2157,7 @@ QUnit.test('Parent route context change', function() { deepEqual(editedPostIds, ['1', '2'], 'modelFor posts.post returns the right context'); }); -QUnit.test('Router accounts for rootURL on page load when using history location', function() { +test('Router accounts for rootURL on page load when using history location', function() { var rootURL = window.location.pathname + '/app'; var postsTemplateRendered = false; var setHistory, HistoryTestLocation; @@ -2213,7 +2212,7 @@ QUnit.test('Router accounts for rootURL on page load when using history location ok(postsTemplateRendered, 'Posts route successfully stripped from rootURL'); }); -QUnit.test('The rootURL is passed properly to the location implementation', function() { +test('The rootURL is passed properly to the location implementation', function() { expect(1); var rootURL = '/blahzorz'; var HistoryTestLocation; @@ -2239,7 +2238,7 @@ QUnit.test('The rootURL is passed properly to the location implementation', func }); -QUnit.test('Only use route rendered into main outlet for default into property on child', function() { +test('Only use route rendered into main outlet for default into property on child', function() { setTemplate('application', compile('{{outlet \'menu\'}}{{outlet}}')); setTemplate('posts', compile('{{outlet}}')); setTemplate('posts/index', compile('postsIndex')); @@ -2278,7 +2277,7 @@ QUnit.test('Only use route rendered into main outlet for default into property o equal(jQuery('p.posts-index:contains(postsIndex)', '#qunit-fixture').length, 1, 'The posts/index template was rendered'); }); -QUnit.test('Generating a URL should not affect currentModel', function() { +test('Generating a URL should not affect currentModel', function() { Router.map(function() { this.route('post', { path: '/posts/:post_id' }); }); @@ -2308,7 +2307,7 @@ QUnit.test('Generating a URL should not affect currentModel', function() { }); -QUnit.test('Generated route should be an instance of App.Route if provided', function() { +test('Generated route should be an instance of App.Route if provided', function() { var generatedRoute; Router.map(function() { @@ -2326,7 +2325,7 @@ QUnit.test('Generated route should be an instance of App.Route if provided', fun ok(generatedRoute instanceof App.Route, 'should extend the correct route'); }); -QUnit.test('Nested index route is not overriden by parent\'s implicit index route', function() { +test('Nested index route is not overriden by parent\'s implicit index route', function() { Router.map(function() { this.route('posts', function() { this.route('index', { path: ':category' }); @@ -2343,7 +2342,7 @@ QUnit.test('Nested index route is not overriden by parent\'s implicit index rout }); if (isEnabled('ember-route-serializers')) { - QUnit.test('Custom Route#serialize method still works [DEPRECATED]', function() { + test('Custom Route#serialize method still works [DEPRECATED]', function() { Router.map(function() { this.route('posts', function() { this.route('index', { @@ -2370,7 +2369,7 @@ if (isEnabled('ember-route-serializers')) { }); } -QUnit.test('Application template does not duplicate when re-rendered', function() { +test('Application template does not duplicate when re-rendered', function() { setTemplate('application', compile('

I Render Once

{{outlet}}')); Router.map(function() { @@ -2391,7 +2390,7 @@ QUnit.test('Application template does not duplicate when re-rendered', function( equal(jQuery('h3:contains(I Render Once)').size(), 1); }); -QUnit.test('Child routes should render inside the application template if the application template causes a redirect', function() { +test('Child routes should render inside the application template if the application template causes a redirect', function() { setTemplate('application', compile('

App

{{outlet}}')); setTemplate('posts', compile('posts')); @@ -2411,7 +2410,7 @@ QUnit.test('Child routes should render inside the application template if the ap equal(jQuery('#qunit-fixture > div').text(), 'App posts'); }); -QUnit.test('The template is not re-rendered when the route\'s context changes', function() { +test('The template is not re-rendered when the route\'s context changes', function() { Router.map(function() { this.route('page', { path: '/page/:name' }); }); @@ -2454,7 +2453,7 @@ QUnit.test('The template is not re-rendered when the route\'s context changes', }); -QUnit.test('The template is not re-rendered when two routes present the exact same template, view, & controller', function() { +test('The template is not re-rendered when two routes present the exact same template, view, & controller', function() { Router.map(function() { this.route('first'); this.route('second'); @@ -2529,7 +2528,7 @@ QUnit.test('The template is not re-rendered when two routes present the exact sa equal(insertionCount, 2, 'view should have inserted a second time'); }); -QUnit.test('ApplicationRoute with model does not proxy the currentPath', function() { +test('ApplicationRoute with model does not proxy the currentPath', function() { var model = {}; var currentPath; @@ -2549,7 +2548,7 @@ QUnit.test('ApplicationRoute with model does not proxy the currentPath', functio equal('currentPath' in model, false, 'should have defined currentPath on controller'); }); -QUnit.test('Promises encountered on app load put app into loading state until resolved', function() { +test('Promises encountered on app load put app into loading state until resolved', function() { expect(2); var deferred = RSVP.defer(); @@ -2570,7 +2569,7 @@ QUnit.test('Promises encountered on app load put app into loading state until re equal(jQuery('p', '#qunit-fixture').text(), 'INDEX', 'The index route is display.'); }); -QUnit.test('Route should tear down multiple outlets', function() { +test('Route should tear down multiple outlets', function() { setTemplate('application', compile('{{outlet \'menu\'}}{{outlet}}{{outlet \'footer\'}}')); setTemplate('posts', compile('{{outlet}}')); setTemplate('users', compile('users')); @@ -2632,7 +2631,7 @@ QUnit.test('Route should tear down multiple outlets', function() { }); -QUnit.test('Route will assert if you try to explicitly render {into: ...} a missing template', function () { +test('Route will assert if you try to explicitly render {into: ...} a missing template', function () { Router.map(function() { this.route('home', { path: '/' }); }); @@ -2648,7 +2647,7 @@ QUnit.test('Route will assert if you try to explicitly render {into: ...} a miss }, 'You attempted to render into \'nonexistent\' but it was not found'); }); -QUnit.test('Route supports clearing outlet explicitly', function() { +test('Route supports clearing outlet explicitly', function() { setTemplate('application', compile('{{outlet}}{{outlet \'modal\'}}')); setTemplate('posts', compile('{{outlet}}')); setTemplate('users', compile('users')); @@ -2731,7 +2730,7 @@ QUnit.test('Route supports clearing outlet explicitly', function() { equal(jQuery('div.posts-extra:contains(postsExtra)', '#qunit-fixture').length, 0, 'The posts/extra template was removed'); }); -QUnit.test('Route supports clearing outlet using string parameter', function() { +test('Route supports clearing outlet using string parameter', function() { setTemplate('application', compile('{{outlet}}{{outlet \'modal\'}}')); setTemplate('posts', compile('{{outlet}}')); setTemplate('users', compile('users')); @@ -2786,7 +2785,7 @@ QUnit.test('Route supports clearing outlet using string parameter', function() { equal(jQuery('div.posts-modal:contains(postsModal)', '#qunit-fixture').length, 0, 'The posts/modal template was removed'); }); -QUnit.test('Route silently fails when cleaning an outlet from an inactive view', function() { +test('Route silently fails when cleaning an outlet from an inactive view', function() { expect(1); // handleURL setTemplate('application', compile('{{outlet}}')); @@ -2820,7 +2819,7 @@ QUnit.test('Route silently fails when cleaning an outlet from an inactive view', run(function() { router.send('hideModal'); }); }); -QUnit.test('Router `willTransition` hook passes in cancellable transition', function() { +test('Router `willTransition` hook passes in cancellable transition', function() { // Should hit willTransition 3 times, once for the initial route, and then 2 more times // for the two handleURL calls below expect(3); @@ -2866,7 +2865,7 @@ QUnit.test('Router `willTransition` hook passes in cancellable transition', func run(router, 'handleURL', '/about'); }); -QUnit.test('Aborting/redirecting the transition in `willTransition` prevents LoadingRoute from being entered', function() { +test('Aborting/redirecting the transition in `willTransition` prevents LoadingRoute from being entered', function() { expect(8); Router.map(function() { @@ -2935,7 +2934,7 @@ QUnit.test('Aborting/redirecting the transition in `willTransition` prevents Loa run(deferred.resolve); }); -QUnit.test('`didTransition` event fires on the router', function() { +test('`didTransition` event fires on the router', function() { expect(3); Router.map(function() { @@ -2957,7 +2956,7 @@ QUnit.test('`didTransition` event fires on the router', function() { run(router, 'transitionTo', 'nork'); }); -QUnit.test('`didTransition` can be reopened', function() { +test('`didTransition` can be reopened', function() { expect(1); Router.map(function() { @@ -2974,7 +2973,7 @@ QUnit.test('`didTransition` can be reopened', function() { bootApplication(); }); -QUnit.test('`activate` event fires on the route', function() { +test('`activate` event fires on the route', function() { expect(2); var eventFired = 0; @@ -3002,7 +3001,7 @@ QUnit.test('`activate` event fires on the route', function() { run(router, 'transitionTo', 'nork'); }); -QUnit.test('`deactivate` event fires on the route', function() { +test('`deactivate` event fires on the route', function() { expect(2); var eventFired = 0; @@ -3032,7 +3031,7 @@ QUnit.test('`deactivate` event fires on the route', function() { run(router, 'transitionTo', 'dork'); }); -QUnit.test('Actions can be handled by inherited action handlers', function() { +test('Actions can be handled by inherited action handlers', function() { expect(4); App.SuperRoute = Route.extend({ @@ -3070,7 +3069,7 @@ QUnit.test('Actions can be handled by inherited action handlers', function() { router.send('baz'); }); -QUnit.test('transitionTo returns Transition when passed a route name', function() { +test('transitionTo returns Transition when passed a route name', function() { expect(1); Router.map(function() { this.route('root', { path: '/' }); @@ -3088,7 +3087,7 @@ QUnit.test('transitionTo returns Transition when passed a route name', function( equal(transition instanceof Transition, true); }); -QUnit.test('transitionTo returns Transition when passed a url', function() { +test('transitionTo returns Transition when passed a url', function() { expect(1); Router.map(function() { this.route('root', { path: '/' }); @@ -3108,7 +3107,7 @@ QUnit.test('transitionTo returns Transition when passed a url', function() { equal(transition instanceof Transition, true); }); -QUnit.test('currentRouteName is a property installed on ApplicationController that can be used in transitionTo', function() { +test('currentRouteName is a property installed on ApplicationController that can be used in transitionTo', function() { expect(24); Router.map(function() { @@ -3148,7 +3147,7 @@ QUnit.test('currentRouteName is a property installed on ApplicationController th transitionAndCheck('each.other', 'be.excellent.to.each.other', 'each.other'); }); -QUnit.test('Route model hook finds the same model as a manual find', function() { +test('Route model hook finds the same model as a manual find', function() { var Post; App.Post = EmberObject.extend(); App.Post.reopenClass({ @@ -3169,7 +3168,7 @@ QUnit.test('Route model hook finds the same model as a manual find', function() equal(App.Post, Post); }); -QUnit.test('Routes can refresh themselves causing their model hooks to be re-run', function() { +test('Routes can refresh themselves causing their model hooks to be re-run', function() { Router.map(function() { this.route('parent', { path: '/parent/:parent_id' }, function() { this.route('child'); @@ -3222,7 +3221,7 @@ QUnit.test('Routes can refresh themselves causing their model hooks to be re-run equal(childcount, 2); }); -QUnit.test('Specifying non-existent controller name in route#render throws', function() { +test('Specifying non-existent controller name in route#render throws', function() { expect(1); Router.map(function() { @@ -3242,7 +3241,7 @@ QUnit.test('Specifying non-existent controller name in route#render throws', fun bootApplication(); }); -QUnit.test('Redirecting with null model doesn\'t error out', function() { +test('Redirecting with null model doesn\'t error out', function() { function serializeAboutRoute(model) { if (model === null) { return { hurhurhur: 'TreeklesMcGeekles' }; @@ -3276,7 +3275,7 @@ QUnit.test('Redirecting with null model doesn\'t error out', function() { equal(router.get('location.path'), '/about/TreeklesMcGeekles'); }); -QUnit.test('rejecting the model hooks promise with a non-error prints the `message` property', function() { +test('rejecting the model hooks promise with a non-error prints the `message` property', function() { expect(5); var rejectedMessage = 'OMG!! SOOOOOO BAD!!!!'; @@ -3306,7 +3305,7 @@ QUnit.test('rejecting the model hooks promise with a non-error prints the `messa }, 'expected an exception'); }); -QUnit.test('rejecting the model hooks promise with an error with `errorThrown` property prints `errorThrown.message` property', function() { +test('rejecting the model hooks promise with an error with `errorThrown` property prints `errorThrown.message` property', function() { expect(5); var rejectedMessage = 'OMG!! SOOOOOO BAD!!!!'; var rejectedStack = 'Yeah, buddy: stack gets printed too.'; @@ -3337,7 +3336,7 @@ QUnit.test('rejecting the model hooks promise with an error with `errorThrown` p }, 'expected an exception'); }); -QUnit.test('rejecting the model hooks promise with no reason still logs error', function() { +test('rejecting the model hooks promise with no reason still logs error', function() { Router.map(function() { this.route('wowzers', { path: '/' }); }); @@ -3355,7 +3354,7 @@ QUnit.test('rejecting the model hooks promise with no reason still logs error', bootApplication(); }); -QUnit.test('rejecting the model hooks promise with a string shows a good error', function() { +test('rejecting the model hooks promise with a string shows a good error', function() { expect(3); var originalLoggerError = Logger.error; var rejectedMessage = 'Supercalifragilisticexpialidocious'; @@ -3382,7 +3381,7 @@ QUnit.test('rejecting the model hooks promise with a string shows a good error', Logger.error = originalLoggerError; }); -QUnit.test('willLeave, willChangeContext, willChangeModel actions don\'t fire unless feature flag enabled', function() { +test('willLeave, willChangeContext, willChangeModel actions don\'t fire unless feature flag enabled', function() { expect(1); App.Router.map(function() { @@ -3411,7 +3410,7 @@ QUnit.test('willLeave, willChangeContext, willChangeModel actions don\'t fire un run(router, 'transitionTo', 'about'); }); -QUnit.test('Errors in transitionTo within redirect hook are logged', function() { +test('Errors in transitionTo within redirect hook are logged', function() { expect(4); var actual = []; @@ -3440,7 +3439,7 @@ QUnit.test('Errors in transitionTo within redirect hook are logged', function() ok(actual[0][1].match(/More context objects were passed than there are dynamic segments for the route: stink-bomb/), 'the error is printed'); }); -QUnit.test('Errors in transition show error template if available', function() { +test('Errors in transition show error template if available', function() { setTemplate('error', compile('
Error!
')); Router.map(function() { @@ -3461,7 +3460,7 @@ QUnit.test('Errors in transition show error template if available', function() { equal(jQuery('#error').length, 1, 'Error template was rendered.'); }); -QUnit.test('Route#resetController gets fired when changing models and exiting routes', function() { +test('Route#resetController gets fired when changing models and exiting routes', function() { expect(4); Router.map(function() { @@ -3504,7 +3503,7 @@ QUnit.test('Route#resetController gets fired when changing models and exiting ro deepEqual(calls, [['reset', 'c'], ['reset', 'a'], ['setup', 'out']]); }); -QUnit.test('Exception during initialization of non-initial route is not swallowed', function() { +test('Exception during initialization of non-initial route is not swallowed', function() { Router.map(function() { this.route('boom'); }); @@ -3520,7 +3519,7 @@ QUnit.test('Exception during initialization of non-initial route is not swallowe }); -QUnit.test('Exception during load of non-initial route is not swallowed', function() { +test('Exception during load of non-initial route is not swallowed', function() { Router.map(function() { this.route('boom'); }); @@ -3542,7 +3541,7 @@ QUnit.test('Exception during load of non-initial route is not swallowed', functi }); }); -QUnit.test('Exception during initialization of initial route is not swallowed', function() { +test('Exception during initialization of initial route is not swallowed', function() { Router.map(function() { this.route('boom', { path: '/' }); }); @@ -3556,7 +3555,7 @@ QUnit.test('Exception during initialization of initial route is not swallowed', }, /\bboom\b/); }); -QUnit.test('Exception during load of initial route is not swallowed', function() { +test('Exception during load of initial route is not swallowed', function() { Router.map(function() { this.route('boom', { path: '/' }); }); @@ -3577,7 +3576,7 @@ QUnit.test('Exception during load of initial route is not swallowed', function() }, /\bboom\b/); }); -QUnit.test('{{outlet}} works when created after initial render', function() { +test('{{outlet}} works when created after initial render', function() { setTemplate('sample', compile('Hi{{#if showTheThing}}{{outlet}}{{/if}}Bye')); setTemplate('sample/inner', compile('Yay')); setTemplate('sample/inner2', compile('Boo')); @@ -3603,7 +3602,7 @@ QUnit.test('{{outlet}} works when created after initial render', function() { equal(jQuery('#qunit-fixture').text(), 'HiBooBye', 'third render'); }); -QUnit.test('Can rerender application view multiple times when it contains an outlet', function() { +test('Can rerender application view multiple times when it contains an outlet', function() { setTemplate('application', compile('App{{outlet}}')); setTemplate('index', compile('Hello world')); @@ -3628,7 +3627,7 @@ QUnit.test('Can rerender application view multiple times when it contains an out equal(jQuery('#qunit-fixture').text(), 'AppHello world', 'third render'); }); -QUnit.test('Can render into a named outlet at the top level', function() { +test('Can render into a named outlet at the top level', function() { setTemplate('application', compile('A-{{outlet}}-B-{{outlet "other"}}-C')); setTemplate('modal', compile('Hello world')); setTemplate('index', compile('The index')); @@ -3648,7 +3647,7 @@ QUnit.test('Can render into a named outlet at the top level', function() { equal(jQuery('#qunit-fixture').text(), 'A-The index-B-Hello world-C', 'initial render'); }); -QUnit.test('Can disconnect a named outlet at the top level', function() { +test('Can disconnect a named outlet at the top level', function() { setTemplate('application', compile('A-{{outlet}}-B-{{outlet "other"}}-C')); setTemplate('modal', compile('Hello world')); setTemplate('index', compile('The index')); @@ -3680,7 +3679,7 @@ QUnit.test('Can disconnect a named outlet at the top level', function() { equal(jQuery('#qunit-fixture').text(), 'A-The index-B--C', 'second render'); }); -QUnit.test('Can render into a named outlet at the top level, with empty main outlet', function() { +test('Can render into a named outlet at the top level, with empty main outlet', function() { setTemplate('application', compile('A-{{outlet}}-B-{{outlet "other"}}-C')); setTemplate('modal', compile('Hello world')); @@ -3704,7 +3703,7 @@ QUnit.test('Can render into a named outlet at the top level, with empty main out }); -QUnit.test('Can render into a named outlet at the top level, later', function() { +test('Can render into a named outlet at the top level, later', function() { setTemplate('application', compile('A-{{outlet}}-B-{{outlet "other"}}-C')); setTemplate('modal', compile('Hello world')); setTemplate('index', compile('The index')); @@ -3729,7 +3728,7 @@ QUnit.test('Can render into a named outlet at the top level, later', function() equal(jQuery('#qunit-fixture').text(), 'A-The index-B-Hello world-C', 'second render'); }); -QUnit.test('Can render routes with no \'main\' outlet and their children', function() { +test('Can render routes with no \'main\' outlet and their children', function() { setTemplate('application', compile('
{{outlet "app"}}
')); setTemplate('app', compile('
{{outlet "common"}}
{{outlet "sub"}}
')); setTemplate('common', compile('
')); @@ -3771,7 +3770,7 @@ QUnit.test('Can render routes with no \'main\' outlet and their children', funct equal(jQuery('#app-sub #sub').length, 1, 'Finds sub while viewing /app/sub'); }); -QUnit.test('Tolerates stacked renders', function() { +test('Tolerates stacked renders', function() { setTemplate('application', compile('{{outlet}}{{outlet "modal"}}')); setTemplate('index', compile('hi')); setTemplate('layer', compile('layer')); @@ -3801,7 +3800,7 @@ QUnit.test('Tolerates stacked renders', function() { equal(trim(jQuery('#qunit-fixture').text()), 'hi'); }); -QUnit.test('Renders child into parent with non-default template name', function() { +test('Renders child into parent with non-default template name', function() { setTemplate('application', compile('
{{outlet}}
')); setTemplate('exports/root', compile('
{{outlet}}
')); setTemplate('exports/index', compile('
')); @@ -3828,7 +3827,7 @@ QUnit.test('Renders child into parent with non-default template name', function( equal(jQuery('#qunit-fixture .a .b .c').length, 1); }); -QUnit.test('Allows any route to disconnectOutlet another route\'s templates', function() { +test('Allows any route to disconnectOutlet another route\'s templates', function() { setTemplate('application', compile('{{outlet}}{{outlet "modal"}}')); setTemplate('index', compile('hi')); setTemplate('layer', compile('layer')); @@ -3860,7 +3859,7 @@ QUnit.test('Allows any route to disconnectOutlet another route\'s templates', fu equal(trim(jQuery('#qunit-fixture').text()), 'hi'); }); -QUnit.test('Can this.render({into:...}) the render helper', function() { +test('Can this.render({into:...}) the render helper', function() { setTemplate('application', compile('{{render "foo"}}')); setTemplate('foo', compile('
{{outlet}}
')); setTemplate('index', compile('other')); @@ -3887,7 +3886,7 @@ QUnit.test('Can this.render({into:...}) the render helper', function() { equal(jQuery('#qunit-fixture .foo').text(), 'bar'); }); -QUnit.test('Can disconnect from the render helper', function() { +test('Can disconnect from the render helper', function() { setTemplate('application', compile('{{render "foo"}}')); setTemplate('foo', compile('
{{outlet}}
')); setTemplate('index', compile('other')); @@ -3913,7 +3912,7 @@ QUnit.test('Can disconnect from the render helper', function() { }); -QUnit.test('Can this.render({into:...}) the render helper\'s children', function() { +test('Can this.render({into:...}) the render helper\'s children', function() { setTemplate('application', compile('{{render "foo"}}')); setTemplate('foo', compile('
{{outlet}}
')); setTemplate('index', compile('
{{outlet}}
')); @@ -3942,7 +3941,7 @@ QUnit.test('Can this.render({into:...}) the render helper\'s children', function equal(jQuery('#qunit-fixture .foo .index').text(), 'bar'); }); -QUnit.test('Can disconnect from the render helper\'s children', function() { +test('Can disconnect from the render helper\'s children', function() { setTemplate('application', compile('{{render "foo"}}')); setTemplate('foo', compile('
{{outlet}}
')); setTemplate('index', compile('
{{outlet}}
')); @@ -3969,7 +3968,7 @@ QUnit.test('Can disconnect from the render helper\'s children', function() { equal(jQuery('#qunit-fixture .foo .index').text(), ''); }); -QUnit.test('Can this.render({into:...}) nested render helpers', function() { +test('Can this.render({into:...}) nested render helpers', function() { setTemplate('application', compile('{{render "foo"}}')); setTemplate('foo', compile('
{{render "bar"}}
')); setTemplate('bar', compile('
{{outlet}}
')); @@ -3997,7 +3996,7 @@ QUnit.test('Can this.render({into:...}) nested render helpers', function() { equal(jQuery('#qunit-fixture .bar').text(), 'baz'); }); -QUnit.test('Can disconnect from nested render helpers', function() { +test('Can disconnect from nested render helpers', function() { setTemplate('application', compile('{{render "foo"}}')); setTemplate('foo', compile('
{{render "bar"}}
')); setTemplate('bar', compile('
{{outlet}}
')); @@ -4023,7 +4022,7 @@ QUnit.test('Can disconnect from nested render helpers', function() { equal(jQuery('#qunit-fixture .bar').text(), ''); }); -QUnit.test('Can render with layout', function() { +test('Can render with layout', function() { setTemplate('application', compile('{{outlet}}')); setTemplate('index', compile('index-template')); setTemplate('my-layout', compile('my-layout [{{yield}}]')); @@ -4036,7 +4035,7 @@ QUnit.test('Can render with layout', function() { equal(jQuery('#qunit-fixture').text(), 'my-layout [index-template]'); }); -QUnit.test('Components inside an outlet have their didInsertElement hook invoked when the route is displayed', function(assert) { +test('Components inside an outlet have their didInsertElement hook invoked when the route is displayed', function(assert) { setTemplate('index', compile('{{#if showFirst}}{{my-component}}{{else}}{{other-component}}{{/if}}')); var myComponentCounter = 0; @@ -4078,7 +4077,7 @@ QUnit.test('Components inside an outlet have their didInsertElement hook invoked assert.strictEqual(otherComponentCounter, 1, 'didInsertElement invoked on displayed component'); }); -QUnit.test('Doesnt swallow exception thrown from willTransition', function() { +test('Doesnt swallow exception thrown from willTransition', function() { expect(1); setTemplate('application', compile('{{outlet}}')); setTemplate('index', compile('index')); @@ -4106,7 +4105,7 @@ QUnit.test('Doesnt swallow exception thrown from willTransition', function() { }, /boom/, 'expected an exception that didnt happen'); }); -QUnit.test('Exception if outlet name is undefined in render and disconnectOutlet', function(assert) { +test('Exception if outlet name is undefined in render and disconnectOutlet', function(assert) { App.ApplicationRoute = Route.extend({ actions: { showModal: function() { @@ -4134,5 +4133,3 @@ QUnit.test('Exception if outlet name is undefined in render and disconnectOutlet run(function() { router.send('hideModal'); }); }, /You passed undefined as the outlet name/); }); - -} diff --git a/packages/ember/tests/routing/query_params_test.js b/packages/ember/tests/routing/query_params_test.js index cb8d80c0861..131d83b0e3c 100644 --- a/packages/ember/tests/routing/query_params_test.js +++ b/packages/ember/tests/routing/query_params_test.js @@ -107,10 +107,10 @@ function sharedTeardown() { } } -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; +// jscs:disable -QUnit.module('Routing with Query Params', { +testModule('Routing with Query Params', { setup() { sharedSetup(); }, @@ -121,7 +121,7 @@ QUnit.module('Routing with Query Params', { }); if (isEnabled('ember-routing-route-configured-query-params')) { - QUnit.test('Single query params can be set on the route', function() { + test('Single query params can be set on the route', function() { App.Router.map(function() { this.route('home', { path: '/' }); }); @@ -146,7 +146,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=987'); }); - QUnit.test('a query param can have define a `type` for type casting', function() { + test('a query param can have define a `type` for type casting', function() { App.Router.map(function() { this.route('home', { path: '/' }); }); @@ -168,7 +168,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(controller.get('page'), 4); }); - QUnit.test('Query params can map to different url keys configured on the route', function() { + test('Query params can map to different url keys configured on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { as: 'other_foo', defaultValue: 'FOO' }, @@ -194,7 +194,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(router, 'transitionTo', '/?other_bar=NERK&other_foo=NAW'); }); - QUnit.test('Routes have overridable serializeQueryParamKey hook and it works with route-configured query params', function() { + test('Routes have overridable serializeQueryParamKey hook and it works with route-configured query params', function() { App.IndexRoute = Route.extend({ queryParams: { funTimes: { @@ -213,7 +213,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?fun-times=woot'); }); - QUnit.test('No replaceURL occurs on startup when configured via Route because default values don\'t show up in URL', function() { + test('No replaceURL occurs on startup when configured via Route because default values don\'t show up in URL', function() { expect(0); App.IndexRoute = Route.extend({ @@ -229,7 +229,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('model hooks receives query params when configred on Route', function() { + test('model hooks receives query params when configred on Route', function() { App.IndexRoute = Route.extend({ queryParams: { omg: { @@ -246,7 +246,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), ''); }); - QUnit.test('model hooks receives query params (overridden by incoming url value) when configured on route', function() { + test('model hooks receives query params (overridden by incoming url value) when configured on route', function() { App.IndexRoute = Route.extend({ queryParams: { omg: { @@ -264,7 +264,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?omg=yes'); }); - QUnit.test('Route#paramsFor fetches query params when configured on the route', function() { + test('Route#paramsFor fetches query params when configured on the route', function() { expect(1); App.Router.map(function() { @@ -286,7 +286,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('Route#paramsFor fetches falsy query params when they\'re configured on the route', function() { + test('Route#paramsFor fetches falsy query params when they\'re configured on the route', function() { expect(1); App.IndexRoute = Route.extend({ @@ -304,7 +304,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('model hook can query prefix-less application params when they\'re configured on the route', function() { + test('model hook can query prefix-less application params when they\'re configured on the route', function() { App.ApplicationRoute = Route.extend({ queryParams: { appomg: { @@ -333,7 +333,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), ''); }); - QUnit.test('can opt into full transition by setting refreshModel in route queryParams when all configuration is in route', function() { + test('can opt into full transition by setting refreshModel in route queryParams when all configuration is in route', function() { expect(6); var appModelCount = 0; @@ -379,7 +379,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(indexModelCount, 2); }); - QUnit.test('refreshModel does not cause a second transition during app boot ', function() { + test('refreshModel does not cause a second transition during app boot ', function() { expect(0); App.ApplicationRoute = Route.extend({ @@ -406,7 +406,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('can use refreshModel even w URL changes that remove QPs from address bar when QP configured on route', function() { + test('can use refreshModel even w URL changes that remove QPs from address bar when QP configured on route', function() { expect(4); var indexModelCount = 0; @@ -439,7 +439,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(indexController.get('omg'), 'lol'); }); - QUnit.test('can opt into a replace query by specifying replace:true in the Router config hash when all configuration lives on route', function() { + test('can opt into a replace query by specifying replace:true in the Router config hash when all configuration lives on route', function() { expect(2); App.ApplicationRoute = Route.extend({ @@ -460,7 +460,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { setAndFlush(appController, 'alex', 'wallace'); }); - QUnit.test('Route query params config can be configured using property name instead of URL key when configured on the route', function() { + test('Route query params config can be configured using property name instead of URL key when configured on the route', function() { expect(2); App.ApplicationRoute = Route.extend({ @@ -481,7 +481,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { setAndFlush(appController, 'commitBy', 'igor_seb'); }); - QUnit.test('An explicit replace:false on a changed QP always wins and causes a pushState even when configuration is all on the route', function() { + test('An explicit replace:false on a changed QP always wins and causes a pushState even when configuration is all on the route', function() { expect(3); App.ApplicationRoute = Route.extend({ @@ -510,7 +510,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(appController, 'setProperties', { alex: 'sriracha' }); }); - QUnit.test('can opt into full transition by setting refreshModel in route queryParams when transitioning from child to parent when all configuration is on route', function() { + test('can opt into full transition by setting refreshModel in route queryParams when transitioning from child to parent when all configuration is on route', function() { App.register('template:parent', compile('{{outlet}}')); App.register('template:parent/child', compile("{{link-to 'Parent' 'parent' (query-params foo='change') id='parent-link'}}")); @@ -545,7 +545,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(parentModelCount, 2); }); - QUnit.test('URL transitions that remove QPs still register as QP changes when configuration lives on the route', function() { + test('URL transitions that remove QPs still register as QP changes when configuration lives on the route', function() { expect(2); App.IndexRoute = Route.extend({ @@ -565,7 +565,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(indexController.get('omg'), 'lol'); }); - QUnit.test('Subresource naming style is supported when configuration is all on the route', function() { + test('Subresource naming style is supported when configuration is all on the route', function() { App.Router.map(function() { this.route('abc.def', { path: '/abcdef' }, function() { this.route('zoo'); @@ -599,7 +599,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/abcdef/zoo?bar=456&foo=123'); }); - QUnit.test('transitionTo supports query params when configuration occurs on the route', function() { + test('transitionTo supports query params when configuration occurs on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -622,7 +622,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=false', 'shorhand supported (bool)'); }); - QUnit.test('transitionTo supports query params (multiple) when configuration occurs on the route', function() { + test('transitionTo supports query params (multiple) when configuration occurs on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -648,7 +648,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=false', 'shorhand supported (bool)'); }); - QUnit.test('A default boolean value deserializes QPs as booleans rather than strings when configuration occurs on the route', function() { + test('A default boolean value deserializes QPs as booleans rather than strings when configuration occurs on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -670,7 +670,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(controller.get('foo'), false); }); - QUnit.test('Query param without value are empty string when configuration occurs on the route', function() { + test('Query param without value are empty string when configuration occurs on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -686,7 +686,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(controller.get('foo'), ''); }); - QUnit.test('Array query params can be set when configured on the route', function() { + test('Array query params can be set when configured on the route', function() { App.Router.map(function() { this.route('home', { path: '/' }); }); @@ -711,7 +711,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=%5B3%2C4%5D'); }); - QUnit.test('(de)serialization: arrays when configuration occurs on the route', function() { + test('(de)serialization: arrays when configuration occurs on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -732,7 +732,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=%5B%5D', 'longform supported'); }); - QUnit.test('Url with array query param sets controller property to array when configuration occurs on the route', function() { + test('Url with array query param sets controller property to array when configuration occurs on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -748,7 +748,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(controller.get('foo'), ['1', '2', '3']); }); - QUnit.test('Url with array query param sets controller property to array when configuration occurs on the route and there is still a controller', function() { + test('Url with array query param sets controller property to array when configuration occurs on the route and there is still a controller', function() { App.IndexController = Controller.extend(); App.IndexRoute = Route.extend({ @@ -766,7 +766,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(controller.get('foo'), ['1', '2', '3']); }); - QUnit.test('Array query params can be pushed/popped when configuration occurs on the route but there is still a controller', function() { + test('Array query params can be pushed/popped when configuration occurs on the route but there is still a controller', function() { App.Router.map(function() { this.route('home', { path: '/' }); }); @@ -813,7 +813,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(controller.foo, ['lol', 1]); }); - QUnit.test('Overwriting with array with same content shouldn\'t refire update when configuration occurs on router but there is still a controller', function() { + test('Overwriting with array with same content shouldn\'t refire update when configuration occurs on router but there is still a controller', function() { expect(3); var modelCount = 0; @@ -843,7 +843,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), ''); }); - QUnit.test('A child of a resource route still defaults to parent route\'s model even if the child route has a query param when configuration occurs on the router', function() { + test('A child of a resource route still defaults to parent route\'s model even if the child route has a query param when configuration occurs on the router', function() { expect(1); App.IndexRoute = Route.extend({ @@ -867,7 +867,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('opting into replace does not affect transitions between routes when configuration occurs on the route', function() { + test('opting into replace does not affect transitions between routes when configuration occurs on the route', function() { expect(5); App.register('template:application', compile( "{{link-to 'Foo' 'foo' id='foo-link'}}" + @@ -908,7 +908,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(jQuery('#bar-link'), 'click'); }); - QUnit.test('Undefined isn\'t deserialized into a string when configuration occurs on the route', function() { + test('Undefined isn\'t deserialized into a string when configuration occurs on the route', function() { expect(3); App.Router.map(function() { this.route('example'); @@ -938,7 +938,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(get(controller, 'foo'), undefined); }); - QUnit.test('query params have been set by the time setupController is called when configuration occurs on the router', function() { + test('query params have been set by the time setupController is called when configuration occurs on the router', function() { expect(1); App.ApplicationRoute = Route.extend({ @@ -956,7 +956,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('query params have been set by the time setupController is called when configuration occurs on the router and there is still a controller', function() { + test('query params have been set by the time setupController is called when configuration occurs on the router and there is still a controller', function() { expect(1); App.ApplicationController = Controller.extend(); @@ -976,7 +976,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('model hooks receives query params when configured on the route', function() { + test('model hooks receives query params when configured on the route', function() { App.IndexRoute = Route.extend({ queryParams: { omg: { @@ -993,7 +993,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), ''); }); - QUnit.test('Routes have overridable serializeQueryParamKey hook when configured on the route', function() { + test('Routes have overridable serializeQueryParamKey hook when configured on the route', function() { App.IndexRoute = Route.extend({ queryParams: { funTimes: { @@ -1012,7 +1012,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?fun-times=woot'); }); - QUnit.test('No replaceURL occurs on startup because default values don\'t show up in URL when configured on the route', function() { + test('No replaceURL occurs on startup because default values don\'t show up in URL when configured on the route', function() { expect(0); App.IndexRoute = Route.extend({ @@ -1028,7 +1028,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test("controllers won't be eagerly instantiated by internal query params logic when configured on the route", function() { + test("controllers won't be eagerly instantiated by internal query params logic when configured on the route", function() { expect(10); App.Router.map(function() { this.route('cats', function() { @@ -1131,7 +1131,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/cats?name=domino', 'url is correct'); }); - QUnit.test('query params have been set by the time setupController is called when configured on the route', function() { + test('query params have been set by the time setupController is called when configured on the route', function() { expect(1); App.ApplicationRoute = Route.extend({ @@ -1149,7 +1149,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('model hooks receives query params (overridden by incoming url value) when configured on the route', function() { + test('model hooks receives query params (overridden by incoming url value) when configured on the route', function() { App.IndexRoute = Route.extend({ queryParams: { omg: { @@ -1167,7 +1167,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?omg=yes'); }); - QUnit.test('Route#paramsFor fetches query params when configured on the route', function() { + test('Route#paramsFor fetches query params when configured on the route', function() { expect(1); App.Router.map(function() { @@ -1189,7 +1189,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('model hook can query prefix-less application params (overridden by incoming url value) when they\'re configured on the route', function() { + test('model hook can query prefix-less application params (overridden by incoming url value) when they\'re configured on the route', function() { App.ApplicationRoute = Route.extend({ queryParams: { appomg: { @@ -1219,7 +1219,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?appomg=appyes&omg=yes'); }); - QUnit.test('Route#paramsFor fetches falsy query params when configured on the route', function() { + test('Route#paramsFor fetches falsy query params when configured on the route', function() { expect(1); App.IndexRoute = Route.extend({ @@ -1237,7 +1237,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('model hook can query prefix-less application params when configured on the route', function() { + test('model hook can query prefix-less application params when configured on the route', function() { App.ApplicationRoute = Route.extend({ queryParams: { appomg: { @@ -1266,7 +1266,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), ''); }); - QUnit.test('can opt into full transition by setting refreshModel in route queryParams when configured on the route', function() { + test('can opt into full transition by setting refreshModel in route queryParams when configured on the route', function() { expect(6); var appModelCount = 0; @@ -1313,7 +1313,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { }); - QUnit.test('can use refreshModel even w URL changes that remove QPs from address bar when configured on the route', function() { + test('can use refreshModel even w URL changes that remove QPs from address bar when configured on the route', function() { expect(4); var indexModelCount = 0; @@ -1346,7 +1346,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(indexController.get('omg'), 'lol'); }); - QUnit.test('can opt into a replace query by specifying replace:true in the Router config hash when configured on the route', function() { + test('can opt into a replace query by specifying replace:true in the Router config hash when configured on the route', function() { expect(2); App.ApplicationRoute = Route.extend({ @@ -1367,7 +1367,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { setAndFlush(appController, 'alex', 'wallace'); }); - QUnit.test('Route query params config can be configured using property name instead of URL key when configured on the route', function() { + test('Route query params config can be configured using property name instead of URL key when configured on the route', function() { expect(2); App.ApplicationRoute = Route.extend({ @@ -1388,7 +1388,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { setAndFlush(appController, 'commitBy', 'igor_seb'); }); - QUnit.test('An explicit replace:false on a changed QP always wins and causes a pushState when configured on the route', function() { + test('An explicit replace:false on a changed QP always wins and causes a pushState when configured on the route', function() { expect(3); App.ApplicationRoute = Route.extend({ @@ -1417,7 +1417,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(appController, 'setProperties', { alex: 'sriracha' }); }); - QUnit.test('can opt into full transition by setting refreshModel in route queryParams when transitioning from child to parent when configured on the route', function() { + test('can opt into full transition by setting refreshModel in route queryParams when transitioning from child to parent when configured on the route', function() { App.register('template:parent', compile('{{outlet}}')); App.register('template:parent.child', compile("{{link-to 'Parent' 'parent' (query-params foo='change') id='parent-link'}}")); @@ -1452,7 +1452,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(parentModelCount, 2); }); - QUnit.test('can override incoming QP values in setupController when configured on the route', function() { + test('can override incoming QP values in setupController when configured on the route', function() { expect(3); App.Router.map(function() { @@ -1483,7 +1483,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?omg=OVERRIDE'); }); - QUnit.test('can override incoming QP array values in setupController when configured on the route', function() { + test('can override incoming QP array values in setupController when configured on the route', function() { expect(3); App.Router.map(function() { @@ -1514,7 +1514,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?omg=' + encodeURIComponent(JSON.stringify(['OVERRIDE']))); }); - QUnit.test('URL transitions that remove QPs still register as QP changes when configured on the route', function() { + test('URL transitions that remove QPs still register as QP changes when configured on the route', function() { expect(2); App.IndexRoute = Route.extend({ @@ -1534,7 +1534,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(indexController.get('omg'), 'lol'); }); - QUnit.test('Subresource naming style is supported when configured on the route', function() { + test('Subresource naming style is supported when configured on the route', function() { App.Router.map(function() { this.route('abc.def', { path: '/abcdef' }, function() { this.route('zoo'); @@ -1570,7 +1570,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/abcdef/zoo?bar=456&foo=123'); }); - QUnit.test('transitionTo supports query params when configured on the route', function() { + test('transitionTo supports query params when configured on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -1593,7 +1593,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=false', 'shorhand supported (bool)'); }); - QUnit.test('transitionTo supports query params (multiple) when configured on the route', function() { + test('transitionTo supports query params (multiple) when configured on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -1619,7 +1619,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=false', 'shorhand supported (bool)'); }); - QUnit.test('setting controller QP to empty string doesn\'t generate null in URL when configured on the route', function() { + test('setting controller QP to empty string doesn\'t generate null in URL when configured on the route', function() { expect(1); App.IndexRoute = Route.extend({ queryParams: { @@ -1636,7 +1636,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { setAndFlush(controller, 'foo', ''); }); - QUnit.test('setting QP to empty string doesn\'t generate null in URL when configured on the route', function() { + test('setting QP to empty string doesn\'t generate null in URL when configured on the route', function() { expect(1); App.IndexRoute = Route.extend({ queryParams: { @@ -1653,7 +1653,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { setAndFlush(controller, 'foo', ''); }); - QUnit.test('A default boolean value deserializes QPs as booleans rather than strings when configured on the route', function() { + test('A default boolean value deserializes QPs as booleans rather than strings when configured on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -1675,7 +1675,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(controller.get('foo'), false); }); - QUnit.test('Query param without value are empty string when configured on the route', function() { + test('Query param without value are empty string when configured on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -1691,7 +1691,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(controller.get('foo'), ''); }); - QUnit.test('Array query params can be set when configured on the route', function() { + test('Array query params can be set when configured on the route', function() { App.Router.map(function() { this.route('home', { path: '/' }); }); @@ -1716,7 +1716,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=%5B3%2C4%5D'); }); - QUnit.test('(de)serialization: arrays when configured on the route', function() { + test('(de)serialization: arrays when configured on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -1737,7 +1737,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=%5B%5D', 'longform supported'); }); - QUnit.test('Url with array query param sets controller property to array when configured on the route', function() { + test('Url with array query param sets controller property to array when configured on the route', function() { App.IndexRoute = Route.extend({ queryParams: { foo: { @@ -1753,7 +1753,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(controller.get('foo'), ['1', '2', '3']); }); - QUnit.test('Array query params can be pushed/popped when configured on the route', function() { + test('Array query params can be pushed/popped when configured on the route', function() { App.Router.map(function() { this.route('home', { path: '/' }); }); @@ -1798,7 +1798,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(controller.foo, ['lol', 1]); }); - QUnit.test('Overwriting with array with same content shouldn\'t refire update when configured on the route', function() { + test('Overwriting with array with same content shouldn\'t refire update when configured on the route', function() { expect(3); var modelCount = 0; @@ -1826,7 +1826,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), ''); }); - QUnit.test('Defaulting to params hash as the model should not result in that params object being watched when configured on the route', function() { + test('Defaulting to params hash as the model should not result in that params object being watched when configured on the route', function() { expect(1); App.Router.map(function() { @@ -1857,7 +1857,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(router, 'transitionTo', 'other'); }); - QUnit.test('A child of a resource route still defaults to parent route\'s model even if the child route has a query param when configured on the route', function() { + test('A child of a resource route still defaults to parent route\'s model even if the child route has a query param when configured on the route', function() { expect(1); App.ApplicationRoute = Route.extend({ @@ -1880,7 +1880,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('opting into replace does not affect transitions between routes when configured on route', function() { + test('opting into replace does not affect transitions between routes when configured on route', function() { expect(5); App.register('template:application', compile( "{{link-to 'Foo' 'foo' id='foo-link'}}" + @@ -1921,7 +1921,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(jQuery('#bar-link'), 'click'); }); - QUnit.test('Undefined isn\'t deserialized into a string when configured on the route', function() { + test('Undefined isn\'t deserialized into a string when configured on the route', function() { expect(3); App.Router.map(function() { this.route('example'); @@ -1949,7 +1949,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(get(controller, 'foo'), undefined); }); - QUnit.test('Changing a query param property on a controller after navigating using a {{link-to}} should preserve the unchanged query params', function() { + test('Changing a query param property on a controller after navigating using a {{link-to}} should preserve the unchanged query params', function() { expect(11); App.Router.map(function() { this.route('example'); @@ -1992,7 +1992,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(get(controller, 'foo'), '456'); }); - QUnit.test('Calling transitionTo does not lose query params already on the activeTransition', function() { + test('Calling transitionTo does not lose query params already on the activeTransition', function() { expect(2); App.Router.map(function() { this.route('parent', function() { @@ -2020,7 +2020,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(parentController.get('foo'), 'lol'); }); } else { - QUnit.test('Calling transitionTo does not lose query params already on the activeTransition', function() { + test('Calling transitionTo does not lose query params already on the activeTransition', function() { expect(2); App.Router.map(function() { this.route('parent', function() { @@ -2049,7 +2049,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(parentController.get('foo'), 'lol'); }); - QUnit.test('Single query params can be set on the controller [DEPRECATED]', function() { + test('Single query params can be set on the controller [DEPRECATED]', function() { App.Router.map(function() { this.route('home', { path: '/' }); }); @@ -2071,7 +2071,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=987'); }); - QUnit.test('Single query params can be set on the controller [DEPRECATED]', function() { + test('Single query params can be set on the controller [DEPRECATED]', function() { App.Router.map(function() { this.route('home', { path: '/' }); }); @@ -2093,7 +2093,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=987'); }); - QUnit.test('Query params can map to different url keys configured on the controller [DEPRECATED]', function() { + test('Query params can map to different url keys configured on the controller [DEPRECATED]', function() { App.IndexController = Controller.extend({ queryParams: [{ foo: 'other_foo', bar: { as: 'other_bar' } }], foo: 'FOO', @@ -2117,7 +2117,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(router, 'transitionTo', '/?other_bar=NERK&other_foo=NAW'); }); - QUnit.test('Routes have overridable serializeQueryParamKey hook', function() { + test('Routes have overridable serializeQueryParamKey hook', function() { App.IndexRoute = Route.extend({ serializeQueryParamKey: dasherize }); @@ -2136,7 +2136,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?fun-times=woot'); }); - QUnit.test('No replaceURL occurs on startup because default values don\'t show up in URL', function() { + test('No replaceURL occurs on startup because default values don\'t show up in URL', function() { expect(0); App.IndexController = Controller.extend({ @@ -2149,7 +2149,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('Can override inherited QP behavior by specifying queryParams as a computed property', function() { + test('Can override inherited QP behavior by specifying queryParams as a computed property', function() { expect(0); var SharedMixin = Mixin.create({ queryParams: ['a'], @@ -2170,7 +2170,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(indexController, 'set', 'a', 1); }); - QUnit.test('model hooks receives query params', function() { + test('model hooks receives query params', function() { App.IndexController = Controller.extend({ queryParams: ['omg'], omg: 'lol' @@ -2187,7 +2187,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), ''); }); - QUnit.test("controllers won't be eagerly instantiated by internal query params logic", function() { + test('controllers won\'t be eagerly instantiated by internal query params logic', function() { expect(10); App.Router.map(function() { this.route('cats', function() { @@ -2279,7 +2279,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/cats?name=domino', 'url is correct'); }); - QUnit.test('query params have been set by the time setupController is called', function() { + test('query params have been set by the time setupController is called', function() { expect(1); App.ApplicationController = Controller.extend({ @@ -2297,7 +2297,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('model hooks receives query params (overridden by incoming url value)', function() { + test('model hooks receives query params (overridden by incoming url value)', function() { App.IndexController = Controller.extend({ queryParams: ['omg'], omg: 'lol' @@ -2315,7 +2315,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?omg=yes'); }); - QUnit.test('Route#paramsFor fetches query params', function() { + test('Route#paramsFor fetches query params', function() { expect(1); App.Router.map(function() { @@ -2337,7 +2337,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('model hook can query prefix-less application params (overridden by incoming url value)', function() { + test('model hook can query prefix-less application params (overridden by incoming url value)', function() { App.ApplicationController = Controller.extend({ queryParams: ['appomg'], appomg: 'applol' @@ -2368,7 +2368,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { }); - QUnit.test('Route#paramsFor fetches falsy query params', function() { + test('Route#paramsFor fetches falsy query params', function() { expect(1); App.IndexController = Controller.extend({ @@ -2386,7 +2386,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('model hook can query prefix-less application params', function() { + test('model hook can query prefix-less application params', function() { App.ApplicationController = Controller.extend({ queryParams: ['appomg'], appomg: 'applol' @@ -2415,7 +2415,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), ''); }); - QUnit.test('can opt into full transition by setting refreshModel in route queryParams', function() { + test('can opt into full transition by setting refreshModel in route queryParams', function() { expect(6); App.ApplicationController = Controller.extend({ queryParams: ['appomg'], @@ -2464,7 +2464,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(indexModelCount, 2); }); - QUnit.test('refreshModel does not cause a second transition during app boot ', function() { + test('refreshModel does not cause a second transition during app boot ', function() { expect(0); App.ApplicationController = Controller.extend({ queryParams: ['appomg'], @@ -2491,7 +2491,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('Use Ember.get to retrieve query params \'refreshModel\' configuration', function() { + test('Use Ember.get to retrieve query params \'refreshModel\' configuration', function() { expect(6); App.ApplicationController = Controller.extend({ queryParams: ['appomg'], @@ -2540,7 +2540,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(indexModelCount, 2); }); - QUnit.test('can use refreshModel even w URL changes that remove QPs from address bar', function() { + test('can use refreshModel even w URL changes that remove QPs from address bar', function() { expect(4); App.IndexController = Controller.extend({ @@ -2577,7 +2577,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(indexController.get('omg'), 'lol'); }); - QUnit.test('can opt into a replace query by specifying replace:true in the Router config hash', function() { + test('can opt into a replace query by specifying replace:true in the Router config hash', function() { expect(2); App.ApplicationController = Controller.extend({ queryParams: ['alex'], @@ -2601,7 +2601,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { setAndFlush(appController, 'alex', 'wallace'); }); - QUnit.test('Route query params config can be configured using property name instead of URL key', function() { + test('Route query params config can be configured using property name instead of URL key', function() { expect(2); App.ApplicationController = Controller.extend({ queryParams: [ @@ -2627,7 +2627,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { }); - QUnit.test('An explicit replace:false on a changed QP always wins and causes a pushState', function() { + test('An explicit replace:false on a changed QP always wins and causes a pushState', function() { expect(3); App.ApplicationController = Controller.extend({ queryParams: ['alex', 'steely'], @@ -2659,7 +2659,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(appController, 'setProperties', { alex: 'sriracha' }); }); - QUnit.test('can opt into full transition by setting refreshModel in route queryParams when transitioning from child to parent', function() { + test('can opt into full transition by setting refreshModel in route queryParams when transitioning from child to parent', function() { App.register('template:parent', compile('{{outlet}}')); App.register('template:parent.child', compile('{{link-to \'Parent\' \'parent\' (query-params foo=\'change\') id=\'parent-link\'}}')); @@ -2698,7 +2698,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(parentModelCount, 2); }); - QUnit.test('Use Ember.get to retrieve query params \'replace\' configuration', function() { + test('Use Ember.get to retrieve query params \'replace\' configuration', function() { expect(2); App.ApplicationController = Controller.extend({ queryParams: ['alex'], @@ -2723,7 +2723,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { setAndFlush(appController, 'alex', 'wallace'); }); - QUnit.test('can override incoming QP values in setupController', function() { + test('can override incoming QP values in setupController', function() { expect(3); App.Router.map(function() { @@ -2754,7 +2754,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?omg=OVERRIDE'); }); - QUnit.test('can override incoming QP array values in setupController', function() { + test('can override incoming QP array values in setupController', function() { expect(3); App.Router.map(function() { @@ -2785,7 +2785,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?omg=' + encodeURIComponent(JSON.stringify(['OVERRIDE']))); }); - QUnit.test('URL transitions that remove QPs still register as QP changes', function() { + test('URL transitions that remove QPs still register as QP changes', function() { expect(2); App.IndexController = Controller.extend({ @@ -2802,7 +2802,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(indexController.get('omg'), 'lol'); }); - QUnit.test('Subresource naming style is supported', function() { + test('Subresource naming style is supported', function() { App.Router.map(function() { this.route('abc.def', { path: '/abcdef' }, function() { this.route('zoo'); @@ -2832,7 +2832,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/abcdef/zoo?bar=456&foo=123'); }); - QUnit.test('transitionTo supports query params', function() { + test('transitionTo supports query params', function() { App.IndexController = Controller.extend({ queryParams: ['foo'], foo: 'lol' @@ -2852,7 +2852,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=false', 'shorhand supported (bool)'); }); - QUnit.test('transitionTo supports query params (multiple)', function() { + test('transitionTo supports query params (multiple)', function() { App.IndexController = Controller.extend({ queryParams: ['foo', 'bar'], foo: 'lol', @@ -2873,7 +2873,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=false', 'shorhand supported (bool)'); }); - QUnit.test('setting controller QP to empty string doesn\'t generate null in URL', function() { + test('setting controller QP to empty string doesn\'t generate null in URL', function() { expect(1); App.IndexController = Controller.extend({ queryParams: ['foo'], @@ -2887,7 +2887,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { setAndFlush(controller, 'foo', ''); }); - QUnit.test('setting QP to empty string doesn\'t generate null in URL', function() { + test('setting QP to empty string doesn\'t generate null in URL', function() { expect(1); App.IndexRoute = Route.extend({ queryParams: { @@ -2904,7 +2904,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { setAndFlush(controller, 'foo', ''); }); - QUnit.test('A default boolean value deserializes QPs as booleans rather than strings', function() { + test('A default boolean value deserializes QPs as booleans rather than strings', function() { App.IndexController = Controller.extend({ queryParams: ['foo'], foo: false @@ -2926,7 +2926,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(controller.get('foo'), false); }); - QUnit.test('Query param without value are empty string', function() { + test('Query param without value are empty string', function() { App.IndexController = Controller.extend({ queryParams: ['foo'], foo: '' @@ -2939,7 +2939,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(controller.get('foo'), ''); }); - QUnit.test('Array query params can be set', function() { + test('Array query params can be set', function() { App.Router.map(function() { this.route('home', { path: '/' }); }); @@ -2961,7 +2961,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=%5B3%2C4%5D'); }); - QUnit.test('(de)serialization: arrays', function() { + test('(de)serialization: arrays', function() { App.IndexController = Controller.extend({ queryParams: ['foo'], foo: [1] @@ -2979,7 +2979,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), '/?foo=%5B%5D', 'longform supported'); }); - QUnit.test('Url with array query param sets controller property to array', function() { + test('Url with array query param sets controller property to array', function() { App.IndexController = Controller.extend({ queryParams: ['foo'], foo: '' @@ -2992,7 +2992,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(controller.get('foo'), ['1', '2', '3']); }); - QUnit.test('Array query params can be pushed/popped', function() { + test('Array query params can be pushed/popped', function() { App.Router.map(function() { this.route('home', { path: '/' }); }); @@ -3034,7 +3034,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { deepEqual(controller.foo, ['lol', 1]); }); - QUnit.test('Overwriting with array with same content shouldn\'t refire update', function() { + test('Overwriting with array with same content shouldn\'t refire update', function() { expect(3); var modelCount = 0; @@ -3062,7 +3062,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { equal(router.get('location.path'), ''); }); - QUnit.test('Defaulting to params hash as the model should not result in that params object being watched', function() { + test('Defaulting to params hash as the model should not result in that params object being watched', function() { expect(1); App.Router.map(function() { @@ -3090,7 +3090,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(router, 'transitionTo', 'other'); }); - QUnit.test('A child of a resource route still defaults to parent route\'s model even if the child route has a query param', function() { + test('A child of a resource route still defaults to parent route\'s model even if the child route has a query param', function() { expect(1); App.IndexController = Controller.extend({ @@ -3112,7 +3112,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { bootApplication(); }); - QUnit.test('opting into replace does not affect transitions between routes', function() { + test('opting into replace does not affect transitions between routes', function() { expect(5); App.register('template:application', compile( '{{link-to \'Foo\' \'foo\' id=\'foo-link\'}}' + @@ -3157,7 +3157,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { run(jQuery('#bar-link'), 'click'); }); - QUnit.test('Undefined isn\'t deserialized into a string', function() { + test('Undefined isn\'t deserialized into a string', function() { expect(3); App.Router.map(function() { this.route('example'); @@ -3187,7 +3187,7 @@ if (isEnabled('ember-routing-route-configured-query-params')) { }); } -QUnit.test('warn user that routes query params configuration must be an Object, not an Array', function() { +test('warn user that routes query params configuration must be an Object, not an Array', function() { expect(1); App.ApplicationRoute = Route.extend({ @@ -3201,7 +3201,7 @@ QUnit.test('warn user that routes query params configuration must be an Object, }, 'You passed in `[{"commitBy":{"replace":true}}]` as the value for `queryParams` but `queryParams` cannot be an Array'); }); -QUnit.test('handle routes names that clash with Object.prototype properties', function() { +test('handle routes names that clash with Object.prototype properties', function() { expect(1); App.Router.map(function() { @@ -3223,5 +3223,3 @@ QUnit.test('handle routes names that clash with Object.prototype properties', fu var controller = container.lookup('controller:constructor'); equal(get(controller, 'foo'), '999'); }); - -} diff --git a/packages/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js b/packages/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js index cc3d7d67fc6..ebac99d0870 100644 --- a/packages/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js +++ b/packages/ember/tests/routing/query_params_test/model_dependent_state_with_query_params_test.js @@ -330,10 +330,9 @@ function queryParamsStickyTest6(urlPrefix, articleLookup, commentsLookup) { }; } -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('Model Dep Query Params', { +testModule('Model Dep Query Params', { setup() { sharedSetup(); @@ -410,19 +409,19 @@ QUnit.module('Model Dep Query Params', { } }); -QUnit.test('query params have \'model\' stickiness by default', queryParamsStickyTest1('/a')); +test('query params have \'model\' stickiness by default', queryParamsStickyTest1('/a')); -QUnit.test('query params have \'model\' stickiness by default (url changes)', queryParamsStickyTest2('/a')); +test('query params have \'model\' stickiness by default (url changes)', queryParamsStickyTest2('/a')); -QUnit.test('query params have \'model\' stickiness by default (params-based transitions)', queryParamsStickyTest3('/a', 'article')); +test('query params have \'model\' stickiness by default (params-based transitions)', queryParamsStickyTest3('/a', 'article')); -QUnit.test('\'controller\' stickiness shares QP state between models', queryParamsStickyTest4('/a', 'article')); +test('\'controller\' stickiness shares QP state between models', queryParamsStickyTest4('/a', 'article')); -QUnit.test('\'model\' stickiness is scoped to current or first dynamic parent route', queryParamsStickyTest5('/a', 'comments')); +test('\'model\' stickiness is scoped to current or first dynamic parent route', queryParamsStickyTest5('/a', 'comments')); -QUnit.test('can reset query params using the resetController hook', queryParamsStickyTest6('/a', 'article', 'comments')); +test('can reset query params using the resetController hook', queryParamsStickyTest6('/a', 'article', 'comments')); -QUnit.module('Model Dep Query Params (nested)', { +testModule('Model Dep Query Params (nested)', { setup() { sharedSetup(); @@ -500,19 +499,19 @@ QUnit.module('Model Dep Query Params (nested)', { } }); -QUnit.test('query params have \'model\' stickiness by default', queryParamsStickyTest1('/site/a')); +test('query params have \'model\' stickiness by default', queryParamsStickyTest1('/site/a')); -QUnit.test('query params have \'model\' stickiness by default (url changes)', queryParamsStickyTest2('/site/a')); +test('query params have \'model\' stickiness by default (url changes)', queryParamsStickyTest2('/site/a')); -QUnit.test('query params have \'model\' stickiness by default (params-based transitions)', queryParamsStickyTest3('/site/a', 'site.article')); +test('query params have \'model\' stickiness by default (params-based transitions)', queryParamsStickyTest3('/site/a', 'site.article')); -QUnit.test('\'controller\' stickiness shares QP state between models', queryParamsStickyTest4('/site/a', 'site.article')); +test('\'controller\' stickiness shares QP state between models', queryParamsStickyTest4('/site/a', 'site.article')); -QUnit.test('\'model\' stickiness is scoped to current or first dynamic parent route', queryParamsStickyTest5('/site/a', 'site.article.comments')); +test('\'model\' stickiness is scoped to current or first dynamic parent route', queryParamsStickyTest5('/site/a', 'site.article.comments')); -QUnit.test('can reset query params using the resetController hook', queryParamsStickyTest6('/site/a', 'site.article', 'site.article.comments')); +test('can reset query params using the resetController hook', queryParamsStickyTest6('/site/a', 'site.article', 'site.article.comments')); -QUnit.module('Model Dep Query Params (nested & more than 1 dynamic segment)', { +testModule('Model Dep Query Params (nested & more than 1 dynamic segment)', { setup() { sharedSetup(); @@ -638,7 +637,7 @@ QUnit.module('Model Dep Query Params (nested & more than 1 dynamic segment)', { } }); -QUnit.test('query params have \'model\' stickiness by default', function() { +test('query params have \'model\' stickiness by default', function() { this.boot(); run(this.links['s-1-a-1'], 'click'); @@ -705,7 +704,7 @@ QUnit.test('query params have \'model\' stickiness by default', function() { equal(this.links['s-3-a-3'].attr('href'), '/site/s-3/a/a-3'); }); -QUnit.test('query params have \'model\' stickiness by default (url changes)', function() { +test('query params have \'model\' stickiness by default (url changes)', function() { this.boot(); this.expectedSiteModelHookParams = { site_id: 's-1', country: 'au' }; @@ -804,7 +803,7 @@ QUnit.test('query params have \'model\' stickiness by default (url changes)', fu equal(this.links['s-3-a-3'].attr('href'), '/site/s-3/a/a-3?country=nz&q=lol&z=123'); }); -QUnit.test('query params have \'model\' stickiness by default (params-based transitions)', function() { +test('query params have \'model\' stickiness by default (params-based transitions)', function() { this.boot(); this.expectedSiteModelHookParams = { site_id: 's-1', country: 'au' }; @@ -940,5 +939,3 @@ QUnit.test('query params have \'model\' stickiness by default (params-based tran equal(this.links['s-3-a-2'].attr('href'), '/site/s-3/a/a-2?country=nz&q=lol&z=1'); equal(this.links['s-3-a-3'].attr('href'), '/site/s-3/a/a-3?country=nz&q=hay&z=3'); }); - -} diff --git a/packages/ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js b/packages/ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js index 41b4c0c17f5..ac313081bc6 100644 --- a/packages/ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js +++ b/packages/ember/tests/routing/query_params_test/query_params_paramless_link_to_test.js @@ -82,10 +82,9 @@ function sharedTeardown() { }); } -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.module('Routing with Query Params', { +testModule('Routing with Query Params', { setup() { sharedSetup(); }, @@ -98,7 +97,7 @@ QUnit.module('Routing with Query Params', { var startingURL = ''; var testParamlessLinks = function(routeName) { - QUnit.test('param-less links in an app booted with query params in the URL don\'t reset the query params: ' + routeName, function() { + test('param-less links in an app booted with query params in the URL don\'t reset the query params: ' + routeName, function() { expect(1); setTemplate(routeName, compile('{{link-to \'index\' \'index\' id=\'index-link\'}}')); @@ -116,7 +115,7 @@ var testParamlessLinks = function(routeName) { }; var testParamlessLinksWithRouteConfig = function(routeName) { - QUnit.test('param-less links in an app booted with query params in the URL don\'t reset the query params: ' + routeName, function() { + test('param-less links in an app booted with query params in the URL don\'t reset the query params: ' + routeName, function() { expect(1); setTemplate(routeName, compile('{{link-to \'index\' \'index\' id=\'index-link\'}}')); @@ -143,5 +142,3 @@ if (isEnabled('ember-routing-route-configured-query-params')) { testParamlessLinks('application'); testParamlessLinks('index'); } - -} diff --git a/packages/ember/tests/routing/substates_test.js b/packages/ember/tests/routing/substates_test.js index 15ab0b270f0..0f0af0b1ced 100644 --- a/packages/ember/tests/routing/substates_test.js +++ b/packages/ember/tests/routing/substates_test.js @@ -739,11 +739,9 @@ QUnit.test('Setting a query param during a slow transition should work', functio equal(appController.get('currentPath'), 'grandma.index', 'Transition should be complete'); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('Slow promises returned from ApplicationRoute#model enter ApplicationLoadingRoute if present', function() { +test('Slow promises returned from ApplicationRoute#model enter ApplicationLoadingRoute if present', function() { expect(2); var appDeferred = RSVP.defer(); @@ -769,7 +767,7 @@ QUnit.test('Slow promises returned from ApplicationRoute#model enter Application equal(jQuery('#app', '#qunit-fixture').text(), 'INDEX'); }); -QUnit.test('Slow promises returned from ApplicationRoute#model enter application_loading if template present', function() { +test('Slow promises returned from ApplicationRoute#model enter application_loading if template present', function() { expect(3); templates['application_loading'] = 'TOPLEVEL LOADING'; @@ -802,8 +800,6 @@ QUnit.test('Slow promises returned from ApplicationRoute#model enter application equal(jQuery('#app', '#qunit-fixture').text(), 'INDEX'); }); -} - QUnit.test('Default error event moves into nested route, prioritizing more specifically named error route', function() { expect(6); @@ -1010,10 +1006,7 @@ QUnit.test('Prioritized error substate entry works with auto-generated index rou equal(jQuery('#app', '#qunit-fixture').text(), 'FOO ERROR: did it broke?', 'foo.index_error was entered'); }); -if (!isEnabled('ember-glimmer')) { - // jscs:disable - -QUnit.test('Rejected promises returned from ApplicationRoute transition into top-level application_error', function() { +test('Rejected promises returned from ApplicationRoute transition into top-level application_error', function() { expect(3); templates['application_error'] = '

TOPLEVEL ERROR: {{model.msg}}

'; @@ -1040,5 +1033,3 @@ QUnit.test('Rejected promises returned from ApplicationRoute transition into top equal(jQuery('#app', '#qunit-fixture').text(), 'INDEX'); }); - -} diff --git a/packages/ember/tests/routing/toplevel_dom_test.js b/packages/ember/tests/routing/toplevel_dom_test.js index a06320fb92a..6de2070cb2b 100644 --- a/packages/ember/tests/routing/toplevel_dom_test.js +++ b/packages/ember/tests/routing/toplevel_dom_test.js @@ -56,16 +56,12 @@ QUnit.test('Topmost template always get an element', function() { equal(jQuery('#qunit-fixture > .ember-view').text(), 'hello world'); }); -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable +import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer'; -QUnit.test('If topmost view has its own element, it doesn\'t get wrapped in a higher element', function() { +test('If topmost view has its own element, it doesn\'t get wrapped in a higher element', function() { App.register('view:application', EmberView.extend({ classNames: ['im-special'] })); bootApplication(); equal(jQuery('#qunit-fixture > .im-special').text(), 'hello world'); }); - -} diff --git a/packages/ember/tests/view_instrumentation_test.js b/packages/ember/tests/view_instrumentation_test.js index 2ebd936cd2a..625a2769c88 100644 --- a/packages/ember/tests/view_instrumentation_test.js +++ b/packages/ember/tests/view_instrumentation_test.js @@ -4,6 +4,7 @@ import Application from 'ember-application/system/application'; import { subscribe, unsubscribe } from 'ember-metal/instrumentation'; import { compile } from 'ember-template-compiler'; import { setTemplates, set as setTemplate } from 'ember-htmlbars/template_registry'; +import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer'; var App, $fixture; @@ -23,12 +24,8 @@ function handleURL(path) { return run(router, 'handleURL', path); } -import isEnabled from 'ember-metal/features'; -if (!isEnabled('ember-glimmer')) { - // jscs:disable - let subscriber; -QUnit.module('View Instrumentation', { +testModule('View Instrumentation', { setup() { run(function() { App = Application.create({ @@ -55,7 +52,7 @@ QUnit.module('View Instrumentation', { } }); -QUnit.test('Nodes without view instances are instrumented', function(assert) { +test('Nodes without view instances are instrumented', function(assert) { var called = false; subscriber = subscribe('render', { before() { @@ -69,5 +66,3 @@ QUnit.test('Nodes without view instances are instrumented', function(assert) { handleURL('/posts'); assert.ok(called, 'instrumentation called on transition to non-view backed route'); }); - -}