Skip to content

Commit b125ff5

Browse files
chadhietalakrisselden
authored andcommitted
[Glimmer 2] Skip tests instead of bailing (#13457)
1 parent 714b3d7 commit b125ff5

File tree

75 files changed

+989
-1284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+989
-1284
lines changed

packages/ember-application/tests/system/application_test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,9 @@ QUnit.test('initialize application with stateManager via initialize call from Ro
226226
equal(jQuery('#qunit-fixture h1').text(), 'Hello!');
227227
});
228228

229-
import isEnabled from 'ember-metal/features';
230-
if (!isEnabled('ember-glimmer')) {
231-
// jscs:disable
229+
import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer';
232230

233-
QUnit.test('ApplicationView is inserted into the page', function() {
231+
test('ApplicationView is inserted into the page', function() {
234232
run(function() {
235233
app = Application.create({
236234
rootElement: '#qunit-fixture'
@@ -250,8 +248,6 @@ QUnit.test('ApplicationView is inserted into the page', function() {
250248
equal(jQuery('#qunit-fixture h1').text(), 'Hello!');
251249
});
252250

253-
}
254-
255251
QUnit.test('Minimal Application initialized with just an application template', function() {
256252
jQuery('#qunit-fixture').html('<script type="text/x-handlebars">Hello World</script>');
257253
run(function () {

packages/ember-application/tests/system/dependency_injection/default_resolver_test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,9 @@ QUnit.test('the default resolver can look things up in other namespaces', functi
4949
ok(nav instanceof UserInterface.NavigationController, 'the result should be an instance of the specified class');
5050
});
5151

52-
import isEnabled from 'ember-metal/features';
53-
if (!isEnabled('ember-glimmer')) {
54-
// jscs:disable
52+
import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer';
5553

56-
QUnit.test('the default resolver looks up templates in Ember.TEMPLATES', function() {
54+
test('the default resolver looks up templates in Ember.TEMPLATES', function() {
5755
function fooTemplate() {}
5856
function fooBarTemplate() {}
5957
function fooBarBazTemplate() {}
@@ -67,8 +65,6 @@ QUnit.test('the default resolver looks up templates in Ember.TEMPLATES', functio
6765
equal(locator.lookup('template:fooBar.baz'), fooBarBazTemplate, 'resolves template:foo_bar.baz');
6866
});
6967

70-
}
71-
7268
QUnit.test('the default resolver looks up basic name as no prefix', function() {
7369
ok(Controller.detect(locator.lookup('controller:basic')), 'locator looks up correct controller');
7470
});

packages/ember-application/tests/system/logging_test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,9 @@ QUnit.test('do not log when template and view are missing when flag is not true'
205205
});
206206
});
207207

208-
import isEnabled from 'ember-metal/features';
209-
if (!isEnabled('ember-glimmer')) {
210-
// jscs:disable
208+
import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer';
211209

212-
QUnit.test('log which view is used with a template', function() {
210+
test('log which view is used with a template', function() {
213211
if (EmberDev && EmberDev.runningProdBuild) {
214212
ok(true, 'Logging does not occur in production builds');
215213
return;
@@ -227,8 +225,6 @@ QUnit.test('log which view is used with a template', function() {
227225
});
228226
});
229227

230-
}
231-
232228
QUnit.test('do not log which views are used with templates when flag is not true', function() {
233229
App.reopen({
234230
LOG_VIEW_LOOKUPS: false

packages/ember-application/tests/system/reset_test.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,9 @@ QUnit.test('When an application is reset, the eventDispatcher is destroyed and r
129129
Registry.prototype.register = originalRegister;
130130
});
131131

132-
import isEnabled from 'ember-metal/features';
133-
if (!isEnabled('ember-glimmer')) {
134-
// jscs:disable
132+
import { test } from 'ember-glimmer/tests/utils/skip-if-glimmer';
135133

136-
QUnit.test('When an application is reset, the ApplicationView is torn down', function() {
134+
test('When an application is reset, the ApplicationView is torn down', function() {
137135
run(function() {
138136
application = Application.create();
139137
application.ApplicationView = View.extend({
@@ -154,8 +152,6 @@ QUnit.test('When an application is reset, the ApplicationView is torn down', fun
154152
notStrictEqual(originalView, resettedView, 'The view object has changed');
155153
});
156154

157-
}
158-
159155
QUnit.test('When an application is reset, the router URL is reset to `/`', function() {
160156
var location, router;
161157

packages/ember-application/tests/system/visit_test.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,9 @@ QUnit.test('visit() returns a promise that resolves when the view has rendered',
340340
});
341341
});
342342

343-
import isEnabled from 'ember-metal/features';
344-
if (!isEnabled('ember-glimmer')) {
345-
// jscs:disable
343+
import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer';
346344

347-
QUnit.test('Views created via visit() are not added to the global views hash', function(assert) {
345+
test('Views created via visit() are not added to the global views hash', function(assert) {
348346
run(function() {
349347
createApplication();
350348

@@ -376,7 +374,7 @@ QUnit.test('Views created via visit() are not added to the global views hash', f
376374
});
377375

378376

379-
QUnit.module('Ember.Application - visit() Integration Tests', {
377+
testModule('Ember.Application - visit() Integration Tests', {
380378
teardown() {
381379
if (instances) {
382380
run(instances, 'forEach', (i) => i.destroy());
@@ -390,7 +388,7 @@ QUnit.module('Ember.Application - visit() Integration Tests', {
390388
}
391389
});
392390

393-
QUnit.test('Ember Islands-style setup', function(assert) {
391+
test('Ember Islands-style setup', function(assert) {
394392
let xFooInitCalled = false;
395393
let xFooDidInsertElementCalled = false;
396394

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

527525
QUnit.skip('iframe setup', function(assert) {
528526
});
529-
530-
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import isEnabled from 'ember-metal/features';
2+
3+
export function test(name, fn) {
4+
if (isEnabled('ember-glimmer')) {
5+
QUnit.skip('[GLIMMER] ' + name, fn);
6+
} else {
7+
QUnit.test(name, fn);
8+
}
9+
}
10+
11+
export function testModule(name, setup) {
12+
if (!isEnabled('ember-glimmer')) {
13+
QUnit.module(name, setup);
14+
}
15+
}
16+
17+
export function asyncTest(name, fn) {
18+
if (isEnabled('ember-glimmer')) {
19+
QUnit.skip('[GLIMMER] ' + name, fn);
20+
} else {
21+
QUnit.asyncTest(name, fn);
22+
}
23+
}

packages/ember-htmlbars/tests/attr_nodes/boolean_test.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@ function appendView(view) {
99
run(function() { view.appendTo('#qunit-fixture'); });
1010
}
1111

12-
import isEnabled from 'ember-metal/features';
13-
if (!isEnabled('ember-glimmer')) {
14-
// jscs:disable
12+
import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer';
1513

16-
QUnit.module('ember-htmlbars: boolean attribute', {
14+
testModule('ember-htmlbars: boolean attribute', {
1715
teardown() {
1816
if (view) {
1917
run(view, view.destroy);
2018
}
2119
}
2220
});
2321

24-
QUnit.test('disabled property can be set true', function() {
22+
test('disabled property can be set true', function() {
2523
view = EmberView.create({
2624
context: { isDisabled: true },
2725
template: compile('<input disabled={{isDisabled}}>')
@@ -33,7 +31,7 @@ QUnit.test('disabled property can be set true', function() {
3331
'boolean property is set true');
3432
});
3533

36-
QUnit.test('disabled property can be set false with a blank string', function() {
34+
test('disabled property can be set false with a blank string', function() {
3735
view = EmberView.create({
3836
context: { isDisabled: '' },
3937
template: compile('<input disabled={{isDisabled}}>')
@@ -45,7 +43,7 @@ QUnit.test('disabled property can be set false with a blank string', function()
4543
'boolean property is set false');
4644
});
4745

48-
QUnit.test('disabled property can be set false', function() {
46+
test('disabled property can be set false', function() {
4947
view = EmberView.create({
5048
context: { isDisabled: false },
5149
template: compile('<input disabled={{isDisabled}}>')
@@ -58,7 +56,7 @@ QUnit.test('disabled property can be set false', function() {
5856
'boolean property is set false');
5957
});
6058

61-
QUnit.test('disabled property can be set true with a string', function() {
59+
test('disabled property can be set true with a string', function() {
6260
view = EmberView.create({
6361
context: { isDisabled: 'oh, no a string' },
6462
template: compile('<input disabled={{isDisabled}}>')
@@ -70,7 +68,7 @@ QUnit.test('disabled property can be set true with a string', function() {
7068
'boolean property is set true');
7169
});
7270

73-
QUnit.test('disabled attribute turns a value to a string', function() {
71+
test('disabled attribute turns a value to a string', function() {
7472
view = EmberView.create({
7573
context: { isDisabled: false },
7674
template: compile('<input disabled=\'{{isDisabled}}\'>')
@@ -82,7 +80,7 @@ QUnit.test('disabled attribute turns a value to a string', function() {
8280
'boolean property is set true');
8381
});
8482

85-
QUnit.test('disabled attribute preserves a blank string value', function() {
83+
test('disabled attribute preserves a blank string value', function() {
8684
view = EmberView.create({
8785
context: { isDisabled: '' },
8886
template: compile('<input disabled=\'{{isDisabled}}\'>')
@@ -94,5 +92,3 @@ QUnit.test('disabled attribute preserves a blank string value', function() {
9492
equal(view.element.firstChild.disabled, false,
9593
'boolean property is set false');
9694
});
97-
98-
}

packages/ember-htmlbars/tests/attr_nodes/data_test.js

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@ import { InteractiveRenderer } from 'ember-metal-views';
66
import { equalInnerHTML } from 'htmlbars-test-helpers';
77
import { domHelper as dom } from 'ember-htmlbars/env';
88
import { runAppend, runDestroy } from 'ember-runtime/tests/utils';
9+
import { test, testModule } from 'ember-glimmer/tests/utils/skip-if-glimmer';
910

1011
var view, originalSetAttribute, setAttributeCalls, renderer;
1112

12-
import isEnabled from 'ember-metal/features';
13-
if (!isEnabled('ember-glimmer')) {
14-
// jscs:disable
15-
16-
QUnit.module('ember-htmlbars: data attribute', {
13+
testModule('ember-htmlbars: data attribute', {
1714
teardown() {
1815
runDestroy(view);
1916
}
2017
});
2118

22-
QUnit.test('property is output', function() {
19+
test('property is output', function() {
2320
view = EmberView.create({
2421
context: { name: 'erik' },
2522
template: compile('<div data-name={{name}}>Hi!</div>')
@@ -29,7 +26,7 @@ QUnit.test('property is output', function() {
2926
equalInnerHTML(view.element, '<div data-name="erik">Hi!</div>', 'attribute is output');
3027
});
3128

32-
QUnit.test('property set before didInsertElement', function() {
29+
test('property set before didInsertElement', function() {
3330
var matchingElement;
3431
view = EmberView.create({
3532
didInsertElement() {
@@ -44,7 +41,7 @@ QUnit.test('property set before didInsertElement', function() {
4441
equal(matchingElement.length, 1, 'element is in the DOM when didInsertElement');
4542
});
4643

47-
QUnit.test('quoted attributes are concatenated', function() {
44+
test('quoted attributes are concatenated', function() {
4845
view = EmberView.create({
4946
context: { firstName: 'max', lastName: 'jackson' },
5047
template: compile('<div data-name=\'{{firstName}} {{lastName}}\'>Hi!</div>')
@@ -54,7 +51,7 @@ QUnit.test('quoted attributes are concatenated', function() {
5451
equalInnerHTML(view.element, '<div data-name="max jackson">Hi!</div>', 'attribute is output');
5552
});
5653

57-
QUnit.test('quoted attributes are updated when changed', function() {
54+
test('quoted attributes are updated when changed', function() {
5855
view = EmberView.create({
5956
context: { firstName: 'max', lastName: 'jackson' },
6057
template: compile('<div data-name=\'{{firstName}} {{lastName}}\'>Hi!</div>')
@@ -68,7 +65,7 @@ QUnit.test('quoted attributes are updated when changed', function() {
6865
equalInnerHTML(view.element, '<div data-name="james jackson">Hi!</div>', 'attribute is output');
6966
});
7067

71-
QUnit.test('quoted attributes are not removed when value is null', function() {
68+
test('quoted attributes are not removed when value is null', function() {
7269
view = EmberView.create({
7370
context: { firstName: 'max', lastName: 'jackson' },
7471
template: compile('<div data-name=\'{{firstName}}\'>Hi!</div>')
@@ -82,7 +79,7 @@ QUnit.test('quoted attributes are not removed when value is null', function() {
8279
equal(view.element.firstChild.getAttribute('data-name'), '', 'attribute is output');
8380
});
8481

85-
QUnit.test('unquoted attributes are removed when value is null', function() {
82+
test('unquoted attributes are removed when value is null', function() {
8683
view = EmberView.create({
8784
context: { firstName: 'max' },
8885
template: compile('<div data-name={{firstName}}>Hi!</div>')
@@ -96,7 +93,7 @@ QUnit.test('unquoted attributes are removed when value is null', function() {
9693
ok(!view.element.firstChild.hasAttribute('data-name'), 'attribute is removed output');
9794
});
9895

99-
QUnit.test('unquoted attributes that are null are not added', function() {
96+
test('unquoted attributes that are null are not added', function() {
10097
view = EmberView.create({
10198
context: { firstName: null },
10299
template: compile('<div data-name={{firstName}}>Hi!</div>')
@@ -106,7 +103,7 @@ QUnit.test('unquoted attributes that are null are not added', function() {
106103
equalInnerHTML(view.element, '<div>Hi!</div>', 'attribute is not present');
107104
});
108105

109-
QUnit.test('unquoted attributes are added when changing from null', function() {
106+
test('unquoted attributes are added when changing from null', function() {
110107
view = EmberView.create({
111108
context: { firstName: null },
112109
template: compile('<div data-name={{firstName}}>Hi!</div>')
@@ -120,7 +117,7 @@ QUnit.test('unquoted attributes are added when changing from null', function() {
120117
equalInnerHTML(view.element, '<div data-name="max">Hi!</div>', 'attribute is added output');
121118
});
122119

123-
QUnit.test('property value is directly added to attribute', function() {
120+
test('property value is directly added to attribute', function() {
124121
view = EmberView.create({
125122
context: { name: '"" data-foo="blah"' },
126123
template: compile('<div data-name={{name}}>Hi!</div>')
@@ -130,7 +127,7 @@ QUnit.test('property value is directly added to attribute', function() {
130127
equal(view.element.firstChild.getAttribute('data-name'), '"" data-foo="blah"', 'attribute is output');
131128
});
132129

133-
QUnit.test('path is output', function() {
130+
test('path is output', function() {
134131
view = EmberView.create({
135132
context: { name: { firstName: 'erik' } },
136133
template: compile('<div data-name={{name.firstName}}>Hi!</div>')
@@ -140,7 +137,7 @@ QUnit.test('path is output', function() {
140137
equalInnerHTML(view.element, '<div data-name="erik">Hi!</div>', 'attribute is output');
141138
});
142139

143-
QUnit.test('changed property updates', function() {
140+
test('changed property updates', function() {
144141
var context = EmberObject.create({ name: 'erik' });
145142
view = EmberView.create({
146143
context: context,
@@ -155,7 +152,7 @@ QUnit.test('changed property updates', function() {
155152
equalInnerHTML(view.element, '<div data-name="mmun">Hi!</div>', 'attribute is updated output');
156153
});
157154

158-
QUnit.test('updates are scheduled in the render queue', function() {
155+
test('updates are scheduled in the render queue', function() {
159156
expect(4);
160157

161158
var context = EmberObject.create({ name: 'erik' });
@@ -182,7 +179,7 @@ QUnit.test('updates are scheduled in the render queue', function() {
182179
equalInnerHTML(view.element, '<div data-name="mmun">Hi!</div>', 'attribute is updated output');
183180
});
184181

185-
QUnit.test('updates fail silently after an element is destroyed', function() {
182+
test('updates fail silently after an element is destroyed', function() {
186183
var context = EmberObject.create({ name: 'erik' });
187184
view = EmberView.create({
188185
context: context,
@@ -198,7 +195,7 @@ QUnit.test('updates fail silently after an element is destroyed', function() {
198195
});
199196
});
200197

201-
QUnit.module('ember-htmlbars: {{attribute}} helper -- setAttribute', {
198+
testModule('ember-htmlbars: {{attribute}} helper -- setAttribute', {
202199
setup() {
203200
renderer = InteractiveRenderer.create({ dom });
204201

@@ -221,7 +218,7 @@ QUnit.module('ember-htmlbars: {{attribute}} helper -- setAttribute', {
221218
}
222219
});
223220

224-
QUnit.test('calls setAttribute for new values', function() {
221+
test('calls setAttribute for new values', function() {
225222
var context = EmberObject.create({ name: 'erik' });
226223
view = EmberView.create({
227224
renderer: renderer,
@@ -240,7 +237,7 @@ QUnit.test('calls setAttribute for new values', function() {
240237
deepEqual(setAttributeCalls, expected);
241238
});
242239

243-
QUnit.test('does not call setAttribute if the same value is set', function() {
240+
test('does not call setAttribute if the same value is set', function() {
244241
var context = EmberObject.create({ name: 'erik' });
245242
view = EmberView.create({
246243
renderer: renderer,
@@ -260,5 +257,3 @@ QUnit.test('does not call setAttribute if the same value is set', function() {
260257

261258
deepEqual(setAttributeCalls, expected);
262259
});
263-
264-
}

0 commit comments

Comments
 (0)