ember-source 2.16.0.beta.1 → 2.16.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/dist/ember-runtime.js +110 -77
- data/dist/ember-template-compiler.js +174 -132
- data/dist/ember-testing.js +1 -1
- data/dist/ember-tests.js +1329 -1251
- data/dist/ember-tests.prod.js +1279 -1249
- data/dist/ember.debug.js +631 -424
- data/dist/ember.min.js +204 -198
- data/dist/ember.prod.js +650 -436
- metadata +3 -3
data/dist/ember-testing.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
7
7
|
* @license Licensed under MIT license
|
8
8
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
9
|
-
* @version 2.16.0-beta.
|
9
|
+
* @version 2.16.0-beta.2
|
10
10
|
*/
|
11
11
|
|
12
12
|
var enifed, requireModule, Ember;
|
data/dist/ember-tests.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
7
7
|
* @license Licensed under MIT license
|
8
8
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
9
|
-
* @version 2.16.0-beta.
|
9
|
+
* @version 2.16.0-beta.2
|
10
10
|
*/
|
11
11
|
|
12
12
|
var enifed, requireModule, Ember;
|
@@ -148,7 +148,7 @@ QUnit.test('should pass ESLint', function(assert) {
|
|
148
148
|
assert.ok(true, 'container.js should pass ESLint\n\n');
|
149
149
|
});
|
150
150
|
|
151
|
-
enifed('container/tests/container_test', ['ember-babel', 'ember-utils', 'ember-
|
151
|
+
enifed('container/tests/container_test', ['ember-babel', 'ember-utils', 'ember-metal', 'ember/features', 'container', 'internal-test-helpers'], function (_emberBabel, _emberUtils, _emberMetal, _features, _container, _internalTestHelpers) {
|
152
152
|
'use strict';
|
153
153
|
|
154
154
|
QUnit.module('Container');
|
@@ -8616,7 +8616,7 @@ enifed('ember-glimmer/tests/integration/application/engine-test', ['ember-babel'
|
|
8616
8616
|
return this.visit('/').then(function () {
|
8617
8617
|
_this12.assertText('Application');
|
8618
8618
|
return _this12.transitionTo('blog.post');
|
8619
|
-
}).
|
8619
|
+
}).then(function () {
|
8620
8620
|
_this12.assertText('ApplicationError! Oh, noes!');
|
8621
8621
|
});
|
8622
8622
|
};
|
@@ -8639,7 +8639,7 @@ enifed('ember-glimmer/tests/integration/application/engine-test', ['ember-babel'
|
|
8639
8639
|
return this.visit('/').then(function () {
|
8640
8640
|
_this13.assertText('Application');
|
8641
8641
|
return _this13.transitionTo('blog.post');
|
8642
|
-
}).
|
8642
|
+
}).then(function () {
|
8643
8643
|
_this13.assertText('ApplicationEngineError! Oh, noes!');
|
8644
8644
|
});
|
8645
8645
|
};
|
@@ -8662,7 +8662,7 @@ enifed('ember-glimmer/tests/integration/application/engine-test', ['ember-babel'
|
|
8662
8662
|
return this.visit('/').then(function () {
|
8663
8663
|
_this14.assertText('Application');
|
8664
8664
|
return _this14.transitionTo('blog.post');
|
8665
|
-
}).
|
8665
|
+
}).then(function () {
|
8666
8666
|
_this14.assertText('ApplicationEngineError! Oh, noes!');
|
8667
8667
|
});
|
8668
8668
|
};
|
@@ -8685,7 +8685,7 @@ enifed('ember-glimmer/tests/integration/application/engine-test', ['ember-babel'
|
|
8685
8685
|
return this.visit('/').then(function () {
|
8686
8686
|
_this15.assertText('Application');
|
8687
8687
|
return _this15.transitionTo('blog.post.comments');
|
8688
|
-
}).
|
8688
|
+
}).then(function () {
|
8689
8689
|
_this15.assertText('ApplicationEngineError! Oh, noes!');
|
8690
8690
|
});
|
8691
8691
|
};
|
@@ -27170,9 +27170,31 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27170
27170
|
this.assertText('[First][Second][Third]');
|
27171
27171
|
};
|
27172
27172
|
|
27173
|
-
_class.prototype['@test should be able to get an
|
27173
|
+
_class.prototype['@test should be able to get an array value with numeric keys'] = function testShouldBeAbleToGetAnArrayValueWithNumericKeys() {
|
27174
27174
|
var _this5 = this;
|
27175
27175
|
|
27176
|
+
this.render('{{#each numbers as |num index|}}[{{get numbers index}}]{{/each}}', {
|
27177
|
+
numbers: [1, 2, 3]
|
27178
|
+
});
|
27179
|
+
|
27180
|
+
this.assertText('[1][2][3]');
|
27181
|
+
|
27182
|
+
this.runTask(function () {
|
27183
|
+
return _this5.rerender();
|
27184
|
+
});
|
27185
|
+
|
27186
|
+
this.assertText('[1][2][3]');
|
27187
|
+
|
27188
|
+
this.runTask(function () {
|
27189
|
+
return (0, _emberMetal.set)(_this5.context, 'numbers', [3, 2, 1]);
|
27190
|
+
});
|
27191
|
+
|
27192
|
+
this.assertText('[3][2][1]');
|
27193
|
+
};
|
27194
|
+
|
27195
|
+
_class.prototype['@test should be able to get an object value with a bound/dynamic key'] = function testShouldBeAbleToGetAnObjectValueWithABoundDynamicKey() {
|
27196
|
+
var _this6 = this;
|
27197
|
+
|
27176
27198
|
this.render('[{{get colors key}}] [{{if true (get colors key)}}]', {
|
27177
27199
|
colors: { apple: 'red', banana: 'yellow' },
|
27178
27200
|
key: 'apple'
|
@@ -27181,39 +27203,39 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27181
27203
|
this.assertText('[red] [red]');
|
27182
27204
|
|
27183
27205
|
this.runTask(function () {
|
27184
|
-
return
|
27206
|
+
return _this6.rerender();
|
27185
27207
|
});
|
27186
27208
|
|
27187
27209
|
this.assertText('[red] [red]');
|
27188
27210
|
|
27189
27211
|
this.runTask(function () {
|
27190
|
-
return (0, _emberMetal.set)(
|
27212
|
+
return (0, _emberMetal.set)(_this6.context, 'key', 'banana');
|
27191
27213
|
});
|
27192
27214
|
|
27193
27215
|
this.assertText('[yellow] [yellow]');
|
27194
27216
|
|
27195
27217
|
this.runTask(function () {
|
27196
|
-
(0, _emberMetal.set)(
|
27197
|
-
(0, _emberMetal.set)(
|
27218
|
+
(0, _emberMetal.set)(_this6.context, 'colors.apple', 'green');
|
27219
|
+
(0, _emberMetal.set)(_this6.context, 'colors.banana', 'purple');
|
27198
27220
|
});
|
27199
27221
|
|
27200
27222
|
this.assertText('[purple] [purple]');
|
27201
27223
|
|
27202
27224
|
this.runTask(function () {
|
27203
|
-
return (0, _emberMetal.set)(
|
27225
|
+
return (0, _emberMetal.set)(_this6.context, 'key', 'apple');
|
27204
27226
|
});
|
27205
27227
|
|
27206
27228
|
this.assertText('[green] [green]');
|
27207
27229
|
|
27208
27230
|
this.runTask(function () {
|
27209
|
-
return (0, _emberMetal.set)(
|
27231
|
+
return (0, _emberMetal.set)(_this6.context, 'colors', { apple: 'red' });
|
27210
27232
|
});
|
27211
27233
|
|
27212
27234
|
this.assertText('[red] [red]');
|
27213
27235
|
};
|
27214
27236
|
|
27215
27237
|
_class.prototype['@test should be able to get an object value with nested dynamic key'] = function testShouldBeAbleToGetAnObjectValueWithNestedDynamicKey() {
|
27216
|
-
var
|
27238
|
+
var _this7 = this;
|
27217
27239
|
|
27218
27240
|
this.render('[{{get colors key}}] [{{if true (get colors key)}}]', {
|
27219
27241
|
colors: {
|
@@ -27229,32 +27251,32 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27229
27251
|
this.assertText('[red and yellow] [red and yellow]');
|
27230
27252
|
|
27231
27253
|
this.runTask(function () {
|
27232
|
-
return
|
27254
|
+
return _this7.rerender();
|
27233
27255
|
});
|
27234
27256
|
|
27235
27257
|
this.assertText('[red and yellow] [red and yellow]');
|
27236
27258
|
|
27237
27259
|
this.runTask(function () {
|
27238
|
-
return (0, _emberMetal.set)(
|
27260
|
+
return (0, _emberMetal.set)(_this7.context, 'key', 'apple.mcintosh');
|
27239
27261
|
});
|
27240
27262
|
|
27241
27263
|
this.assertText('[red] [red]');
|
27242
27264
|
|
27243
27265
|
this.runTask(function () {
|
27244
|
-
return (0, _emberMetal.set)(
|
27266
|
+
return (0, _emberMetal.set)(_this7.context, 'key', 'banana');
|
27245
27267
|
});
|
27246
27268
|
|
27247
27269
|
this.assertText('[yellow] [yellow]');
|
27248
27270
|
|
27249
27271
|
this.runTask(function () {
|
27250
|
-
return (0, _emberMetal.set)(
|
27272
|
+
return (0, _emberMetal.set)(_this7.context, 'key', 'apple.gala');
|
27251
27273
|
});
|
27252
27274
|
|
27253
27275
|
this.assertText('[red and yellow] [red and yellow]');
|
27254
27276
|
};
|
27255
27277
|
|
27256
27278
|
_class.prototype['@test should be able to get an object value with subexpression returning nested key'] = function testShouldBeAbleToGetAnObjectValueWithSubexpressionReturningNestedKey() {
|
27257
|
-
var
|
27279
|
+
var _this8 = this;
|
27258
27280
|
|
27259
27281
|
this.render('[{{get colors (concat \'apple\' \'.\' \'gala\')}}] [{{if true (get colors (concat \'apple\' \'.\' \'gala\'))}}]', {
|
27260
27282
|
colors: {
|
@@ -27269,25 +27291,25 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27269
27291
|
this.assertText('[red and yellow] [red and yellow]');
|
27270
27292
|
|
27271
27293
|
this.runTask(function () {
|
27272
|
-
return
|
27294
|
+
return _this8.rerender();
|
27273
27295
|
});
|
27274
27296
|
|
27275
27297
|
this.assertText('[red and yellow] [red and yellow]');
|
27276
27298
|
|
27277
27299
|
this.runTask(function () {
|
27278
|
-
return (0, _emberMetal.set)(
|
27300
|
+
return (0, _emberMetal.set)(_this8.context, 'colors.apple.gala', 'yellow and red striped');
|
27279
27301
|
});
|
27280
27302
|
|
27281
27303
|
this.assertText('[yellow and red striped] [yellow and red striped]');
|
27282
27304
|
|
27283
27305
|
this.runTask(function () {
|
27284
|
-
return (0, _emberMetal.set)(
|
27306
|
+
return (0, _emberMetal.set)(_this8.context, 'colors.apple.gala', 'yellow-redish');
|
27285
27307
|
});
|
27286
27308
|
|
27287
27309
|
this.assertText('[yellow-redish] [yellow-redish]');
|
27288
27310
|
|
27289
27311
|
this.runTask(function () {
|
27290
|
-
return (0, _emberMetal.set)(
|
27312
|
+
return (0, _emberMetal.set)(_this8.context, 'colors', {
|
27291
27313
|
apple: {
|
27292
27314
|
gala: 'red and yellow',
|
27293
27315
|
mcintosh: 'red'
|
@@ -27299,7 +27321,7 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27299
27321
|
};
|
27300
27322
|
|
27301
27323
|
_class.prototype['@test should be able to get an object value with a get helper as the key'] = function testShouldBeAbleToGetAnObjectValueWithAGetHelperAsTheKey() {
|
27302
|
-
var
|
27324
|
+
var _this9 = this;
|
27303
27325
|
|
27304
27326
|
this.render('[{{get colors (get possibleKeys key)}}] [{{if true (get colors (get possibleKeys key))}}]', {
|
27305
27327
|
colors: { apple: 'red', banana: 'yellow' },
|
@@ -27310,39 +27332,39 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27310
27332
|
this.assertText('[red] [red]');
|
27311
27333
|
|
27312
27334
|
this.runTask(function () {
|
27313
|
-
return
|
27335
|
+
return _this9.rerender();
|
27314
27336
|
});
|
27315
27337
|
|
27316
27338
|
this.assertText('[red] [red]');
|
27317
27339
|
|
27318
27340
|
this.runTask(function () {
|
27319
|
-
return (0, _emberMetal.set)(
|
27341
|
+
return (0, _emberMetal.set)(_this9.context, 'key', 'key2');
|
27320
27342
|
});
|
27321
27343
|
|
27322
27344
|
this.assertText('[yellow] [yellow]');
|
27323
27345
|
|
27324
27346
|
this.runTask(function () {
|
27325
|
-
(0, _emberMetal.set)(
|
27326
|
-
(0, _emberMetal.set)(
|
27347
|
+
(0, _emberMetal.set)(_this9.context, 'colors.apple', 'green');
|
27348
|
+
(0, _emberMetal.set)(_this9.context, 'colors.banana', 'purple');
|
27327
27349
|
});
|
27328
27350
|
|
27329
27351
|
this.assertText('[purple] [purple]');
|
27330
27352
|
|
27331
27353
|
this.runTask(function () {
|
27332
|
-
return (0, _emberMetal.set)(
|
27354
|
+
return (0, _emberMetal.set)(_this9.context, 'key', 'key1');
|
27333
27355
|
});
|
27334
27356
|
|
27335
27357
|
this.assertText('[green] [green]');
|
27336
27358
|
|
27337
27359
|
this.runTask(function () {
|
27338
|
-
return (0, _emberMetal.set)(
|
27360
|
+
return (0, _emberMetal.set)(_this9.context, 'colors', { apple: 'red', banana: 'yellow' });
|
27339
27361
|
});
|
27340
27362
|
|
27341
27363
|
this.assertText('[red] [red]');
|
27342
27364
|
};
|
27343
27365
|
|
27344
27366
|
_class.prototype['@test should be able to get an object value with a get helper value as a bound/dynamic key'] = function testShouldBeAbleToGetAnObjectValueWithAGetHelperValueAsABoundDynamicKey() {
|
27345
|
-
var
|
27367
|
+
var _this10 = this;
|
27346
27368
|
|
27347
27369
|
this.render('[{{get (get possibleValues objectKey) key}}] [{{if true (get (get possibleValues objectKey) key)}}]', {
|
27348
27370
|
possibleValues: {
|
@@ -27356,48 +27378,48 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27356
27378
|
this.assertText('[red] [red]');
|
27357
27379
|
|
27358
27380
|
this.runTask(function () {
|
27359
|
-
return
|
27381
|
+
return _this10.rerender();
|
27360
27382
|
});
|
27361
27383
|
|
27362
27384
|
this.assertText('[red] [red]');
|
27363
27385
|
|
27364
27386
|
this.runTask(function () {
|
27365
|
-
return (0, _emberMetal.set)(
|
27387
|
+
return (0, _emberMetal.set)(_this10.context, 'objectKey', 'colors2');
|
27366
27388
|
});
|
27367
27389
|
|
27368
27390
|
this.assertText('[green] [green]');
|
27369
27391
|
|
27370
27392
|
this.runTask(function () {
|
27371
|
-
return (0, _emberMetal.set)(
|
27393
|
+
return (0, _emberMetal.set)(_this10.context, 'objectKey', 'colors1');
|
27372
27394
|
});
|
27373
27395
|
|
27374
27396
|
this.assertText('[red] [red]');
|
27375
27397
|
|
27376
27398
|
this.runTask(function () {
|
27377
|
-
return (0, _emberMetal.set)(
|
27399
|
+
return (0, _emberMetal.set)(_this10.context, 'key', 'banana');
|
27378
27400
|
});
|
27379
27401
|
|
27380
27402
|
this.assertText('[yellow] [yellow]');
|
27381
27403
|
|
27382
27404
|
this.runTask(function () {
|
27383
|
-
return (0, _emberMetal.set)(
|
27405
|
+
return (0, _emberMetal.set)(_this10.context, 'objectKey', 'colors2');
|
27384
27406
|
});
|
27385
27407
|
|
27386
27408
|
this.assertText('[purple] [purple]');
|
27387
27409
|
|
27388
27410
|
this.runTask(function () {
|
27389
|
-
return (0, _emberMetal.set)(
|
27411
|
+
return (0, _emberMetal.set)(_this10.context, 'objectKey', 'colors1');
|
27390
27412
|
});
|
27391
27413
|
|
27392
27414
|
this.assertText('[yellow] [yellow]');
|
27393
27415
|
|
27394
27416
|
this.runTask(function () {
|
27395
|
-
return (0, _emberMetal.set)(
|
27417
|
+
return (0, _emberMetal.set)(_this10.context, 'key', 'apple');
|
27396
27418
|
});
|
27397
27419
|
};
|
27398
27420
|
|
27399
27421
|
_class.prototype['@test should be able to get an object value with a get helper as the value and a get helper as the key'] = function testShouldBeAbleToGetAnObjectValueWithAGetHelperAsTheValueAndAGetHelperAsTheKey() {
|
27400
|
-
var
|
27422
|
+
var _this11 = this;
|
27401
27423
|
|
27402
27424
|
this.render('[{{get (get possibleValues objectKey) (get possibleKeys key)}}] [{{if true (get (get possibleValues objectKey) (get possibleKeys key))}}]', {
|
27403
27425
|
possibleValues: {
|
@@ -27415,45 +27437,45 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27415
27437
|
this.assertText('[red] [red]');
|
27416
27438
|
|
27417
27439
|
this.runTask(function () {
|
27418
|
-
return
|
27440
|
+
return _this11.rerender();
|
27419
27441
|
});
|
27420
27442
|
|
27421
27443
|
this.assertText('[red] [red]');
|
27422
27444
|
|
27423
27445
|
this.runTask(function () {
|
27424
|
-
return (0, _emberMetal.set)(
|
27446
|
+
return (0, _emberMetal.set)(_this11.context, 'objectKey', 'colors2');
|
27425
27447
|
});
|
27426
27448
|
|
27427
27449
|
this.assertText('[green] [green]');
|
27428
27450
|
|
27429
27451
|
this.runTask(function () {
|
27430
|
-
return (0, _emberMetal.set)(
|
27452
|
+
return (0, _emberMetal.set)(_this11.context, 'objectKey', 'colors1');
|
27431
27453
|
});
|
27432
27454
|
|
27433
27455
|
this.assertText('[red] [red]');
|
27434
27456
|
|
27435
27457
|
this.runTask(function () {
|
27436
|
-
return (0, _emberMetal.set)(
|
27458
|
+
return (0, _emberMetal.set)(_this11.context, 'key', 'key2');
|
27437
27459
|
});
|
27438
27460
|
|
27439
27461
|
this.assertText('[yellow] [yellow]');
|
27440
27462
|
|
27441
27463
|
this.runTask(function () {
|
27442
|
-
return (0, _emberMetal.set)(
|
27464
|
+
return (0, _emberMetal.set)(_this11.context, 'objectKey', 'colors2');
|
27443
27465
|
});
|
27444
27466
|
|
27445
27467
|
this.assertText('[purple] [purple]');
|
27446
27468
|
|
27447
27469
|
this.runTask(function () {
|
27448
|
-
(0, _emberMetal.set)(
|
27449
|
-
(0, _emberMetal.set)(
|
27470
|
+
(0, _emberMetal.set)(_this11.context, 'objectKey', 'colors1');
|
27471
|
+
(0, _emberMetal.set)(_this11.context, 'key', 'key1');
|
27450
27472
|
});
|
27451
27473
|
|
27452
27474
|
this.assertText('[red] [red]');
|
27453
27475
|
};
|
27454
27476
|
|
27455
27477
|
_class.prototype['@test the result of a get helper can be yielded'] = function testTheResultOfAGetHelperCanBeYielded() {
|
27456
|
-
var
|
27478
|
+
var _this12 = this;
|
27457
27479
|
|
27458
27480
|
var fooBarInstance = void 0;
|
27459
27481
|
var FooBarComponent = _helpers.Component.extend({
|
@@ -27478,28 +27500,28 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27478
27500
|
this.assertText('banana');
|
27479
27501
|
|
27480
27502
|
this.runTask(function () {
|
27481
|
-
return
|
27503
|
+
return _this12.rerender();
|
27482
27504
|
});
|
27483
27505
|
|
27484
27506
|
this.assertText('banana');
|
27485
27507
|
|
27486
27508
|
this.runTask(function () {
|
27487
27509
|
(0, _emberMetal.set)(fooBarInstance, 'mcintosh', 'yellow');
|
27488
|
-
(0, _emberMetal.set)(
|
27510
|
+
(0, _emberMetal.set)(_this12.context, 'colors', { yellow: 'bus' });
|
27489
27511
|
});
|
27490
27512
|
|
27491
27513
|
this.assertText('bus');
|
27492
27514
|
|
27493
27515
|
this.runTask(function () {
|
27494
27516
|
(0, _emberMetal.set)(fooBarInstance, 'mcintosh', 'red');
|
27495
|
-
(0, _emberMetal.set)(
|
27517
|
+
(0, _emberMetal.set)(_this12.context, 'colors', { red: 'banana' });
|
27496
27518
|
});
|
27497
27519
|
|
27498
27520
|
this.assertText('banana');
|
27499
27521
|
};
|
27500
27522
|
|
27501
27523
|
_class.prototype['@test should handle object values as nulls'] = function testShouldHandleObjectValuesAsNulls() {
|
27502
|
-
var
|
27524
|
+
var _this13 = this;
|
27503
27525
|
|
27504
27526
|
this.render('[{{get colors \'apple\'}}] [{{if true (get colors \'apple\')}}]', {
|
27505
27527
|
colors: null
|
@@ -27508,26 +27530,26 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27508
27530
|
this.assertText('[] []');
|
27509
27531
|
|
27510
27532
|
this.runTask(function () {
|
27511
|
-
return
|
27533
|
+
return _this13.rerender();
|
27512
27534
|
});
|
27513
27535
|
|
27514
27536
|
this.assertText('[] []');
|
27515
27537
|
|
27516
27538
|
this.runTask(function () {
|
27517
|
-
return (0, _emberMetal.set)(
|
27539
|
+
return (0, _emberMetal.set)(_this13.context, 'colors', { apple: 'green', banana: 'purple' });
|
27518
27540
|
});
|
27519
27541
|
|
27520
27542
|
this.assertText('[green] [green]');
|
27521
27543
|
|
27522
27544
|
this.runTask(function () {
|
27523
|
-
return (0, _emberMetal.set)(
|
27545
|
+
return (0, _emberMetal.set)(_this13.context, 'colors', null);
|
27524
27546
|
});
|
27525
27547
|
|
27526
27548
|
this.assertText('[] []');
|
27527
27549
|
};
|
27528
27550
|
|
27529
27551
|
_class.prototype['@test should handle object keys as nulls'] = function testShouldHandleObjectKeysAsNulls() {
|
27530
|
-
var
|
27552
|
+
var _this14 = this;
|
27531
27553
|
|
27532
27554
|
this.render('[{{get colors key}}] [{{if true (get colors key)}}]', {
|
27533
27555
|
colors: {
|
@@ -27540,19 +27562,19 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27540
27562
|
this.assertText('[] []');
|
27541
27563
|
|
27542
27564
|
this.runTask(function () {
|
27543
|
-
return
|
27565
|
+
return _this14.rerender();
|
27544
27566
|
});
|
27545
27567
|
|
27546
27568
|
this.assertText('[] []');
|
27547
27569
|
|
27548
27570
|
this.runTask(function () {
|
27549
|
-
return (0, _emberMetal.set)(
|
27571
|
+
return (0, _emberMetal.set)(_this14.context, 'key', 'banana');
|
27550
27572
|
});
|
27551
27573
|
|
27552
27574
|
this.assertText('[yellow] [yellow]');
|
27553
27575
|
|
27554
27576
|
this.runTask(function () {
|
27555
|
-
return (0, _emberMetal.set)(
|
27577
|
+
return (0, _emberMetal.set)(_this14.context, 'key', null);
|
27556
27578
|
});
|
27557
27579
|
|
27558
27580
|
this.assertText('[] []');
|
@@ -27568,7 +27590,7 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27568
27590
|
};
|
27569
27591
|
|
27570
27592
|
_class.prototype['@test get helper value should be updatable using {{input}} and (mut) - static key'] = function testGetHelperValueShouldBeUpdatableUsingInputAndMutStaticKey(assert) {
|
27571
|
-
var
|
27593
|
+
var _this15 = this;
|
27572
27594
|
|
27573
27595
|
this.render('{{input type=\'text\' value=(mut (get source \'banana\')) id=\'get-input\'}}', {
|
27574
27596
|
source: {
|
@@ -27579,33 +27601,33 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27579
27601
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
27580
27602
|
|
27581
27603
|
this.runTask(function () {
|
27582
|
-
return
|
27604
|
+
return _this15.rerender();
|
27583
27605
|
});
|
27584
27606
|
|
27585
27607
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
27586
27608
|
|
27587
27609
|
this.runTask(function () {
|
27588
|
-
return (0, _emberMetal.set)(
|
27610
|
+
return (0, _emberMetal.set)(_this15.context, 'source.banana', 'yellow');
|
27589
27611
|
});
|
27590
27612
|
|
27591
27613
|
assert.strictEqual(this.$('#get-input').val(), 'yellow');
|
27592
27614
|
|
27593
27615
|
this.runTask(function () {
|
27594
|
-
return
|
27616
|
+
return _this15.$('#get-input').val('some value').trigger('change');
|
27595
27617
|
});
|
27596
27618
|
|
27597
27619
|
assert.strictEqual(this.$('#get-input').val(), 'some value');
|
27598
27620
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.banana'), 'some value');
|
27599
27621
|
|
27600
27622
|
this.runTask(function () {
|
27601
|
-
return (0, _emberMetal.set)(
|
27623
|
+
return (0, _emberMetal.set)(_this15.context, 'source', { banana: 'banana' });
|
27602
27624
|
});
|
27603
27625
|
|
27604
27626
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
27605
27627
|
};
|
27606
27628
|
|
27607
27629
|
_class.prototype['@test get helper value should be updatable using {{input}} and (mut) - dynamic key'] = function testGetHelperValueShouldBeUpdatableUsingInputAndMutDynamicKey(assert) {
|
27608
|
-
var
|
27630
|
+
var _this16 = this;
|
27609
27631
|
|
27610
27632
|
this.render('{{input type=\'text\' value=(mut (get source key)) id=\'get-input\'}}', {
|
27611
27633
|
source: {
|
@@ -27618,47 +27640,47 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27618
27640
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
27619
27641
|
|
27620
27642
|
this.runTask(function () {
|
27621
|
-
return
|
27643
|
+
return _this16.rerender();
|
27622
27644
|
});
|
27623
27645
|
|
27624
27646
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
27625
27647
|
|
27626
27648
|
this.runTask(function () {
|
27627
|
-
return (0, _emberMetal.set)(
|
27649
|
+
return (0, _emberMetal.set)(_this16.context, 'source.banana', 'yellow');
|
27628
27650
|
});
|
27629
27651
|
|
27630
27652
|
assert.strictEqual(this.$('#get-input').val(), 'yellow');
|
27631
27653
|
|
27632
27654
|
this.runTask(function () {
|
27633
|
-
return
|
27655
|
+
return _this16.$('#get-input').val('some value').trigger('change');
|
27634
27656
|
});
|
27635
27657
|
|
27636
27658
|
assert.strictEqual(this.$('#get-input').val(), 'some value');
|
27637
27659
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.banana'), 'some value');
|
27638
27660
|
|
27639
27661
|
this.runTask(function () {
|
27640
|
-
return (0, _emberMetal.set)(
|
27662
|
+
return (0, _emberMetal.set)(_this16.context, 'key', 'apple');
|
27641
27663
|
});
|
27642
27664
|
|
27643
27665
|
assert.strictEqual(this.$('#get-input').val(), 'apple');
|
27644
27666
|
|
27645
27667
|
this.runTask(function () {
|
27646
|
-
return
|
27668
|
+
return _this16.$('#get-input').val('some other value').trigger('change');
|
27647
27669
|
});
|
27648
27670
|
|
27649
27671
|
assert.strictEqual(this.$('#get-input').val(), 'some other value');
|
27650
27672
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.apple'), 'some other value');
|
27651
27673
|
|
27652
27674
|
this.runTask(function () {
|
27653
|
-
(0, _emberMetal.set)(
|
27654
|
-
(0, _emberMetal.set)(
|
27675
|
+
(0, _emberMetal.set)(_this16.context, 'key', 'banana');
|
27676
|
+
(0, _emberMetal.set)(_this16.context, 'source', { banana: 'banana' });
|
27655
27677
|
});
|
27656
27678
|
|
27657
27679
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
27658
27680
|
};
|
27659
27681
|
|
27660
27682
|
_class.prototype['@test get helper value should be updatable using {{input}} and (mut) - dynamic nested key'] = function testGetHelperValueShouldBeUpdatableUsingInputAndMutDynamicNestedKey(assert) {
|
27661
|
-
var
|
27683
|
+
var _this17 = this;
|
27662
27684
|
|
27663
27685
|
this.render('{{input type=\'text\' value=(mut (get source key)) id=\'get-input\'}}', {
|
27664
27686
|
source: {
|
@@ -27674,53 +27696,53 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
27674
27696
|
assert.strictEqual(this.$('#get-input').val(), 'mcintosh');
|
27675
27697
|
|
27676
27698
|
this.runTask(function () {
|
27677
|
-
return
|
27699
|
+
return _this17.rerender();
|
27678
27700
|
});
|
27679
27701
|
|
27680
27702
|
assert.strictEqual(this.$('#get-input').val(), 'mcintosh');
|
27681
27703
|
|
27682
27704
|
this.runTask(function () {
|
27683
|
-
return (0, _emberMetal.set)(
|
27705
|
+
return (0, _emberMetal.set)(_this17.context, 'source.apple.mcintosh', 'red');
|
27684
27706
|
});
|
27685
27707
|
|
27686
27708
|
assert.strictEqual(this.$('#get-input').val(), 'red');
|
27687
27709
|
|
27688
27710
|
this.runTask(function () {
|
27689
|
-
return
|
27711
|
+
return _this17.$('#get-input').val('some value').trigger('change');
|
27690
27712
|
});
|
27691
27713
|
|
27692
27714
|
assert.strictEqual(this.$('#get-input').val(), 'some value');
|
27693
27715
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.apple.mcintosh'), 'some value');
|
27694
27716
|
|
27695
27717
|
this.runTask(function () {
|
27696
|
-
return (0, _emberMetal.set)(
|
27718
|
+
return (0, _emberMetal.set)(_this17.context, 'key', 'apple.gala');
|
27697
27719
|
});
|
27698
27720
|
|
27699
27721
|
assert.strictEqual(this.$('#get-input').val(), 'gala');
|
27700
27722
|
|
27701
27723
|
this.runTask(function () {
|
27702
|
-
return
|
27724
|
+
return _this17.$('#get-input').val('some other value').trigger('change');
|
27703
27725
|
});
|
27704
27726
|
|
27705
27727
|
assert.strictEqual(this.$('#get-input').val(), 'some other value');
|
27706
27728
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.apple.gala'), 'some other value');
|
27707
27729
|
|
27708
27730
|
this.runTask(function () {
|
27709
|
-
return (0, _emberMetal.set)(
|
27731
|
+
return (0, _emberMetal.set)(_this17.context, 'key', 'banana');
|
27710
27732
|
});
|
27711
27733
|
|
27712
27734
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
27713
27735
|
|
27714
27736
|
this.runTask(function () {
|
27715
|
-
return
|
27737
|
+
return _this17.$('#get-input').val('yet another value').trigger('change');
|
27716
27738
|
});
|
27717
27739
|
|
27718
27740
|
assert.strictEqual(this.$('#get-input').val(), 'yet another value');
|
27719
27741
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.banana'), 'yet another value');
|
27720
27742
|
|
27721
27743
|
this.runTask(function () {
|
27722
|
-
(0, _emberMetal.set)(
|
27723
|
-
(0, _emberMetal.set)(
|
27744
|
+
(0, _emberMetal.set)(_this17.context, 'key', 'apple.mcintosh');
|
27745
|
+
(0, _emberMetal.set)(_this17.context, 'source', {
|
27724
27746
|
apple: {
|
27725
27747
|
gala: 'gala',
|
27726
27748
|
mcintosh: 'mcintosh'
|
@@ -28974,6 +28996,63 @@ enifed('ember-glimmer/tests/integration/helpers/input-test', ['ember-babel', 'em
|
|
28974
28996
|
|
28975
28997
|
return _class4;
|
28976
28998
|
}(InputRenderingTest));
|
28999
|
+
|
29000
|
+
// These are the permutations of the set:
|
29001
|
+
// ['type="range"', 'min="-5" max="50"', 'value="%x"']
|
29002
|
+
['type="range" min="-5" max="50" value="%x"', 'type="range" value="%x" min="-5" max="50"', 'min="-5" max="50" type="range" value="%x"', 'min="-5" max="50" value="%x" type="range"', 'value="%x" min="-5" max="50" type="range"', 'value="%x" type="range" min="-5" max="50"'].forEach(function (attrs) {
|
29003
|
+
(0, _testCase.moduleFor)('[GH#15675] Helpers test: {{input ' + attrs + '}}', function (_InputRenderingTest5) {
|
29004
|
+
(0, _emberBabel.inherits)(_class5, _InputRenderingTest5);
|
29005
|
+
|
29006
|
+
function _class5() {
|
29007
|
+
(0, _emberBabel.classCallCheck)(this, _class5);
|
29008
|
+
return (0, _emberBabel.possibleConstructorReturn)(this, _InputRenderingTest5.apply(this, arguments));
|
29009
|
+
}
|
29010
|
+
|
29011
|
+
_class5.prototype.renderInput = function renderInput() {
|
29012
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 25;
|
29013
|
+
|
29014
|
+
this.render('{{input ' + attrs.replace("%x", value) + '}}');
|
29015
|
+
};
|
29016
|
+
|
29017
|
+
_class5.prototype.assertValue = function assertValue(expected) {
|
29018
|
+
var type = this.$input().attr('type');
|
29019
|
+
|
29020
|
+
if (type !== 'range') {
|
29021
|
+
this.assert.ok(true, 'IE9 does not support range items');
|
29022
|
+
return;
|
29023
|
+
}
|
29024
|
+
|
29025
|
+
_InputRenderingTest5.prototype.assertValue.call(this, expected);
|
29026
|
+
};
|
29027
|
+
|
29028
|
+
_class5.prototype['@test value over default max but below set max is kept'] = function testValueOverDefaultMaxButBelowSetMaxIsKept(assert) {
|
29029
|
+
this.renderInput("25");
|
29030
|
+
this.assertValue("25");
|
29031
|
+
};
|
29032
|
+
|
29033
|
+
_class5.prototype['@test value below default min but above set min is kept'] = function testValueBelowDefaultMinButAboveSetMinIsKept(assert) {
|
29034
|
+
this.renderInput("-2");
|
29035
|
+
this.assertValue("-2");
|
29036
|
+
};
|
29037
|
+
|
29038
|
+
_class5.prototype['@test in the valid default range is kept'] = function testInTheValidDefaultRangeIsKept(assert) {
|
29039
|
+
this.renderInput("5");
|
29040
|
+
this.assertValue("5");
|
29041
|
+
};
|
29042
|
+
|
29043
|
+
_class5.prototype['@test value above max is reset to max'] = function testValueAboveMaxIsResetToMax(assert) {
|
29044
|
+
this.renderInput("55");
|
29045
|
+
this.assertValue("50");
|
29046
|
+
};
|
29047
|
+
|
29048
|
+
_class5.prototype['@test value below min is reset to min'] = function testValueBelowMinIsResetToMin(assert) {
|
29049
|
+
this.renderInput("-10");
|
29050
|
+
this.assertValue("-5");
|
29051
|
+
};
|
29052
|
+
|
29053
|
+
return _class5;
|
29054
|
+
}(InputRenderingTest));
|
29055
|
+
});
|
28977
29056
|
});
|
28978
29057
|
QUnit.module('ESLint | ember-glimmer/tests/integration/helpers/input-test.js');
|
28979
29058
|
QUnit.test('should pass ESLint', function(assert) {
|
@@ -40885,6 +40964,20 @@ enifed('ember-metal/tests/events_test', ['ember-metal'], function (_emberMetal)
|
|
40885
40964
|
equal(triggered, 2, 'should invoke listeners');
|
40886
40965
|
});
|
40887
40966
|
|
40967
|
+
QUnit.test('Ember.on asserts for invalid arguments', function () {
|
40968
|
+
expectAssertion(function () {
|
40969
|
+
_emberMetal.Mixin.create({
|
40970
|
+
foo1: (0, _emberMetal.on)('bar')
|
40971
|
+
});
|
40972
|
+
}, 'Ember.on expects function as last argument');
|
40973
|
+
|
40974
|
+
expectAssertion(function () {
|
40975
|
+
_emberMetal.Mixin.create({
|
40976
|
+
foo1: (0, _emberMetal.on)(function () {})
|
40977
|
+
});
|
40978
|
+
}, 'Ember.on called without valid event names');
|
40979
|
+
});
|
40980
|
+
|
40888
40981
|
QUnit.test('a listener added as part of a mixin may be overridden', function () {
|
40889
40982
|
var triggered = 0;
|
40890
40983
|
var FirstMixin = _emberMetal.Mixin.create({
|
@@ -45221,7 +45314,7 @@ QUnit.test('should pass ESLint', function(assert) {
|
|
45221
45314
|
assert.ok(true, 'ember-metal/tests/run_loop/debounce_test.js should pass ESLint\n\n');
|
45222
45315
|
});
|
45223
45316
|
|
45224
|
-
enifed('ember-metal/tests/run_loop/later_test', ['ember-metal'], function (_emberMetal) {
|
45317
|
+
enifed('ember-metal/tests/run_loop/later_test', ['ember-utils', 'ember-metal'], function (_emberUtils, _emberMetal) {
|
45225
45318
|
'use strict';
|
45226
45319
|
|
45227
45320
|
var originalSetTimeout = window.setTimeout;
|
@@ -45428,7 +45521,7 @@ enifed('ember-metal/tests/run_loop/later_test', ['ember-metal'], function (_embe
|
|
45428
45521
|
// happens when an expired timer callback takes a while to run,
|
45429
45522
|
// which is what we simulate here.
|
45430
45523
|
var newSetTimeoutUsed = void 0;
|
45431
|
-
_emberMetal.run.backburner._platform = {
|
45524
|
+
_emberMetal.run.backburner._platform = (0, _emberUtils.assign)({}, originalPlatform, {
|
45432
45525
|
setTimeout: function () {
|
45433
45526
|
var wait = arguments[arguments.length - 1];
|
45434
45527
|
newSetTimeoutUsed = true;
|
@@ -45436,7 +45529,7 @@ enifed('ember-metal/tests/run_loop/later_test', ['ember-metal'], function (_embe
|
|
45436
45529
|
|
45437
45530
|
return originalPlatform.setTimeout.apply(originalPlatform, arguments);
|
45438
45531
|
}
|
45439
|
-
};
|
45532
|
+
});
|
45440
45533
|
|
45441
45534
|
var count = 0;
|
45442
45535
|
(0, _emberMetal.run)(function () {
|
@@ -55585,7 +55678,6 @@ enifed('ember-runtime/tests/mixins/promise_proxy_test', ['ember-metal', 'ember-r
|
|
55585
55678
|
|
55586
55679
|
PromiseSubclass.prototype = Object.create(_rsvp2.Promise.prototype);
|
55587
55680
|
PromiseSubclass.prototype.constructor = PromiseSubclass;
|
55588
|
-
PromiseSubclass.cast = _rsvp2.Promise.cast;
|
55589
55681
|
|
55590
55682
|
var proxy = ObjectPromiseProxy.create({
|
55591
55683
|
promise: new PromiseSubclass(function () {})
|
@@ -61000,17 +61092,6 @@ enifed('ember-runtime/tests/system/object/create_test', ['ember-metal', 'ember/f
|
|
61000
61092
|
}, 'Ember.Object.create no longer supports mixing in other definitions, use .extend & .create separately instead.');
|
61001
61093
|
});
|
61002
61094
|
|
61003
|
-
// This test is for IE8.
|
61004
|
-
QUnit.test('property name is the same as own prototype property', function () {
|
61005
|
-
var MyClass = _object.default.extend({
|
61006
|
-
toString: function () {
|
61007
|
-
return 'MyClass';
|
61008
|
-
}
|
61009
|
-
});
|
61010
|
-
|
61011
|
-
equal(MyClass.create().toString(), 'MyClass', 'should inherit property from the arguments of `EmberObject.create`');
|
61012
|
-
});
|
61013
|
-
|
61014
61095
|
QUnit.test('inherits properties from passed in EmberObject', function () {
|
61015
61096
|
var baseObj = _object.default.create({ foo: 'bar' });
|
61016
61097
|
var secondaryObj = _object.default.create(baseObj);
|
@@ -61019,9 +61100,9 @@ enifed('ember-runtime/tests/system/object/create_test', ['ember-metal', 'ember/f
|
|
61019
61100
|
});
|
61020
61101
|
|
61021
61102
|
QUnit.test('throws if you try to pass anything a string as a parameter', function () {
|
61022
|
-
var expected = '
|
61103
|
+
var expected = 'Ember.Object.create only accepts objects.';
|
61023
61104
|
|
61024
|
-
|
61105
|
+
expectAssertion(function () {
|
61025
61106
|
return _object.default.create('some-string');
|
61026
61107
|
}, expected);
|
61027
61108
|
});
|
@@ -64201,15 +64282,6 @@ enifed('ember-testing/tests/adapters/adapter_test', ['ember-metal', 'ember-testi
|
|
64201
64282
|
}
|
64202
64283
|
});
|
64203
64284
|
|
64204
|
-
// Can't test these this way anymore since we have nothing to compare to
|
64205
|
-
// test("asyncStart is a noop", function() {
|
64206
|
-
// equal(adapter.asyncStart, K);
|
64207
|
-
// });
|
64208
|
-
|
64209
|
-
// test("asyncEnd is a noop", function() {
|
64210
|
-
// equal(adapter.asyncEnd, K);
|
64211
|
-
// });
|
64212
|
-
|
64213
64285
|
QUnit.test('exception throws', function () {
|
64214
64286
|
var error = 'Hai';
|
64215
64287
|
var thrown;
|
@@ -67251,6 +67323,105 @@ QUnit.test('should pass ESLint', function(assert) {
|
|
67251
67323
|
assert.ok(true, 'ember/tests/controller_test.js should pass ESLint\n\n');
|
67252
67324
|
});
|
67253
67325
|
|
67326
|
+
enifed('ember/tests/error_handler_test', ['ember', 'ember-metal'], function (_ember, _emberMetal) {
|
67327
|
+
'use strict';
|
67328
|
+
|
67329
|
+
var ONERROR = _ember.default.onerror;
|
67330
|
+
var ADAPTER = _ember.default.Test && _ember.default.Test.adapter;
|
67331
|
+
var TESTING = _ember.default.testing;
|
67332
|
+
|
67333
|
+
QUnit.module('error_handler', {
|
67334
|
+
teardown: function () {
|
67335
|
+
_ember.default.onerror = ONERROR;
|
67336
|
+
_ember.default.testing = TESTING;
|
67337
|
+
if (_ember.default.Test) {
|
67338
|
+
_ember.default.Test.adapter = ADAPTER;
|
67339
|
+
}
|
67340
|
+
}
|
67341
|
+
});
|
67342
|
+
|
67343
|
+
function runThatThrows(message) {
|
67344
|
+
return (0, _emberMetal.run)(function () {
|
67345
|
+
throw new Error(message);
|
67346
|
+
});
|
67347
|
+
}
|
67348
|
+
|
67349
|
+
test('by default there is no onerror', function (assert) {
|
67350
|
+
_ember.default.onerror = undefined;
|
67351
|
+
assert.throws(runThatThrows, Error);
|
67352
|
+
assert.equal(_ember.default.onerror, undefined);
|
67353
|
+
});
|
67354
|
+
|
67355
|
+
test('when Ember.onerror is registered', function (assert) {
|
67356
|
+
assert.expect(2);
|
67357
|
+
_ember.default.onerror = function (error) {
|
67358
|
+
assert.ok(true, 'onerror called');
|
67359
|
+
throw error;
|
67360
|
+
};
|
67361
|
+
assert.throws(runThatThrows, Error);
|
67362
|
+
// Ember.onerror = ONERROR;
|
67363
|
+
});
|
67364
|
+
|
67365
|
+
if (true) {
|
67366
|
+
test('when Ember.Test.adapter is registered', function (assert) {
|
67367
|
+
assert.expect(2);
|
67368
|
+
|
67369
|
+
_ember.default.Test.adapter = {
|
67370
|
+
exception: function (error) {
|
67371
|
+
assert.ok(true, 'adapter called');
|
67372
|
+
throw error;
|
67373
|
+
}
|
67374
|
+
};
|
67375
|
+
|
67376
|
+
assert.throws(runThatThrows, Error);
|
67377
|
+
});
|
67378
|
+
|
67379
|
+
test('when both Ember.onerror Ember.Test.adapter are registered', function (assert) {
|
67380
|
+
assert.expect(2);
|
67381
|
+
|
67382
|
+
// takes precedence
|
67383
|
+
_ember.default.Test.adapter = {
|
67384
|
+
exception: function (error) {
|
67385
|
+
assert.ok(true, 'adapter called');
|
67386
|
+
throw error;
|
67387
|
+
}
|
67388
|
+
};
|
67389
|
+
|
67390
|
+
_ember.default.onerror = function (error) {
|
67391
|
+
assert.ok(false, 'onerror was NEVER called');
|
67392
|
+
throw error;
|
67393
|
+
};
|
67394
|
+
|
67395
|
+
assert.throws(runThatThrows, Error);
|
67396
|
+
});
|
67397
|
+
}
|
67398
|
+
|
67399
|
+
QUnit.test('Ember.run does not swallow exceptions by default (Ember.testing = true)', function () {
|
67400
|
+
_ember.default.testing = true;
|
67401
|
+
var error = new Error('the error');
|
67402
|
+
throws(function () {
|
67403
|
+
_ember.default.run(function () {
|
67404
|
+
throw error;
|
67405
|
+
});
|
67406
|
+
}, error);
|
67407
|
+
});
|
67408
|
+
|
67409
|
+
QUnit.test('Ember.run does not swallow exceptions by default (Ember.testing = false)', function () {
|
67410
|
+
_ember.default.testing = false;
|
67411
|
+
var error = new Error('the error');
|
67412
|
+
throws(function () {
|
67413
|
+
_ember.default.run(function () {
|
67414
|
+
throw error;
|
67415
|
+
});
|
67416
|
+
}, error);
|
67417
|
+
});
|
67418
|
+
});
|
67419
|
+
QUnit.module('ESLint | ember/tests/error_handler_test.js');
|
67420
|
+
QUnit.test('should pass ESLint', function(assert) {
|
67421
|
+
assert.expect(1);
|
67422
|
+
assert.ok(true, 'ember/tests/error_handler_test.js should pass ESLint\n\n');
|
67423
|
+
});
|
67424
|
+
|
67254
67425
|
enifed('ember/tests/global-api-test', ['ember-metal', 'ember-runtime'], function (_emberMetal, _emberRuntime) {
|
67255
67426
|
'use strict';
|
67256
67427
|
|
@@ -69533,7 +69704,7 @@ enifed('ember/tests/helpers/link_to_test/link_to_with_query_params_test', ['embe
|
|
69533
69704
|
|
69534
69705
|
assert.expect(1);
|
69535
69706
|
|
69536
|
-
|
69707
|
+
expectAssertion(function () {
|
69537
69708
|
_this19.runTask(function () {
|
69538
69709
|
_this19.createApplication();
|
69539
69710
|
|
@@ -69543,7 +69714,7 @@ enifed('ember/tests/helpers/link_to_test/link_to_with_query_params_test', ['embe
|
|
69543
69714
|
|
69544
69715
|
_this19.addTemplate('application', '{{#link-to id=\'the-link\'}}Index{{/link-to}}');
|
69545
69716
|
});
|
69546
|
-
}, /
|
69717
|
+
}, /You must provide one or more parameters to the link-to component/);
|
69547
69718
|
};
|
69548
69719
|
|
69549
69720
|
return _class2;
|
@@ -69912,341 +70083,6 @@ enifed('ember/tests/routing/basic_test', ['ember-utils', 'ember-console', 'ember
|
|
69912
70083
|
}
|
69913
70084
|
});
|
69914
70085
|
|
69915
|
-
QUnit.test('warn on URLs not included in the route set', function () {
|
69916
|
-
Router.map(function () {
|
69917
|
-
this.route('home', { path: '/' });
|
69918
|
-
});
|
69919
|
-
|
69920
|
-
bootApplication();
|
69921
|
-
|
69922
|
-
expectAssertion(function () {
|
69923
|
-
return (0, _emberMetal.run)(function () {
|
69924
|
-
return router.handleURL('/what-is-this-i-dont-even');
|
69925
|
-
});
|
69926
|
-
}, 'The URL \'/what-is-this-i-dont-even\' did not match any routes in your application');
|
69927
|
-
});
|
69928
|
-
|
69929
|
-
QUnit.test('The Homepage', function () {
|
69930
|
-
Router.map(function () {
|
69931
|
-
this.route('home', { path: '/' });
|
69932
|
-
});
|
69933
|
-
|
69934
|
-
App.HomeRoute = _emberRouting.Route.extend({});
|
69935
|
-
|
69936
|
-
var currentPath = void 0;
|
69937
|
-
|
69938
|
-
App.ApplicationController = _emberRuntime.Controller.extend({
|
69939
|
-
currentPathDidChange: (0, _emberMetal.observer)('currentPath', function () {
|
69940
|
-
currentPath = (0, _emberMetal.get)(this, 'currentPath');
|
69941
|
-
})
|
69942
|
-
});
|
69943
|
-
|
69944
|
-
bootApplication();
|
69945
|
-
|
69946
|
-
equal(currentPath, 'home');
|
69947
|
-
equal((0, _emberViews.jQuery)('h3:contains(Hours)', '#qunit-fixture').length, 1, 'The home template was rendered');
|
69948
|
-
});
|
69949
|
-
|
69950
|
-
QUnit.test('The Home page and the Camelot page with multiple Router.map calls', function () {
|
69951
|
-
Router.map(function () {
|
69952
|
-
this.route('home', { path: '/' });
|
69953
|
-
});
|
69954
|
-
|
69955
|
-
Router.map(function () {
|
69956
|
-
this.route('camelot', { path: '/camelot' });
|
69957
|
-
});
|
69958
|
-
|
69959
|
-
App.HomeRoute = _emberRouting.Route.extend({});
|
69960
|
-
|
69961
|
-
App.CamelotRoute = _emberRouting.Route.extend({});
|
69962
|
-
|
69963
|
-
var currentPath = void 0;
|
69964
|
-
|
69965
|
-
App.ApplicationController = _emberRuntime.Controller.extend({
|
69966
|
-
currentPathDidChange: (0, _emberMetal.observer)('currentPath', function () {
|
69967
|
-
currentPath = (0, _emberMetal.get)(this, 'currentPath');
|
69968
|
-
})
|
69969
|
-
});
|
69970
|
-
|
69971
|
-
App.CamelotController = _emberRuntime.Controller.extend({
|
69972
|
-
currentPathDidChange: (0, _emberMetal.observer)('currentPath', function () {
|
69973
|
-
currentPath = (0, _emberMetal.get)(this, 'currentPath');
|
69974
|
-
})
|
69975
|
-
});
|
69976
|
-
|
69977
|
-
bootApplication();
|
69978
|
-
|
69979
|
-
handleURL('/camelot');
|
69980
|
-
|
69981
|
-
equal(currentPath, 'camelot');
|
69982
|
-
equal((0, _emberViews.jQuery)('h3:contains(silly)', '#qunit-fixture').length, 1, 'The camelot template was rendered');
|
69983
|
-
|
69984
|
-
handleURL('/');
|
69985
|
-
|
69986
|
-
equal(currentPath, 'home');
|
69987
|
-
equal((0, _emberViews.jQuery)('h3:contains(Hours)', '#qunit-fixture').length, 1, 'The home template was rendered');
|
69988
|
-
});
|
69989
|
-
|
69990
|
-
QUnit.test('The Homepage with explicit template name in renderTemplate', function () {
|
69991
|
-
Router.map(function () {
|
69992
|
-
this.route('home', { path: '/' });
|
69993
|
-
});
|
69994
|
-
|
69995
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
69996
|
-
renderTemplate: function () {
|
69997
|
-
this.render('homepage');
|
69998
|
-
}
|
69999
|
-
});
|
70000
|
-
|
70001
|
-
bootApplication();
|
70002
|
-
|
70003
|
-
equal((0, _emberViews.jQuery)('h3:contains(Megatroll)', '#qunit-fixture').length, 1, 'The homepage template was rendered');
|
70004
|
-
});
|
70005
|
-
|
70006
|
-
QUnit.test('An alternate template will pull in an alternate controller', function () {
|
70007
|
-
Router.map(function () {
|
70008
|
-
this.route('home', { path: '/' });
|
70009
|
-
});
|
70010
|
-
|
70011
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
70012
|
-
renderTemplate: function () {
|
70013
|
-
this.render('homepage');
|
70014
|
-
}
|
70015
|
-
});
|
70016
|
-
|
70017
|
-
App.HomepageController = _emberRuntime.Controller.extend({
|
70018
|
-
model: {
|
70019
|
-
home: 'Comes from homepage'
|
70020
|
-
}
|
70021
|
-
});
|
70022
|
-
|
70023
|
-
bootApplication();
|
70024
|
-
|
70025
|
-
equal((0, _emberViews.jQuery)('h3:contains(Megatroll) + p:contains(Comes from homepage)', '#qunit-fixture').length, 1, 'The homepage template was rendered');
|
70026
|
-
});
|
70027
|
-
|
70028
|
-
QUnit.test('An alternate template will pull in an alternate controller instead of controllerName', function () {
|
70029
|
-
Router.map(function () {
|
70030
|
-
this.route('home', { path: '/' });
|
70031
|
-
});
|
70032
|
-
|
70033
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
70034
|
-
controllerName: 'foo',
|
70035
|
-
renderTemplate: function () {
|
70036
|
-
this.render('homepage');
|
70037
|
-
}
|
70038
|
-
});
|
70039
|
-
|
70040
|
-
App.FooController = _emberRuntime.Controller.extend({
|
70041
|
-
model: {
|
70042
|
-
home: 'Comes from Foo'
|
70043
|
-
}
|
70044
|
-
});
|
70045
|
-
|
70046
|
-
App.HomepageController = _emberRuntime.Controller.extend({
|
70047
|
-
model: {
|
70048
|
-
home: 'Comes from homepage'
|
70049
|
-
}
|
70050
|
-
});
|
70051
|
-
|
70052
|
-
bootApplication();
|
70053
|
-
|
70054
|
-
equal((0, _emberViews.jQuery)('h3:contains(Megatroll) + p:contains(Comes from homepage)', '#qunit-fixture').length, 1, 'The homepage template was rendered');
|
70055
|
-
});
|
70056
|
-
|
70057
|
-
QUnit.test('The template will pull in an alternate controller via key/value', function () {
|
70058
|
-
Router.map(function () {
|
70059
|
-
this.route('homepage', { path: '/' });
|
70060
|
-
});
|
70061
|
-
|
70062
|
-
App.HomepageRoute = _emberRouting.Route.extend({
|
70063
|
-
renderTemplate: function () {
|
70064
|
-
this.render({ controller: 'home' });
|
70065
|
-
}
|
70066
|
-
});
|
70067
|
-
|
70068
|
-
App.HomeController = _emberRuntime.Controller.extend({
|
70069
|
-
model: {
|
70070
|
-
home: 'Comes from home.'
|
70071
|
-
}
|
70072
|
-
});
|
70073
|
-
|
70074
|
-
bootApplication();
|
70075
|
-
|
70076
|
-
equal((0, _emberViews.jQuery)('h3:contains(Megatroll) + p:contains(Comes from home.)', '#qunit-fixture').length, 1, 'The homepage template was rendered from data from the HomeController');
|
70077
|
-
});
|
70078
|
-
|
70079
|
-
QUnit.test('The Homepage with explicit template name in renderTemplate and controller', function () {
|
70080
|
-
Router.map(function () {
|
70081
|
-
this.route('home', { path: '/' });
|
70082
|
-
});
|
70083
|
-
|
70084
|
-
App.HomeController = _emberRuntime.Controller.extend({
|
70085
|
-
model: {
|
70086
|
-
home: 'YES I AM HOME'
|
70087
|
-
}
|
70088
|
-
});
|
70089
|
-
|
70090
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
70091
|
-
renderTemplate: function () {
|
70092
|
-
this.render('homepage');
|
70093
|
-
}
|
70094
|
-
});
|
70095
|
-
|
70096
|
-
bootApplication();
|
70097
|
-
|
70098
|
-
equal((0, _emberViews.jQuery)('h3:contains(Megatroll) + p:contains(YES I AM HOME)', '#qunit-fixture').length, 1, 'The homepage template was rendered');
|
70099
|
-
});
|
70100
|
-
|
70101
|
-
QUnit.test('Model passed via renderTemplate model is set as controller\'s model', function () {
|
70102
|
-
(0, _emberGlimmer.setTemplate)('bio', (0, _emberTemplateCompiler.compile)('<p>{{model.name}}</p>'));
|
70103
|
-
|
70104
|
-
App.BioController = _emberRuntime.Controller.extend();
|
70105
|
-
|
70106
|
-
Router.map(function () {
|
70107
|
-
this.route('home', { path: '/' });
|
70108
|
-
});
|
70109
|
-
|
70110
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
70111
|
-
renderTemplate: function () {
|
70112
|
-
this.render('bio', {
|
70113
|
-
model: { name: 'emberjs' }
|
70114
|
-
});
|
70115
|
-
}
|
70116
|
-
});
|
70117
|
-
|
70118
|
-
bootApplication();
|
70119
|
-
|
70120
|
-
equal((0, _emberViews.jQuery)('p:contains(emberjs)', '#qunit-fixture').length, 1, 'Passed model was set as controllers model');
|
70121
|
-
});
|
70122
|
-
|
70123
|
-
QUnit.test('render uses templateName from route', function () {
|
70124
|
-
Router.map(function () {
|
70125
|
-
this.route('home', { path: '/' });
|
70126
|
-
});
|
70127
|
-
|
70128
|
-
(0, _emberGlimmer.setTemplate)('the_real_home_template', (0, _emberTemplateCompiler.compile)('<p>THIS IS THE REAL HOME</p>'));
|
70129
|
-
|
70130
|
-
App.HomeController = _emberRuntime.Controller.extend();
|
70131
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
70132
|
-
templateName: 'the_real_home_template'
|
70133
|
-
});
|
70134
|
-
|
70135
|
-
bootApplication();
|
70136
|
-
|
70137
|
-
equal((0, _emberViews.jQuery)('p', '#qunit-fixture').text(), 'THIS IS THE REAL HOME', 'The homepage template was rendered');
|
70138
|
-
});
|
70139
|
-
|
70140
|
-
QUnit.test('defining templateName allows other templates to be rendered', function () {
|
70141
|
-
Router.map(function () {
|
70142
|
-
this.route('home', { path: '/' });
|
70143
|
-
});
|
70144
|
-
|
70145
|
-
(0, _emberGlimmer.setTemplate)('alert', (0, _emberTemplateCompiler.compile)('<div class=\'alert-box\'>Invader!</div>'));
|
70146
|
-
(0, _emberGlimmer.setTemplate)('the_real_home_template', (0, _emberTemplateCompiler.compile)('<p>THIS IS THE REAL HOME</p>{{outlet \'alert\'}}'));
|
70147
|
-
|
70148
|
-
App.HomeController = _emberRuntime.Controller.extend();
|
70149
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
70150
|
-
templateName: 'the_real_home_template',
|
70151
|
-
actions: {
|
70152
|
-
showAlert: function () {
|
70153
|
-
this.render('alert', {
|
70154
|
-
into: 'home',
|
70155
|
-
outlet: 'alert'
|
70156
|
-
});
|
70157
|
-
}
|
70158
|
-
}
|
70159
|
-
});
|
70160
|
-
|
70161
|
-
bootApplication();
|
70162
|
-
|
70163
|
-
equal((0, _emberViews.jQuery)('p', '#qunit-fixture').text(), 'THIS IS THE REAL HOME', 'The homepage template was rendered');
|
70164
|
-
|
70165
|
-
(0, _emberMetal.run)(function () {
|
70166
|
-
return router.send('showAlert');
|
70167
|
-
});
|
70168
|
-
|
70169
|
-
equal((0, _emberViews.jQuery)('.alert-box', '#qunit-fixture').text(), 'Invader!', 'Template for alert was render into outlet');
|
70170
|
-
});
|
70171
|
-
|
70172
|
-
QUnit.test('templateName is still used when calling render with no name and options', function () {
|
70173
|
-
Router.map(function () {
|
70174
|
-
this.route('home', { path: '/' });
|
70175
|
-
});
|
70176
|
-
|
70177
|
-
(0, _emberGlimmer.setTemplate)('alert', (0, _emberTemplateCompiler.compile)('<div class=\'alert-box\'>Invader!</div>'));
|
70178
|
-
(0, _emberGlimmer.setTemplate)('home', (0, _emberTemplateCompiler.compile)('<p>THIS IS THE REAL HOME</p>{{outlet \'alert\'}}'));
|
70179
|
-
|
70180
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
70181
|
-
templateName: 'alert',
|
70182
|
-
renderTemplate: function () {
|
70183
|
-
this.render({});
|
70184
|
-
}
|
70185
|
-
});
|
70186
|
-
|
70187
|
-
bootApplication();
|
70188
|
-
|
70189
|
-
equal((0, _emberViews.jQuery)('.alert-box', '#qunit-fixture').text(), 'Invader!', 'default templateName was rendered into outlet');
|
70190
|
-
});
|
70191
|
-
|
70192
|
-
QUnit.test('The Homepage with a `setupController` hook', function () {
|
70193
|
-
Router.map(function () {
|
70194
|
-
this.route('home', { path: '/' });
|
70195
|
-
});
|
70196
|
-
|
70197
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
70198
|
-
setupController: function (controller) {
|
70199
|
-
(0, _emberMetal.set)(controller, 'hours', (0, _emberRuntime.A)(['Monday through Friday: 9am to 5pm', 'Saturday: Noon to Midnight', 'Sunday: Noon to 6pm']));
|
70200
|
-
}
|
70201
|
-
});
|
70202
|
-
|
70203
|
-
(0, _emberGlimmer.setTemplate)('home', (0, _emberTemplateCompiler.compile)('<ul>{{#each hours as |entry|}}<li>{{entry}}</li>{{/each}}</ul>'));
|
70204
|
-
|
70205
|
-
bootApplication();
|
70206
|
-
|
70207
|
-
equal((0, _emberViews.jQuery)('ul li', '#qunit-fixture').eq(2).text(), 'Sunday: Noon to 6pm', 'The template was rendered with the hours context');
|
70208
|
-
});
|
70209
|
-
|
70210
|
-
QUnit.test('The route controller is still set when overriding the setupController hook', function () {
|
70211
|
-
Router.map(function () {
|
70212
|
-
this.route('home', { path: '/' });
|
70213
|
-
});
|
70214
|
-
|
70215
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
70216
|
-
setupController: function (controller) {
|
70217
|
-
// no-op
|
70218
|
-
// importantly, we are not calling this._super here
|
70219
|
-
}
|
70220
|
-
});
|
70221
|
-
|
70222
|
-
registry.register('controller:home', _emberRuntime.Controller.extend());
|
70223
|
-
|
70224
|
-
bootApplication();
|
70225
|
-
|
70226
|
-
deepEqual(container.lookup('route:home').controller, container.lookup('controller:home'), 'route controller is the home controller');
|
70227
|
-
});
|
70228
|
-
|
70229
|
-
QUnit.test('The route controller can be specified via controllerName', function () {
|
70230
|
-
Router.map(function () {
|
70231
|
-
this.route('home', { path: '/' });
|
70232
|
-
});
|
70233
|
-
|
70234
|
-
(0, _emberGlimmer.setTemplate)('home', (0, _emberTemplateCompiler.compile)('<p>{{myValue}}</p>'));
|
70235
|
-
|
70236
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
70237
|
-
controllerName: 'myController'
|
70238
|
-
});
|
70239
|
-
|
70240
|
-
registry.register('controller:myController', _emberRuntime.Controller.extend({
|
70241
|
-
myValue: 'foo'
|
70242
|
-
}));
|
70243
|
-
|
70244
|
-
bootApplication();
|
70245
|
-
|
70246
|
-
deepEqual(container.lookup('route:home').controller, container.lookup('controller:myController'), 'route controller is set by controllerName');
|
70247
|
-
equal((0, _emberViews.jQuery)('p', '#qunit-fixture').text(), 'foo', 'The homepage template was rendered with data from the custom controller');
|
70248
|
-
});
|
70249
|
-
|
70250
70086
|
QUnit.test('The route controller specified via controllerName is used in render', function () {
|
70251
70087
|
Router.map(function () {
|
70252
70088
|
this.route('home', { path: '/' });
|
@@ -72841,9 +72677,7 @@ enifed('ember/tests/routing/basic_test', ['ember-utils', 'ember-console', 'ember
|
|
72841
72677
|
}
|
72842
72678
|
});
|
72843
72679
|
|
72844
|
-
|
72845
|
-
return bootApplication();
|
72846
|
-
}, /More context objects were passed/);
|
72680
|
+
bootApplication();
|
72847
72681
|
|
72848
72682
|
equal((0, _emberViews.jQuery)('#error').length, 1, 'Error template was rendered.');
|
72849
72683
|
});
|
@@ -73632,6 +73466,341 @@ QUnit.test('should pass ESLint', function(assert) {
|
|
73632
73466
|
assert.ok(true, 'ember/tests/routing/basic_test.js should pass ESLint\n\n');
|
73633
73467
|
});
|
73634
73468
|
|
73469
|
+
enifed('ember/tests/routing/decoupled_basic_test', ['ember-babel', 'ember-routing', 'ember-runtime', 'internal-test-helpers'], function (_emberBabel, _emberRouting, _emberRuntime, _internalTestHelpers) {
|
73470
|
+
'use strict';
|
73471
|
+
|
73472
|
+
(0, _internalTestHelpers.moduleFor)('Basic Routing - Decoupled from global resovler', function (_ApplicationTestCase) {
|
73473
|
+
(0, _emberBabel.inherits)(_class, _ApplicationTestCase);
|
73474
|
+
|
73475
|
+
function _class() {
|
73476
|
+
(0, _emberBabel.classCallCheck)(this, _class);
|
73477
|
+
|
73478
|
+
var _this = (0, _emberBabel.possibleConstructorReturn)(this, _ApplicationTestCase.call(this));
|
73479
|
+
|
73480
|
+
_this.addTemplate('home', '<h3 id="app">Hours</h3>');
|
73481
|
+
_this.addTemplate('camelot', '<section id="camelot"><h3>Is a silly place</h3></section>');
|
73482
|
+
_this.addTemplate('homepage', '<h3 id="troll">Megatroll</h3><p>{{model.home}}</p>');
|
73483
|
+
|
73484
|
+
_this.router.map(function () {
|
73485
|
+
this.route('home', { path: '/' });
|
73486
|
+
});
|
73487
|
+
return _this;
|
73488
|
+
}
|
73489
|
+
|
73490
|
+
_class.prototype.getController = function getController(name) {
|
73491
|
+
return this.applicationInstance.lookup('controller:' + name);
|
73492
|
+
};
|
73493
|
+
|
73494
|
+
_class.prototype['@test warn on URLs not included in the route set'] = function testWarnOnURLsNotIncludedInTheRouteSet(assert) {
|
73495
|
+
var _this2 = this;
|
73496
|
+
|
73497
|
+
return this.visit('/').then(function () {
|
73498
|
+
expectAssertion(function () {
|
73499
|
+
_this2.visit('/what-is-this-i-dont-even');
|
73500
|
+
}, /'\/what-is-this-i-dont-even' did not match any routes/);
|
73501
|
+
});
|
73502
|
+
};
|
73503
|
+
|
73504
|
+
_class.prototype['@test The Homepage'] = function testTheHomepage(assert) {
|
73505
|
+
var _this3 = this;
|
73506
|
+
|
73507
|
+
return this.visit('/').then(function () {
|
73508
|
+
assert.equal(_this3.currentPath, 'home', 'currently on the home route');
|
73509
|
+
|
73510
|
+
var text = _this3.$('#app').text();
|
73511
|
+
assert.equal(text, "Hours", 'the home template was rendered');
|
73512
|
+
});
|
73513
|
+
};
|
73514
|
+
|
73515
|
+
_class.prototype['@test The Homepage and the Camelot page with multiple Router.map calls'] = function (assert) {
|
73516
|
+
var _this4 = this;
|
73517
|
+
|
73518
|
+
this.router.map(function () {
|
73519
|
+
this.route('camelot', { path: '/camelot' });
|
73520
|
+
});
|
73521
|
+
|
73522
|
+
return this.visit('/camelot').then(function () {
|
73523
|
+
assert.equal(_this4.currentPath, 'camelot');
|
73524
|
+
|
73525
|
+
var text = _this4.$('#camelot').text();
|
73526
|
+
assert.equal(text, "Is a silly place", 'the camelot template was rendered');
|
73527
|
+
|
73528
|
+
return _this4.visit('/');
|
73529
|
+
}).then(function () {
|
73530
|
+
assert.equal(_this4.currentPath, 'home');
|
73531
|
+
|
73532
|
+
var text = _this4.$('#app').text();
|
73533
|
+
assert.equal(text, "Hours", 'the home template was rendered');
|
73534
|
+
});
|
73535
|
+
};
|
73536
|
+
|
73537
|
+
_class.prototype['@test The Homepage with explicit template name in renderTemplate'] = function (assert) {
|
73538
|
+
var _this5 = this;
|
73539
|
+
|
73540
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73541
|
+
renderTemplate: function () {
|
73542
|
+
this.render('homepage');
|
73543
|
+
}
|
73544
|
+
}));
|
73545
|
+
|
73546
|
+
return this.visit('/').then(function () {
|
73547
|
+
var text = _this5.$('#troll').text();
|
73548
|
+
assert.equal(text, "Megatroll", 'the homepage template was rendered');
|
73549
|
+
});
|
73550
|
+
};
|
73551
|
+
|
73552
|
+
_class.prototype['@test an alternate template will pull in an alternate controller'] = function (assert) {
|
73553
|
+
var _this6 = this;
|
73554
|
+
|
73555
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73556
|
+
renderTemplate: function () {
|
73557
|
+
this.render('homepage');
|
73558
|
+
}
|
73559
|
+
}));
|
73560
|
+
this.add('controller:homepage', _emberRuntime.Controller.extend({
|
73561
|
+
model: {
|
73562
|
+
home: 'Comes from homepage'
|
73563
|
+
}
|
73564
|
+
}));
|
73565
|
+
|
73566
|
+
return this.visit('/').then(function () {
|
73567
|
+
var text = _this6.$('p').text();
|
73568
|
+
|
73569
|
+
assert.equal(text, 'Comes from homepage', 'the homepage template was rendered');
|
73570
|
+
});
|
73571
|
+
};
|
73572
|
+
|
73573
|
+
_class.prototype['@test An alternate template will pull in an alternate controller instead of controllerName'] = function (assert) {
|
73574
|
+
var _this7 = this;
|
73575
|
+
|
73576
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73577
|
+
controllerName: 'foo',
|
73578
|
+
renderTemplate: function () {
|
73579
|
+
this.render('homepage');
|
73580
|
+
}
|
73581
|
+
}));
|
73582
|
+
this.add('controller:foo', _emberRuntime.Controller.extend({
|
73583
|
+
model: {
|
73584
|
+
home: 'Comes from foo'
|
73585
|
+
}
|
73586
|
+
}));
|
73587
|
+
this.add('controller:homepage', _emberRuntime.Controller.extend({
|
73588
|
+
model: {
|
73589
|
+
home: 'Comes from homepage'
|
73590
|
+
}
|
73591
|
+
}));
|
73592
|
+
|
73593
|
+
return this.visit('/').then(function () {
|
73594
|
+
var text = _this7.$('p').text();
|
73595
|
+
|
73596
|
+
assert.equal(text, 'Comes from homepage', 'the homepage template was rendered');
|
73597
|
+
});
|
73598
|
+
};
|
73599
|
+
|
73600
|
+
_class.prototype['@test The template will pull in an alternate controller via key/value'] = function (assert) {
|
73601
|
+
var _this8 = this;
|
73602
|
+
|
73603
|
+
this.router.map(function () {
|
73604
|
+
this.route('homepage', { path: '/' });
|
73605
|
+
});
|
73606
|
+
|
73607
|
+
this.add('route:homepage', _emberRouting.Route.extend({
|
73608
|
+
renderTemplate: function () {
|
73609
|
+
this.render({ controller: 'home' });
|
73610
|
+
}
|
73611
|
+
}));
|
73612
|
+
this.add('controller:home', _emberRuntime.Controller.extend({
|
73613
|
+
model: {
|
73614
|
+
home: 'Comes from home.'
|
73615
|
+
}
|
73616
|
+
}));
|
73617
|
+
|
73618
|
+
return this.visit('/').then(function () {
|
73619
|
+
var text = _this8.$('p').text();
|
73620
|
+
|
73621
|
+
assert.equal(text, 'Comes from home.', 'the homepage template was rendered from data from the HomeController');
|
73622
|
+
});
|
73623
|
+
};
|
73624
|
+
|
73625
|
+
_class.prototype['@test The Homepage with explicit template name in renderTemplate and controller'] = function (assert) {
|
73626
|
+
var _this9 = this;
|
73627
|
+
|
73628
|
+
this.add('controller:home', _emberRuntime.Controller.extend({
|
73629
|
+
model: {
|
73630
|
+
home: 'YES I AM HOME'
|
73631
|
+
}
|
73632
|
+
}));
|
73633
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73634
|
+
renderTemplate: function () {
|
73635
|
+
this.render('homepage');
|
73636
|
+
}
|
73637
|
+
}));
|
73638
|
+
|
73639
|
+
return this.visit('/').then(function () {
|
73640
|
+
var text = _this9.$('p').text();
|
73641
|
+
|
73642
|
+
assert.equal(text, 'YES I AM HOME', 'The homepage template was rendered');
|
73643
|
+
});
|
73644
|
+
};
|
73645
|
+
|
73646
|
+
_class.prototype['@test Model passed via renderTemplate model is set as controller\'s model'] = function (assert) {
|
73647
|
+
var _this10 = this;
|
73648
|
+
|
73649
|
+
this.addTemplate('bio', '<p>{{model.name}}</p>');
|
73650
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73651
|
+
renderTemplate: function () {
|
73652
|
+
this.render('bio', {
|
73653
|
+
model: { name: 'emberjs' }
|
73654
|
+
});
|
73655
|
+
}
|
73656
|
+
}));
|
73657
|
+
|
73658
|
+
return this.visit('/').then(function () {
|
73659
|
+
var text = _this10.$('p').text();
|
73660
|
+
|
73661
|
+
assert.equal(text, 'emberjs', 'Passed model was set as controller\'s model');
|
73662
|
+
});
|
73663
|
+
};
|
73664
|
+
|
73665
|
+
_class.prototype['@test render uses templateName from route'] = function testRenderUsesTemplateNameFromRoute(assert) {
|
73666
|
+
var _this11 = this;
|
73667
|
+
|
73668
|
+
this.addTemplate('the_real_home_template', '<p>THIS IS THE REAL HOME</p>');
|
73669
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73670
|
+
templateName: 'the_real_home_template'
|
73671
|
+
}));
|
73672
|
+
|
73673
|
+
return this.visit('/').then(function () {
|
73674
|
+
var text = _this11.$('p').text();
|
73675
|
+
|
73676
|
+
assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
|
73677
|
+
});
|
73678
|
+
};
|
73679
|
+
|
73680
|
+
_class.prototype['@test defining templateName allows other templates to be rendered'] = function testDefiningTemplateNameAllowsOtherTemplatesToBeRendered(assert) {
|
73681
|
+
var _this12 = this;
|
73682
|
+
|
73683
|
+
this.addTemplate('alert', '<div class=\'alert-box\'>Invader!</div>');
|
73684
|
+
this.addTemplate('the_real_home_template', '<p>THIS IS THE REAL HOME</p>{{outlet \'alert\'}}');
|
73685
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73686
|
+
templateName: 'the_real_home_template',
|
73687
|
+
actions: {
|
73688
|
+
showAlert: function () {
|
73689
|
+
this.render('alert', {
|
73690
|
+
into: 'home',
|
73691
|
+
outlet: 'alert'
|
73692
|
+
});
|
73693
|
+
}
|
73694
|
+
}
|
73695
|
+
}));
|
73696
|
+
|
73697
|
+
return this.visit('/').then(function () {
|
73698
|
+
var text = _this12.$('p').text();
|
73699
|
+
assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
|
73700
|
+
|
73701
|
+
return _this12.runTask(function () {
|
73702
|
+
return _this12.appRouter.send('showAlert');
|
73703
|
+
});
|
73704
|
+
}).then(function () {
|
73705
|
+
var text = _this12.$('.alert-box').text();
|
73706
|
+
|
73707
|
+
assert.equal(text, 'Invader!', 'Template for alert was rendered into the outlet');
|
73708
|
+
});
|
73709
|
+
};
|
73710
|
+
|
73711
|
+
_class.prototype['@test templateName is still used when calling render with no name and options'] = function testTemplateNameIsStillUsedWhenCallingRenderWithNoNameAndOptions(assert) {
|
73712
|
+
var _this13 = this;
|
73713
|
+
|
73714
|
+
this.addTemplate('alert', '<div class=\'alert-box\'>Invader!</div>');
|
73715
|
+
this.addTemplate('home', '<p>THIS IS THE REAL HOME</p>{{outlet \'alert\'}}');
|
73716
|
+
|
73717
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73718
|
+
templateName: 'alert',
|
73719
|
+
renderTemplate: function () {
|
73720
|
+
this.render({});
|
73721
|
+
}
|
73722
|
+
}));
|
73723
|
+
|
73724
|
+
return this.visit('/').then(function () {
|
73725
|
+
var text = _this13.$('.alert-box').text();
|
73726
|
+
|
73727
|
+
assert.equal(text, 'Invader!', 'default templateName was rendered into outlet');
|
73728
|
+
});
|
73729
|
+
};
|
73730
|
+
|
73731
|
+
_class.prototype['@test The Homepage with a `setupController` hook'] = function testTheHomepageWithASetupControllerHook(assert) {
|
73732
|
+
var _this14 = this;
|
73733
|
+
|
73734
|
+
this.addTemplate('home', '<ul>{{#each hours as |entry|}}\n <li>{{entry}}</li>\n {{/each}}\n </ul>\n ');
|
73735
|
+
|
73736
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73737
|
+
setupController: function (controller) {
|
73738
|
+
controller.set('hours', (0, _emberRuntime.A)(['Monday through Friday: 9am to 5pm', 'Saturday: Noon to Midnight', 'Sunday: Noon to 6pm']));
|
73739
|
+
}
|
73740
|
+
}));
|
73741
|
+
return this.visit('/').then(function () {
|
73742
|
+
var text = _this14.$('ul li').eq(2).text();
|
73743
|
+
|
73744
|
+
assert.equal(text, 'Sunday: Noon to 6pm', 'The template was rendered with the hours context');
|
73745
|
+
});
|
73746
|
+
};
|
73747
|
+
|
73748
|
+
_class.prototype['@test The route controller is still set when overriding the setupController hook'] = function (assert) {
|
73749
|
+
var _this15 = this;
|
73750
|
+
|
73751
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73752
|
+
setupController: function () {
|
73753
|
+
// no-op
|
73754
|
+
// importantly, we are not calling this._super
|
73755
|
+
}
|
73756
|
+
}));
|
73757
|
+
|
73758
|
+
this.add('controller:home', _emberRuntime.Controller.extend());
|
73759
|
+
|
73760
|
+
return this.visit('/').then(function () {
|
73761
|
+
var homeRoute = _this15.applicationInstance.lookup('route:home');
|
73762
|
+
var homeController = _this15.applicationInstance.lookup('controller:home');
|
73763
|
+
|
73764
|
+
assert.equal(homeRoute.controller, homeController, 'route controller is the home controller');
|
73765
|
+
});
|
73766
|
+
};
|
73767
|
+
|
73768
|
+
_class.prototype['@test the route controller can be specified via controllerName'] = function testTheRouteControllerCanBeSpecifiedViaControllerName(assert) {
|
73769
|
+
var _this16 = this;
|
73770
|
+
|
73771
|
+
this.addTemplate('home', '<p>{{myValue}}</p>');
|
73772
|
+
this.add('route:home', _emberRouting.Route.extend({
|
73773
|
+
controllerName: 'myController'
|
73774
|
+
}));
|
73775
|
+
this.add('controller:myController', _emberRuntime.Controller.extend({
|
73776
|
+
myValue: 'foo'
|
73777
|
+
}));
|
73778
|
+
|
73779
|
+
return this.visit('/').then(function () {
|
73780
|
+
var homeRoute = _this16.applicationInstance.lookup('route:home');
|
73781
|
+
var myController = _this16.applicationInstance.lookup('controller:myController');
|
73782
|
+
var text = _this16.$('p').text();
|
73783
|
+
|
73784
|
+
assert.deepEqual(homeRoute.controller, myController, 'route controller is set by controllerName');
|
73785
|
+
assert.equal(text, 'foo', 'The homepage template was rendered with data from the custom controller');
|
73786
|
+
});
|
73787
|
+
};
|
73788
|
+
|
73789
|
+
(0, _emberBabel.createClass)(_class, [{
|
73790
|
+
key: 'currentPath',
|
73791
|
+
get: function () {
|
73792
|
+
return this.getController('application').get('currentPath');
|
73793
|
+
}
|
73794
|
+
}]);
|
73795
|
+
return _class;
|
73796
|
+
}(_internalTestHelpers.ApplicationTestCase));
|
73797
|
+
});
|
73798
|
+
QUnit.module('ESLint | ember/tests/routing/decoupled_basic_test.js');
|
73799
|
+
QUnit.test('should pass ESLint', function(assert) {
|
73800
|
+
assert.expect(1);
|
73801
|
+
assert.ok(true, 'ember/tests/routing/decoupled_basic_test.js should pass ESLint\n\n');
|
73802
|
+
});
|
73803
|
+
|
73635
73804
|
enifed('ember/tests/routing/query_params_test', ['ember-babel', 'ember-runtime', 'ember-metal', 'ember-routing', 'ember-views', 'internal-test-helpers'], function (_emberBabel, _emberRuntime, _emberMetal, _emberRouting, _emberViews, _internalTestHelpers) {
|
73636
73805
|
'use strict';
|
73637
73806
|
|
@@ -77643,1066 +77812,975 @@ QUnit.test('should pass ESLint', function(assert) {
|
|
77643
77812
|
assert.ok(true, 'ember/tests/routing/router_service_test/urlFor_test.js should pass ESLint\n\n');
|
77644
77813
|
});
|
77645
77814
|
|
77646
|
-
enifed('ember/tests/routing/substates_test', ['ember-
|
77815
|
+
enifed('ember/tests/routing/substates_test', ['ember-babel', 'ember-runtime', 'ember-routing', 'internal-test-helpers'], function (_emberBabel, _emberRuntime, _emberRouting, _internalTestHelpers) {
|
77647
77816
|
'use strict';
|
77648
77817
|
|
77649
|
-
var
|
77650
|
-
App = void 0,
|
77651
|
-
templates = void 0,
|
77652
|
-
router = void 0,
|
77653
|
-
container = void 0,
|
77654
|
-
counter = void 0;
|
77818
|
+
var counter = void 0;
|
77655
77819
|
|
77656
77820
|
function step(expectedValue, description) {
|
77657
77821
|
equal(counter, expectedValue, 'Step ' + expectedValue + ': ' + description);
|
77658
77822
|
counter++;
|
77659
77823
|
}
|
77660
77824
|
|
77661
|
-
function
|
77662
|
-
|
77663
|
-
(0, _emberGlimmer.setTemplate)(name, (0, _emberTemplateCompiler.compile)(templates[name]));
|
77664
|
-
}
|
77825
|
+
(0, _internalTestHelpers.moduleFor)('Loading/Error Substates', function (_ApplicationTestCase) {
|
77826
|
+
(0, _emberBabel.inherits)(_class, _ApplicationTestCase);
|
77665
77827
|
|
77666
|
-
|
77667
|
-
|
77668
|
-
path: startingURL
|
77669
|
-
});
|
77670
|
-
}
|
77828
|
+
function _class() {
|
77829
|
+
(0, _emberBabel.classCallCheck)(this, _class);
|
77671
77830
|
|
77672
|
-
|
77673
|
-
router = container.lookup('router:main');
|
77674
|
-
(0, _emberMetal.run)(App, 'advanceReadiness');
|
77675
|
-
}
|
77831
|
+
var _this = (0, _emberBabel.possibleConstructorReturn)(this, _ApplicationTestCase.call(this));
|
77676
77832
|
|
77677
|
-
QUnit.module('Loading/Error Substates', {
|
77678
|
-
setup: function () {
|
77679
77833
|
counter = 1;
|
77680
77834
|
|
77681
|
-
(
|
77682
|
-
|
77683
|
-
|
77684
|
-
|
77685
|
-
// fake a modules resolver
|
77686
|
-
Resolver: _emberApplication.Resolver.extend({ moduleBasedResolver: true })
|
77687
|
-
});
|
77688
|
-
|
77689
|
-
App.deferReadiness();
|
77690
|
-
|
77691
|
-
App.Router.reopen({
|
77692
|
-
location: 'none'
|
77693
|
-
});
|
77694
|
-
|
77695
|
-
Router = App.Router;
|
77835
|
+
_this.addTemplate('application', '<div id="app">{{outlet}}</div>');
|
77836
|
+
_this.addTemplate('index', 'INDEX');
|
77837
|
+
return _this;
|
77838
|
+
}
|
77696
77839
|
|
77697
|
-
|
77840
|
+
_class.prototype.getController = function getController(name) {
|
77841
|
+
return this.applicationInstance.lookup('controller:' + name);
|
77842
|
+
};
|
77698
77843
|
|
77699
|
-
|
77700
|
-
|
77701
|
-
index: 'INDEX',
|
77702
|
-
loading: 'LOADING',
|
77703
|
-
bro: 'BRO',
|
77704
|
-
sis: 'SIS'
|
77705
|
-
};
|
77706
|
-
});
|
77707
|
-
},
|
77708
|
-
teardown: function () {
|
77709
|
-
(0, _emberMetal.run)(function () {
|
77710
|
-
App.destroy();
|
77711
|
-
App = null;
|
77844
|
+
_class.prototype['@test Slow promise from a child route of application enters nested loading state'] = function testSlowPromiseFromAChildRouteOfApplicationEntersNestedLoadingState(assert) {
|
77845
|
+
var _this2 = this;
|
77712
77846
|
|
77713
|
-
|
77714
|
-
});
|
77847
|
+
var turtleDeferred = _emberRuntime.RSVP.defer();
|
77715
77848
|
|
77716
|
-
|
77717
|
-
|
77849
|
+
this.router.map(function () {
|
77850
|
+
this.route('turtle');
|
77718
77851
|
});
|
77719
|
-
}
|
77720
|
-
});
|
77721
|
-
|
77722
|
-
QUnit.test('Slow promise from a child route of application enters nested loading state', function () {
|
77723
|
-
var broModel = {};
|
77724
|
-
var broDeferred = _emberRuntime.RSVP.defer();
|
77725
77852
|
|
77726
|
-
|
77727
|
-
|
77728
|
-
|
77853
|
+
this.add('route:application', _emberRouting.Route.extend({
|
77854
|
+
setupController: function () {
|
77855
|
+
step(2, 'ApplicationRoute#setupController');
|
77856
|
+
}
|
77857
|
+
}));
|
77729
77858
|
|
77730
|
-
|
77731
|
-
|
77732
|
-
|
77733
|
-
|
77734
|
-
|
77859
|
+
this.add('route:turtle', _emberRouting.Route.extend({
|
77860
|
+
model: function () {
|
77861
|
+
step(1, 'TurtleRoute#model');
|
77862
|
+
return turtleDeferred.promise;
|
77863
|
+
}
|
77864
|
+
}));
|
77865
|
+
this.addTemplate('turtle', 'TURTLE');
|
77866
|
+
this.addTemplate('loading', 'LOADING');
|
77735
77867
|
|
77736
|
-
|
77737
|
-
|
77738
|
-
|
77739
|
-
|
77740
|
-
}
|
77741
|
-
});
|
77868
|
+
var promise = this.visit('/turtle').then(function () {
|
77869
|
+
text = _this2.$('#app').text();
|
77870
|
+
assert.equal(text, 'TURTLE', 'turtle template has loaded and replaced the loading template');
|
77871
|
+
});
|
77742
77872
|
|
77743
|
-
|
77873
|
+
var text = this.$('#app').text();
|
77874
|
+
assert.equal(text, 'LOADING', 'The Loading template is nested in application template\'s outlet');
|
77744
77875
|
|
77745
|
-
|
77876
|
+
turtleDeferred.resolve();
|
77877
|
+
return promise;
|
77878
|
+
};
|
77746
77879
|
|
77747
|
-
|
77880
|
+
_class.prototype['@test Slow promises returned from ApplicationRoute#model don\'t enter LoadingRoute'] = function (assert) {
|
77881
|
+
var _this3 = this;
|
77748
77882
|
|
77749
|
-
|
77750
|
-
});
|
77883
|
+
var appDeferred = _emberRuntime.RSVP.defer();
|
77751
77884
|
|
77752
|
-
|
77753
|
-
|
77885
|
+
this.add('route:application', _emberRouting.Route.extend({
|
77886
|
+
model: function () {
|
77887
|
+
return appDeferred.promise;
|
77888
|
+
}
|
77889
|
+
}));
|
77890
|
+
this.add('route:loading', _emberRouting.Route.extend({
|
77891
|
+
setupController: function () {
|
77892
|
+
ok(false, 'shouldn\'t get here');
|
77893
|
+
}
|
77894
|
+
}));
|
77754
77895
|
|
77755
|
-
|
77756
|
-
|
77896
|
+
var promise = this.visit('/').then(function () {
|
77897
|
+
text = _this3.$('#app').text();
|
77757
77898
|
|
77758
|
-
|
77759
|
-
this.route('grandma', function () {
|
77760
|
-
this.route('mom', { resetNamespace: true }, function () {
|
77761
|
-
this.route('sally');
|
77762
|
-
});
|
77899
|
+
assert.equal(text, 'INDEX', 'index template has been rendered');
|
77763
77900
|
});
|
77764
|
-
});
|
77765
|
-
|
77766
|
-
templates.grandma = 'GRANDMA {{outlet}}';
|
77767
|
-
templates.mom = 'MOM {{outlet}}';
|
77768
|
-
templates['mom/loading'] = 'MOMLOADING';
|
77769
|
-
templates['mom/sally'] = 'SALLY';
|
77770
77901
|
|
77771
|
-
|
77772
|
-
model: function () {
|
77773
|
-
step(1, 'GrandmaRoute#model');
|
77774
|
-
return grandmaDeferred.promise;
|
77775
|
-
}
|
77776
|
-
});
|
77777
|
-
|
77778
|
-
App.MomRoute = _emberRouting.Route.extend({
|
77779
|
-
model: function () {
|
77780
|
-
step(2, 'Mom#model');
|
77781
|
-
return {};
|
77782
|
-
}
|
77783
|
-
});
|
77784
|
-
|
77785
|
-
App.MomSallyRoute = _emberRouting.Route.extend({
|
77786
|
-
model: function () {
|
77787
|
-
step(3, 'SallyRoute#model');
|
77788
|
-
return sallyDeferred.promise;
|
77789
|
-
},
|
77790
|
-
setupController: function () {
|
77791
|
-
step(4, 'SallyRoute#setupController');
|
77792
|
-
}
|
77793
|
-
});
|
77794
|
-
|
77795
|
-
bootApplication('/grandma/mom/sally');
|
77796
|
-
|
77797
|
-
equal((0, _emberViews.jQuery)('#app', '#qunit-fixture').text(), 'LOADING', 'The Loading template is nested in application template\'s outlet');
|
77902
|
+
var text = this.$('#app').text();
|
77798
77903
|
|
77799
|
-
|
77800
|
-
|
77904
|
+
assert.equal(text, '', 'nothing has been rendered yet');
|
77905
|
+
appDeferred.resolve();
|
77801
77906
|
|
77802
|
-
|
77803
|
-
|
77804
|
-
});
|
77907
|
+
return promise;
|
77908
|
+
};
|
77805
77909
|
|
77806
|
-
|
77807
|
-
|
77910
|
+
_class.prototype['@test Don\'t enter loading route unless either route or template defined'] = function (assert) {
|
77911
|
+
var _this4 = this;
|
77808
77912
|
|
77809
|
-
|
77913
|
+
var deferred = _emberRuntime.RSVP.defer();
|
77810
77914
|
|
77811
|
-
|
77812
|
-
|
77813
|
-
this.route('mom');
|
77915
|
+
this.router.map(function () {
|
77916
|
+
this.route('dummy');
|
77814
77917
|
});
|
77815
|
-
|
77816
|
-
|
77817
|
-
|
77818
|
-
|
77819
|
-
|
77820
|
-
|
77821
|
-
App.GrandmaMomRoute = _emberRouting.Route.extend({
|
77822
|
-
model: function () {
|
77823
|
-
return momDeferred.promise;
|
77824
|
-
}
|
77825
|
-
});
|
77826
|
-
|
77827
|
-
bootApplication('/grandma/mom');
|
77828
|
-
|
77829
|
-
equal((0, _emberViews.jQuery)('#app', '#qunit-fixture').text(), 'GRANDMA GRANDMALOADING');
|
77918
|
+
this.add('route:dummy', _emberRouting.Route.extend({
|
77919
|
+
model: function () {
|
77920
|
+
return deferred.promise;
|
77921
|
+
}
|
77922
|
+
}));
|
77923
|
+
this.addTemplate('dummy', 'DUMMY');
|
77830
77924
|
|
77831
|
-
|
77832
|
-
|
77925
|
+
return this.visit('/').then(function () {
|
77926
|
+
var promise = _this4.visit('/dummy').then(function () {
|
77927
|
+
var text = _this4.$('#app').text();
|
77833
77928
|
|
77834
|
-
|
77835
|
-
|
77836
|
-
equal(appController.get('currentPath'), 'grandma.mom', 'currentPath reflects final state');
|
77837
|
-
});
|
77929
|
+
assert.equal(text, 'DUMMY', 'dummy template has been rendered');
|
77930
|
+
});
|
77838
77931
|
|
77839
|
-
|
77840
|
-
|
77932
|
+
assert.ok(_this4.currentPath !== 'loading', '\n loading state not entered\n ');
|
77933
|
+
deferred.resolve();
|
77841
77934
|
|
77842
|
-
|
77935
|
+
return promise;
|
77936
|
+
});
|
77937
|
+
};
|
77843
77938
|
|
77844
|
-
|
77845
|
-
|
77846
|
-
return appDeferred.promise;
|
77847
|
-
}
|
77848
|
-
});
|
77939
|
+
_class.prototype['@test Enter loading route only if loadingRoute is defined'] = function testEnterLoadingRouteOnlyIfLoadingRouteIsDefined(assert) {
|
77940
|
+
var _this5 = this;
|
77849
77941
|
|
77850
|
-
|
77851
|
-
setupController: function () {
|
77852
|
-
ok(false, 'shouldn\'t get here');
|
77853
|
-
}
|
77854
|
-
});
|
77942
|
+
var deferred = _emberRuntime.RSVP.defer();
|
77855
77943
|
|
77856
|
-
|
77944
|
+
this.router.map(function () {
|
77945
|
+
this.route('dummy');
|
77946
|
+
});
|
77857
77947
|
|
77858
|
-
|
77948
|
+
this.add('route:dummy', _emberRouting.Route.extend({
|
77949
|
+
model: function () {
|
77950
|
+
step(1, 'DummyRoute#model');
|
77951
|
+
return deferred.promise;
|
77952
|
+
}
|
77953
|
+
}));
|
77954
|
+
this.add('route:loading', _emberRouting.Route.extend({
|
77955
|
+
setupController: function () {
|
77956
|
+
step(2, 'LoadingRoute#setupController');
|
77957
|
+
}
|
77958
|
+
}));
|
77959
|
+
this.addTemplate('dummy', 'DUMMY');
|
77859
77960
|
|
77860
|
-
|
77861
|
-
|
77862
|
-
|
77961
|
+
return this.visit('/').then(function () {
|
77962
|
+
var promise = _this5.visit('/dummy').then(function () {
|
77963
|
+
var text = _this5.$('#app').text();
|
77863
77964
|
|
77864
|
-
|
77865
|
-
|
77965
|
+
assert.equal(text, 'DUMMY', 'dummy template has been rendered');
|
77966
|
+
});
|
77866
77967
|
|
77867
|
-
|
77968
|
+
assert.equal(_this5.currentPath, 'loading', 'loading state entered');
|
77969
|
+
deferred.resolve();
|
77868
77970
|
|
77869
|
-
|
77971
|
+
return promise;
|
77972
|
+
});
|
77973
|
+
};
|
77870
77974
|
|
77871
|
-
|
77975
|
+
_class.prototype['@test Slow promises returned from ApplicationRoute#model enter ApplicationLoadingRoute if present'] = function testSlowPromisesReturnedFromApplicationRouteModelEnterApplicationLoadingRouteIfPresent(assert) {
|
77976
|
+
var _this6 = this;
|
77872
77977
|
|
77873
|
-
|
77874
|
-
model: function () {
|
77875
|
-
return indexDeferred.promise;
|
77876
|
-
}
|
77877
|
-
});
|
77978
|
+
var appDeferred = _emberRuntime.RSVP.defer();
|
77878
77979
|
|
77879
|
-
|
77980
|
+
this.add('route:application', _emberRouting.Route.extend({
|
77981
|
+
model: function () {
|
77982
|
+
return appDeferred.promise;
|
77983
|
+
}
|
77984
|
+
}));
|
77985
|
+
var loadingRouteEntered = false;
|
77986
|
+
this.add('route:application_loading', _emberRouting.Route.extend({
|
77987
|
+
setupController: function () {
|
77988
|
+
loadingRouteEntered = true;
|
77989
|
+
}
|
77990
|
+
}));
|
77880
77991
|
|
77881
|
-
|
77882
|
-
|
77992
|
+
var promise = this.visit('/').then(function () {
|
77993
|
+
assert.equal(_this6.$('#app').text(), 'INDEX', 'index route loaded');
|
77994
|
+
});
|
77995
|
+
assert.ok(loadingRouteEntered, 'ApplicationLoadingRoute was entered');
|
77996
|
+
appDeferred.resolve();
|
77883
77997
|
|
77884
|
-
|
77885
|
-
|
77886
|
-
});
|
77998
|
+
return promise;
|
77999
|
+
};
|
77887
78000
|
|
77888
|
-
|
77889
|
-
|
78001
|
+
_class.prototype['@test Slow promises returned from ApplicationRoute#model enter application_loading if template present'] = function testSlowPromisesReturnedFromApplicationRouteModelEnterApplication_loadingIfTemplatePresent(assert) {
|
78002
|
+
var _this7 = this;
|
77890
78003
|
|
77891
|
-
|
78004
|
+
var appDeferred = _emberRuntime.RSVP.defer();
|
77892
78005
|
|
77893
|
-
|
78006
|
+
this.addTemplate('application_loading', '\n <div id="toplevel-loading">TOPLEVEL LOADING</div>\n ');
|
78007
|
+
this.add('route:application', _emberRouting.Route.extend({
|
78008
|
+
model: function () {
|
78009
|
+
return appDeferred.promise;
|
78010
|
+
}
|
78011
|
+
}));
|
77894
78012
|
|
77895
|
-
|
77896
|
-
|
77897
|
-
|
77898
|
-
return indexDeferred.promise;
|
77899
|
-
}
|
77900
|
-
});
|
78013
|
+
var promise = this.visit('/').then(function () {
|
78014
|
+
var length = _this7.$('#toplevel-loading').length;
|
78015
|
+
text = _this7.$('#app').text();
|
77901
78016
|
|
77902
|
-
|
77903
|
-
|
77904
|
-
|
77905
|
-
|
77906
|
-
});
|
78017
|
+
assert.equal(length, 0, 'top-level loading view has been entirely removed from the DOM');
|
78018
|
+
assert.equal(text, 'INDEX', 'index has fully rendered');
|
78019
|
+
});
|
78020
|
+
var text = this.$('#toplevel-loading').text();
|
77907
78021
|
|
77908
|
-
|
78022
|
+
assert.equal(text, 'TOPLEVEL LOADING', 'still loading the top level');
|
78023
|
+
appDeferred.resolve();
|
77909
78024
|
|
77910
|
-
|
77911
|
-
|
78025
|
+
return promise;
|
78026
|
+
};
|
77912
78027
|
|
77913
|
-
|
77914
|
-
|
77915
|
-
});
|
78028
|
+
_class.prototype['@test Prioritized substate entry works with preserved-namespace nested routes'] = function testPrioritizedSubstateEntryWorksWithPreservedNamespaceNestedRoutes(assert) {
|
78029
|
+
var _this8 = this;
|
77916
78030
|
|
77917
|
-
|
77918
|
-
expect(4);
|
78031
|
+
var deferred = _emberRuntime.RSVP.defer();
|
77919
78032
|
|
77920
|
-
|
78033
|
+
this.addTemplate('foo.bar_loading', 'FOOBAR LOADING');
|
78034
|
+
this.addTemplate('foo.bar.index', 'YAY');
|
77921
78035
|
|
77922
|
-
|
77923
|
-
|
77924
|
-
|
77925
|
-
this.route('sally');
|
78036
|
+
this.router.map(function () {
|
78037
|
+
this.route('foo', function () {
|
78038
|
+
this.route('bar', { path: '/bar' }, function () {});
|
77926
78039
|
});
|
77927
|
-
this.route('smells');
|
77928
78040
|
});
|
77929
|
-
});
|
77930
|
-
|
77931
|
-
templates['grandma/loading'] = 'GMONEYLOADING';
|
77932
|
-
|
77933
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
77934
78041
|
|
77935
|
-
|
77936
|
-
|
77937
|
-
|
77938
|
-
|
77939
|
-
|
77940
|
-
|
77941
|
-
App.GrandmaSmellsRoute = _emberRouting.Route.extend({
|
77942
|
-
model: function () {
|
77943
|
-
return deferred.promise;
|
77944
|
-
}
|
77945
|
-
});
|
77946
|
-
|
77947
|
-
bootApplication('/grandma/mom/sally');
|
78042
|
+
this.add('route:foo.bar', _emberRouting.Route.extend({
|
78043
|
+
model: function () {
|
78044
|
+
return deferred.promise;
|
78045
|
+
}
|
78046
|
+
}));
|
77948
78047
|
|
77949
|
-
|
77950
|
-
|
78048
|
+
return this.visit('/').then(function () {
|
78049
|
+
var promise = _this8.visit('/foo/bar').then(function () {
|
78050
|
+
text = _this8.$('#app').text();
|
77951
78051
|
|
77952
|
-
|
77953
|
-
|
78052
|
+
assert.equal(text, 'YAY', 'foo.bar.index fully loaded');
|
78053
|
+
});
|
78054
|
+
var text = _this8.$('#app').text();
|
77954
78055
|
|
77955
|
-
|
78056
|
+
assert.equal(text, 'FOOBAR LOADING', 'foo.bar_loading was entered (as opposed to something like foo/foo/bar_loading)');
|
78057
|
+
deferred.resolve();
|
77956
78058
|
|
77957
|
-
|
77958
|
-
|
78059
|
+
return promise;
|
78060
|
+
});
|
78061
|
+
};
|
77959
78062
|
|
77960
|
-
|
77961
|
-
|
78063
|
+
_class.prototype['@test Prioritized substate entry works with reset-namespace nested routes'] = function testPrioritizedSubstateEntryWorksWithResetNamespaceNestedRoutes(assert) {
|
78064
|
+
var _this9 = this;
|
77962
78065
|
|
77963
|
-
|
78066
|
+
var deferred = _emberRuntime.RSVP.defer();
|
77964
78067
|
|
77965
|
-
|
77966
|
-
|
78068
|
+
this.addTemplate('bar_loading', 'BAR LOADING');
|
78069
|
+
this.addTemplate('bar.index', 'YAY');
|
77967
78070
|
|
77968
|
-
|
77969
|
-
|
77970
|
-
|
77971
|
-
this.route('sally');
|
78071
|
+
this.router.map(function () {
|
78072
|
+
this.route('foo', function () {
|
78073
|
+
this.route('bar', { path: '/bar', resetNamespace: true }, function () {});
|
77972
78074
|
});
|
77973
|
-
this.route('smells');
|
77974
78075
|
});
|
77975
|
-
});
|
77976
|
-
|
77977
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
77978
78076
|
|
77979
|
-
|
77980
|
-
|
77981
|
-
|
77982
|
-
ok(true, 'loading action received on ApplicationRoute');
|
78077
|
+
this.add('route:bar', _emberRouting.Route.extend({
|
78078
|
+
model: function () {
|
78079
|
+
return deferred.promise;
|
77983
78080
|
}
|
77984
|
-
}
|
77985
|
-
});
|
77986
|
-
|
77987
|
-
App.MomSallyRoute = _emberRouting.Route.extend({
|
77988
|
-
model: function () {
|
77989
|
-
return sallyDeferred.promise;
|
77990
|
-
}
|
77991
|
-
});
|
77992
|
-
|
77993
|
-
App.GrandmaSmellsRoute = _emberRouting.Route.extend({
|
77994
|
-
model: function () {
|
77995
|
-
return smellsDeferred.promise;
|
77996
|
-
}
|
77997
|
-
});
|
78081
|
+
}));
|
77998
78082
|
|
77999
|
-
|
78083
|
+
return this.visit('/').then(function () {
|
78084
|
+
var promise = _this9.visit('/foo/bar').then(function () {
|
78085
|
+
text = _this9.$('#app').text();
|
78000
78086
|
|
78001
|
-
|
78002
|
-
|
78003
|
-
(0, _emberMetal.run)(sallyDeferred, 'resolve', {});
|
78087
|
+
assert.equal(text, 'YAY', 'bar.index fully loaded');
|
78088
|
+
});
|
78004
78089
|
|
78005
|
-
|
78090
|
+
var text = _this9.$('#app').text();
|
78006
78091
|
|
78007
|
-
|
78008
|
-
|
78092
|
+
assert.equal(text, 'BAR LOADING', 'foo.bar_loading was entered (as opposed to something likefoo/foo/bar_loading)');
|
78093
|
+
deferred.resolve();
|
78009
78094
|
|
78010
|
-
|
78095
|
+
return promise;
|
78096
|
+
});
|
78097
|
+
};
|
78011
78098
|
|
78012
|
-
|
78013
|
-
|
78099
|
+
_class.prototype['@test Prioritized loading substate entry works with preserved-namespace nested routes'] = function testPrioritizedLoadingSubstateEntryWorksWithPreservedNamespaceNestedRoutes(assert) {
|
78100
|
+
var _this10 = this;
|
78014
78101
|
|
78015
|
-
|
78016
|
-
expect(6);
|
78102
|
+
var deferred = _emberRuntime.RSVP.defer();
|
78017
78103
|
|
78018
|
-
|
78019
|
-
|
78104
|
+
this.addTemplate('foo.bar_loading', 'FOOBAR LOADING');
|
78105
|
+
this.addTemplate('foo.bar', 'YAY');
|
78020
78106
|
|
78021
|
-
|
78022
|
-
|
78023
|
-
|
78024
|
-
this.route('sally');
|
78107
|
+
this.router.map(function () {
|
78108
|
+
this.route('foo', function () {
|
78109
|
+
this.route('bar');
|
78025
78110
|
});
|
78026
78111
|
});
|
78027
|
-
});
|
78028
|
-
|
78029
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
78030
78112
|
|
78031
|
-
|
78032
|
-
|
78033
|
-
|
78034
|
-
|
78035
|
-
return _emberRuntime.RSVP.reject({
|
78036
|
-
msg: 'did it broke?'
|
78037
|
-
});
|
78038
|
-
},
|
78039
|
-
|
78040
|
-
actions: {
|
78041
|
-
error: function () {
|
78042
|
-
step(2, 'MomSallyRoute#actions.error');
|
78043
|
-
return true;
|
78113
|
+
this.add('route:foo.bar', _emberRouting.Route.extend({
|
78114
|
+
model: function () {
|
78115
|
+
return deferred.promise;
|
78044
78116
|
}
|
78045
|
-
}
|
78046
|
-
});
|
78117
|
+
}));
|
78047
78118
|
|
78048
|
-
|
78049
|
-
|
78050
|
-
}, function (err) {
|
78051
|
-
return err.msg === 'did it broke?';
|
78052
|
-
});
|
78119
|
+
var promise = this.visit('/foo/bar').then(function () {
|
78120
|
+
text = _this10.$('#app').text();
|
78053
78121
|
|
78054
|
-
|
78122
|
+
assert.equal(text, 'YAY', 'foo.bar has rendered');
|
78123
|
+
});
|
78124
|
+
var text = this.$('#app').text();
|
78055
78125
|
|
78056
|
-
|
78126
|
+
assert.equal(text, 'FOOBAR LOADING', 'foo.bar_loading was entered (as opposed to something like foo/foo/bar_loading)');
|
78127
|
+
deferred.resolve();
|
78057
78128
|
|
78058
|
-
|
78059
|
-
|
78060
|
-
});
|
78129
|
+
return promise;
|
78130
|
+
};
|
78061
78131
|
|
78062
|
-
|
78063
|
-
|
78132
|
+
_class.prototype['@test Prioritized error substate entry works with preserved-namespaec nested routes'] = function testPrioritizedErrorSubstateEntryWorksWithPreservedNamespaecNestedRoutes(assert) {
|
78133
|
+
var _this11 = this;
|
78064
78134
|
|
78065
|
-
|
78135
|
+
this.addTemplate('foo.bar_error', 'FOOBAR ERROR: {{model.msg}}');
|
78136
|
+
this.addTemplate('foo.bar', 'YAY');
|
78066
78137
|
|
78067
|
-
|
78068
|
-
|
78069
|
-
|
78070
|
-
this.route('sally');
|
78138
|
+
this.router.map(function () {
|
78139
|
+
this.route('foo', function () {
|
78140
|
+
this.route('bar');
|
78071
78141
|
});
|
78072
78142
|
});
|
78073
|
-
});
|
78074
|
-
|
78075
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
78076
|
-
|
78077
|
-
App.MomSallyRoute = _emberRouting.Route.extend({
|
78078
|
-
model: function () {
|
78079
|
-
step(1, 'MomSallyRoute#model');
|
78080
|
-
|
78081
|
-
return _emberRuntime.RSVP.reject({
|
78082
|
-
msg: 'did it broke?'
|
78083
|
-
});
|
78084
|
-
},
|
78085
78143
|
|
78086
|
-
|
78087
|
-
|
78088
|
-
|
78089
|
-
|
78144
|
+
this.add('route:foo.bar', _emberRouting.Route.extend({
|
78145
|
+
model: function () {
|
78146
|
+
return _emberRuntime.RSVP.reject({
|
78147
|
+
msg: 'did it broke?'
|
78148
|
+
});
|
78090
78149
|
}
|
78091
|
-
}
|
78092
|
-
});
|
78093
|
-
|
78094
|
-
bootApplication('/grandma/mom/sally');
|
78095
|
-
});
|
78096
|
-
|
78097
|
-
QUnit.test('Non-bubbled errors that re-throw aren\'t swallowed', function () {
|
78098
|
-
expect(2);
|
78150
|
+
}));
|
78099
78151
|
|
78100
|
-
|
78152
|
+
return this.visit('/').then(function () {
|
78153
|
+
return _this11.visit('/foo/bar').then(function () {
|
78101
78154
|
|
78102
|
-
|
78103
|
-
|
78104
|
-
this.route('mom', { resetNamespace: true }, function () {
|
78105
|
-
this.route('sally');
|
78155
|
+
var text = _this11.$('#app').text();
|
78156
|
+
assert.equal(text, 'FOOBAR ERROR: did it broke?', 'foo.bar_error was entered (as opposed to something like foo/foo/bar_error)');
|
78106
78157
|
});
|
78107
78158
|
});
|
78108
|
-
}
|
78159
|
+
};
|
78109
78160
|
|
78110
|
-
|
78161
|
+
_class.prototype['@test Prioritized loading substate entry works with auto-generated index routes'] = function testPrioritizedLoadingSubstateEntryWorksWithAutoGeneratedIndexRoutes(assert) {
|
78162
|
+
var _this12 = this;
|
78111
78163
|
|
78112
|
-
|
78113
|
-
|
78114
|
-
|
78164
|
+
var deferred = _emberRuntime.RSVP.defer();
|
78165
|
+
this.addTemplate('foo.index_loading', 'FOO LOADING');
|
78166
|
+
this.addTemplate('foo.index', 'YAY');
|
78167
|
+
this.addTemplate('foo', '{{outlet}}');
|
78115
78168
|
|
78116
|
-
|
78117
|
-
|
78169
|
+
this.router.map(function () {
|
78170
|
+
this.route('foo', function () {
|
78171
|
+
this.route('bar');
|
78118
78172
|
});
|
78119
|
-
}
|
78173
|
+
});
|
78120
78174
|
|
78121
|
-
|
78122
|
-
|
78123
|
-
|
78124
|
-
throw err;
|
78175
|
+
this.add('route:foo.index', _emberRouting.Route.extend({
|
78176
|
+
model: function () {
|
78177
|
+
return deferred.promise;
|
78125
78178
|
}
|
78126
|
-
}
|
78127
|
-
|
78128
|
-
|
78129
|
-
|
78130
|
-
|
78131
|
-
|
78132
|
-
return err.msg === 'did it broke?';
|
78133
|
-
});
|
78134
|
-
});
|
78135
|
-
|
78136
|
-
QUnit.test('Handled errors that re-throw aren\'t swallowed', function () {
|
78137
|
-
expect(4);
|
78138
|
-
|
78139
|
-
var handledError = void 0;
|
78179
|
+
}));
|
78180
|
+
this.add('route:foo', _emberRouting.Route.extend({
|
78181
|
+
model: function () {
|
78182
|
+
return true;
|
78183
|
+
}
|
78184
|
+
}));
|
78140
78185
|
|
78141
|
-
|
78186
|
+
var promise = this.visit('/foo').then(function () {
|
78187
|
+
text = _this12.$('#app').text();
|
78142
78188
|
|
78143
|
-
|
78144
|
-
this.route('grandma', function () {
|
78145
|
-
this.route('mom', { resetNamespace: true }, function () {
|
78146
|
-
this.route('sally');
|
78147
|
-
this.route('this-route-throws');
|
78148
|
-
});
|
78189
|
+
assert.equal(text, 'YAY', 'foo.index was rendered');
|
78149
78190
|
});
|
78150
|
-
|
78151
|
-
|
78152
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
78191
|
+
var text = this.$('#app').text();
|
78192
|
+
assert.equal(text, 'FOO LOADING', 'foo.index_loading was entered');
|
78153
78193
|
|
78154
|
-
|
78155
|
-
model: function () {
|
78156
|
-
step(1, 'MomSallyRoute#model');
|
78194
|
+
deferred.resolve();
|
78157
78195
|
|
78158
|
-
|
78159
|
-
|
78160
|
-
});
|
78161
|
-
},
|
78196
|
+
return promise;
|
78197
|
+
};
|
78162
78198
|
|
78163
|
-
|
78164
|
-
|
78165
|
-
step(2, 'MomSallyRoute#error');
|
78199
|
+
_class.prototype['@test Prioritized error substate entry works with auto-generated index routes'] = function testPrioritizedErrorSubstateEntryWorksWithAutoGeneratedIndexRoutes(assert) {
|
78200
|
+
var _this13 = this;
|
78166
78201
|
|
78167
|
-
|
78202
|
+
this.addTemplate('foo.index_error', 'FOO ERROR: {{model.msg}}');
|
78203
|
+
this.addTemplate('foo.index', 'YAY');
|
78204
|
+
this.addTemplate('foo', '{{outlet}}');
|
78168
78205
|
|
78169
|
-
|
78206
|
+
this.router.map(function () {
|
78207
|
+
this.route('foo', function () {
|
78208
|
+
this.route('bar');
|
78209
|
+
});
|
78210
|
+
});
|
78170
78211
|
|
78171
|
-
|
78172
|
-
|
78212
|
+
this.add('route:foo.index', _emberRouting.Route.extend({
|
78213
|
+
model: function () {
|
78214
|
+
return _emberRuntime.RSVP.reject({
|
78215
|
+
msg: 'did it broke?'
|
78216
|
+
});
|
78173
78217
|
}
|
78174
|
-
}
|
78175
|
-
|
78176
|
-
|
78177
|
-
|
78178
|
-
|
78179
|
-
|
78180
|
-
|
78181
|
-
throw handledError;
|
78182
|
-
}
|
78183
|
-
});
|
78184
|
-
|
78185
|
-
throws(function () {
|
78186
|
-
bootApplication('/grandma/mom/sally');
|
78187
|
-
}, function (err) {
|
78188
|
-
return err.msg === 'did it broke?';
|
78189
|
-
});
|
78190
|
-
});
|
78191
|
-
|
78192
|
-
QUnit.test('Handled errors that bubble can be handled at a higher level', function () {
|
78193
|
-
expect(4);
|
78218
|
+
}));
|
78219
|
+
this.add('route:foo', _emberRouting.Route.extend({
|
78220
|
+
model: function () {
|
78221
|
+
return true;
|
78222
|
+
}
|
78223
|
+
}));
|
78194
78224
|
|
78195
|
-
|
78225
|
+
return this.visit('/').then(function () {
|
78196
78226
|
|
78197
|
-
|
78227
|
+
return _this13.visit('/foo').then(function () {
|
78228
|
+
var text = _this13.$('#app').text();
|
78198
78229
|
|
78199
|
-
|
78200
|
-
this.route('grandma', function () {
|
78201
|
-
this.route('mom', { resetNamespace: true }, function () {
|
78202
|
-
this.route('sally');
|
78230
|
+
assert.equal(text, 'FOO ERROR: did it broke?', 'foo.index_error was entered');
|
78203
78231
|
});
|
78204
78232
|
});
|
78205
|
-
}
|
78206
|
-
|
78207
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
78208
|
-
|
78209
|
-
App.MomRoute = _emberRouting.Route.extend({
|
78210
|
-
actions: {
|
78211
|
-
error: function (err) {
|
78212
|
-
step(3, 'MomRoute#error');
|
78233
|
+
};
|
78213
78234
|
|
78214
|
-
|
78215
|
-
|
78235
|
+
(0, _emberBabel.createClass)(_class, [{
|
78236
|
+
key: 'currentPath',
|
78237
|
+
get: function () {
|
78238
|
+
return this.getController('application').get('currentPath');
|
78216
78239
|
}
|
78217
|
-
});
|
78240
|
+
}]);
|
78241
|
+
return _class;
|
78242
|
+
}(_internalTestHelpers.ApplicationTestCase));
|
78218
78243
|
|
78219
|
-
|
78220
|
-
|
78221
|
-
step(1, 'MomSallyRoute#model');
|
78244
|
+
(0, _internalTestHelpers.moduleFor)('Loading/Error Substates - globals mode app', function (_AutobootApplicationT) {
|
78245
|
+
(0, _emberBabel.inherits)(_class2, _AutobootApplicationT);
|
78222
78246
|
|
78223
|
-
|
78224
|
-
|
78225
|
-
|
78226
|
-
|
78247
|
+
function _class2() {
|
78248
|
+
(0, _emberBabel.classCallCheck)(this, _class2);
|
78249
|
+
return (0, _emberBabel.possibleConstructorReturn)(this, _AutobootApplicationT.apply(this, arguments));
|
78250
|
+
}
|
78227
78251
|
|
78252
|
+
_class2.prototype['@test Rejected promises returned from ApplicationRoute transition into top-level application_error'] = function testRejectedPromisesReturnedFromApplicationRouteTransitionIntoTopLevelApplication_error(assert) {
|
78253
|
+
var _this15 = this;
|
78228
78254
|
|
78229
|
-
|
78230
|
-
error: function (err) {
|
78231
|
-
step(2, 'MomSallyRoute#error');
|
78255
|
+
var reject = true;
|
78232
78256
|
|
78233
|
-
|
78257
|
+
this.runTask(function () {
|
78258
|
+
_this15.createApplication();
|
78259
|
+
_this15.addTemplate('index', '<div id="app">INDEX</div>');
|
78260
|
+
_this15.add('route:application', _emberRouting.Route.extend({
|
78261
|
+
init: function () {
|
78262
|
+
this._super.apply(this, arguments);
|
78263
|
+
},
|
78264
|
+
model: function () {
|
78265
|
+
if (reject) {
|
78266
|
+
return _emberRuntime.RSVP.reject({ msg: 'BAD NEWS BEARS' });
|
78267
|
+
} else {
|
78268
|
+
return {};
|
78269
|
+
}
|
78270
|
+
}
|
78271
|
+
}));
|
78234
78272
|
|
78235
|
-
|
78236
|
-
|
78237
|
-
}
|
78238
|
-
});
|
78273
|
+
_this15.addTemplate('application_error', '\n <p id="toplevel-error">TOPLEVEL ERROR: {{model.msg}}</p>\n ');
|
78274
|
+
});
|
78239
78275
|
|
78240
|
-
|
78241
|
-
|
78276
|
+
var text = this.$('#toplevel-error').text();
|
78277
|
+
assert.equal(text, 'TOPLEVEL ERROR: BAD NEWS BEARS', 'toplevel error rendered');
|
78242
78278
|
|
78243
|
-
|
78244
|
-
expect(3);
|
78279
|
+
reject = false;
|
78245
78280
|
|
78246
|
-
|
78281
|
+
return this.visit('/').then(function () {
|
78282
|
+
var text = _this15.$('#app').text();
|
78247
78283
|
|
78248
|
-
|
78249
|
-
this.route('grandma', function () {
|
78250
|
-
this.route('mom', { resetNamespace: true }, function () {
|
78251
|
-
this.route('sally');
|
78252
|
-
});
|
78284
|
+
assert.equal(text, 'INDEX', 'the index route resolved');
|
78253
78285
|
});
|
78254
|
-
}
|
78255
|
-
|
78256
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
78257
|
-
|
78258
|
-
App.MomSallyRoute = _emberRouting.Route.extend({
|
78259
|
-
model: function () {
|
78260
|
-
step(1, 'MomSallyRoute#model');
|
78261
|
-
|
78262
|
-
return _emberRuntime.RSVP.reject({
|
78263
|
-
msg: 'did it broke?'
|
78264
|
-
});
|
78265
|
-
},
|
78286
|
+
};
|
78266
78287
|
|
78288
|
+
return _class2;
|
78289
|
+
}(_internalTestHelpers.AutobootApplicationTestCase));
|
78267
78290
|
|
78268
|
-
|
78269
|
-
|
78270
|
-
step(2, 'MomSallyRoute#error');
|
78271
|
-
return true;
|
78272
|
-
}
|
78273
|
-
}
|
78274
|
-
});
|
78291
|
+
(0, _internalTestHelpers.moduleFor)('Loading/Error Substates - nested routes', function (_ApplicationTestCase2) {
|
78292
|
+
(0, _emberBabel.inherits)(_class3, _ApplicationTestCase2);
|
78275
78293
|
|
78276
|
-
|
78277
|
-
|
78278
|
-
}, function (err) {
|
78279
|
-
return err.msg === 'did it broke?';
|
78280
|
-
}, 'Correct error was thrown');
|
78281
|
-
});
|
78294
|
+
function _class3() {
|
78295
|
+
(0, _emberBabel.classCallCheck)(this, _class3);
|
78282
78296
|
|
78283
|
-
|
78284
|
-
expect(4);
|
78297
|
+
var _this16 = (0, _emberBabel.possibleConstructorReturn)(this, _ApplicationTestCase2.call(this));
|
78285
78298
|
|
78286
|
-
|
78299
|
+
counter = 1;
|
78287
78300
|
|
78288
|
-
|
78301
|
+
_this16.addTemplate('application', '<div id="app">{{outlet}}</div>');
|
78302
|
+
_this16.addTemplate('index', 'INDEX');
|
78303
|
+
_this16.addTemplate('grandma', 'GRANDMA {{outlet}}');
|
78304
|
+
_this16.addTemplate('mom', 'MOM');
|
78289
78305
|
|
78290
|
-
|
78291
|
-
|
78292
|
-
|
78293
|
-
|
78294
|
-
|
78306
|
+
_this16.router.map(function () {
|
78307
|
+
this.route('grandma', function () {
|
78308
|
+
this.route('mom', { resetNamespace: true }, function () {
|
78309
|
+
this.route('sally');
|
78310
|
+
this.route('this-route-throws');
|
78311
|
+
});
|
78312
|
+
this.route('puppies');
|
78295
78313
|
});
|
78314
|
+
this.route('memere', { path: '/memere/:seg' }, function () {});
|
78296
78315
|
});
|
78297
|
-
});
|
78298
78316
|
|
78299
|
-
|
78300
|
-
|
78301
|
-
|
78302
|
-
model: function () {
|
78303
|
-
step(1, 'MomSallyRoute#model');
|
78317
|
+
_this16.visit('/');
|
78318
|
+
return _this16;
|
78319
|
+
}
|
78304
78320
|
|
78305
|
-
|
78306
|
-
|
78307
|
-
|
78308
|
-
},
|
78321
|
+
_class3.prototype.getController = function getController(name) {
|
78322
|
+
return this.applicationInstance.lookup('controller:' + name);
|
78323
|
+
};
|
78309
78324
|
|
78310
|
-
|
78311
|
-
|
78312
|
-
step(2, 'MomSallyRoute#error');
|
78325
|
+
_class3.prototype['@test ApplicationRoute#currentPath reflects loading state path'] = function testApplicationRouteCurrentPathReflectsLoadingStatePath(assert) {
|
78326
|
+
var _this17 = this;
|
78313
78327
|
|
78314
|
-
|
78328
|
+
var momDeferred = _emberRuntime.RSVP.defer();
|
78315
78329
|
|
78316
|
-
|
78330
|
+
this.addTemplate('grandma.loading', 'GRANDMALOADING');
|
78317
78331
|
|
78318
|
-
|
78319
|
-
|
78332
|
+
this.add('route:mom', _emberRouting.Route.extend({
|
78333
|
+
model: function () {
|
78334
|
+
return momDeferred.promise;
|
78320
78335
|
}
|
78321
|
-
}
|
78322
|
-
});
|
78336
|
+
}));
|
78323
78337
|
|
78324
|
-
|
78325
|
-
|
78326
|
-
step(3, 'MomThisRouteThrows#model');
|
78338
|
+
var promise = this.visit('/grandma/mom').then(function () {
|
78339
|
+
text = _this17.$('#app').text();
|
78327
78340
|
|
78328
|
-
|
78329
|
-
|
78330
|
-
|
78341
|
+
assert.equal(text, 'GRANDMA MOM', 'Grandma.mom loaded text is displayed');
|
78342
|
+
assert.equal(_this17.currentPath, 'grandma.mom.index', 'currentPath reflects final state');
|
78343
|
+
});
|
78344
|
+
var text = this.$('#app').text();
|
78331
78345
|
|
78332
|
-
|
78333
|
-
bootApplication('/grandma/mom/sally');
|
78334
|
-
}, function (err) {
|
78335
|
-
return err.msg === 'did it broke?';
|
78336
|
-
});
|
78337
|
-
});
|
78346
|
+
assert.equal(text, 'GRANDMA GRANDMALOADING', 'Grandma.mom loading text displayed');
|
78338
78347
|
|
78339
|
-
|
78340
|
-
var deferred = _emberRuntime.RSVP.defer();
|
78348
|
+
assert.equal(this.currentPath, 'grandma.loading', 'currentPath reflects loading state');
|
78341
78349
|
|
78342
|
-
|
78343
|
-
this.route('grandma', { path: '/grandma/:seg' }, function () {});
|
78344
|
-
});
|
78350
|
+
momDeferred.resolve();
|
78345
78351
|
|
78346
|
-
|
78352
|
+
return promise;
|
78353
|
+
};
|
78347
78354
|
|
78348
|
-
|
78355
|
+
_class3.prototype['@test Loading actions bubble to root but don\'t enter substates above pivot '] = function (assert) {
|
78356
|
+
var _this18 = this;
|
78349
78357
|
|
78350
|
-
|
78351
|
-
|
78352
|
-
this.transitionTo('grandma', 1);
|
78353
|
-
}
|
78354
|
-
});
|
78358
|
+
var sallyDeferred = _emberRuntime.RSVP.defer();
|
78359
|
+
var puppiesDeferred = _emberRuntime.RSVP.defer();
|
78355
78360
|
|
78356
|
-
|
78357
|
-
|
78358
|
-
|
78359
|
-
|
78360
|
-
|
78361
|
+
this.add('route:application', _emberRouting.Route.extend({
|
78362
|
+
actions: {
|
78363
|
+
loading: function (transition, route) {
|
78364
|
+
assert.ok(true, 'loading action received on ApplicationRoute');
|
78365
|
+
}
|
78366
|
+
}
|
78367
|
+
}));
|
78361
78368
|
|
78362
|
-
|
78363
|
-
|
78364
|
-
|
78365
|
-
|
78366
|
-
|
78369
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78370
|
+
model: function () {
|
78371
|
+
return sallyDeferred.promise;
|
78372
|
+
}
|
78373
|
+
}));
|
78367
78374
|
|
78368
|
-
|
78375
|
+
this.add('route:grandma.puppies', _emberRouting.Route.extend({
|
78376
|
+
model: function () {
|
78377
|
+
return puppiesDeferred.promise;
|
78378
|
+
}
|
78379
|
+
}));
|
78369
78380
|
|
78370
|
-
|
78371
|
-
|
78381
|
+
var promise = this.visit('/grandma/mom/sally');
|
78382
|
+
assert.equal(this.currentPath, 'index', 'Initial route fully loaded');
|
78372
78383
|
|
78373
|
-
|
78384
|
+
sallyDeferred.resolve();
|
78374
78385
|
|
78375
|
-
|
78376
|
-
|
78377
|
-
});
|
78386
|
+
promise.then(function () {
|
78387
|
+
assert.equal(_this18.currentPath, 'grandma.mom.sally', 'transition completed');
|
78378
78388
|
|
78379
|
-
|
78380
|
-
|
78389
|
+
var visit = _this18.visit('/grandma/puppies');
|
78390
|
+
assert.equal(_this18.currentPath, 'grandma.mom.sally', 'still in initial state because the only loading state is above the pivot route');
|
78381
78391
|
|
78382
|
-
|
78392
|
+
return visit;
|
78393
|
+
}).then(function () {
|
78394
|
+
_this18.runTask(function () {
|
78395
|
+
return puppiesDeferred.resolve();
|
78396
|
+
});
|
78383
78397
|
|
78384
|
-
|
78385
|
-
|
78398
|
+
assert.equal(_this18.currentPath, 'grandma.puppies', 'Finished transition');
|
78399
|
+
});
|
78386
78400
|
|
78387
|
-
|
78388
|
-
|
78401
|
+
return promise;
|
78402
|
+
};
|
78389
78403
|
|
78390
|
-
|
78404
|
+
_class3.prototype['@test Default error event moves into nested route'] = function testDefaultErrorEventMovesIntoNestedRoute(assert) {
|
78405
|
+
var _this19 = this;
|
78391
78406
|
|
78392
|
-
|
78393
|
-
model: function () {
|
78394
|
-
return appDeferred.promise;
|
78395
|
-
}
|
78396
|
-
});
|
78407
|
+
this.addTemplate('grandma.error', 'ERROR: {{model.msg}}');
|
78397
78408
|
|
78398
|
-
|
78399
|
-
|
78400
|
-
|
78401
|
-
|
78402
|
-
|
78403
|
-
|
78409
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78410
|
+
model: function () {
|
78411
|
+
step(1, 'MomSallyRoute#model');
|
78412
|
+
return _emberRuntime.RSVP.reject({
|
78413
|
+
msg: 'did it broke?'
|
78414
|
+
});
|
78415
|
+
},
|
78404
78416
|
|
78405
|
-
|
78417
|
+
actions: {
|
78418
|
+
error: function () {
|
78419
|
+
step(2, 'MomSallyRoute#actions.error');
|
78420
|
+
return true;
|
78421
|
+
}
|
78422
|
+
}
|
78423
|
+
}));
|
78406
78424
|
|
78407
|
-
|
78425
|
+
return this.visit('/grandma/mom/sally').then(function () {
|
78426
|
+
step(3, 'App finished loading');
|
78408
78427
|
|
78409
|
-
|
78410
|
-
equal((0, _emberViews.jQuery)('#app', '#qunit-fixture').text(), 'INDEX');
|
78411
|
-
});
|
78428
|
+
var text = _this19.$('#app').text();
|
78412
78429
|
|
78413
|
-
|
78414
|
-
|
78430
|
+
assert.equal(text, 'GRANDMA ERROR: did it broke?', 'error bubbles');
|
78431
|
+
assert.equal(_this19.currentPath, 'grandma.error', 'Initial route fully loaded');
|
78432
|
+
});
|
78433
|
+
};
|
78415
78434
|
|
78416
|
-
|
78435
|
+
_class3.prototype['@test Non-bubbled errors that re-throw aren\'t swallowed'] = function (assert) {
|
78436
|
+
var _this20 = this;
|
78417
78437
|
|
78418
|
-
|
78419
|
-
|
78420
|
-
|
78421
|
-
|
78422
|
-
|
78423
|
-
|
78438
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78439
|
+
model: function () {
|
78440
|
+
return _emberRuntime.RSVP.reject({
|
78441
|
+
msg: 'did it broke?'
|
78442
|
+
});
|
78443
|
+
},
|
78424
78444
|
|
78425
|
-
|
78445
|
+
actions: {
|
78446
|
+
error: function (err) {
|
78447
|
+
// returns undefined which is falsey
|
78448
|
+
throw err;
|
78449
|
+
}
|
78450
|
+
}
|
78451
|
+
}));
|
78426
78452
|
|
78427
|
-
|
78453
|
+
assert.throws(function () {
|
78454
|
+
_this20.visit('/grandma/mom/sally');
|
78455
|
+
}, function (err) {
|
78456
|
+
return err.msg === 'did it broke?';
|
78457
|
+
}, 'it broke');
|
78458
|
+
};
|
78428
78459
|
|
78429
|
-
|
78460
|
+
_class3.prototype['@test Handled errors that re-throw aren\'t swallowed'] = function (assert) {
|
78461
|
+
var _this21 = this;
|
78430
78462
|
|
78431
|
-
|
78432
|
-
equal((0, _emberViews.jQuery)('#app', '#qunit-fixture').text(), 'INDEX');
|
78433
|
-
});
|
78463
|
+
var handledError = void 0;
|
78434
78464
|
|
78435
|
-
|
78436
|
-
|
78465
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78466
|
+
model: function () {
|
78467
|
+
step(1, 'MomSallyRoute#model');
|
78468
|
+
return _emberRuntime.RSVP.reject({
|
78469
|
+
msg: 'did it broke?'
|
78470
|
+
});
|
78471
|
+
},
|
78437
78472
|
|
78438
|
-
|
78439
|
-
|
78440
|
-
|
78473
|
+
actions: {
|
78474
|
+
error: function (err) {
|
78475
|
+
step(2, 'MomSallyRoute#actions.error');
|
78476
|
+
handledError = err;
|
78477
|
+
this.transitionTo('mom.this-route-throws');
|
78441
78478
|
|
78442
|
-
|
78443
|
-
|
78444
|
-
|
78445
|
-
|
78446
|
-
});
|
78447
|
-
});
|
78448
|
-
});
|
78479
|
+
return false;
|
78480
|
+
}
|
78481
|
+
}
|
78482
|
+
}));
|
78449
78483
|
|
78450
|
-
|
78484
|
+
this.add('route:mom.this-route-throws', _emberRouting.Route.extend({
|
78485
|
+
model: function () {
|
78486
|
+
step(3, 'MomThisRouteThrows#model');
|
78487
|
+
throw handledError;
|
78488
|
+
}
|
78489
|
+
}));
|
78451
78490
|
|
78452
|
-
|
78453
|
-
|
78454
|
-
|
78491
|
+
assert.throws(function () {
|
78492
|
+
_this21.visit('/grandma/mom/sally');
|
78493
|
+
}, function (err) {
|
78494
|
+
return err.msg === 'did it broke?';
|
78495
|
+
}, 'it broke');
|
78496
|
+
};
|
78455
78497
|
|
78456
|
-
|
78457
|
-
|
78458
|
-
});
|
78459
|
-
},
|
78498
|
+
_class3.prototype['@test errors that are bubbled are thrown at a higher level if not handled'] = function testErrorsThatAreBubbledAreThrownAtAHigherLevelIfNotHandled(assert) {
|
78499
|
+
var _this22 = this;
|
78460
78500
|
|
78461
|
-
|
78462
|
-
|
78463
|
-
step(
|
78464
|
-
return
|
78465
|
-
|
78466
|
-
|
78467
|
-
|
78501
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78502
|
+
model: function () {
|
78503
|
+
step(1, 'MomSallyRoute#model');
|
78504
|
+
return _emberRuntime.RSVP.reject({
|
78505
|
+
msg: 'did it broke?'
|
78506
|
+
});
|
78507
|
+
},
|
78468
78508
|
|
78469
|
-
|
78470
|
-
|
78471
|
-
|
78472
|
-
|
78473
|
-
|
78509
|
+
actions: {
|
78510
|
+
error: function (err) {
|
78511
|
+
step(2, 'MomSallyRoute#actions.error');
|
78512
|
+
return true;
|
78513
|
+
}
|
78514
|
+
}
|
78515
|
+
}));
|
78474
78516
|
|
78475
|
-
|
78517
|
+
assert.throws(function () {
|
78518
|
+
_this22.visit('/grandma/mom/sally');
|
78519
|
+
}, function (err) {
|
78520
|
+
return err.msg == "did it broke?";
|
78521
|
+
}, 'Correct error was thrown');
|
78522
|
+
};
|
78476
78523
|
|
78477
|
-
|
78524
|
+
_class3.prototype['@test Handled errors that are thrown through rejection aren\'t swallowed'] = function (assert) {
|
78525
|
+
var _this23 = this;
|
78478
78526
|
|
78479
|
-
|
78480
|
-
equal(appController.get('currentPath'), 'grandma.mom_error', 'Initial route fully loaded');
|
78481
|
-
});
|
78527
|
+
var handledError = void 0;
|
78482
78528
|
|
78483
|
-
|
78484
|
-
|
78529
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78530
|
+
model: function () {
|
78531
|
+
step(1, 'MomSallyRoute#model');
|
78532
|
+
return _emberRuntime.RSVP.reject({
|
78533
|
+
msg: 'did it broke?'
|
78534
|
+
});
|
78535
|
+
},
|
78485
78536
|
|
78486
|
-
|
78487
|
-
|
78537
|
+
actions: {
|
78538
|
+
error: function (err) {
|
78539
|
+
step(2, 'MomSallyRoute#actions.error');
|
78540
|
+
handledError = err;
|
78541
|
+
this.transitionTo('mom.this-route-throws');
|
78488
78542
|
|
78489
|
-
|
78490
|
-
|
78491
|
-
|
78492
|
-
});
|
78493
|
-
});
|
78543
|
+
return false;
|
78544
|
+
}
|
78545
|
+
}
|
78546
|
+
}));
|
78494
78547
|
|
78495
|
-
|
78548
|
+
this.add('route:mom.this-route-throws', _emberRouting.Route.extend({
|
78549
|
+
model: function () {
|
78550
|
+
step(3, 'MomThisRouteThrows#model');
|
78551
|
+
return _emberRuntime.RSVP.reject(handledError);
|
78552
|
+
}
|
78553
|
+
}));
|
78496
78554
|
|
78497
|
-
|
78498
|
-
|
78499
|
-
|
78500
|
-
return
|
78501
|
-
}
|
78502
|
-
}
|
78555
|
+
assert.throws(function () {
|
78556
|
+
_this23.visit('/grandma/mom/sally');
|
78557
|
+
}, function (err) {
|
78558
|
+
return err.msg === 'did it broke?';
|
78559
|
+
}, 'it broke');
|
78560
|
+
};
|
78503
78561
|
|
78504
|
-
|
78562
|
+
_class3.prototype['@test Default error events move into nested route, prioritizing more specifically named error routes - NEW'] = function testDefaultErrorEventsMoveIntoNestedRoutePrioritizingMoreSpecificallyNamedErrorRoutesNEW(assert) {
|
78563
|
+
var _this24 = this;
|
78505
78564
|
|
78506
|
-
|
78565
|
+
this.addTemplate('grandma.error', 'ERROR: {{model.msg}}');
|
78566
|
+
this.addTemplate('mom_error', 'MOM ERROR: {{model.msg}}');
|
78507
78567
|
|
78508
|
-
|
78568
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78569
|
+
model: function () {
|
78570
|
+
step(1, 'MomSallyRoute#model');
|
78571
|
+
return _emberRuntime.RSVP.reject({
|
78572
|
+
msg: 'did it broke?'
|
78573
|
+
});
|
78574
|
+
},
|
78509
78575
|
|
78510
|
-
|
78511
|
-
|
78576
|
+
actions: {
|
78577
|
+
error: function () {
|
78578
|
+
step(2, 'MomSallyRoute#actions.error');
|
78579
|
+
return true;
|
78580
|
+
}
|
78581
|
+
}
|
78582
|
+
}));
|
78512
78583
|
|
78513
|
-
|
78514
|
-
|
78584
|
+
return this.visit('/grandma/mom/sally').then(function () {
|
78585
|
+
step(3, 'Application finished booting');
|
78515
78586
|
|
78516
|
-
|
78517
|
-
templates['bar/index'] = 'YAY';
|
78587
|
+
assert.equal(_this24.$('#app').text(), 'GRANDMA MOM ERROR: did it broke?', 'the more specifically named mome error substate was entered over the other error route');
|
78518
78588
|
|
78519
|
-
|
78520
|
-
this.route('foo', function () {
|
78521
|
-
this.route('bar', { path: '/bar', resetNamespace: true }, function () {});
|
78589
|
+
assert.equal(_this24.currentPath, 'grandma.mom_error', 'Initial route fully loaded');
|
78522
78590
|
});
|
78523
|
-
}
|
78524
|
-
|
78525
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
78591
|
+
};
|
78526
78592
|
|
78527
|
-
|
78528
|
-
|
78529
|
-
model: function () {
|
78530
|
-
return deferred.promise;
|
78531
|
-
}
|
78532
|
-
});
|
78593
|
+
_class3.prototype['@test Slow promises waterfall on startup'] = function testSlowPromisesWaterfallOnStartup(assert) {
|
78594
|
+
var _this25 = this;
|
78533
78595
|
|
78534
|
-
|
78596
|
+
var grandmaDeferred = _emberRuntime.RSVP.defer();
|
78597
|
+
var sallyDeferred = _emberRuntime.RSVP.defer();
|
78535
78598
|
|
78536
|
-
|
78599
|
+
this.addTemplate('loading', 'LOADING');
|
78600
|
+
this.addTemplate('mom', 'MOM {{outlet}}');
|
78601
|
+
this.addTemplate('mom.loading', 'MOMLOADING');
|
78602
|
+
this.addTemplate('mom.sally', 'SALLY');
|
78537
78603
|
|
78538
|
-
|
78604
|
+
this.add('route:grandma', _emberRouting.Route.extend({
|
78605
|
+
model: function () {
|
78606
|
+
step(1, 'GrandmaRoute#model');
|
78607
|
+
return grandmaDeferred.promise;
|
78608
|
+
}
|
78609
|
+
}));
|
78539
78610
|
|
78540
|
-
|
78541
|
-
|
78611
|
+
this.add('route:mom', _emberRouting.Route.extend({
|
78612
|
+
model: function () {
|
78613
|
+
step(2, 'MomRoute#model');
|
78614
|
+
return {};
|
78615
|
+
}
|
78616
|
+
}));
|
78542
78617
|
|
78543
|
-
|
78544
|
-
|
78618
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78619
|
+
model: function () {
|
78620
|
+
step(3, 'SallyRoute#model');
|
78621
|
+
return sallyDeferred.promise;
|
78622
|
+
},
|
78623
|
+
setupController: function () {
|
78624
|
+
step(4, 'SallyRoute#setupController');
|
78625
|
+
}
|
78626
|
+
}));
|
78545
78627
|
|
78546
|
-
|
78547
|
-
|
78628
|
+
var promise = this.visit('/grandma/mom/sally').then(function () {
|
78629
|
+
text = _this25.$('#app').text();
|
78548
78630
|
|
78549
|
-
|
78550
|
-
this.route('foo', function () {
|
78551
|
-
this.route('bar');
|
78631
|
+
assert.equal(text, 'GRANDMA MOM SALLY', 'Sally template displayed');
|
78552
78632
|
});
|
78553
|
-
|
78633
|
+
var text = this.$('#app').text();
|
78554
78634
|
|
78555
|
-
|
78635
|
+
assert.equal(text, 'LOADING', 'The loading template is nested in application template\'s outlet');
|
78556
78636
|
|
78557
|
-
|
78558
|
-
|
78559
|
-
|
78560
|
-
|
78561
|
-
}
|
78562
|
-
});
|
78637
|
+
this.runTask(function () {
|
78638
|
+
return grandmaDeferred.resolve();
|
78639
|
+
});
|
78640
|
+
text = this.$('#app').text();
|
78563
78641
|
|
78564
|
-
|
78642
|
+
assert.equal(text, 'GRANDMA MOM MOMLOADING', 'Mom\'s child loading route is displayed due to sally\'s slow promise');
|
78565
78643
|
|
78566
|
-
|
78644
|
+
sallyDeferred.resolve();
|
78567
78645
|
|
78568
|
-
|
78646
|
+
return promise;
|
78647
|
+
};
|
78569
78648
|
|
78570
|
-
|
78571
|
-
|
78649
|
+
_class3.prototype['@test Enter child loading state of pivot route'] = function testEnterChildLoadingStateOfPivotRoute(assert) {
|
78650
|
+
var _this26 = this;
|
78572
78651
|
|
78573
|
-
|
78574
|
-
|
78652
|
+
var deferred = _emberRuntime.RSVP.defer();
|
78653
|
+
this.addTemplate('grandma.loading', 'GMONEYLOADING');
|
78575
78654
|
|
78576
|
-
|
78577
|
-
|
78655
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78656
|
+
setupController: function () {
|
78657
|
+
step(1, 'SallyRoute#setupController');
|
78658
|
+
}
|
78659
|
+
}));
|
78578
78660
|
|
78579
|
-
|
78580
|
-
|
78581
|
-
|
78582
|
-
|
78583
|
-
|
78661
|
+
this.add('route:grandma.puppies', _emberRouting.Route.extend({
|
78662
|
+
model: function () {
|
78663
|
+
return deferred.promise;
|
78664
|
+
}
|
78665
|
+
}));
|
78584
78666
|
|
78585
|
-
|
78667
|
+
return this.visit('/grandma/mom/sally').then(function () {
|
78668
|
+
assert.equal(_this26.currentPath, 'grandma.mom.sally', 'Initial route fully loaded');
|
78586
78669
|
|
78587
|
-
|
78588
|
-
|
78589
|
-
return _emberRuntime.RSVP.reject({
|
78590
|
-
msg: 'did it broke?'
|
78670
|
+
var promise = _this26.visit('/grandma/puppies').then(function () {
|
78671
|
+
assert.equal(_this26.currentPath, 'grandma.puppies', 'Finished transition');
|
78591
78672
|
});
|
78592
|
-
}
|
78593
|
-
});
|
78594
78673
|
|
78595
|
-
|
78596
|
-
|
78597
|
-
}, function (err) {
|
78598
|
-
return err.msg === 'did it broke?';
|
78599
|
-
});
|
78674
|
+
assert.equal(_this26.currentPath, 'grandma.loading', 'in pivot route\'s child loading state');
|
78675
|
+
deferred.resolve();
|
78600
78676
|
|
78601
|
-
|
78602
|
-
});
|
78603
|
-
|
78604
|
-
QUnit.test('Prioritized loading substate entry works with auto-generated index routes', function () {
|
78605
|
-
expect(2);
|
78606
|
-
|
78607
|
-
templates['foo/index_loading'] = 'FOO LOADING';
|
78608
|
-
templates['foo/index'] = 'YAY';
|
78609
|
-
templates['foo'] = '{{outlet}}';
|
78610
|
-
|
78611
|
-
Router.map(function () {
|
78612
|
-
this.route('foo', function () {
|
78613
|
-
this.route('bar');
|
78677
|
+
return promise;
|
78614
78678
|
});
|
78615
|
-
}
|
78679
|
+
};
|
78616
78680
|
|
78617
|
-
|
78681
|
+
_class3.prototype['@test Error events that aren\'t bubbled don\'t throw application assertions'] = function (assert) {
|
78682
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78683
|
+
model: function () {
|
78684
|
+
step(1, 'MomSallyRoute#model');
|
78685
|
+
return _emberRuntime.RSVP.reject({
|
78686
|
+
msg: 'did it broke?'
|
78687
|
+
});
|
78688
|
+
},
|
78618
78689
|
|
78619
|
-
|
78620
|
-
|
78621
|
-
|
78622
|
-
|
78623
|
-
|
78624
|
-
|
78625
|
-
|
78626
|
-
|
78627
|
-
return true;
|
78628
|
-
}
|
78629
|
-
});
|
78690
|
+
actions: {
|
78691
|
+
error: function (err) {
|
78692
|
+
step(2, 'MomSallyRoute#actions.error');
|
78693
|
+
assert.equal(err.msg, 'did it broke?', 'it didn\'t break');
|
78694
|
+
return false;
|
78695
|
+
}
|
78696
|
+
}
|
78697
|
+
}));
|
78630
78698
|
|
78631
|
-
|
78699
|
+
return this.visit('/grandma/mom/sally');
|
78700
|
+
};
|
78632
78701
|
|
78633
|
-
|
78702
|
+
_class3.prototype['@test Handled errors that bubble can be handled at a higher level'] = function testHandledErrorsThatBubbleCanBeHandledAtAHigherLevel(assert) {
|
78703
|
+
var handledError = void 0;
|
78634
78704
|
|
78635
|
-
|
78705
|
+
this.add('route:mom', _emberRouting.Route.extend({
|
78706
|
+
actions: {
|
78707
|
+
error: function (err) {
|
78708
|
+
step(3, 'MomRoute#actions.error');
|
78709
|
+
assert.equal(err, handledError, 'error handled and rebubbled is handleable at higher route');
|
78710
|
+
}
|
78711
|
+
}
|
78712
|
+
}));
|
78636
78713
|
|
78637
|
-
|
78638
|
-
|
78714
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
78715
|
+
model: function () {
|
78716
|
+
step(1, 'MomSallyRoute#model');
|
78717
|
+
return _emberRuntime.RSVP.reject({
|
78718
|
+
msg: 'did it broke?'
|
78719
|
+
});
|
78720
|
+
},
|
78639
78721
|
|
78640
|
-
|
78641
|
-
|
78722
|
+
actions: {
|
78723
|
+
error: function (err) {
|
78724
|
+
step(2, 'MomSallyRoute#actions.error');
|
78725
|
+
handledError = err;
|
78642
78726
|
|
78643
|
-
|
78644
|
-
|
78645
|
-
|
78727
|
+
return true;
|
78728
|
+
}
|
78729
|
+
}
|
78730
|
+
}));
|
78646
78731
|
|
78647
|
-
|
78648
|
-
|
78649
|
-
this.route('bar');
|
78650
|
-
});
|
78651
|
-
});
|
78732
|
+
return this.visit('/grandma/mom/sally');
|
78733
|
+
};
|
78652
78734
|
|
78653
|
-
|
78735
|
+
_class3.prototype['@test Setting a query param during a slow transition should work'] = function testSettingAQueryParamDuringASlowTransitionShouldWork(assert) {
|
78736
|
+
var _this27 = this;
|
78654
78737
|
|
78655
|
-
|
78656
|
-
|
78657
|
-
return _emberRuntime.RSVP.reject({
|
78658
|
-
msg: 'did it broke?'
|
78659
|
-
});
|
78660
|
-
}
|
78661
|
-
});
|
78662
|
-
App.FooRoute = _emberRouting.Route.extend({
|
78663
|
-
model: function () {
|
78664
|
-
return true;
|
78665
|
-
}
|
78666
|
-
});
|
78738
|
+
var deferred = _emberRuntime.RSVP.defer();
|
78739
|
+
this.addTemplate('memere.loading', 'MMONEYLOADING');
|
78667
78740
|
|
78668
|
-
|
78669
|
-
|
78670
|
-
|
78671
|
-
|
78672
|
-
|
78741
|
+
this.add('route:grandma', _emberRouting.Route.extend({
|
78742
|
+
beforeModel: function () {
|
78743
|
+
this.transitionTo('memere', 1);
|
78744
|
+
}
|
78745
|
+
}));
|
78673
78746
|
|
78674
|
-
|
78675
|
-
|
78747
|
+
this.add('route:memere', _emberRouting.Route.extend({
|
78748
|
+
queryParams: {
|
78749
|
+
test: { defaultValue: 1 }
|
78750
|
+
}
|
78751
|
+
}));
|
78676
78752
|
|
78677
|
-
|
78678
|
-
|
78753
|
+
this.add('route:memere.index', _emberRouting.Route.extend({
|
78754
|
+
model: function () {
|
78755
|
+
return deferred.promise;
|
78756
|
+
}
|
78757
|
+
}));
|
78679
78758
|
|
78680
|
-
|
78759
|
+
var promise = this.visit('/grandma').then(function () {
|
78760
|
+
assert.equal(_this27.currentPath, 'memere.index', 'Transition should be complete');
|
78761
|
+
});
|
78762
|
+
var memereController = this.getController('memere');
|
78681
78763
|
|
78682
|
-
|
78683
|
-
App.ApplicationRoute = _emberRouting.Route.extend({
|
78684
|
-
model: function () {
|
78685
|
-
if (reject) {
|
78686
|
-
return _emberRuntime.RSVP.reject({ msg: 'BAD NEWS BEARS' });
|
78687
|
-
} else {
|
78688
|
-
return {};
|
78689
|
-
}
|
78690
|
-
}
|
78691
|
-
});
|
78764
|
+
assert.equal(this.currentPath, 'memere.loading', 'Initial route should be loading');
|
78692
78765
|
|
78693
|
-
|
78694
|
-
return bootApplication();
|
78695
|
-
}, function (err) {
|
78696
|
-
return err.msg === 'BAD NEWS BEARS';
|
78697
|
-
});
|
78766
|
+
memereController.set('test', 3);
|
78698
78767
|
|
78699
|
-
|
78768
|
+
assert.equal(this.currentPath, 'memere.loading', 'Initial route should still be loading');
|
78700
78769
|
|
78701
|
-
|
78702
|
-
|
78770
|
+
assert.equal(memereController.get('test'), 3, 'Controller query param value should have changed');
|
78771
|
+
deferred.resolve();
|
78703
78772
|
|
78704
|
-
|
78705
|
-
|
78773
|
+
return promise;
|
78774
|
+
};
|
78775
|
+
|
78776
|
+
(0, _emberBabel.createClass)(_class3, [{
|
78777
|
+
key: 'currentPath',
|
78778
|
+
get: function () {
|
78779
|
+
return this.getController('application').get('currentPath');
|
78780
|
+
}
|
78781
|
+
}]);
|
78782
|
+
return _class3;
|
78783
|
+
}(_internalTestHelpers.ApplicationTestCase));
|
78706
78784
|
});
|
78707
78785
|
QUnit.module('ESLint | ember/tests/routing/substates_test.js');
|
78708
78786
|
QUnit.test('should pass ESLint', function(assert) {
|