Skip to content

Commit

Permalink
[Glimmer 2] Skip tests instead of bailing (#13457)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadhietala authored and krisselden committed May 6, 2016
1 parent 714b3d7 commit b125ff5
Show file tree
Hide file tree
Showing 75 changed files with 989 additions and 1,284 deletions.
8 changes: 2 additions & 6 deletions packages/ember-application/tests/system/application_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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('<script type="text/x-handlebars">Hello World</script>');
run(function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand All @@ -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');
});
Expand Down
8 changes: 2 additions & 6 deletions packages/ember-application/tests/system/logging_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
8 changes: 2 additions & 6 deletions packages/ember-application/tests/system/reset_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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;

Expand Down
12 changes: 4 additions & 8 deletions packages/ember-application/tests/system/visit_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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());
Expand All @@ -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;

Expand Down Expand Up @@ -526,5 +524,3 @@ QUnit.skip('Test setup', function(assert) {

QUnit.skip('iframe setup', function(assert) {
});

}
23 changes: 23 additions & 0 deletions packages/ember-glimmer/tests/utils/skip-if-glimmer.js
Original file line number Diff line number Diff line change
@@ -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);
}
}
20 changes: 8 additions & 12 deletions packages/ember-htmlbars/tests/attr_nodes/boolean_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@ 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);
}
}
});

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('<input disabled={{isDisabled}}>')
Expand All @@ -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('<input disabled={{isDisabled}}>')
Expand All @@ -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('<input disabled={{isDisabled}}>')
Expand All @@ -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('<input disabled={{isDisabled}}>')
Expand All @@ -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('<input disabled=\'{{isDisabled}}\'>')
Expand All @@ -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('<input disabled=\'{{isDisabled}}\'>')
Expand All @@ -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');
});

}
41 changes: 18 additions & 23 deletions packages/ember-htmlbars/tests/attr_nodes/data_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<div data-name={{name}}>Hi!</div>')
Expand All @@ -29,7 +26,7 @@ QUnit.test('property is output', function() {
equalInnerHTML(view.element, '<div data-name="erik">Hi!</div>', 'attribute is output');
});

QUnit.test('property set before didInsertElement', function() {
test('property set before didInsertElement', function() {
var matchingElement;
view = EmberView.create({
didInsertElement() {
Expand All @@ -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('<div data-name=\'{{firstName}} {{lastName}}\'>Hi!</div>')
Expand All @@ -54,7 +51,7 @@ QUnit.test('quoted attributes are concatenated', function() {
equalInnerHTML(view.element, '<div data-name="max jackson">Hi!</div>', '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('<div data-name=\'{{firstName}} {{lastName}}\'>Hi!</div>')
Expand All @@ -68,7 +65,7 @@ QUnit.test('quoted attributes are updated when changed', function() {
equalInnerHTML(view.element, '<div data-name="james jackson">Hi!</div>', '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('<div data-name=\'{{firstName}}\'>Hi!</div>')
Expand All @@ -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('<div data-name={{firstName}}>Hi!</div>')
Expand All @@ -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('<div data-name={{firstName}}>Hi!</div>')
Expand All @@ -106,7 +103,7 @@ QUnit.test('unquoted attributes that are null are not added', function() {
equalInnerHTML(view.element, '<div>Hi!</div>', '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('<div data-name={{firstName}}>Hi!</div>')
Expand All @@ -120,7 +117,7 @@ QUnit.test('unquoted attributes are added when changing from null', function() {
equalInnerHTML(view.element, '<div data-name="max">Hi!</div>', '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('<div data-name={{name}}>Hi!</div>')
Expand All @@ -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('<div data-name={{name.firstName}}>Hi!</div>')
Expand All @@ -140,7 +137,7 @@ QUnit.test('path is output', function() {
equalInnerHTML(view.element, '<div data-name="erik">Hi!</div>', '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,
Expand All @@ -155,7 +152,7 @@ QUnit.test('changed property updates', function() {
equalInnerHTML(view.element, '<div data-name="mmun">Hi!</div>', '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' });
Expand All @@ -182,7 +179,7 @@ QUnit.test('updates are scheduled in the render queue', function() {
equalInnerHTML(view.element, '<div data-name="mmun">Hi!</div>', '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,
Expand All @@ -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 });

Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -260,5 +257,3 @@ QUnit.test('does not call setAttribute if the same value is set', function() {

deepEqual(setAttributeCalls, expected);
});

}
Loading

0 comments on commit b125ff5

Please sign in to comment.