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-tests.prod.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;
|
@@ -112,7 +112,7 @@ var mainContext = this; // Used in ember-environment/lib/global.js
|
|
112
112
|
}
|
113
113
|
})();
|
114
114
|
|
115
|
-
enifed('container/tests/container_test', ['ember-utils', 'ember-
|
115
|
+
enifed('container/tests/container_test', ['ember-utils', 'ember-metal', 'container', 'internal-test-helpers'], function (_emberUtils, _emberMetal, _container, _internalTestHelpers) {
|
116
116
|
'use strict';
|
117
117
|
|
118
118
|
QUnit.module('Container');
|
@@ -7767,7 +7767,7 @@ enifed('ember-glimmer/tests/integration/application/engine-test', ['ember-babel'
|
|
7767
7767
|
return this.visit('/').then(function () {
|
7768
7768
|
_this12.assertText('Application');
|
7769
7769
|
return _this12.transitionTo('blog.post');
|
7770
|
-
}).
|
7770
|
+
}).then(function () {
|
7771
7771
|
_this12.assertText('ApplicationError! Oh, noes!');
|
7772
7772
|
});
|
7773
7773
|
};
|
@@ -7790,7 +7790,7 @@ enifed('ember-glimmer/tests/integration/application/engine-test', ['ember-babel'
|
|
7790
7790
|
return this.visit('/').then(function () {
|
7791
7791
|
_this13.assertText('Application');
|
7792
7792
|
return _this13.transitionTo('blog.post');
|
7793
|
-
}).
|
7793
|
+
}).then(function () {
|
7794
7794
|
_this13.assertText('ApplicationEngineError! Oh, noes!');
|
7795
7795
|
});
|
7796
7796
|
};
|
@@ -7813,7 +7813,7 @@ enifed('ember-glimmer/tests/integration/application/engine-test', ['ember-babel'
|
|
7813
7813
|
return this.visit('/').then(function () {
|
7814
7814
|
_this14.assertText('Application');
|
7815
7815
|
return _this14.transitionTo('blog.post');
|
7816
|
-
}).
|
7816
|
+
}).then(function () {
|
7817
7817
|
_this14.assertText('ApplicationEngineError! Oh, noes!');
|
7818
7818
|
});
|
7819
7819
|
};
|
@@ -7836,7 +7836,7 @@ enifed('ember-glimmer/tests/integration/application/engine-test', ['ember-babel'
|
|
7836
7836
|
return this.visit('/').then(function () {
|
7837
7837
|
_this15.assertText('Application');
|
7838
7838
|
return _this15.transitionTo('blog.post.comments');
|
7839
|
-
}).
|
7839
|
+
}).then(function () {
|
7840
7840
|
_this15.assertText('ApplicationEngineError! Oh, noes!');
|
7841
7841
|
});
|
7842
7842
|
};
|
@@ -25510,9 +25510,31 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25510
25510
|
this.assertText('[First][Second][Third]');
|
25511
25511
|
};
|
25512
25512
|
|
25513
|
-
_class.prototype['@test should be able to get an
|
25513
|
+
_class.prototype['@test should be able to get an array value with numeric keys'] = function () {
|
25514
25514
|
var _this5 = this;
|
25515
25515
|
|
25516
|
+
this.render('{{#each numbers as |num index|}}[{{get numbers index}}]{{/each}}', {
|
25517
|
+
numbers: [1, 2, 3]
|
25518
|
+
});
|
25519
|
+
|
25520
|
+
this.assertText('[1][2][3]');
|
25521
|
+
|
25522
|
+
this.runTask(function () {
|
25523
|
+
return _this5.rerender();
|
25524
|
+
});
|
25525
|
+
|
25526
|
+
this.assertText('[1][2][3]');
|
25527
|
+
|
25528
|
+
this.runTask(function () {
|
25529
|
+
return (0, _emberMetal.set)(_this5.context, 'numbers', [3, 2, 1]);
|
25530
|
+
});
|
25531
|
+
|
25532
|
+
this.assertText('[3][2][1]');
|
25533
|
+
};
|
25534
|
+
|
25535
|
+
_class.prototype['@test should be able to get an object value with a bound/dynamic key'] = function () {
|
25536
|
+
var _this6 = this;
|
25537
|
+
|
25516
25538
|
this.render('[{{get colors key}}] [{{if true (get colors key)}}]', {
|
25517
25539
|
colors: { apple: 'red', banana: 'yellow' },
|
25518
25540
|
key: 'apple'
|
@@ -25521,39 +25543,39 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25521
25543
|
this.assertText('[red] [red]');
|
25522
25544
|
|
25523
25545
|
this.runTask(function () {
|
25524
|
-
return
|
25546
|
+
return _this6.rerender();
|
25525
25547
|
});
|
25526
25548
|
|
25527
25549
|
this.assertText('[red] [red]');
|
25528
25550
|
|
25529
25551
|
this.runTask(function () {
|
25530
|
-
return (0, _emberMetal.set)(
|
25552
|
+
return (0, _emberMetal.set)(_this6.context, 'key', 'banana');
|
25531
25553
|
});
|
25532
25554
|
|
25533
25555
|
this.assertText('[yellow] [yellow]');
|
25534
25556
|
|
25535
25557
|
this.runTask(function () {
|
25536
|
-
(0, _emberMetal.set)(
|
25537
|
-
(0, _emberMetal.set)(
|
25558
|
+
(0, _emberMetal.set)(_this6.context, 'colors.apple', 'green');
|
25559
|
+
(0, _emberMetal.set)(_this6.context, 'colors.banana', 'purple');
|
25538
25560
|
});
|
25539
25561
|
|
25540
25562
|
this.assertText('[purple] [purple]');
|
25541
25563
|
|
25542
25564
|
this.runTask(function () {
|
25543
|
-
return (0, _emberMetal.set)(
|
25565
|
+
return (0, _emberMetal.set)(_this6.context, 'key', 'apple');
|
25544
25566
|
});
|
25545
25567
|
|
25546
25568
|
this.assertText('[green] [green]');
|
25547
25569
|
|
25548
25570
|
this.runTask(function () {
|
25549
|
-
return (0, _emberMetal.set)(
|
25571
|
+
return (0, _emberMetal.set)(_this6.context, 'colors', { apple: 'red' });
|
25550
25572
|
});
|
25551
25573
|
|
25552
25574
|
this.assertText('[red] [red]');
|
25553
25575
|
};
|
25554
25576
|
|
25555
25577
|
_class.prototype['@test should be able to get an object value with nested dynamic key'] = function () {
|
25556
|
-
var
|
25578
|
+
var _this7 = this;
|
25557
25579
|
|
25558
25580
|
this.render('[{{get colors key}}] [{{if true (get colors key)}}]', {
|
25559
25581
|
colors: {
|
@@ -25569,32 +25591,32 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25569
25591
|
this.assertText('[red and yellow] [red and yellow]');
|
25570
25592
|
|
25571
25593
|
this.runTask(function () {
|
25572
|
-
return
|
25594
|
+
return _this7.rerender();
|
25573
25595
|
});
|
25574
25596
|
|
25575
25597
|
this.assertText('[red and yellow] [red and yellow]');
|
25576
25598
|
|
25577
25599
|
this.runTask(function () {
|
25578
|
-
return (0, _emberMetal.set)(
|
25600
|
+
return (0, _emberMetal.set)(_this7.context, 'key', 'apple.mcintosh');
|
25579
25601
|
});
|
25580
25602
|
|
25581
25603
|
this.assertText('[red] [red]');
|
25582
25604
|
|
25583
25605
|
this.runTask(function () {
|
25584
|
-
return (0, _emberMetal.set)(
|
25606
|
+
return (0, _emberMetal.set)(_this7.context, 'key', 'banana');
|
25585
25607
|
});
|
25586
25608
|
|
25587
25609
|
this.assertText('[yellow] [yellow]');
|
25588
25610
|
|
25589
25611
|
this.runTask(function () {
|
25590
|
-
return (0, _emberMetal.set)(
|
25612
|
+
return (0, _emberMetal.set)(_this7.context, 'key', 'apple.gala');
|
25591
25613
|
});
|
25592
25614
|
|
25593
25615
|
this.assertText('[red and yellow] [red and yellow]');
|
25594
25616
|
};
|
25595
25617
|
|
25596
25618
|
_class.prototype['@test should be able to get an object value with subexpression returning nested key'] = function () {
|
25597
|
-
var
|
25619
|
+
var _this8 = this;
|
25598
25620
|
|
25599
25621
|
this.render('[{{get colors (concat \'apple\' \'.\' \'gala\')}}] [{{if true (get colors (concat \'apple\' \'.\' \'gala\'))}}]', {
|
25600
25622
|
colors: {
|
@@ -25609,25 +25631,25 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25609
25631
|
this.assertText('[red and yellow] [red and yellow]');
|
25610
25632
|
|
25611
25633
|
this.runTask(function () {
|
25612
|
-
return
|
25634
|
+
return _this8.rerender();
|
25613
25635
|
});
|
25614
25636
|
|
25615
25637
|
this.assertText('[red and yellow] [red and yellow]');
|
25616
25638
|
|
25617
25639
|
this.runTask(function () {
|
25618
|
-
return (0, _emberMetal.set)(
|
25640
|
+
return (0, _emberMetal.set)(_this8.context, 'colors.apple.gala', 'yellow and red striped');
|
25619
25641
|
});
|
25620
25642
|
|
25621
25643
|
this.assertText('[yellow and red striped] [yellow and red striped]');
|
25622
25644
|
|
25623
25645
|
this.runTask(function () {
|
25624
|
-
return (0, _emberMetal.set)(
|
25646
|
+
return (0, _emberMetal.set)(_this8.context, 'colors.apple.gala', 'yellow-redish');
|
25625
25647
|
});
|
25626
25648
|
|
25627
25649
|
this.assertText('[yellow-redish] [yellow-redish]');
|
25628
25650
|
|
25629
25651
|
this.runTask(function () {
|
25630
|
-
return (0, _emberMetal.set)(
|
25652
|
+
return (0, _emberMetal.set)(_this8.context, 'colors', {
|
25631
25653
|
apple: {
|
25632
25654
|
gala: 'red and yellow',
|
25633
25655
|
mcintosh: 'red'
|
@@ -25639,7 +25661,7 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25639
25661
|
};
|
25640
25662
|
|
25641
25663
|
_class.prototype['@test should be able to get an object value with a get helper as the key'] = function () {
|
25642
|
-
var
|
25664
|
+
var _this9 = this;
|
25643
25665
|
|
25644
25666
|
this.render('[{{get colors (get possibleKeys key)}}] [{{if true (get colors (get possibleKeys key))}}]', {
|
25645
25667
|
colors: { apple: 'red', banana: 'yellow' },
|
@@ -25650,39 +25672,39 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25650
25672
|
this.assertText('[red] [red]');
|
25651
25673
|
|
25652
25674
|
this.runTask(function () {
|
25653
|
-
return
|
25675
|
+
return _this9.rerender();
|
25654
25676
|
});
|
25655
25677
|
|
25656
25678
|
this.assertText('[red] [red]');
|
25657
25679
|
|
25658
25680
|
this.runTask(function () {
|
25659
|
-
return (0, _emberMetal.set)(
|
25681
|
+
return (0, _emberMetal.set)(_this9.context, 'key', 'key2');
|
25660
25682
|
});
|
25661
25683
|
|
25662
25684
|
this.assertText('[yellow] [yellow]');
|
25663
25685
|
|
25664
25686
|
this.runTask(function () {
|
25665
|
-
(0, _emberMetal.set)(
|
25666
|
-
(0, _emberMetal.set)(
|
25687
|
+
(0, _emberMetal.set)(_this9.context, 'colors.apple', 'green');
|
25688
|
+
(0, _emberMetal.set)(_this9.context, 'colors.banana', 'purple');
|
25667
25689
|
});
|
25668
25690
|
|
25669
25691
|
this.assertText('[purple] [purple]');
|
25670
25692
|
|
25671
25693
|
this.runTask(function () {
|
25672
|
-
return (0, _emberMetal.set)(
|
25694
|
+
return (0, _emberMetal.set)(_this9.context, 'key', 'key1');
|
25673
25695
|
});
|
25674
25696
|
|
25675
25697
|
this.assertText('[green] [green]');
|
25676
25698
|
|
25677
25699
|
this.runTask(function () {
|
25678
|
-
return (0, _emberMetal.set)(
|
25700
|
+
return (0, _emberMetal.set)(_this9.context, 'colors', { apple: 'red', banana: 'yellow' });
|
25679
25701
|
});
|
25680
25702
|
|
25681
25703
|
this.assertText('[red] [red]');
|
25682
25704
|
};
|
25683
25705
|
|
25684
25706
|
_class.prototype['@test should be able to get an object value with a get helper value as a bound/dynamic key'] = function () {
|
25685
|
-
var
|
25707
|
+
var _this10 = this;
|
25686
25708
|
|
25687
25709
|
this.render('[{{get (get possibleValues objectKey) key}}] [{{if true (get (get possibleValues objectKey) key)}}]', {
|
25688
25710
|
possibleValues: {
|
@@ -25696,48 +25718,48 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25696
25718
|
this.assertText('[red] [red]');
|
25697
25719
|
|
25698
25720
|
this.runTask(function () {
|
25699
|
-
return
|
25721
|
+
return _this10.rerender();
|
25700
25722
|
});
|
25701
25723
|
|
25702
25724
|
this.assertText('[red] [red]');
|
25703
25725
|
|
25704
25726
|
this.runTask(function () {
|
25705
|
-
return (0, _emberMetal.set)(
|
25727
|
+
return (0, _emberMetal.set)(_this10.context, 'objectKey', 'colors2');
|
25706
25728
|
});
|
25707
25729
|
|
25708
25730
|
this.assertText('[green] [green]');
|
25709
25731
|
|
25710
25732
|
this.runTask(function () {
|
25711
|
-
return (0, _emberMetal.set)(
|
25733
|
+
return (0, _emberMetal.set)(_this10.context, 'objectKey', 'colors1');
|
25712
25734
|
});
|
25713
25735
|
|
25714
25736
|
this.assertText('[red] [red]');
|
25715
25737
|
|
25716
25738
|
this.runTask(function () {
|
25717
|
-
return (0, _emberMetal.set)(
|
25739
|
+
return (0, _emberMetal.set)(_this10.context, 'key', 'banana');
|
25718
25740
|
});
|
25719
25741
|
|
25720
25742
|
this.assertText('[yellow] [yellow]');
|
25721
25743
|
|
25722
25744
|
this.runTask(function () {
|
25723
|
-
return (0, _emberMetal.set)(
|
25745
|
+
return (0, _emberMetal.set)(_this10.context, 'objectKey', 'colors2');
|
25724
25746
|
});
|
25725
25747
|
|
25726
25748
|
this.assertText('[purple] [purple]');
|
25727
25749
|
|
25728
25750
|
this.runTask(function () {
|
25729
|
-
return (0, _emberMetal.set)(
|
25751
|
+
return (0, _emberMetal.set)(_this10.context, 'objectKey', 'colors1');
|
25730
25752
|
});
|
25731
25753
|
|
25732
25754
|
this.assertText('[yellow] [yellow]');
|
25733
25755
|
|
25734
25756
|
this.runTask(function () {
|
25735
|
-
return (0, _emberMetal.set)(
|
25757
|
+
return (0, _emberMetal.set)(_this10.context, 'key', 'apple');
|
25736
25758
|
});
|
25737
25759
|
};
|
25738
25760
|
|
25739
25761
|
_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 () {
|
25740
|
-
var
|
25762
|
+
var _this11 = this;
|
25741
25763
|
|
25742
25764
|
this.render('[{{get (get possibleValues objectKey) (get possibleKeys key)}}] [{{if true (get (get possibleValues objectKey) (get possibleKeys key))}}]', {
|
25743
25765
|
possibleValues: {
|
@@ -25755,45 +25777,45 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25755
25777
|
this.assertText('[red] [red]');
|
25756
25778
|
|
25757
25779
|
this.runTask(function () {
|
25758
|
-
return
|
25780
|
+
return _this11.rerender();
|
25759
25781
|
});
|
25760
25782
|
|
25761
25783
|
this.assertText('[red] [red]');
|
25762
25784
|
|
25763
25785
|
this.runTask(function () {
|
25764
|
-
return (0, _emberMetal.set)(
|
25786
|
+
return (0, _emberMetal.set)(_this11.context, 'objectKey', 'colors2');
|
25765
25787
|
});
|
25766
25788
|
|
25767
25789
|
this.assertText('[green] [green]');
|
25768
25790
|
|
25769
25791
|
this.runTask(function () {
|
25770
|
-
return (0, _emberMetal.set)(
|
25792
|
+
return (0, _emberMetal.set)(_this11.context, 'objectKey', 'colors1');
|
25771
25793
|
});
|
25772
25794
|
|
25773
25795
|
this.assertText('[red] [red]');
|
25774
25796
|
|
25775
25797
|
this.runTask(function () {
|
25776
|
-
return (0, _emberMetal.set)(
|
25798
|
+
return (0, _emberMetal.set)(_this11.context, 'key', 'key2');
|
25777
25799
|
});
|
25778
25800
|
|
25779
25801
|
this.assertText('[yellow] [yellow]');
|
25780
25802
|
|
25781
25803
|
this.runTask(function () {
|
25782
|
-
return (0, _emberMetal.set)(
|
25804
|
+
return (0, _emberMetal.set)(_this11.context, 'objectKey', 'colors2');
|
25783
25805
|
});
|
25784
25806
|
|
25785
25807
|
this.assertText('[purple] [purple]');
|
25786
25808
|
|
25787
25809
|
this.runTask(function () {
|
25788
|
-
(0, _emberMetal.set)(
|
25789
|
-
(0, _emberMetal.set)(
|
25810
|
+
(0, _emberMetal.set)(_this11.context, 'objectKey', 'colors1');
|
25811
|
+
(0, _emberMetal.set)(_this11.context, 'key', 'key1');
|
25790
25812
|
});
|
25791
25813
|
|
25792
25814
|
this.assertText('[red] [red]');
|
25793
25815
|
};
|
25794
25816
|
|
25795
25817
|
_class.prototype['@test the result of a get helper can be yielded'] = function () {
|
25796
|
-
var
|
25818
|
+
var _this12 = this;
|
25797
25819
|
|
25798
25820
|
var fooBarInstance = void 0;
|
25799
25821
|
var FooBarComponent = _helpers.Component.extend({
|
@@ -25818,28 +25840,28 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25818
25840
|
this.assertText('banana');
|
25819
25841
|
|
25820
25842
|
this.runTask(function () {
|
25821
|
-
return
|
25843
|
+
return _this12.rerender();
|
25822
25844
|
});
|
25823
25845
|
|
25824
25846
|
this.assertText('banana');
|
25825
25847
|
|
25826
25848
|
this.runTask(function () {
|
25827
25849
|
(0, _emberMetal.set)(fooBarInstance, 'mcintosh', 'yellow');
|
25828
|
-
(0, _emberMetal.set)(
|
25850
|
+
(0, _emberMetal.set)(_this12.context, 'colors', { yellow: 'bus' });
|
25829
25851
|
});
|
25830
25852
|
|
25831
25853
|
this.assertText('bus');
|
25832
25854
|
|
25833
25855
|
this.runTask(function () {
|
25834
25856
|
(0, _emberMetal.set)(fooBarInstance, 'mcintosh', 'red');
|
25835
|
-
(0, _emberMetal.set)(
|
25857
|
+
(0, _emberMetal.set)(_this12.context, 'colors', { red: 'banana' });
|
25836
25858
|
});
|
25837
25859
|
|
25838
25860
|
this.assertText('banana');
|
25839
25861
|
};
|
25840
25862
|
|
25841
25863
|
_class.prototype['@test should handle object values as nulls'] = function () {
|
25842
|
-
var
|
25864
|
+
var _this13 = this;
|
25843
25865
|
|
25844
25866
|
this.render('[{{get colors \'apple\'}}] [{{if true (get colors \'apple\')}}]', {
|
25845
25867
|
colors: null
|
@@ -25848,26 +25870,26 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25848
25870
|
this.assertText('[] []');
|
25849
25871
|
|
25850
25872
|
this.runTask(function () {
|
25851
|
-
return
|
25873
|
+
return _this13.rerender();
|
25852
25874
|
});
|
25853
25875
|
|
25854
25876
|
this.assertText('[] []');
|
25855
25877
|
|
25856
25878
|
this.runTask(function () {
|
25857
|
-
return (0, _emberMetal.set)(
|
25879
|
+
return (0, _emberMetal.set)(_this13.context, 'colors', { apple: 'green', banana: 'purple' });
|
25858
25880
|
});
|
25859
25881
|
|
25860
25882
|
this.assertText('[green] [green]');
|
25861
25883
|
|
25862
25884
|
this.runTask(function () {
|
25863
|
-
return (0, _emberMetal.set)(
|
25885
|
+
return (0, _emberMetal.set)(_this13.context, 'colors', null);
|
25864
25886
|
});
|
25865
25887
|
|
25866
25888
|
this.assertText('[] []');
|
25867
25889
|
};
|
25868
25890
|
|
25869
25891
|
_class.prototype['@test should handle object keys as nulls'] = function () {
|
25870
|
-
var
|
25892
|
+
var _this14 = this;
|
25871
25893
|
|
25872
25894
|
this.render('[{{get colors key}}] [{{if true (get colors key)}}]', {
|
25873
25895
|
colors: {
|
@@ -25880,19 +25902,19 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25880
25902
|
this.assertText('[] []');
|
25881
25903
|
|
25882
25904
|
this.runTask(function () {
|
25883
|
-
return
|
25905
|
+
return _this14.rerender();
|
25884
25906
|
});
|
25885
25907
|
|
25886
25908
|
this.assertText('[] []');
|
25887
25909
|
|
25888
25910
|
this.runTask(function () {
|
25889
|
-
return (0, _emberMetal.set)(
|
25911
|
+
return (0, _emberMetal.set)(_this14.context, 'key', 'banana');
|
25890
25912
|
});
|
25891
25913
|
|
25892
25914
|
this.assertText('[yellow] [yellow]');
|
25893
25915
|
|
25894
25916
|
this.runTask(function () {
|
25895
|
-
return (0, _emberMetal.set)(
|
25917
|
+
return (0, _emberMetal.set)(_this14.context, 'key', null);
|
25896
25918
|
});
|
25897
25919
|
|
25898
25920
|
this.assertText('[] []');
|
@@ -25908,7 +25930,7 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25908
25930
|
};
|
25909
25931
|
|
25910
25932
|
_class.prototype['@test get helper value should be updatable using {{input}} and (mut) - static key'] = function (assert) {
|
25911
|
-
var
|
25933
|
+
var _this15 = this;
|
25912
25934
|
|
25913
25935
|
this.render('{{input type=\'text\' value=(mut (get source \'banana\')) id=\'get-input\'}}', {
|
25914
25936
|
source: {
|
@@ -25919,33 +25941,33 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25919
25941
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
25920
25942
|
|
25921
25943
|
this.runTask(function () {
|
25922
|
-
return
|
25944
|
+
return _this15.rerender();
|
25923
25945
|
});
|
25924
25946
|
|
25925
25947
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
25926
25948
|
|
25927
25949
|
this.runTask(function () {
|
25928
|
-
return (0, _emberMetal.set)(
|
25950
|
+
return (0, _emberMetal.set)(_this15.context, 'source.banana', 'yellow');
|
25929
25951
|
});
|
25930
25952
|
|
25931
25953
|
assert.strictEqual(this.$('#get-input').val(), 'yellow');
|
25932
25954
|
|
25933
25955
|
this.runTask(function () {
|
25934
|
-
return
|
25956
|
+
return _this15.$('#get-input').val('some value').trigger('change');
|
25935
25957
|
});
|
25936
25958
|
|
25937
25959
|
assert.strictEqual(this.$('#get-input').val(), 'some value');
|
25938
25960
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.banana'), 'some value');
|
25939
25961
|
|
25940
25962
|
this.runTask(function () {
|
25941
|
-
return (0, _emberMetal.set)(
|
25963
|
+
return (0, _emberMetal.set)(_this15.context, 'source', { banana: 'banana' });
|
25942
25964
|
});
|
25943
25965
|
|
25944
25966
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
25945
25967
|
};
|
25946
25968
|
|
25947
25969
|
_class.prototype['@test get helper value should be updatable using {{input}} and (mut) - dynamic key'] = function (assert) {
|
25948
|
-
var
|
25970
|
+
var _this16 = this;
|
25949
25971
|
|
25950
25972
|
this.render('{{input type=\'text\' value=(mut (get source key)) id=\'get-input\'}}', {
|
25951
25973
|
source: {
|
@@ -25958,47 +25980,47 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
25958
25980
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
25959
25981
|
|
25960
25982
|
this.runTask(function () {
|
25961
|
-
return
|
25983
|
+
return _this16.rerender();
|
25962
25984
|
});
|
25963
25985
|
|
25964
25986
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
25965
25987
|
|
25966
25988
|
this.runTask(function () {
|
25967
|
-
return (0, _emberMetal.set)(
|
25989
|
+
return (0, _emberMetal.set)(_this16.context, 'source.banana', 'yellow');
|
25968
25990
|
});
|
25969
25991
|
|
25970
25992
|
assert.strictEqual(this.$('#get-input').val(), 'yellow');
|
25971
25993
|
|
25972
25994
|
this.runTask(function () {
|
25973
|
-
return
|
25995
|
+
return _this16.$('#get-input').val('some value').trigger('change');
|
25974
25996
|
});
|
25975
25997
|
|
25976
25998
|
assert.strictEqual(this.$('#get-input').val(), 'some value');
|
25977
25999
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.banana'), 'some value');
|
25978
26000
|
|
25979
26001
|
this.runTask(function () {
|
25980
|
-
return (0, _emberMetal.set)(
|
26002
|
+
return (0, _emberMetal.set)(_this16.context, 'key', 'apple');
|
25981
26003
|
});
|
25982
26004
|
|
25983
26005
|
assert.strictEqual(this.$('#get-input').val(), 'apple');
|
25984
26006
|
|
25985
26007
|
this.runTask(function () {
|
25986
|
-
return
|
26008
|
+
return _this16.$('#get-input').val('some other value').trigger('change');
|
25987
26009
|
});
|
25988
26010
|
|
25989
26011
|
assert.strictEqual(this.$('#get-input').val(), 'some other value');
|
25990
26012
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.apple'), 'some other value');
|
25991
26013
|
|
25992
26014
|
this.runTask(function () {
|
25993
|
-
(0, _emberMetal.set)(
|
25994
|
-
(0, _emberMetal.set)(
|
26015
|
+
(0, _emberMetal.set)(_this16.context, 'key', 'banana');
|
26016
|
+
(0, _emberMetal.set)(_this16.context, 'source', { banana: 'banana' });
|
25995
26017
|
});
|
25996
26018
|
|
25997
26019
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
25998
26020
|
};
|
25999
26021
|
|
26000
26022
|
_class.prototype['@test get helper value should be updatable using {{input}} and (mut) - dynamic nested key'] = function (assert) {
|
26001
|
-
var
|
26023
|
+
var _this17 = this;
|
26002
26024
|
|
26003
26025
|
this.render('{{input type=\'text\' value=(mut (get source key)) id=\'get-input\'}}', {
|
26004
26026
|
source: {
|
@@ -26014,53 +26036,53 @@ enifed('ember-glimmer/tests/integration/helpers/get-test', ['ember-babel', 'embe
|
|
26014
26036
|
assert.strictEqual(this.$('#get-input').val(), 'mcintosh');
|
26015
26037
|
|
26016
26038
|
this.runTask(function () {
|
26017
|
-
return
|
26039
|
+
return _this17.rerender();
|
26018
26040
|
});
|
26019
26041
|
|
26020
26042
|
assert.strictEqual(this.$('#get-input').val(), 'mcintosh');
|
26021
26043
|
|
26022
26044
|
this.runTask(function () {
|
26023
|
-
return (0, _emberMetal.set)(
|
26045
|
+
return (0, _emberMetal.set)(_this17.context, 'source.apple.mcintosh', 'red');
|
26024
26046
|
});
|
26025
26047
|
|
26026
26048
|
assert.strictEqual(this.$('#get-input').val(), 'red');
|
26027
26049
|
|
26028
26050
|
this.runTask(function () {
|
26029
|
-
return
|
26051
|
+
return _this17.$('#get-input').val('some value').trigger('change');
|
26030
26052
|
});
|
26031
26053
|
|
26032
26054
|
assert.strictEqual(this.$('#get-input').val(), 'some value');
|
26033
26055
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.apple.mcintosh'), 'some value');
|
26034
26056
|
|
26035
26057
|
this.runTask(function () {
|
26036
|
-
return (0, _emberMetal.set)(
|
26058
|
+
return (0, _emberMetal.set)(_this17.context, 'key', 'apple.gala');
|
26037
26059
|
});
|
26038
26060
|
|
26039
26061
|
assert.strictEqual(this.$('#get-input').val(), 'gala');
|
26040
26062
|
|
26041
26063
|
this.runTask(function () {
|
26042
|
-
return
|
26064
|
+
return _this17.$('#get-input').val('some other value').trigger('change');
|
26043
26065
|
});
|
26044
26066
|
|
26045
26067
|
assert.strictEqual(this.$('#get-input').val(), 'some other value');
|
26046
26068
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.apple.gala'), 'some other value');
|
26047
26069
|
|
26048
26070
|
this.runTask(function () {
|
26049
|
-
return (0, _emberMetal.set)(
|
26071
|
+
return (0, _emberMetal.set)(_this17.context, 'key', 'banana');
|
26050
26072
|
});
|
26051
26073
|
|
26052
26074
|
assert.strictEqual(this.$('#get-input').val(), 'banana');
|
26053
26075
|
|
26054
26076
|
this.runTask(function () {
|
26055
|
-
return
|
26077
|
+
return _this17.$('#get-input').val('yet another value').trigger('change');
|
26056
26078
|
});
|
26057
26079
|
|
26058
26080
|
assert.strictEqual(this.$('#get-input').val(), 'yet another value');
|
26059
26081
|
assert.strictEqual((0, _emberMetal.get)(this.context, 'source.banana'), 'yet another value');
|
26060
26082
|
|
26061
26083
|
this.runTask(function () {
|
26062
|
-
(0, _emberMetal.set)(
|
26063
|
-
(0, _emberMetal.set)(
|
26084
|
+
(0, _emberMetal.set)(_this17.context, 'key', 'apple.mcintosh');
|
26085
|
+
(0, _emberMetal.set)(_this17.context, 'source', {
|
26064
26086
|
apple: {
|
26065
26087
|
gala: 'gala',
|
26066
26088
|
mcintosh: 'mcintosh'
|
@@ -27279,6 +27301,62 @@ enifed('ember-glimmer/tests/integration/helpers/input-test', ['ember-babel', 'em
|
|
27279
27301
|
|
27280
27302
|
return _class4;
|
27281
27303
|
}(InputRenderingTest));
|
27304
|
+
|
27305
|
+
// These are the permutations of the set:
|
27306
|
+
// ['type="range"', 'min="-5" max="50"', 'value="%x"']
|
27307
|
+
['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) {
|
27308
|
+
(0, _testCase.moduleFor)('[GH#15675] Helpers test: {{input ' + attrs + '}}', function (_InputRenderingTest5) {
|
27309
|
+
(0, _emberBabel.inherits)(_class5, _InputRenderingTest5);
|
27310
|
+
|
27311
|
+
function _class5() {
|
27312
|
+
return (0, _emberBabel.possibleConstructorReturn)(this, _InputRenderingTest5.apply(this, arguments));
|
27313
|
+
}
|
27314
|
+
|
27315
|
+
_class5.prototype.renderInput = function () {
|
27316
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 25;
|
27317
|
+
|
27318
|
+
this.render('{{input ' + attrs.replace("%x", value) + '}}');
|
27319
|
+
};
|
27320
|
+
|
27321
|
+
_class5.prototype.assertValue = function (expected) {
|
27322
|
+
var type = this.$input().attr('type');
|
27323
|
+
|
27324
|
+
if (type !== 'range') {
|
27325
|
+
this.assert.ok(true, 'IE9 does not support range items');
|
27326
|
+
return;
|
27327
|
+
}
|
27328
|
+
|
27329
|
+
_InputRenderingTest5.prototype.assertValue.call(this, expected);
|
27330
|
+
};
|
27331
|
+
|
27332
|
+
_class5.prototype['@test value over default max but below set max is kept'] = function () {
|
27333
|
+
this.renderInput("25");
|
27334
|
+
this.assertValue("25");
|
27335
|
+
};
|
27336
|
+
|
27337
|
+
_class5.prototype['@test value below default min but above set min is kept'] = function () {
|
27338
|
+
this.renderInput("-2");
|
27339
|
+
this.assertValue("-2");
|
27340
|
+
};
|
27341
|
+
|
27342
|
+
_class5.prototype['@test in the valid default range is kept'] = function () {
|
27343
|
+
this.renderInput("5");
|
27344
|
+
this.assertValue("5");
|
27345
|
+
};
|
27346
|
+
|
27347
|
+
_class5.prototype['@test value above max is reset to max'] = function () {
|
27348
|
+
this.renderInput("55");
|
27349
|
+
this.assertValue("50");
|
27350
|
+
};
|
27351
|
+
|
27352
|
+
_class5.prototype['@test value below min is reset to min'] = function () {
|
27353
|
+
this.renderInput("-10");
|
27354
|
+
this.assertValue("-5");
|
27355
|
+
};
|
27356
|
+
|
27357
|
+
return _class5;
|
27358
|
+
}(InputRenderingTest));
|
27359
|
+
});
|
27282
27360
|
});
|
27283
27361
|
enifed('ember-glimmer/tests/integration/helpers/loc-test', ['ember-babel', 'ember-glimmer/tests/utils/test-case', 'ember-metal', 'ember'], function (_emberBabel, _testCase, _emberMetal, _ember) {
|
27284
27362
|
'use strict';
|
@@ -38257,6 +38335,20 @@ enifed('ember-metal/tests/events_test', ['ember-metal'], function (_emberMetal)
|
|
38257
38335
|
equal(triggered, 2, 'should invoke listeners');
|
38258
38336
|
});
|
38259
38337
|
|
38338
|
+
QUnit.test('Ember.on asserts for invalid arguments', function () {
|
38339
|
+
expectAssertion(function () {
|
38340
|
+
_emberMetal.Mixin.create({
|
38341
|
+
foo1: (0, _emberMetal.on)('bar')
|
38342
|
+
});
|
38343
|
+
}, 'Ember.on expects function as last argument');
|
38344
|
+
|
38345
|
+
expectAssertion(function () {
|
38346
|
+
_emberMetal.Mixin.create({
|
38347
|
+
foo1: (0, _emberMetal.on)(function () {})
|
38348
|
+
});
|
38349
|
+
}, 'Ember.on called without valid event names');
|
38350
|
+
});
|
38351
|
+
|
38260
38352
|
QUnit.test('a listener added as part of a mixin may be overridden', function () {
|
38261
38353
|
var triggered = 0;
|
38262
38354
|
var FirstMixin = _emberMetal.Mixin.create({
|
@@ -42369,7 +42461,7 @@ enifed('ember-metal/tests/run_loop/debounce_test', ['ember-metal'], function (_e
|
|
42369
42461
|
ok(wasCalled, 'Ember.run.debounce used');
|
42370
42462
|
});
|
42371
42463
|
});
|
42372
|
-
enifed('ember-metal/tests/run_loop/later_test', ['ember-metal'], function (_emberMetal) {
|
42464
|
+
enifed('ember-metal/tests/run_loop/later_test', ['ember-utils', 'ember-metal'], function (_emberUtils, _emberMetal) {
|
42373
42465
|
'use strict';
|
42374
42466
|
|
42375
42467
|
var originalSetTimeout = window.setTimeout;
|
@@ -42576,7 +42668,7 @@ enifed('ember-metal/tests/run_loop/later_test', ['ember-metal'], function (_embe
|
|
42576
42668
|
// happens when an expired timer callback takes a while to run,
|
42577
42669
|
// which is what we simulate here.
|
42578
42670
|
var newSetTimeoutUsed = void 0;
|
42579
|
-
_emberMetal.run.backburner._platform = {
|
42671
|
+
_emberMetal.run.backburner._platform = (0, _emberUtils.assign)({}, originalPlatform, {
|
42580
42672
|
setTimeout: function () {
|
42581
42673
|
var wait = arguments[arguments.length - 1];
|
42582
42674
|
newSetTimeoutUsed = true;
|
@@ -42584,7 +42676,7 @@ enifed('ember-metal/tests/run_loop/later_test', ['ember-metal'], function (_embe
|
|
42584
42676
|
|
42585
42677
|
return originalPlatform.setTimeout.apply(originalPlatform, arguments);
|
42586
42678
|
}
|
42587
|
-
};
|
42679
|
+
});
|
42588
42680
|
|
42589
42681
|
var count = 0;
|
42590
42682
|
(0, _emberMetal.run)(function () {
|
@@ -51988,7 +52080,6 @@ enifed('ember-runtime/tests/mixins/promise_proxy_test', ['ember-metal', 'ember-r
|
|
51988
52080
|
|
51989
52081
|
PromiseSubclass.prototype = Object.create(_rsvp2.Promise.prototype);
|
51990
52082
|
PromiseSubclass.prototype.constructor = PromiseSubclass;
|
51991
|
-
PromiseSubclass.cast = _rsvp2.Promise.cast;
|
51992
52083
|
|
51993
52084
|
var proxy = ObjectPromiseProxy.create({
|
51994
52085
|
promise: new PromiseSubclass(function () {})
|
@@ -56979,17 +57070,6 @@ enifed('ember-runtime/tests/system/object/create_test', ['ember-metal', 'ember-r
|
|
56979
57070
|
}, 'Ember.Object.create no longer supports mixing in other definitions, use .extend & .create separately instead.');
|
56980
57071
|
});
|
56981
57072
|
|
56982
|
-
// This test is for IE8.
|
56983
|
-
QUnit.test('property name is the same as own prototype property', function () {
|
56984
|
-
var MyClass = _object.default.extend({
|
56985
|
-
toString: function () {
|
56986
|
-
return 'MyClass';
|
56987
|
-
}
|
56988
|
-
});
|
56989
|
-
|
56990
|
-
equal(MyClass.create().toString(), 'MyClass', 'should inherit property from the arguments of `EmberObject.create`');
|
56991
|
-
});
|
56992
|
-
|
56993
57073
|
QUnit.test('inherits properties from passed in EmberObject', function () {
|
56994
57074
|
var baseObj = _object.default.create({ foo: 'bar' });
|
56995
57075
|
var secondaryObj = _object.default.create(baseObj);
|
@@ -56999,9 +57079,9 @@ enifed('ember-runtime/tests/system/object/create_test', ['ember-metal', 'ember-r
|
|
56999
57079
|
|
57000
57080
|
QUnit.test('throws if you try to pass anything a string as a parameter', function () {
|
57001
57081
|
|
57002
|
-
|
57082
|
+
expectAssertion(function () {
|
57003
57083
|
return _object.default.create('some-string');
|
57004
|
-
}, '
|
57084
|
+
}, 'Ember.Object.create only accepts objects.');
|
57005
57085
|
});
|
57006
57086
|
|
57007
57087
|
QUnit.test('EmberObject.create can take undefined as a parameter', function () {
|
@@ -60964,15 +61044,6 @@ enifed('ember-testing/tests/adapters/adapter_test', ['ember-metal', 'ember-testi
|
|
60964
61044
|
}
|
60965
61045
|
});
|
60966
61046
|
|
60967
|
-
// Can't test these this way anymore since we have nothing to compare to
|
60968
|
-
// test("asyncStart is a noop", function() {
|
60969
|
-
// equal(adapter.asyncStart, K);
|
60970
|
-
// });
|
60971
|
-
|
60972
|
-
// test("asyncEnd is a noop", function() {
|
60973
|
-
// equal(adapter.asyncEnd, K);
|
60974
|
-
// });
|
60975
|
-
|
60976
61047
|
QUnit.test('exception throws', function () {
|
60977
61048
|
var error = 'Hai';
|
60978
61049
|
var thrown;
|
@@ -63691,6 +63762,65 @@ enifed('ember/tests/controller_test', ['ember-babel', 'ember-runtime', 'internal
|
|
63691
63762
|
return _class;
|
63692
63763
|
}(_internalTestHelpers.ApplicationTestCase));
|
63693
63764
|
});
|
63765
|
+
enifed('ember/tests/error_handler_test', ['ember', 'ember-metal'], function (_ember, _emberMetal) {
|
63766
|
+
'use strict';
|
63767
|
+
|
63768
|
+
var ONERROR = _ember.default.onerror;
|
63769
|
+
var ADAPTER = _ember.default.Test && _ember.default.Test.adapter;
|
63770
|
+
var TESTING = _ember.default.testing;
|
63771
|
+
|
63772
|
+
QUnit.module('error_handler', {
|
63773
|
+
teardown: function () {
|
63774
|
+
_ember.default.onerror = ONERROR;
|
63775
|
+
_ember.default.testing = TESTING;
|
63776
|
+
if (_ember.default.Test) {
|
63777
|
+
_ember.default.Test.adapter = ADAPTER;
|
63778
|
+
}
|
63779
|
+
}
|
63780
|
+
});
|
63781
|
+
|
63782
|
+
function runThatThrows(message) {
|
63783
|
+
return (0, _emberMetal.run)(function () {
|
63784
|
+
throw new Error(message);
|
63785
|
+
});
|
63786
|
+
}
|
63787
|
+
|
63788
|
+
test('by default there is no onerror', function (assert) {
|
63789
|
+
_ember.default.onerror = undefined;
|
63790
|
+
assert.throws(runThatThrows, Error);
|
63791
|
+
assert.equal(_ember.default.onerror, undefined);
|
63792
|
+
});
|
63793
|
+
|
63794
|
+
test('when Ember.onerror is registered', function (assert) {
|
63795
|
+
assert.expect(2);
|
63796
|
+
_ember.default.onerror = function (error) {
|
63797
|
+
assert.ok(true, 'onerror called');
|
63798
|
+
throw error;
|
63799
|
+
};
|
63800
|
+
assert.throws(runThatThrows, Error);
|
63801
|
+
// Ember.onerror = ONERROR;
|
63802
|
+
});
|
63803
|
+
|
63804
|
+
QUnit.test('Ember.run does not swallow exceptions by default (Ember.testing = true)', function () {
|
63805
|
+
_ember.default.testing = true;
|
63806
|
+
var error = new Error('the error');
|
63807
|
+
throws(function () {
|
63808
|
+
_ember.default.run(function () {
|
63809
|
+
throw error;
|
63810
|
+
});
|
63811
|
+
}, error);
|
63812
|
+
});
|
63813
|
+
|
63814
|
+
QUnit.test('Ember.run does not swallow exceptions by default (Ember.testing = false)', function () {
|
63815
|
+
_ember.default.testing = false;
|
63816
|
+
var error = new Error('the error');
|
63817
|
+
throws(function () {
|
63818
|
+
_ember.default.run(function () {
|
63819
|
+
throw error;
|
63820
|
+
});
|
63821
|
+
}, error);
|
63822
|
+
});
|
63823
|
+
});
|
63694
63824
|
enifed('ember/tests/global-api-test', ['ember-metal', 'ember-runtime'], function (_emberMetal, _emberRuntime) {
|
63695
63825
|
'use strict';
|
63696
63826
|
|
@@ -65869,7 +65999,7 @@ enifed('ember/tests/helpers/link_to_test/link_to_with_query_params_test', ['embe
|
|
65869
65999
|
|
65870
66000
|
assert.expect(1);
|
65871
66001
|
|
65872
|
-
|
66002
|
+
expectAssertion(function () {
|
65873
66003
|
_this19.runTask(function () {
|
65874
66004
|
_this19.createApplication();
|
65875
66005
|
|
@@ -65879,7 +66009,7 @@ enifed('ember/tests/helpers/link_to_test/link_to_with_query_params_test', ['embe
|
|
65879
66009
|
|
65880
66010
|
_this19.addTemplate('application', '{{#link-to id=\'the-link\'}}Index{{/link-to}}');
|
65881
66011
|
});
|
65882
|
-
}, /
|
66012
|
+
}, /You must provide one or more parameters to the link-to component/);
|
65883
66013
|
};
|
65884
66014
|
|
65885
66015
|
return _class2;
|
@@ -66191,341 +66321,6 @@ enifed('ember/tests/routing/basic_test', ['ember-utils', 'ember-console', 'ember
|
|
66191
66321
|
}
|
66192
66322
|
});
|
66193
66323
|
|
66194
|
-
QUnit.test('warn on URLs not included in the route set', function () {
|
66195
|
-
Router.map(function () {
|
66196
|
-
this.route('home', { path: '/' });
|
66197
|
-
});
|
66198
|
-
|
66199
|
-
bootApplication();
|
66200
|
-
|
66201
|
-
expectAssertion(function () {
|
66202
|
-
return (0, _emberMetal.run)(function () {
|
66203
|
-
return router.handleURL('/what-is-this-i-dont-even');
|
66204
|
-
});
|
66205
|
-
}, 'The URL \'/what-is-this-i-dont-even\' did not match any routes in your application');
|
66206
|
-
});
|
66207
|
-
|
66208
|
-
QUnit.test('The Homepage', function () {
|
66209
|
-
Router.map(function () {
|
66210
|
-
this.route('home', { path: '/' });
|
66211
|
-
});
|
66212
|
-
|
66213
|
-
App.HomeRoute = _emberRouting.Route.extend({});
|
66214
|
-
|
66215
|
-
var currentPath = void 0;
|
66216
|
-
|
66217
|
-
App.ApplicationController = _emberRuntime.Controller.extend({
|
66218
|
-
currentPathDidChange: (0, _emberMetal.observer)('currentPath', function () {
|
66219
|
-
currentPath = (0, _emberMetal.get)(this, 'currentPath');
|
66220
|
-
})
|
66221
|
-
});
|
66222
|
-
|
66223
|
-
bootApplication();
|
66224
|
-
|
66225
|
-
equal(currentPath, 'home');
|
66226
|
-
equal((0, _emberViews.jQuery)('h3:contains(Hours)', '#qunit-fixture').length, 1, 'The home template was rendered');
|
66227
|
-
});
|
66228
|
-
|
66229
|
-
QUnit.test('The Home page and the Camelot page with multiple Router.map calls', function () {
|
66230
|
-
Router.map(function () {
|
66231
|
-
this.route('home', { path: '/' });
|
66232
|
-
});
|
66233
|
-
|
66234
|
-
Router.map(function () {
|
66235
|
-
this.route('camelot', { path: '/camelot' });
|
66236
|
-
});
|
66237
|
-
|
66238
|
-
App.HomeRoute = _emberRouting.Route.extend({});
|
66239
|
-
|
66240
|
-
App.CamelotRoute = _emberRouting.Route.extend({});
|
66241
|
-
|
66242
|
-
var currentPath = void 0;
|
66243
|
-
|
66244
|
-
App.ApplicationController = _emberRuntime.Controller.extend({
|
66245
|
-
currentPathDidChange: (0, _emberMetal.observer)('currentPath', function () {
|
66246
|
-
currentPath = (0, _emberMetal.get)(this, 'currentPath');
|
66247
|
-
})
|
66248
|
-
});
|
66249
|
-
|
66250
|
-
App.CamelotController = _emberRuntime.Controller.extend({
|
66251
|
-
currentPathDidChange: (0, _emberMetal.observer)('currentPath', function () {
|
66252
|
-
currentPath = (0, _emberMetal.get)(this, 'currentPath');
|
66253
|
-
})
|
66254
|
-
});
|
66255
|
-
|
66256
|
-
bootApplication();
|
66257
|
-
|
66258
|
-
handleURL('/camelot');
|
66259
|
-
|
66260
|
-
equal(currentPath, 'camelot');
|
66261
|
-
equal((0, _emberViews.jQuery)('h3:contains(silly)', '#qunit-fixture').length, 1, 'The camelot template was rendered');
|
66262
|
-
|
66263
|
-
handleURL('/');
|
66264
|
-
|
66265
|
-
equal(currentPath, 'home');
|
66266
|
-
equal((0, _emberViews.jQuery)('h3:contains(Hours)', '#qunit-fixture').length, 1, 'The home template was rendered');
|
66267
|
-
});
|
66268
|
-
|
66269
|
-
QUnit.test('The Homepage with explicit template name in renderTemplate', function () {
|
66270
|
-
Router.map(function () {
|
66271
|
-
this.route('home', { path: '/' });
|
66272
|
-
});
|
66273
|
-
|
66274
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66275
|
-
renderTemplate: function () {
|
66276
|
-
this.render('homepage');
|
66277
|
-
}
|
66278
|
-
});
|
66279
|
-
|
66280
|
-
bootApplication();
|
66281
|
-
|
66282
|
-
equal((0, _emberViews.jQuery)('h3:contains(Megatroll)', '#qunit-fixture').length, 1, 'The homepage template was rendered');
|
66283
|
-
});
|
66284
|
-
|
66285
|
-
QUnit.test('An alternate template will pull in an alternate controller', function () {
|
66286
|
-
Router.map(function () {
|
66287
|
-
this.route('home', { path: '/' });
|
66288
|
-
});
|
66289
|
-
|
66290
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66291
|
-
renderTemplate: function () {
|
66292
|
-
this.render('homepage');
|
66293
|
-
}
|
66294
|
-
});
|
66295
|
-
|
66296
|
-
App.HomepageController = _emberRuntime.Controller.extend({
|
66297
|
-
model: {
|
66298
|
-
home: 'Comes from homepage'
|
66299
|
-
}
|
66300
|
-
});
|
66301
|
-
|
66302
|
-
bootApplication();
|
66303
|
-
|
66304
|
-
equal((0, _emberViews.jQuery)('h3:contains(Megatroll) + p:contains(Comes from homepage)', '#qunit-fixture').length, 1, 'The homepage template was rendered');
|
66305
|
-
});
|
66306
|
-
|
66307
|
-
QUnit.test('An alternate template will pull in an alternate controller instead of controllerName', function () {
|
66308
|
-
Router.map(function () {
|
66309
|
-
this.route('home', { path: '/' });
|
66310
|
-
});
|
66311
|
-
|
66312
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66313
|
-
controllerName: 'foo',
|
66314
|
-
renderTemplate: function () {
|
66315
|
-
this.render('homepage');
|
66316
|
-
}
|
66317
|
-
});
|
66318
|
-
|
66319
|
-
App.FooController = _emberRuntime.Controller.extend({
|
66320
|
-
model: {
|
66321
|
-
home: 'Comes from Foo'
|
66322
|
-
}
|
66323
|
-
});
|
66324
|
-
|
66325
|
-
App.HomepageController = _emberRuntime.Controller.extend({
|
66326
|
-
model: {
|
66327
|
-
home: 'Comes from homepage'
|
66328
|
-
}
|
66329
|
-
});
|
66330
|
-
|
66331
|
-
bootApplication();
|
66332
|
-
|
66333
|
-
equal((0, _emberViews.jQuery)('h3:contains(Megatroll) + p:contains(Comes from homepage)', '#qunit-fixture').length, 1, 'The homepage template was rendered');
|
66334
|
-
});
|
66335
|
-
|
66336
|
-
QUnit.test('The template will pull in an alternate controller via key/value', function () {
|
66337
|
-
Router.map(function () {
|
66338
|
-
this.route('homepage', { path: '/' });
|
66339
|
-
});
|
66340
|
-
|
66341
|
-
App.HomepageRoute = _emberRouting.Route.extend({
|
66342
|
-
renderTemplate: function () {
|
66343
|
-
this.render({ controller: 'home' });
|
66344
|
-
}
|
66345
|
-
});
|
66346
|
-
|
66347
|
-
App.HomeController = _emberRuntime.Controller.extend({
|
66348
|
-
model: {
|
66349
|
-
home: 'Comes from home.'
|
66350
|
-
}
|
66351
|
-
});
|
66352
|
-
|
66353
|
-
bootApplication();
|
66354
|
-
|
66355
|
-
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');
|
66356
|
-
});
|
66357
|
-
|
66358
|
-
QUnit.test('The Homepage with explicit template name in renderTemplate and controller', function () {
|
66359
|
-
Router.map(function () {
|
66360
|
-
this.route('home', { path: '/' });
|
66361
|
-
});
|
66362
|
-
|
66363
|
-
App.HomeController = _emberRuntime.Controller.extend({
|
66364
|
-
model: {
|
66365
|
-
home: 'YES I AM HOME'
|
66366
|
-
}
|
66367
|
-
});
|
66368
|
-
|
66369
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66370
|
-
renderTemplate: function () {
|
66371
|
-
this.render('homepage');
|
66372
|
-
}
|
66373
|
-
});
|
66374
|
-
|
66375
|
-
bootApplication();
|
66376
|
-
|
66377
|
-
equal((0, _emberViews.jQuery)('h3:contains(Megatroll) + p:contains(YES I AM HOME)', '#qunit-fixture').length, 1, 'The homepage template was rendered');
|
66378
|
-
});
|
66379
|
-
|
66380
|
-
QUnit.test('Model passed via renderTemplate model is set as controller\'s model', function () {
|
66381
|
-
(0, _emberGlimmer.setTemplate)('bio', (0, _emberTemplateCompiler.compile)('<p>{{model.name}}</p>'));
|
66382
|
-
|
66383
|
-
App.BioController = _emberRuntime.Controller.extend();
|
66384
|
-
|
66385
|
-
Router.map(function () {
|
66386
|
-
this.route('home', { path: '/' });
|
66387
|
-
});
|
66388
|
-
|
66389
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66390
|
-
renderTemplate: function () {
|
66391
|
-
this.render('bio', {
|
66392
|
-
model: { name: 'emberjs' }
|
66393
|
-
});
|
66394
|
-
}
|
66395
|
-
});
|
66396
|
-
|
66397
|
-
bootApplication();
|
66398
|
-
|
66399
|
-
equal((0, _emberViews.jQuery)('p:contains(emberjs)', '#qunit-fixture').length, 1, 'Passed model was set as controllers model');
|
66400
|
-
});
|
66401
|
-
|
66402
|
-
QUnit.test('render uses templateName from route', function () {
|
66403
|
-
Router.map(function () {
|
66404
|
-
this.route('home', { path: '/' });
|
66405
|
-
});
|
66406
|
-
|
66407
|
-
(0, _emberGlimmer.setTemplate)('the_real_home_template', (0, _emberTemplateCompiler.compile)('<p>THIS IS THE REAL HOME</p>'));
|
66408
|
-
|
66409
|
-
App.HomeController = _emberRuntime.Controller.extend();
|
66410
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66411
|
-
templateName: 'the_real_home_template'
|
66412
|
-
});
|
66413
|
-
|
66414
|
-
bootApplication();
|
66415
|
-
|
66416
|
-
equal((0, _emberViews.jQuery)('p', '#qunit-fixture').text(), 'THIS IS THE REAL HOME', 'The homepage template was rendered');
|
66417
|
-
});
|
66418
|
-
|
66419
|
-
QUnit.test('defining templateName allows other templates to be rendered', function () {
|
66420
|
-
Router.map(function () {
|
66421
|
-
this.route('home', { path: '/' });
|
66422
|
-
});
|
66423
|
-
|
66424
|
-
(0, _emberGlimmer.setTemplate)('alert', (0, _emberTemplateCompiler.compile)('<div class=\'alert-box\'>Invader!</div>'));
|
66425
|
-
(0, _emberGlimmer.setTemplate)('the_real_home_template', (0, _emberTemplateCompiler.compile)('<p>THIS IS THE REAL HOME</p>{{outlet \'alert\'}}'));
|
66426
|
-
|
66427
|
-
App.HomeController = _emberRuntime.Controller.extend();
|
66428
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66429
|
-
templateName: 'the_real_home_template',
|
66430
|
-
actions: {
|
66431
|
-
showAlert: function () {
|
66432
|
-
this.render('alert', {
|
66433
|
-
into: 'home',
|
66434
|
-
outlet: 'alert'
|
66435
|
-
});
|
66436
|
-
}
|
66437
|
-
}
|
66438
|
-
});
|
66439
|
-
|
66440
|
-
bootApplication();
|
66441
|
-
|
66442
|
-
equal((0, _emberViews.jQuery)('p', '#qunit-fixture').text(), 'THIS IS THE REAL HOME', 'The homepage template was rendered');
|
66443
|
-
|
66444
|
-
(0, _emberMetal.run)(function () {
|
66445
|
-
return router.send('showAlert');
|
66446
|
-
});
|
66447
|
-
|
66448
|
-
equal((0, _emberViews.jQuery)('.alert-box', '#qunit-fixture').text(), 'Invader!', 'Template for alert was render into outlet');
|
66449
|
-
});
|
66450
|
-
|
66451
|
-
QUnit.test('templateName is still used when calling render with no name and options', function () {
|
66452
|
-
Router.map(function () {
|
66453
|
-
this.route('home', { path: '/' });
|
66454
|
-
});
|
66455
|
-
|
66456
|
-
(0, _emberGlimmer.setTemplate)('alert', (0, _emberTemplateCompiler.compile)('<div class=\'alert-box\'>Invader!</div>'));
|
66457
|
-
(0, _emberGlimmer.setTemplate)('home', (0, _emberTemplateCompiler.compile)('<p>THIS IS THE REAL HOME</p>{{outlet \'alert\'}}'));
|
66458
|
-
|
66459
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66460
|
-
templateName: 'alert',
|
66461
|
-
renderTemplate: function () {
|
66462
|
-
this.render({});
|
66463
|
-
}
|
66464
|
-
});
|
66465
|
-
|
66466
|
-
bootApplication();
|
66467
|
-
|
66468
|
-
equal((0, _emberViews.jQuery)('.alert-box', '#qunit-fixture').text(), 'Invader!', 'default templateName was rendered into outlet');
|
66469
|
-
});
|
66470
|
-
|
66471
|
-
QUnit.test('The Homepage with a `setupController` hook', function () {
|
66472
|
-
Router.map(function () {
|
66473
|
-
this.route('home', { path: '/' });
|
66474
|
-
});
|
66475
|
-
|
66476
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66477
|
-
setupController: function (controller) {
|
66478
|
-
(0, _emberMetal.set)(controller, 'hours', (0, _emberRuntime.A)(['Monday through Friday: 9am to 5pm', 'Saturday: Noon to Midnight', 'Sunday: Noon to 6pm']));
|
66479
|
-
}
|
66480
|
-
});
|
66481
|
-
|
66482
|
-
(0, _emberGlimmer.setTemplate)('home', (0, _emberTemplateCompiler.compile)('<ul>{{#each hours as |entry|}}<li>{{entry}}</li>{{/each}}</ul>'));
|
66483
|
-
|
66484
|
-
bootApplication();
|
66485
|
-
|
66486
|
-
equal((0, _emberViews.jQuery)('ul li', '#qunit-fixture').eq(2).text(), 'Sunday: Noon to 6pm', 'The template was rendered with the hours context');
|
66487
|
-
});
|
66488
|
-
|
66489
|
-
QUnit.test('The route controller is still set when overriding the setupController hook', function () {
|
66490
|
-
Router.map(function () {
|
66491
|
-
this.route('home', { path: '/' });
|
66492
|
-
});
|
66493
|
-
|
66494
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66495
|
-
setupController: function () {
|
66496
|
-
// no-op
|
66497
|
-
// importantly, we are not calling this._super here
|
66498
|
-
}
|
66499
|
-
});
|
66500
|
-
|
66501
|
-
registry.register('controller:home', _emberRuntime.Controller.extend());
|
66502
|
-
|
66503
|
-
bootApplication();
|
66504
|
-
|
66505
|
-
deepEqual(container.lookup('route:home').controller, container.lookup('controller:home'), 'route controller is the home controller');
|
66506
|
-
});
|
66507
|
-
|
66508
|
-
QUnit.test('The route controller can be specified via controllerName', function () {
|
66509
|
-
Router.map(function () {
|
66510
|
-
this.route('home', { path: '/' });
|
66511
|
-
});
|
66512
|
-
|
66513
|
-
(0, _emberGlimmer.setTemplate)('home', (0, _emberTemplateCompiler.compile)('<p>{{myValue}}</p>'));
|
66514
|
-
|
66515
|
-
App.HomeRoute = _emberRouting.Route.extend({
|
66516
|
-
controllerName: 'myController'
|
66517
|
-
});
|
66518
|
-
|
66519
|
-
registry.register('controller:myController', _emberRuntime.Controller.extend({
|
66520
|
-
myValue: 'foo'
|
66521
|
-
}));
|
66522
|
-
|
66523
|
-
bootApplication();
|
66524
|
-
|
66525
|
-
deepEqual(container.lookup('route:home').controller, container.lookup('controller:myController'), 'route controller is set by controllerName');
|
66526
|
-
equal((0, _emberViews.jQuery)('p', '#qunit-fixture').text(), 'foo', 'The homepage template was rendered with data from the custom controller');
|
66527
|
-
});
|
66528
|
-
|
66529
66324
|
QUnit.test('The route controller specified via controllerName is used in render', function () {
|
66530
66325
|
Router.map(function () {
|
66531
66326
|
this.route('home', { path: '/' });
|
@@ -69101,9 +68896,7 @@ enifed('ember/tests/routing/basic_test', ['ember-utils', 'ember-console', 'ember
|
|
69101
68896
|
}
|
69102
68897
|
});
|
69103
68898
|
|
69104
|
-
|
69105
|
-
return bootApplication();
|
69106
|
-
}, /More context objects were passed/);
|
68899
|
+
bootApplication();
|
69107
68900
|
|
69108
68901
|
equal((0, _emberViews.jQuery)('#error').length, 1, 'Error template was rendered.');
|
69109
68902
|
});
|
@@ -69886,6 +69679,334 @@ enifed('ember/tests/routing/basic_test', ['ember-utils', 'ember-console', 'ember
|
|
69886
69679
|
equal(router._toplevelView, null, 'the toplevelView was not reinitialized');
|
69887
69680
|
});
|
69888
69681
|
});
|
69682
|
+
enifed('ember/tests/routing/decoupled_basic_test', ['ember-babel', 'ember-routing', 'ember-runtime', 'internal-test-helpers'], function (_emberBabel, _emberRouting, _emberRuntime, _internalTestHelpers) {
|
69683
|
+
'use strict';
|
69684
|
+
|
69685
|
+
(0, _internalTestHelpers.moduleFor)('Basic Routing - Decoupled from global resovler', function (_ApplicationTestCase) {
|
69686
|
+
(0, _emberBabel.inherits)(_class, _ApplicationTestCase);
|
69687
|
+
|
69688
|
+
function _class() {
|
69689
|
+
|
69690
|
+
var _this = (0, _emberBabel.possibleConstructorReturn)(this, _ApplicationTestCase.call(this));
|
69691
|
+
|
69692
|
+
_this.addTemplate('home', '<h3 id="app">Hours</h3>');
|
69693
|
+
_this.addTemplate('camelot', '<section id="camelot"><h3>Is a silly place</h3></section>');
|
69694
|
+
_this.addTemplate('homepage', '<h3 id="troll">Megatroll</h3><p>{{model.home}}</p>');
|
69695
|
+
|
69696
|
+
_this.router.map(function () {
|
69697
|
+
this.route('home', { path: '/' });
|
69698
|
+
});
|
69699
|
+
return _this;
|
69700
|
+
}
|
69701
|
+
|
69702
|
+
_class.prototype.getController = function (name) {
|
69703
|
+
return this.applicationInstance.lookup('controller:' + name);
|
69704
|
+
};
|
69705
|
+
|
69706
|
+
_class.prototype['@test warn on URLs not included in the route set'] = function () {
|
69707
|
+
var _this2 = this;
|
69708
|
+
|
69709
|
+
return this.visit('/').then(function () {
|
69710
|
+
expectAssertion(function () {
|
69711
|
+
_this2.visit('/what-is-this-i-dont-even');
|
69712
|
+
}, /'\/what-is-this-i-dont-even' did not match any routes/);
|
69713
|
+
});
|
69714
|
+
};
|
69715
|
+
|
69716
|
+
_class.prototype['@test The Homepage'] = function (assert) {
|
69717
|
+
var _this3 = this;
|
69718
|
+
|
69719
|
+
return this.visit('/').then(function () {
|
69720
|
+
assert.equal(_this3.currentPath, 'home', 'currently on the home route');
|
69721
|
+
|
69722
|
+
var text = _this3.$('#app').text();
|
69723
|
+
assert.equal(text, "Hours", 'the home template was rendered');
|
69724
|
+
});
|
69725
|
+
};
|
69726
|
+
|
69727
|
+
_class.prototype['@test The Homepage and the Camelot page with multiple Router.map calls'] = function (assert) {
|
69728
|
+
var _this4 = this;
|
69729
|
+
|
69730
|
+
this.router.map(function () {
|
69731
|
+
this.route('camelot', { path: '/camelot' });
|
69732
|
+
});
|
69733
|
+
|
69734
|
+
return this.visit('/camelot').then(function () {
|
69735
|
+
assert.equal(_this4.currentPath, 'camelot');
|
69736
|
+
|
69737
|
+
var text = _this4.$('#camelot').text();
|
69738
|
+
assert.equal(text, "Is a silly place", 'the camelot template was rendered');
|
69739
|
+
|
69740
|
+
return _this4.visit('/');
|
69741
|
+
}).then(function () {
|
69742
|
+
assert.equal(_this4.currentPath, 'home');
|
69743
|
+
|
69744
|
+
var text = _this4.$('#app').text();
|
69745
|
+
assert.equal(text, "Hours", 'the home template was rendered');
|
69746
|
+
});
|
69747
|
+
};
|
69748
|
+
|
69749
|
+
_class.prototype['@test The Homepage with explicit template name in renderTemplate'] = function (assert) {
|
69750
|
+
var _this5 = this;
|
69751
|
+
|
69752
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69753
|
+
renderTemplate: function () {
|
69754
|
+
this.render('homepage');
|
69755
|
+
}
|
69756
|
+
}));
|
69757
|
+
|
69758
|
+
return this.visit('/').then(function () {
|
69759
|
+
var text = _this5.$('#troll').text();
|
69760
|
+
assert.equal(text, "Megatroll", 'the homepage template was rendered');
|
69761
|
+
});
|
69762
|
+
};
|
69763
|
+
|
69764
|
+
_class.prototype['@test an alternate template will pull in an alternate controller'] = function (assert) {
|
69765
|
+
var _this6 = this;
|
69766
|
+
|
69767
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69768
|
+
renderTemplate: function () {
|
69769
|
+
this.render('homepage');
|
69770
|
+
}
|
69771
|
+
}));
|
69772
|
+
this.add('controller:homepage', _emberRuntime.Controller.extend({
|
69773
|
+
model: {
|
69774
|
+
home: 'Comes from homepage'
|
69775
|
+
}
|
69776
|
+
}));
|
69777
|
+
|
69778
|
+
return this.visit('/').then(function () {
|
69779
|
+
var text = _this6.$('p').text();
|
69780
|
+
|
69781
|
+
assert.equal(text, 'Comes from homepage', 'the homepage template was rendered');
|
69782
|
+
});
|
69783
|
+
};
|
69784
|
+
|
69785
|
+
_class.prototype['@test An alternate template will pull in an alternate controller instead of controllerName'] = function (assert) {
|
69786
|
+
var _this7 = this;
|
69787
|
+
|
69788
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69789
|
+
controllerName: 'foo',
|
69790
|
+
renderTemplate: function () {
|
69791
|
+
this.render('homepage');
|
69792
|
+
}
|
69793
|
+
}));
|
69794
|
+
this.add('controller:foo', _emberRuntime.Controller.extend({
|
69795
|
+
model: {
|
69796
|
+
home: 'Comes from foo'
|
69797
|
+
}
|
69798
|
+
}));
|
69799
|
+
this.add('controller:homepage', _emberRuntime.Controller.extend({
|
69800
|
+
model: {
|
69801
|
+
home: 'Comes from homepage'
|
69802
|
+
}
|
69803
|
+
}));
|
69804
|
+
|
69805
|
+
return this.visit('/').then(function () {
|
69806
|
+
var text = _this7.$('p').text();
|
69807
|
+
|
69808
|
+
assert.equal(text, 'Comes from homepage', 'the homepage template was rendered');
|
69809
|
+
});
|
69810
|
+
};
|
69811
|
+
|
69812
|
+
_class.prototype['@test The template will pull in an alternate controller via key/value'] = function (assert) {
|
69813
|
+
var _this8 = this;
|
69814
|
+
|
69815
|
+
this.router.map(function () {
|
69816
|
+
this.route('homepage', { path: '/' });
|
69817
|
+
});
|
69818
|
+
|
69819
|
+
this.add('route:homepage', _emberRouting.Route.extend({
|
69820
|
+
renderTemplate: function () {
|
69821
|
+
this.render({ controller: 'home' });
|
69822
|
+
}
|
69823
|
+
}));
|
69824
|
+
this.add('controller:home', _emberRuntime.Controller.extend({
|
69825
|
+
model: {
|
69826
|
+
home: 'Comes from home.'
|
69827
|
+
}
|
69828
|
+
}));
|
69829
|
+
|
69830
|
+
return this.visit('/').then(function () {
|
69831
|
+
var text = _this8.$('p').text();
|
69832
|
+
|
69833
|
+
assert.equal(text, 'Comes from home.', 'the homepage template was rendered from data from the HomeController');
|
69834
|
+
});
|
69835
|
+
};
|
69836
|
+
|
69837
|
+
_class.prototype['@test The Homepage with explicit template name in renderTemplate and controller'] = function (assert) {
|
69838
|
+
var _this9 = this;
|
69839
|
+
|
69840
|
+
this.add('controller:home', _emberRuntime.Controller.extend({
|
69841
|
+
model: {
|
69842
|
+
home: 'YES I AM HOME'
|
69843
|
+
}
|
69844
|
+
}));
|
69845
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69846
|
+
renderTemplate: function () {
|
69847
|
+
this.render('homepage');
|
69848
|
+
}
|
69849
|
+
}));
|
69850
|
+
|
69851
|
+
return this.visit('/').then(function () {
|
69852
|
+
var text = _this9.$('p').text();
|
69853
|
+
|
69854
|
+
assert.equal(text, 'YES I AM HOME', 'The homepage template was rendered');
|
69855
|
+
});
|
69856
|
+
};
|
69857
|
+
|
69858
|
+
_class.prototype['@test Model passed via renderTemplate model is set as controller\'s model'] = function (assert) {
|
69859
|
+
var _this10 = this;
|
69860
|
+
|
69861
|
+
this.addTemplate('bio', '<p>{{model.name}}</p>');
|
69862
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69863
|
+
renderTemplate: function () {
|
69864
|
+
this.render('bio', {
|
69865
|
+
model: { name: 'emberjs' }
|
69866
|
+
});
|
69867
|
+
}
|
69868
|
+
}));
|
69869
|
+
|
69870
|
+
return this.visit('/').then(function () {
|
69871
|
+
var text = _this10.$('p').text();
|
69872
|
+
|
69873
|
+
assert.equal(text, 'emberjs', 'Passed model was set as controller\'s model');
|
69874
|
+
});
|
69875
|
+
};
|
69876
|
+
|
69877
|
+
_class.prototype['@test render uses templateName from route'] = function (assert) {
|
69878
|
+
var _this11 = this;
|
69879
|
+
|
69880
|
+
this.addTemplate('the_real_home_template', '<p>THIS IS THE REAL HOME</p>');
|
69881
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69882
|
+
templateName: 'the_real_home_template'
|
69883
|
+
}));
|
69884
|
+
|
69885
|
+
return this.visit('/').then(function () {
|
69886
|
+
var text = _this11.$('p').text();
|
69887
|
+
|
69888
|
+
assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
|
69889
|
+
});
|
69890
|
+
};
|
69891
|
+
|
69892
|
+
_class.prototype['@test defining templateName allows other templates to be rendered'] = function (assert) {
|
69893
|
+
var _this12 = this;
|
69894
|
+
|
69895
|
+
this.addTemplate('alert', '<div class=\'alert-box\'>Invader!</div>');
|
69896
|
+
this.addTemplate('the_real_home_template', '<p>THIS IS THE REAL HOME</p>{{outlet \'alert\'}}');
|
69897
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69898
|
+
templateName: 'the_real_home_template',
|
69899
|
+
actions: {
|
69900
|
+
showAlert: function () {
|
69901
|
+
this.render('alert', {
|
69902
|
+
into: 'home',
|
69903
|
+
outlet: 'alert'
|
69904
|
+
});
|
69905
|
+
}
|
69906
|
+
}
|
69907
|
+
}));
|
69908
|
+
|
69909
|
+
return this.visit('/').then(function () {
|
69910
|
+
var text = _this12.$('p').text();
|
69911
|
+
assert.equal(text, 'THIS IS THE REAL HOME', 'the homepage template was rendered');
|
69912
|
+
|
69913
|
+
return _this12.runTask(function () {
|
69914
|
+
return _this12.appRouter.send('showAlert');
|
69915
|
+
});
|
69916
|
+
}).then(function () {
|
69917
|
+
var text = _this12.$('.alert-box').text();
|
69918
|
+
|
69919
|
+
assert.equal(text, 'Invader!', 'Template for alert was rendered into the outlet');
|
69920
|
+
});
|
69921
|
+
};
|
69922
|
+
|
69923
|
+
_class.prototype['@test templateName is still used when calling render with no name and options'] = function (assert) {
|
69924
|
+
var _this13 = this;
|
69925
|
+
|
69926
|
+
this.addTemplate('alert', '<div class=\'alert-box\'>Invader!</div>');
|
69927
|
+
this.addTemplate('home', '<p>THIS IS THE REAL HOME</p>{{outlet \'alert\'}}');
|
69928
|
+
|
69929
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69930
|
+
templateName: 'alert',
|
69931
|
+
renderTemplate: function () {
|
69932
|
+
this.render({});
|
69933
|
+
}
|
69934
|
+
}));
|
69935
|
+
|
69936
|
+
return this.visit('/').then(function () {
|
69937
|
+
var text = _this13.$('.alert-box').text();
|
69938
|
+
|
69939
|
+
assert.equal(text, 'Invader!', 'default templateName was rendered into outlet');
|
69940
|
+
});
|
69941
|
+
};
|
69942
|
+
|
69943
|
+
_class.prototype['@test The Homepage with a `setupController` hook'] = function (assert) {
|
69944
|
+
var _this14 = this;
|
69945
|
+
|
69946
|
+
this.addTemplate('home', '<ul>{{#each hours as |entry|}}\n <li>{{entry}}</li>\n {{/each}}\n </ul>\n ');
|
69947
|
+
|
69948
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69949
|
+
setupController: function (controller) {
|
69950
|
+
controller.set('hours', (0, _emberRuntime.A)(['Monday through Friday: 9am to 5pm', 'Saturday: Noon to Midnight', 'Sunday: Noon to 6pm']));
|
69951
|
+
}
|
69952
|
+
}));
|
69953
|
+
return this.visit('/').then(function () {
|
69954
|
+
var text = _this14.$('ul li').eq(2).text();
|
69955
|
+
|
69956
|
+
assert.equal(text, 'Sunday: Noon to 6pm', 'The template was rendered with the hours context');
|
69957
|
+
});
|
69958
|
+
};
|
69959
|
+
|
69960
|
+
_class.prototype['@test The route controller is still set when overriding the setupController hook'] = function (assert) {
|
69961
|
+
var _this15 = this;
|
69962
|
+
|
69963
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69964
|
+
setupController: function () {
|
69965
|
+
// no-op
|
69966
|
+
// importantly, we are not calling this._super
|
69967
|
+
}
|
69968
|
+
}));
|
69969
|
+
|
69970
|
+
this.add('controller:home', _emberRuntime.Controller.extend());
|
69971
|
+
|
69972
|
+
return this.visit('/').then(function () {
|
69973
|
+
var homeRoute = _this15.applicationInstance.lookup('route:home');
|
69974
|
+
var homeController = _this15.applicationInstance.lookup('controller:home');
|
69975
|
+
|
69976
|
+
assert.equal(homeRoute.controller, homeController, 'route controller is the home controller');
|
69977
|
+
});
|
69978
|
+
};
|
69979
|
+
|
69980
|
+
_class.prototype['@test the route controller can be specified via controllerName'] = function (assert) {
|
69981
|
+
var _this16 = this;
|
69982
|
+
|
69983
|
+
this.addTemplate('home', '<p>{{myValue}}</p>');
|
69984
|
+
this.add('route:home', _emberRouting.Route.extend({
|
69985
|
+
controllerName: 'myController'
|
69986
|
+
}));
|
69987
|
+
this.add('controller:myController', _emberRuntime.Controller.extend({
|
69988
|
+
myValue: 'foo'
|
69989
|
+
}));
|
69990
|
+
|
69991
|
+
return this.visit('/').then(function () {
|
69992
|
+
var homeRoute = _this16.applicationInstance.lookup('route:home');
|
69993
|
+
var myController = _this16.applicationInstance.lookup('controller:myController');
|
69994
|
+
var text = _this16.$('p').text();
|
69995
|
+
|
69996
|
+
assert.deepEqual(homeRoute.controller, myController, 'route controller is set by controllerName');
|
69997
|
+
assert.equal(text, 'foo', 'The homepage template was rendered with data from the custom controller');
|
69998
|
+
});
|
69999
|
+
};
|
70000
|
+
|
70001
|
+
(0, _emberBabel.createClass)(_class, [{
|
70002
|
+
key: 'currentPath',
|
70003
|
+
get: function () {
|
70004
|
+
return this.getController('application').get('currentPath');
|
70005
|
+
}
|
70006
|
+
}]);
|
70007
|
+
return _class;
|
70008
|
+
}(_internalTestHelpers.ApplicationTestCase));
|
70009
|
+
});
|
69889
70010
|
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) {
|
69890
70011
|
'use strict';
|
69891
70012
|
|
@@ -73790,1063 +73911,972 @@ enifed('ember/tests/routing/router_service_test/urlFor_test', ['ember-babel', 'e
|
|
73790
73911
|
return _class;
|
73791
73912
|
}(_internalTestHelpers.RouterTestCase));
|
73792
73913
|
});
|
73793
|
-
enifed('ember/tests/routing/substates_test', ['ember-
|
73914
|
+
enifed('ember/tests/routing/substates_test', ['ember-babel', 'ember-runtime', 'ember-routing', 'internal-test-helpers'], function (_emberBabel, _emberRuntime, _emberRouting, _internalTestHelpers) {
|
73794
73915
|
'use strict';
|
73795
73916
|
|
73796
|
-
var
|
73797
|
-
App = void 0,
|
73798
|
-
templates = void 0,
|
73799
|
-
router = void 0,
|
73800
|
-
container = void 0,
|
73801
|
-
counter = void 0;
|
73917
|
+
var counter = void 0;
|
73802
73918
|
|
73803
73919
|
function step(expectedValue, description) {
|
73804
73920
|
equal(counter, expectedValue, 'Step ' + expectedValue + ': ' + description);
|
73805
73921
|
counter++;
|
73806
73922
|
}
|
73807
73923
|
|
73808
|
-
function
|
73809
|
-
|
73810
|
-
(0, _emberGlimmer.setTemplate)(name, (0, _emberTemplateCompiler.compile)(templates[name]));
|
73811
|
-
}
|
73924
|
+
(0, _internalTestHelpers.moduleFor)('Loading/Error Substates', function (_ApplicationTestCase) {
|
73925
|
+
(0, _emberBabel.inherits)(_class, _ApplicationTestCase);
|
73812
73926
|
|
73813
|
-
|
73814
|
-
_emberRouting.NoneLocation.reopen({
|
73815
|
-
path: startingURL
|
73816
|
-
});
|
73817
|
-
}
|
73927
|
+
function _class() {
|
73818
73928
|
|
73819
|
-
|
73820
|
-
router = container.lookup('router:main');
|
73821
|
-
(0, _emberMetal.run)(App, 'advanceReadiness');
|
73822
|
-
}
|
73929
|
+
var _this = (0, _emberBabel.possibleConstructorReturn)(this, _ApplicationTestCase.call(this));
|
73823
73930
|
|
73824
|
-
QUnit.module('Loading/Error Substates', {
|
73825
|
-
setup: function () {
|
73826
73931
|
counter = 1;
|
73827
73932
|
|
73828
|
-
(
|
73829
|
-
|
73830
|
-
|
73831
|
-
|
73832
|
-
// fake a modules resolver
|
73833
|
-
Resolver: _emberApplication.Resolver.extend({ moduleBasedResolver: true })
|
73834
|
-
});
|
73835
|
-
|
73836
|
-
App.deferReadiness();
|
73837
|
-
|
73838
|
-
App.Router.reopen({
|
73839
|
-
location: 'none'
|
73840
|
-
});
|
73841
|
-
|
73842
|
-
Router = App.Router;
|
73933
|
+
_this.addTemplate('application', '<div id="app">{{outlet}}</div>');
|
73934
|
+
_this.addTemplate('index', 'INDEX');
|
73935
|
+
return _this;
|
73936
|
+
}
|
73843
73937
|
|
73844
|
-
|
73938
|
+
_class.prototype.getController = function (name) {
|
73939
|
+
return this.applicationInstance.lookup('controller:' + name);
|
73940
|
+
};
|
73845
73941
|
|
73846
|
-
|
73847
|
-
|
73848
|
-
index: 'INDEX',
|
73849
|
-
loading: 'LOADING',
|
73850
|
-
bro: 'BRO',
|
73851
|
-
sis: 'SIS'
|
73852
|
-
};
|
73853
|
-
});
|
73854
|
-
},
|
73855
|
-
teardown: function () {
|
73856
|
-
(0, _emberMetal.run)(function () {
|
73857
|
-
App.destroy();
|
73858
|
-
App = null;
|
73942
|
+
_class.prototype['@test Slow promise from a child route of application enters nested loading state'] = function (assert) {
|
73943
|
+
var _this2 = this;
|
73859
73944
|
|
73860
|
-
|
73861
|
-
});
|
73945
|
+
var turtleDeferred = _emberRuntime.RSVP.defer();
|
73862
73946
|
|
73863
|
-
|
73864
|
-
|
73947
|
+
this.router.map(function () {
|
73948
|
+
this.route('turtle');
|
73865
73949
|
});
|
73866
|
-
}
|
73867
|
-
});
|
73868
|
-
|
73869
|
-
QUnit.test('Slow promise from a child route of application enters nested loading state', function () {
|
73870
|
-
var broDeferred = _emberRuntime.RSVP.defer();
|
73871
73950
|
|
73872
|
-
|
73873
|
-
|
73874
|
-
|
73951
|
+
this.add('route:application', _emberRouting.Route.extend({
|
73952
|
+
setupController: function () {
|
73953
|
+
step(2, 'ApplicationRoute#setupController');
|
73954
|
+
}
|
73955
|
+
}));
|
73875
73956
|
|
73876
|
-
|
73877
|
-
|
73878
|
-
|
73879
|
-
|
73880
|
-
|
73957
|
+
this.add('route:turtle', _emberRouting.Route.extend({
|
73958
|
+
model: function () {
|
73959
|
+
step(1, 'TurtleRoute#model');
|
73960
|
+
return turtleDeferred.promise;
|
73961
|
+
}
|
73962
|
+
}));
|
73963
|
+
this.addTemplate('turtle', 'TURTLE');
|
73964
|
+
this.addTemplate('loading', 'LOADING');
|
73881
73965
|
|
73882
|
-
|
73883
|
-
|
73884
|
-
|
73885
|
-
|
73886
|
-
}
|
73887
|
-
});
|
73966
|
+
var promise = this.visit('/turtle').then(function () {
|
73967
|
+
text = _this2.$('#app').text();
|
73968
|
+
assert.equal(text, 'TURTLE', 'turtle template has loaded and replaced the loading template');
|
73969
|
+
});
|
73888
73970
|
|
73889
|
-
|
73971
|
+
var text = this.$('#app').text();
|
73972
|
+
assert.equal(text, 'LOADING', 'The Loading template is nested in application template\'s outlet');
|
73890
73973
|
|
73891
|
-
|
73974
|
+
turtleDeferred.resolve();
|
73975
|
+
return promise;
|
73976
|
+
};
|
73892
73977
|
|
73893
|
-
|
73978
|
+
_class.prototype['@test Slow promises returned from ApplicationRoute#model don\'t enter LoadingRoute'] = function (assert) {
|
73979
|
+
var _this3 = this;
|
73894
73980
|
|
73895
|
-
|
73896
|
-
});
|
73981
|
+
var appDeferred = _emberRuntime.RSVP.defer();
|
73897
73982
|
|
73898
|
-
|
73899
|
-
|
73983
|
+
this.add('route:application', _emberRouting.Route.extend({
|
73984
|
+
model: function () {
|
73985
|
+
return appDeferred.promise;
|
73986
|
+
}
|
73987
|
+
}));
|
73988
|
+
this.add('route:loading', _emberRouting.Route.extend({
|
73989
|
+
setupController: function () {
|
73990
|
+
ok(false, 'shouldn\'t get here');
|
73991
|
+
}
|
73992
|
+
}));
|
73900
73993
|
|
73901
|
-
|
73902
|
-
|
73994
|
+
var promise = this.visit('/').then(function () {
|
73995
|
+
text = _this3.$('#app').text();
|
73903
73996
|
|
73904
|
-
|
73905
|
-
this.route('grandma', function () {
|
73906
|
-
this.route('mom', { resetNamespace: true }, function () {
|
73907
|
-
this.route('sally');
|
73908
|
-
});
|
73997
|
+
assert.equal(text, 'INDEX', 'index template has been rendered');
|
73909
73998
|
});
|
73910
|
-
});
|
73911
73999
|
|
73912
|
-
|
73913
|
-
templates.mom = 'MOM {{outlet}}';
|
73914
|
-
templates['mom/loading'] = 'MOMLOADING';
|
73915
|
-
templates['mom/sally'] = 'SALLY';
|
74000
|
+
var text = this.$('#app').text();
|
73916
74001
|
|
73917
|
-
|
73918
|
-
|
73919
|
-
step(1, 'GrandmaRoute#model');
|
73920
|
-
return grandmaDeferred.promise;
|
73921
|
-
}
|
73922
|
-
});
|
74002
|
+
assert.equal(text, '', 'nothing has been rendered yet');
|
74003
|
+
appDeferred.resolve();
|
73923
74004
|
|
73924
|
-
|
73925
|
-
|
73926
|
-
step(2, 'Mom#model');
|
73927
|
-
return {};
|
73928
|
-
}
|
73929
|
-
});
|
73930
|
-
|
73931
|
-
App.MomSallyRoute = _emberRouting.Route.extend({
|
73932
|
-
model: function () {
|
73933
|
-
step(3, 'SallyRoute#model');
|
73934
|
-
return sallyDeferred.promise;
|
73935
|
-
},
|
73936
|
-
setupController: function () {
|
73937
|
-
step(4, 'SallyRoute#setupController');
|
73938
|
-
}
|
73939
|
-
});
|
73940
|
-
|
73941
|
-
bootApplication('/grandma/mom/sally');
|
73942
|
-
|
73943
|
-
equal((0, _emberViews.jQuery)('#app', '#qunit-fixture').text(), 'LOADING', 'The Loading template is nested in application template\'s outlet');
|
73944
|
-
|
73945
|
-
(0, _emberMetal.run)(grandmaDeferred, 'resolve', {});
|
73946
|
-
equal((0, _emberViews.jQuery)('#app', '#qunit-fixture').text(), 'GRANDMA MOM MOMLOADING', 'Mom\'s child loading route is displayed due to sally\'s slow promise');
|
73947
|
-
|
73948
|
-
(0, _emberMetal.run)(sallyDeferred, 'resolve', {});
|
73949
|
-
equal((0, _emberViews.jQuery)('#app', '#qunit-fixture').text(), 'GRANDMA MOM SALLY', 'Sally template displayed');
|
73950
|
-
});
|
74005
|
+
return promise;
|
74006
|
+
};
|
73951
74007
|
|
73952
|
-
|
73953
|
-
|
74008
|
+
_class.prototype['@test Don\'t enter loading route unless either route or template defined'] = function (assert) {
|
74009
|
+
var _this4 = this;
|
73954
74010
|
|
73955
|
-
|
74011
|
+
var deferred = _emberRuntime.RSVP.defer();
|
73956
74012
|
|
73957
|
-
|
73958
|
-
|
73959
|
-
this.route('mom');
|
74013
|
+
this.router.map(function () {
|
74014
|
+
this.route('dummy');
|
73960
74015
|
});
|
73961
|
-
|
73962
|
-
|
73963
|
-
|
73964
|
-
|
73965
|
-
|
73966
|
-
|
73967
|
-
App.GrandmaMomRoute = _emberRouting.Route.extend({
|
73968
|
-
model: function () {
|
73969
|
-
return momDeferred.promise;
|
73970
|
-
}
|
73971
|
-
});
|
73972
|
-
|
73973
|
-
bootApplication('/grandma/mom');
|
73974
|
-
|
73975
|
-
equal((0, _emberViews.jQuery)('#app', '#qunit-fixture').text(), 'GRANDMA GRANDMALOADING');
|
74016
|
+
this.add('route:dummy', _emberRouting.Route.extend({
|
74017
|
+
model: function () {
|
74018
|
+
return deferred.promise;
|
74019
|
+
}
|
74020
|
+
}));
|
74021
|
+
this.addTemplate('dummy', 'DUMMY');
|
73976
74022
|
|
73977
|
-
|
73978
|
-
|
74023
|
+
return this.visit('/').then(function () {
|
74024
|
+
var promise = _this4.visit('/dummy').then(function () {
|
74025
|
+
var text = _this4.$('#app').text();
|
73979
74026
|
|
73980
|
-
|
73981
|
-
|
73982
|
-
equal(appController.get('currentPath'), 'grandma.mom', 'currentPath reflects final state');
|
73983
|
-
});
|
74027
|
+
assert.equal(text, 'DUMMY', 'dummy template has been rendered');
|
74028
|
+
});
|
73984
74029
|
|
73985
|
-
|
73986
|
-
|
74030
|
+
assert.ok(_this4.currentPath !== 'loading', '\n loading state not entered\n ');
|
74031
|
+
deferred.resolve();
|
73987
74032
|
|
73988
|
-
|
74033
|
+
return promise;
|
74034
|
+
});
|
74035
|
+
};
|
73989
74036
|
|
73990
|
-
|
73991
|
-
|
73992
|
-
return appDeferred.promise;
|
73993
|
-
}
|
73994
|
-
});
|
74037
|
+
_class.prototype['@test Enter loading route only if loadingRoute is defined'] = function (assert) {
|
74038
|
+
var _this5 = this;
|
73995
74039
|
|
73996
|
-
|
73997
|
-
setupController: function () {
|
73998
|
-
ok(false, 'shouldn\'t get here');
|
73999
|
-
}
|
74000
|
-
});
|
74040
|
+
var deferred = _emberRuntime.RSVP.defer();
|
74001
74041
|
|
74002
|
-
|
74042
|
+
this.router.map(function () {
|
74043
|
+
this.route('dummy');
|
74044
|
+
});
|
74003
74045
|
|
74004
|
-
|
74046
|
+
this.add('route:dummy', _emberRouting.Route.extend({
|
74047
|
+
model: function () {
|
74048
|
+
step(1, 'DummyRoute#model');
|
74049
|
+
return deferred.promise;
|
74050
|
+
}
|
74051
|
+
}));
|
74052
|
+
this.add('route:loading', _emberRouting.Route.extend({
|
74053
|
+
setupController: function () {
|
74054
|
+
step(2, 'LoadingRoute#setupController');
|
74055
|
+
}
|
74056
|
+
}));
|
74057
|
+
this.addTemplate('dummy', 'DUMMY');
|
74005
74058
|
|
74006
|
-
|
74007
|
-
|
74008
|
-
|
74059
|
+
return this.visit('/').then(function () {
|
74060
|
+
var promise = _this5.visit('/dummy').then(function () {
|
74061
|
+
var text = _this5.$('#app').text();
|
74009
74062
|
|
74010
|
-
|
74011
|
-
|
74063
|
+
assert.equal(text, 'DUMMY', 'dummy template has been rendered');
|
74064
|
+
});
|
74012
74065
|
|
74013
|
-
|
74066
|
+
assert.equal(_this5.currentPath, 'loading', 'loading state entered');
|
74067
|
+
deferred.resolve();
|
74014
74068
|
|
74015
|
-
|
74069
|
+
return promise;
|
74070
|
+
});
|
74071
|
+
};
|
74016
74072
|
|
74017
|
-
|
74073
|
+
_class.prototype['@test Slow promises returned from ApplicationRoute#model enter ApplicationLoadingRoute if present'] = function (assert) {
|
74074
|
+
var _this6 = this;
|
74018
74075
|
|
74019
|
-
|
74020
|
-
model: function () {
|
74021
|
-
return indexDeferred.promise;
|
74022
|
-
}
|
74023
|
-
});
|
74076
|
+
var appDeferred = _emberRuntime.RSVP.defer();
|
74024
74077
|
|
74025
|
-
|
74078
|
+
this.add('route:application', _emberRouting.Route.extend({
|
74079
|
+
model: function () {
|
74080
|
+
return appDeferred.promise;
|
74081
|
+
}
|
74082
|
+
}));
|
74083
|
+
var loadingRouteEntered = false;
|
74084
|
+
this.add('route:application_loading', _emberRouting.Route.extend({
|
74085
|
+
setupController: function () {
|
74086
|
+
loadingRouteEntered = true;
|
74087
|
+
}
|
74088
|
+
}));
|
74026
74089
|
|
74027
|
-
|
74028
|
-
|
74090
|
+
var promise = this.visit('/').then(function () {
|
74091
|
+
assert.equal(_this6.$('#app').text(), 'INDEX', 'index route loaded');
|
74092
|
+
});
|
74093
|
+
assert.ok(loadingRouteEntered, 'ApplicationLoadingRoute was entered');
|
74094
|
+
appDeferred.resolve();
|
74029
74095
|
|
74030
|
-
|
74031
|
-
|
74032
|
-
});
|
74096
|
+
return promise;
|
74097
|
+
};
|
74033
74098
|
|
74034
|
-
|
74035
|
-
|
74099
|
+
_class.prototype['@test Slow promises returned from ApplicationRoute#model enter application_loading if template present'] = function (assert) {
|
74100
|
+
var _this7 = this;
|
74036
74101
|
|
74037
|
-
|
74102
|
+
var appDeferred = _emberRuntime.RSVP.defer();
|
74038
74103
|
|
74039
|
-
|
74104
|
+
this.addTemplate('application_loading', '\n <div id="toplevel-loading">TOPLEVEL LOADING</div>\n ');
|
74105
|
+
this.add('route:application', _emberRouting.Route.extend({
|
74106
|
+
model: function () {
|
74107
|
+
return appDeferred.promise;
|
74108
|
+
}
|
74109
|
+
}));
|
74040
74110
|
|
74041
|
-
|
74042
|
-
|
74043
|
-
|
74044
|
-
return indexDeferred.promise;
|
74045
|
-
}
|
74046
|
-
});
|
74111
|
+
var promise = this.visit('/').then(function () {
|
74112
|
+
var length = _this7.$('#toplevel-loading').length;
|
74113
|
+
text = _this7.$('#app').text();
|
74047
74114
|
|
74048
|
-
|
74049
|
-
|
74050
|
-
|
74051
|
-
|
74052
|
-
});
|
74115
|
+
assert.equal(length, 0, 'top-level loading view has been entirely removed from the DOM');
|
74116
|
+
assert.equal(text, 'INDEX', 'index has fully rendered');
|
74117
|
+
});
|
74118
|
+
var text = this.$('#toplevel-loading').text();
|
74053
74119
|
|
74054
|
-
|
74120
|
+
assert.equal(text, 'TOPLEVEL LOADING', 'still loading the top level');
|
74121
|
+
appDeferred.resolve();
|
74055
74122
|
|
74056
|
-
|
74057
|
-
|
74123
|
+
return promise;
|
74124
|
+
};
|
74058
74125
|
|
74059
|
-
|
74060
|
-
|
74061
|
-
});
|
74126
|
+
_class.prototype['@test Prioritized substate entry works with preserved-namespace nested routes'] = function (assert) {
|
74127
|
+
var _this8 = this;
|
74062
74128
|
|
74063
|
-
|
74064
|
-
expect(4);
|
74129
|
+
var deferred = _emberRuntime.RSVP.defer();
|
74065
74130
|
|
74066
|
-
|
74131
|
+
this.addTemplate('foo.bar_loading', 'FOOBAR LOADING');
|
74132
|
+
this.addTemplate('foo.bar.index', 'YAY');
|
74067
74133
|
|
74068
|
-
|
74069
|
-
|
74070
|
-
|
74071
|
-
this.route('sally');
|
74134
|
+
this.router.map(function () {
|
74135
|
+
this.route('foo', function () {
|
74136
|
+
this.route('bar', { path: '/bar' }, function () {});
|
74072
74137
|
});
|
74073
|
-
this.route('smells');
|
74074
74138
|
});
|
74075
|
-
});
|
74076
|
-
|
74077
|
-
templates['grandma/loading'] = 'GMONEYLOADING';
|
74078
|
-
|
74079
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
74080
|
-
|
74081
|
-
App.MomSallyRoute = _emberRouting.Route.extend({
|
74082
|
-
setupController: function () {
|
74083
|
-
step(1, 'SallyRoute#setupController');
|
74084
|
-
}
|
74085
|
-
});
|
74086
|
-
|
74087
|
-
App.GrandmaSmellsRoute = _emberRouting.Route.extend({
|
74088
|
-
model: function () {
|
74089
|
-
return deferred.promise;
|
74090
|
-
}
|
74091
|
-
});
|
74092
74139
|
|
74093
|
-
|
74140
|
+
this.add('route:foo.bar', _emberRouting.Route.extend({
|
74141
|
+
model: function () {
|
74142
|
+
return deferred.promise;
|
74143
|
+
}
|
74144
|
+
}));
|
74094
74145
|
|
74095
|
-
|
74096
|
-
|
74146
|
+
return this.visit('/').then(function () {
|
74147
|
+
var promise = _this8.visit('/foo/bar').then(function () {
|
74148
|
+
text = _this8.$('#app').text();
|
74097
74149
|
|
74098
|
-
|
74099
|
-
|
74150
|
+
assert.equal(text, 'YAY', 'foo.bar.index fully loaded');
|
74151
|
+
});
|
74152
|
+
var text = _this8.$('#app').text();
|
74100
74153
|
|
74101
|
-
|
74154
|
+
assert.equal(text, 'FOOBAR LOADING', 'foo.bar_loading was entered (as opposed to something like foo/foo/bar_loading)');
|
74155
|
+
deferred.resolve();
|
74102
74156
|
|
74103
|
-
|
74104
|
-
|
74157
|
+
return promise;
|
74158
|
+
});
|
74159
|
+
};
|
74105
74160
|
|
74106
|
-
|
74107
|
-
|
74161
|
+
_class.prototype['@test Prioritized substate entry works with reset-namespace nested routes'] = function (assert) {
|
74162
|
+
var _this9 = this;
|
74108
74163
|
|
74109
|
-
|
74164
|
+
var deferred = _emberRuntime.RSVP.defer();
|
74110
74165
|
|
74111
|
-
|
74112
|
-
|
74166
|
+
this.addTemplate('bar_loading', 'BAR LOADING');
|
74167
|
+
this.addTemplate('bar.index', 'YAY');
|
74113
74168
|
|
74114
|
-
|
74115
|
-
|
74116
|
-
|
74117
|
-
this.route('sally');
|
74169
|
+
this.router.map(function () {
|
74170
|
+
this.route('foo', function () {
|
74171
|
+
this.route('bar', { path: '/bar', resetNamespace: true }, function () {});
|
74118
74172
|
});
|
74119
|
-
this.route('smells');
|
74120
74173
|
});
|
74121
|
-
});
|
74122
74174
|
|
74123
|
-
|
74124
|
-
|
74125
|
-
|
74126
|
-
actions: {
|
74127
|
-
loading: function () {
|
74128
|
-
ok(true, 'loading action received on ApplicationRoute');
|
74175
|
+
this.add('route:bar', _emberRouting.Route.extend({
|
74176
|
+
model: function () {
|
74177
|
+
return deferred.promise;
|
74129
74178
|
}
|
74130
|
-
}
|
74131
|
-
});
|
74132
|
-
|
74133
|
-
App.MomSallyRoute = _emberRouting.Route.extend({
|
74134
|
-
model: function () {
|
74135
|
-
return sallyDeferred.promise;
|
74136
|
-
}
|
74137
|
-
});
|
74138
|
-
|
74139
|
-
App.GrandmaSmellsRoute = _emberRouting.Route.extend({
|
74140
|
-
model: function () {
|
74141
|
-
return smellsDeferred.promise;
|
74142
|
-
}
|
74143
|
-
});
|
74179
|
+
}));
|
74144
74180
|
|
74145
|
-
|
74181
|
+
return this.visit('/').then(function () {
|
74182
|
+
var promise = _this9.visit('/foo/bar').then(function () {
|
74183
|
+
text = _this9.$('#app').text();
|
74146
74184
|
|
74147
|
-
|
74148
|
-
|
74149
|
-
(0, _emberMetal.run)(sallyDeferred, 'resolve', {});
|
74185
|
+
assert.equal(text, 'YAY', 'bar.index fully loaded');
|
74186
|
+
});
|
74150
74187
|
|
74151
|
-
|
74188
|
+
var text = _this9.$('#app').text();
|
74152
74189
|
|
74153
|
-
|
74154
|
-
|
74190
|
+
assert.equal(text, 'BAR LOADING', 'foo.bar_loading was entered (as opposed to something likefoo/foo/bar_loading)');
|
74191
|
+
deferred.resolve();
|
74155
74192
|
|
74156
|
-
|
74193
|
+
return promise;
|
74194
|
+
});
|
74195
|
+
};
|
74157
74196
|
|
74158
|
-
|
74159
|
-
|
74197
|
+
_class.prototype['@test Prioritized loading substate entry works with preserved-namespace nested routes'] = function (assert) {
|
74198
|
+
var _this10 = this;
|
74160
74199
|
|
74161
|
-
|
74162
|
-
expect(6);
|
74200
|
+
var deferred = _emberRuntime.RSVP.defer();
|
74163
74201
|
|
74164
|
-
|
74165
|
-
|
74202
|
+
this.addTemplate('foo.bar_loading', 'FOOBAR LOADING');
|
74203
|
+
this.addTemplate('foo.bar', 'YAY');
|
74166
74204
|
|
74167
|
-
|
74168
|
-
|
74169
|
-
|
74170
|
-
this.route('sally');
|
74205
|
+
this.router.map(function () {
|
74206
|
+
this.route('foo', function () {
|
74207
|
+
this.route('bar');
|
74171
74208
|
});
|
74172
74209
|
});
|
74173
|
-
});
|
74174
74210
|
|
74175
|
-
|
74176
|
-
|
74177
|
-
|
74178
|
-
model: function () {
|
74179
|
-
step(1, 'MomSallyRoute#model');
|
74180
|
-
|
74181
|
-
return _emberRuntime.RSVP.reject({
|
74182
|
-
msg: 'did it broke?'
|
74183
|
-
});
|
74184
|
-
},
|
74185
|
-
|
74186
|
-
actions: {
|
74187
|
-
error: function () {
|
74188
|
-
step(2, 'MomSallyRoute#actions.error');
|
74189
|
-
return true;
|
74211
|
+
this.add('route:foo.bar', _emberRouting.Route.extend({
|
74212
|
+
model: function () {
|
74213
|
+
return deferred.promise;
|
74190
74214
|
}
|
74191
|
-
}
|
74192
|
-
});
|
74215
|
+
}));
|
74193
74216
|
|
74194
|
-
|
74195
|
-
|
74196
|
-
}, function (err) {
|
74197
|
-
return err.msg === 'did it broke?';
|
74198
|
-
});
|
74217
|
+
var promise = this.visit('/foo/bar').then(function () {
|
74218
|
+
text = _this10.$('#app').text();
|
74199
74219
|
|
74200
|
-
|
74220
|
+
assert.equal(text, 'YAY', 'foo.bar has rendered');
|
74221
|
+
});
|
74222
|
+
var text = this.$('#app').text();
|
74201
74223
|
|
74202
|
-
|
74224
|
+
assert.equal(text, 'FOOBAR LOADING', 'foo.bar_loading was entered (as opposed to something like foo/foo/bar_loading)');
|
74225
|
+
deferred.resolve();
|
74203
74226
|
|
74204
|
-
|
74205
|
-
|
74206
|
-
});
|
74227
|
+
return promise;
|
74228
|
+
};
|
74207
74229
|
|
74208
|
-
|
74209
|
-
|
74230
|
+
_class.prototype['@test Prioritized error substate entry works with preserved-namespaec nested routes'] = function (assert) {
|
74231
|
+
var _this11 = this;
|
74210
74232
|
|
74211
|
-
|
74233
|
+
this.addTemplate('foo.bar_error', 'FOOBAR ERROR: {{model.msg}}');
|
74234
|
+
this.addTemplate('foo.bar', 'YAY');
|
74212
74235
|
|
74213
|
-
|
74214
|
-
|
74215
|
-
|
74216
|
-
this.route('sally');
|
74236
|
+
this.router.map(function () {
|
74237
|
+
this.route('foo', function () {
|
74238
|
+
this.route('bar');
|
74217
74239
|
});
|
74218
74240
|
});
|
74219
|
-
});
|
74220
|
-
|
74221
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
74222
74241
|
|
74223
|
-
|
74224
|
-
|
74225
|
-
|
74226
|
-
|
74227
|
-
|
74228
|
-
msg: 'did it broke?'
|
74229
|
-
});
|
74230
|
-
},
|
74231
|
-
|
74232
|
-
actions: {
|
74233
|
-
error: function (err) {
|
74234
|
-
equal(err.msg, 'did it broke?');
|
74235
|
-
return false;
|
74242
|
+
this.add('route:foo.bar', _emberRouting.Route.extend({
|
74243
|
+
model: function () {
|
74244
|
+
return _emberRuntime.RSVP.reject({
|
74245
|
+
msg: 'did it broke?'
|
74246
|
+
});
|
74236
74247
|
}
|
74237
|
-
}
|
74238
|
-
});
|
74239
|
-
|
74240
|
-
bootApplication('/grandma/mom/sally');
|
74241
|
-
});
|
74242
|
-
|
74243
|
-
QUnit.test('Non-bubbled errors that re-throw aren\'t swallowed', function () {
|
74244
|
-
expect(2);
|
74248
|
+
}));
|
74245
74249
|
|
74246
|
-
|
74250
|
+
return this.visit('/').then(function () {
|
74251
|
+
return _this11.visit('/foo/bar').then(function () {
|
74247
74252
|
|
74248
|
-
|
74249
|
-
|
74250
|
-
this.route('mom', { resetNamespace: true }, function () {
|
74251
|
-
this.route('sally');
|
74253
|
+
var text = _this11.$('#app').text();
|
74254
|
+
assert.equal(text, 'FOOBAR ERROR: did it broke?', 'foo.bar_error was entered (as opposed to something like foo/foo/bar_error)');
|
74252
74255
|
});
|
74253
74256
|
});
|
74254
|
-
}
|
74257
|
+
};
|
74255
74258
|
|
74256
|
-
|
74259
|
+
_class.prototype['@test Prioritized loading substate entry works with auto-generated index routes'] = function (assert) {
|
74260
|
+
var _this12 = this;
|
74257
74261
|
|
74258
|
-
|
74259
|
-
|
74260
|
-
|
74262
|
+
var deferred = _emberRuntime.RSVP.defer();
|
74263
|
+
this.addTemplate('foo.index_loading', 'FOO LOADING');
|
74264
|
+
this.addTemplate('foo.index', 'YAY');
|
74265
|
+
this.addTemplate('foo', '{{outlet}}');
|
74261
74266
|
|
74262
|
-
|
74263
|
-
|
74267
|
+
this.router.map(function () {
|
74268
|
+
this.route('foo', function () {
|
74269
|
+
this.route('bar');
|
74264
74270
|
});
|
74265
|
-
}
|
74271
|
+
});
|
74266
74272
|
|
74267
|
-
|
74268
|
-
|
74269
|
-
|
74270
|
-
throw err;
|
74273
|
+
this.add('route:foo.index', _emberRouting.Route.extend({
|
74274
|
+
model: function () {
|
74275
|
+
return deferred.promise;
|
74271
74276
|
}
|
74272
|
-
}
|
74273
|
-
|
74274
|
-
|
74275
|
-
|
74276
|
-
|
74277
|
-
|
74278
|
-
return err.msg === 'did it broke?';
|
74279
|
-
});
|
74280
|
-
});
|
74281
|
-
|
74282
|
-
QUnit.test('Handled errors that re-throw aren\'t swallowed', function () {
|
74283
|
-
expect(4);
|
74284
|
-
|
74285
|
-
var handledError = void 0;
|
74277
|
+
}));
|
74278
|
+
this.add('route:foo', _emberRouting.Route.extend({
|
74279
|
+
model: function () {
|
74280
|
+
return true;
|
74281
|
+
}
|
74282
|
+
}));
|
74286
74283
|
|
74287
|
-
|
74284
|
+
var promise = this.visit('/foo').then(function () {
|
74285
|
+
text = _this12.$('#app').text();
|
74288
74286
|
|
74289
|
-
|
74290
|
-
this.route('grandma', function () {
|
74291
|
-
this.route('mom', { resetNamespace: true }, function () {
|
74292
|
-
this.route('sally');
|
74293
|
-
this.route('this-route-throws');
|
74294
|
-
});
|
74287
|
+
assert.equal(text, 'YAY', 'foo.index was rendered');
|
74295
74288
|
});
|
74296
|
-
|
74289
|
+
var text = this.$('#app').text();
|
74290
|
+
assert.equal(text, 'FOO LOADING', 'foo.index_loading was entered');
|
74297
74291
|
|
74298
|
-
|
74299
|
-
|
74300
|
-
App.MomSallyRoute = _emberRouting.Route.extend({
|
74301
|
-
model: function () {
|
74302
|
-
step(1, 'MomSallyRoute#model');
|
74292
|
+
deferred.resolve();
|
74303
74293
|
|
74304
|
-
|
74305
|
-
|
74306
|
-
});
|
74307
|
-
},
|
74294
|
+
return promise;
|
74295
|
+
};
|
74308
74296
|
|
74309
|
-
|
74310
|
-
|
74311
|
-
step(2, 'MomSallyRoute#error');
|
74297
|
+
_class.prototype['@test Prioritized error substate entry works with auto-generated index routes'] = function (assert) {
|
74298
|
+
var _this13 = this;
|
74312
74299
|
|
74313
|
-
|
74300
|
+
this.addTemplate('foo.index_error', 'FOO ERROR: {{model.msg}}');
|
74301
|
+
this.addTemplate('foo.index', 'YAY');
|
74302
|
+
this.addTemplate('foo', '{{outlet}}');
|
74314
74303
|
|
74315
|
-
|
74304
|
+
this.router.map(function () {
|
74305
|
+
this.route('foo', function () {
|
74306
|
+
this.route('bar');
|
74307
|
+
});
|
74308
|
+
});
|
74316
74309
|
|
74317
|
-
|
74318
|
-
|
74310
|
+
this.add('route:foo.index', _emberRouting.Route.extend({
|
74311
|
+
model: function () {
|
74312
|
+
return _emberRuntime.RSVP.reject({
|
74313
|
+
msg: 'did it broke?'
|
74314
|
+
});
|
74319
74315
|
}
|
74320
|
-
}
|
74321
|
-
|
74322
|
-
|
74323
|
-
|
74324
|
-
|
74325
|
-
|
74326
|
-
|
74327
|
-
throw handledError;
|
74328
|
-
}
|
74329
|
-
});
|
74330
|
-
|
74331
|
-
throws(function () {
|
74332
|
-
bootApplication('/grandma/mom/sally');
|
74333
|
-
}, function (err) {
|
74334
|
-
return err.msg === 'did it broke?';
|
74335
|
-
});
|
74336
|
-
});
|
74337
|
-
|
74338
|
-
QUnit.test('Handled errors that bubble can be handled at a higher level', function () {
|
74339
|
-
expect(4);
|
74316
|
+
}));
|
74317
|
+
this.add('route:foo', _emberRouting.Route.extend({
|
74318
|
+
model: function () {
|
74319
|
+
return true;
|
74320
|
+
}
|
74321
|
+
}));
|
74340
74322
|
|
74341
|
-
|
74323
|
+
return this.visit('/').then(function () {
|
74342
74324
|
|
74343
|
-
|
74325
|
+
return _this13.visit('/foo').then(function () {
|
74326
|
+
var text = _this13.$('#app').text();
|
74344
74327
|
|
74345
|
-
|
74346
|
-
this.route('grandma', function () {
|
74347
|
-
this.route('mom', { resetNamespace: true }, function () {
|
74348
|
-
this.route('sally');
|
74328
|
+
assert.equal(text, 'FOO ERROR: did it broke?', 'foo.index_error was entered');
|
74349
74329
|
});
|
74350
74330
|
});
|
74351
|
-
}
|
74352
|
-
|
74353
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
74354
|
-
|
74355
|
-
App.MomRoute = _emberRouting.Route.extend({
|
74356
|
-
actions: {
|
74357
|
-
error: function (err) {
|
74358
|
-
step(3, 'MomRoute#error');
|
74331
|
+
};
|
74359
74332
|
|
74360
|
-
|
74361
|
-
|
74333
|
+
(0, _emberBabel.createClass)(_class, [{
|
74334
|
+
key: 'currentPath',
|
74335
|
+
get: function () {
|
74336
|
+
return this.getController('application').get('currentPath');
|
74362
74337
|
}
|
74363
|
-
});
|
74364
|
-
|
74365
|
-
|
74366
|
-
model: function () {
|
74367
|
-
step(1, 'MomSallyRoute#model');
|
74338
|
+
}]);
|
74339
|
+
return _class;
|
74340
|
+
}(_internalTestHelpers.ApplicationTestCase));
|
74368
74341
|
|
74369
|
-
|
74370
|
-
|
74371
|
-
});
|
74372
|
-
},
|
74342
|
+
(0, _internalTestHelpers.moduleFor)('Loading/Error Substates - globals mode app', function (_AutobootApplicationT) {
|
74343
|
+
(0, _emberBabel.inherits)(_class2, _AutobootApplicationT);
|
74373
74344
|
|
74374
|
-
|
74375
|
-
|
74376
|
-
|
74345
|
+
function _class2() {
|
74346
|
+
return (0, _emberBabel.possibleConstructorReturn)(this, _AutobootApplicationT.apply(this, arguments));
|
74347
|
+
}
|
74377
74348
|
|
74378
|
-
|
74349
|
+
_class2.prototype['@test Rejected promises returned from ApplicationRoute transition into top-level application_error'] = function (assert) {
|
74350
|
+
var _this15 = this;
|
74379
74351
|
|
74380
|
-
|
74381
|
-
}
|
74382
|
-
}
|
74383
|
-
});
|
74352
|
+
var reject = true;
|
74384
74353
|
|
74385
|
-
|
74386
|
-
|
74354
|
+
this.runTask(function () {
|
74355
|
+
_this15.createApplication();
|
74356
|
+
_this15.addTemplate('index', '<div id="app">INDEX</div>');
|
74357
|
+
_this15.add('route:application', _emberRouting.Route.extend({
|
74358
|
+
init: function () {
|
74359
|
+
this._super.apply(this, arguments);
|
74360
|
+
},
|
74361
|
+
model: function () {
|
74362
|
+
if (reject) {
|
74363
|
+
return _emberRuntime.RSVP.reject({ msg: 'BAD NEWS BEARS' });
|
74364
|
+
} else {
|
74365
|
+
return {};
|
74366
|
+
}
|
74367
|
+
}
|
74368
|
+
}));
|
74387
74369
|
|
74388
|
-
|
74389
|
-
|
74370
|
+
_this15.addTemplate('application_error', '\n <p id="toplevel-error">TOPLEVEL ERROR: {{model.msg}}</p>\n ');
|
74371
|
+
});
|
74390
74372
|
|
74391
|
-
|
74373
|
+
var text = this.$('#toplevel-error').text();
|
74374
|
+
assert.equal(text, 'TOPLEVEL ERROR: BAD NEWS BEARS', 'toplevel error rendered');
|
74392
74375
|
|
74393
|
-
|
74394
|
-
this.route('grandma', function () {
|
74395
|
-
this.route('mom', { resetNamespace: true }, function () {
|
74396
|
-
this.route('sally');
|
74397
|
-
});
|
74398
|
-
});
|
74399
|
-
});
|
74376
|
+
reject = false;
|
74400
74377
|
|
74401
|
-
|
74378
|
+
return this.visit('/').then(function () {
|
74379
|
+
var text = _this15.$('#app').text();
|
74402
74380
|
|
74403
|
-
|
74404
|
-
|
74405
|
-
|
74381
|
+
assert.equal(text, 'INDEX', 'the index route resolved');
|
74382
|
+
});
|
74383
|
+
};
|
74406
74384
|
|
74407
|
-
|
74408
|
-
|
74409
|
-
});
|
74410
|
-
},
|
74385
|
+
return _class2;
|
74386
|
+
}(_internalTestHelpers.AutobootApplicationTestCase));
|
74411
74387
|
|
74412
|
-
|
74413
|
-
|
74414
|
-
step(2, 'MomSallyRoute#error');
|
74415
|
-
return true;
|
74416
|
-
}
|
74417
|
-
}
|
74418
|
-
});
|
74388
|
+
(0, _internalTestHelpers.moduleFor)('Loading/Error Substates - nested routes', function (_ApplicationTestCase2) {
|
74389
|
+
(0, _emberBabel.inherits)(_class3, _ApplicationTestCase2);
|
74419
74390
|
|
74420
|
-
|
74421
|
-
bootApplication('/grandma/mom/sally');
|
74422
|
-
}, function (err) {
|
74423
|
-
return err.msg === 'did it broke?';
|
74424
|
-
}, 'Correct error was thrown');
|
74425
|
-
});
|
74391
|
+
function _class3() {
|
74426
74392
|
|
74427
|
-
|
74428
|
-
expect(4);
|
74393
|
+
var _this16 = (0, _emberBabel.possibleConstructorReturn)(this, _ApplicationTestCase2.call(this));
|
74429
74394
|
|
74430
|
-
|
74395
|
+
counter = 1;
|
74431
74396
|
|
74432
|
-
|
74397
|
+
_this16.addTemplate('application', '<div id="app">{{outlet}}</div>');
|
74398
|
+
_this16.addTemplate('index', 'INDEX');
|
74399
|
+
_this16.addTemplate('grandma', 'GRANDMA {{outlet}}');
|
74400
|
+
_this16.addTemplate('mom', 'MOM');
|
74433
74401
|
|
74434
|
-
|
74435
|
-
|
74436
|
-
|
74437
|
-
|
74438
|
-
|
74402
|
+
_this16.router.map(function () {
|
74403
|
+
this.route('grandma', function () {
|
74404
|
+
this.route('mom', { resetNamespace: true }, function () {
|
74405
|
+
this.route('sally');
|
74406
|
+
this.route('this-route-throws');
|
74407
|
+
});
|
74408
|
+
this.route('puppies');
|
74439
74409
|
});
|
74410
|
+
this.route('memere', { path: '/memere/:seg' }, function () {});
|
74440
74411
|
});
|
74441
|
-
});
|
74442
|
-
|
74443
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
74444
74412
|
|
74445
|
-
|
74446
|
-
|
74447
|
-
|
74413
|
+
_this16.visit('/');
|
74414
|
+
return _this16;
|
74415
|
+
}
|
74448
74416
|
|
74449
|
-
|
74450
|
-
|
74451
|
-
|
74452
|
-
},
|
74417
|
+
_class3.prototype.getController = function (name) {
|
74418
|
+
return this.applicationInstance.lookup('controller:' + name);
|
74419
|
+
};
|
74453
74420
|
|
74454
|
-
|
74455
|
-
|
74456
|
-
step(2, 'MomSallyRoute#error');
|
74421
|
+
_class3.prototype['@test ApplicationRoute#currentPath reflects loading state path'] = function (assert) {
|
74422
|
+
var _this17 = this;
|
74457
74423
|
|
74458
|
-
|
74424
|
+
var momDeferred = _emberRuntime.RSVP.defer();
|
74459
74425
|
|
74460
|
-
|
74426
|
+
this.addTemplate('grandma.loading', 'GRANDMALOADING');
|
74461
74427
|
|
74462
|
-
|
74463
|
-
|
74428
|
+
this.add('route:mom', _emberRouting.Route.extend({
|
74429
|
+
model: function () {
|
74430
|
+
return momDeferred.promise;
|
74464
74431
|
}
|
74465
|
-
}
|
74466
|
-
});
|
74432
|
+
}));
|
74467
74433
|
|
74468
|
-
|
74469
|
-
|
74470
|
-
step(3, 'MomThisRouteThrows#model');
|
74434
|
+
var promise = this.visit('/grandma/mom').then(function () {
|
74435
|
+
text = _this17.$('#app').text();
|
74471
74436
|
|
74472
|
-
|
74473
|
-
|
74474
|
-
|
74437
|
+
assert.equal(text, 'GRANDMA MOM', 'Grandma.mom loaded text is displayed');
|
74438
|
+
assert.equal(_this17.currentPath, 'grandma.mom.index', 'currentPath reflects final state');
|
74439
|
+
});
|
74440
|
+
var text = this.$('#app').text();
|
74475
74441
|
|
74476
|
-
|
74477
|
-
bootApplication('/grandma/mom/sally');
|
74478
|
-
}, function (err) {
|
74479
|
-
return err.msg === 'did it broke?';
|
74480
|
-
});
|
74481
|
-
});
|
74442
|
+
assert.equal(text, 'GRANDMA GRANDMALOADING', 'Grandma.mom loading text displayed');
|
74482
74443
|
|
74483
|
-
|
74484
|
-
var deferred = _emberRuntime.RSVP.defer();
|
74444
|
+
assert.equal(this.currentPath, 'grandma.loading', 'currentPath reflects loading state');
|
74485
74445
|
|
74486
|
-
|
74487
|
-
this.route('grandma', { path: '/grandma/:seg' }, function () {});
|
74488
|
-
});
|
74446
|
+
momDeferred.resolve();
|
74489
74447
|
|
74490
|
-
|
74448
|
+
return promise;
|
74449
|
+
};
|
74491
74450
|
|
74492
|
-
|
74451
|
+
_class3.prototype['@test Loading actions bubble to root but don\'t enter substates above pivot '] = function (assert) {
|
74452
|
+
var _this18 = this;
|
74493
74453
|
|
74494
|
-
|
74495
|
-
|
74496
|
-
this.transitionTo('grandma', 1);
|
74497
|
-
}
|
74498
|
-
});
|
74454
|
+
var sallyDeferred = _emberRuntime.RSVP.defer();
|
74455
|
+
var puppiesDeferred = _emberRuntime.RSVP.defer();
|
74499
74456
|
|
74500
|
-
|
74501
|
-
|
74502
|
-
|
74503
|
-
|
74504
|
-
|
74457
|
+
this.add('route:application', _emberRouting.Route.extend({
|
74458
|
+
actions: {
|
74459
|
+
loading: function () {
|
74460
|
+
assert.ok(true, 'loading action received on ApplicationRoute');
|
74461
|
+
}
|
74462
|
+
}
|
74463
|
+
}));
|
74505
74464
|
|
74506
|
-
|
74507
|
-
|
74508
|
-
|
74509
|
-
|
74510
|
-
|
74465
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74466
|
+
model: function () {
|
74467
|
+
return sallyDeferred.promise;
|
74468
|
+
}
|
74469
|
+
}));
|
74511
74470
|
|
74512
|
-
|
74471
|
+
this.add('route:grandma.puppies', _emberRouting.Route.extend({
|
74472
|
+
model: function () {
|
74473
|
+
return puppiesDeferred.promise;
|
74474
|
+
}
|
74475
|
+
}));
|
74513
74476
|
|
74514
|
-
|
74515
|
-
|
74477
|
+
var promise = this.visit('/grandma/mom/sally');
|
74478
|
+
assert.equal(this.currentPath, 'index', 'Initial route fully loaded');
|
74516
74479
|
|
74517
|
-
|
74480
|
+
sallyDeferred.resolve();
|
74518
74481
|
|
74519
|
-
|
74520
|
-
|
74521
|
-
});
|
74482
|
+
promise.then(function () {
|
74483
|
+
assert.equal(_this18.currentPath, 'grandma.mom.sally', 'transition completed');
|
74522
74484
|
|
74523
|
-
|
74524
|
-
|
74485
|
+
var visit = _this18.visit('/grandma/puppies');
|
74486
|
+
assert.equal(_this18.currentPath, 'grandma.mom.sally', 'still in initial state because the only loading state is above the pivot route');
|
74525
74487
|
|
74526
|
-
|
74488
|
+
return visit;
|
74489
|
+
}).then(function () {
|
74490
|
+
_this18.runTask(function () {
|
74491
|
+
return puppiesDeferred.resolve();
|
74492
|
+
});
|
74527
74493
|
|
74528
|
-
|
74529
|
-
|
74494
|
+
assert.equal(_this18.currentPath, 'grandma.puppies', 'Finished transition');
|
74495
|
+
});
|
74530
74496
|
|
74531
|
-
|
74532
|
-
|
74497
|
+
return promise;
|
74498
|
+
};
|
74533
74499
|
|
74534
|
-
|
74500
|
+
_class3.prototype['@test Default error event moves into nested route'] = function (assert) {
|
74501
|
+
var _this19 = this;
|
74535
74502
|
|
74536
|
-
|
74537
|
-
model: function () {
|
74538
|
-
return appDeferred.promise;
|
74539
|
-
}
|
74540
|
-
});
|
74503
|
+
this.addTemplate('grandma.error', 'ERROR: {{model.msg}}');
|
74541
74504
|
|
74542
|
-
|
74543
|
-
|
74544
|
-
|
74545
|
-
|
74546
|
-
|
74547
|
-
|
74505
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74506
|
+
model: function () {
|
74507
|
+
step(1, 'MomSallyRoute#model');
|
74508
|
+
return _emberRuntime.RSVP.reject({
|
74509
|
+
msg: 'did it broke?'
|
74510
|
+
});
|
74511
|
+
},
|
74548
74512
|
|
74549
|
-
|
74513
|
+
actions: {
|
74514
|
+
error: function () {
|
74515
|
+
step(2, 'MomSallyRoute#actions.error');
|
74516
|
+
return true;
|
74517
|
+
}
|
74518
|
+
}
|
74519
|
+
}));
|
74550
74520
|
|
74551
|
-
|
74521
|
+
return this.visit('/grandma/mom/sally').then(function () {
|
74522
|
+
step(3, 'App finished loading');
|
74552
74523
|
|
74553
|
-
|
74554
|
-
equal((0, _emberViews.jQuery)('#app', '#qunit-fixture').text(), 'INDEX');
|
74555
|
-
});
|
74524
|
+
var text = _this19.$('#app').text();
|
74556
74525
|
|
74557
|
-
|
74558
|
-
|
74526
|
+
assert.equal(text, 'GRANDMA ERROR: did it broke?', 'error bubbles');
|
74527
|
+
assert.equal(_this19.currentPath, 'grandma.error', 'Initial route fully loaded');
|
74528
|
+
});
|
74529
|
+
};
|
74559
74530
|
|
74560
|
-
|
74531
|
+
_class3.prototype['@test Non-bubbled errors that re-throw aren\'t swallowed'] = function (assert) {
|
74532
|
+
var _this20 = this;
|
74561
74533
|
|
74562
|
-
|
74563
|
-
|
74564
|
-
|
74565
|
-
|
74566
|
-
|
74567
|
-
|
74534
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74535
|
+
model: function () {
|
74536
|
+
return _emberRuntime.RSVP.reject({
|
74537
|
+
msg: 'did it broke?'
|
74538
|
+
});
|
74539
|
+
},
|
74568
74540
|
|
74569
|
-
|
74541
|
+
actions: {
|
74542
|
+
error: function (err) {
|
74543
|
+
// returns undefined which is falsey
|
74544
|
+
throw err;
|
74545
|
+
}
|
74546
|
+
}
|
74547
|
+
}));
|
74570
74548
|
|
74571
|
-
|
74549
|
+
assert.throws(function () {
|
74550
|
+
_this20.visit('/grandma/mom/sally');
|
74551
|
+
}, function (err) {
|
74552
|
+
return err.msg === 'did it broke?';
|
74553
|
+
}, 'it broke');
|
74554
|
+
};
|
74572
74555
|
|
74573
|
-
|
74556
|
+
_class3.prototype['@test Handled errors that re-throw aren\'t swallowed'] = function (assert) {
|
74557
|
+
var _this21 = this;
|
74574
74558
|
|
74575
|
-
|
74576
|
-
equal((0, _emberViews.jQuery)('#app', '#qunit-fixture').text(), 'INDEX');
|
74577
|
-
});
|
74559
|
+
var handledError = void 0;
|
74578
74560
|
|
74579
|
-
|
74580
|
-
|
74561
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74562
|
+
model: function () {
|
74563
|
+
step(1, 'MomSallyRoute#model');
|
74564
|
+
return _emberRuntime.RSVP.reject({
|
74565
|
+
msg: 'did it broke?'
|
74566
|
+
});
|
74567
|
+
},
|
74581
74568
|
|
74582
|
-
|
74583
|
-
|
74584
|
-
|
74569
|
+
actions: {
|
74570
|
+
error: function (err) {
|
74571
|
+
step(2, 'MomSallyRoute#actions.error');
|
74572
|
+
handledError = err;
|
74573
|
+
this.transitionTo('mom.this-route-throws');
|
74585
74574
|
|
74586
|
-
|
74587
|
-
|
74588
|
-
|
74589
|
-
|
74590
|
-
});
|
74591
|
-
});
|
74592
|
-
});
|
74575
|
+
return false;
|
74576
|
+
}
|
74577
|
+
}
|
74578
|
+
}));
|
74593
74579
|
|
74594
|
-
|
74580
|
+
this.add('route:mom.this-route-throws', _emberRouting.Route.extend({
|
74581
|
+
model: function () {
|
74582
|
+
step(3, 'MomThisRouteThrows#model');
|
74583
|
+
throw handledError;
|
74584
|
+
}
|
74585
|
+
}));
|
74595
74586
|
|
74596
|
-
|
74597
|
-
|
74598
|
-
|
74587
|
+
assert.throws(function () {
|
74588
|
+
_this21.visit('/grandma/mom/sally');
|
74589
|
+
}, function (err) {
|
74590
|
+
return err.msg === 'did it broke?';
|
74591
|
+
}, 'it broke');
|
74592
|
+
};
|
74599
74593
|
|
74600
|
-
|
74601
|
-
|
74602
|
-
});
|
74603
|
-
},
|
74594
|
+
_class3.prototype['@test errors that are bubbled are thrown at a higher level if not handled'] = function (assert) {
|
74595
|
+
var _this22 = this;
|
74604
74596
|
|
74605
|
-
|
74606
|
-
|
74607
|
-
step(
|
74608
|
-
return
|
74609
|
-
|
74610
|
-
|
74611
|
-
|
74597
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74598
|
+
model: function () {
|
74599
|
+
step(1, 'MomSallyRoute#model');
|
74600
|
+
return _emberRuntime.RSVP.reject({
|
74601
|
+
msg: 'did it broke?'
|
74602
|
+
});
|
74603
|
+
},
|
74612
74604
|
|
74613
|
-
|
74614
|
-
|
74615
|
-
|
74616
|
-
|
74617
|
-
|
74605
|
+
actions: {
|
74606
|
+
error: function () {
|
74607
|
+
step(2, 'MomSallyRoute#actions.error');
|
74608
|
+
return true;
|
74609
|
+
}
|
74610
|
+
}
|
74611
|
+
}));
|
74618
74612
|
|
74619
|
-
|
74613
|
+
assert.throws(function () {
|
74614
|
+
_this22.visit('/grandma/mom/sally');
|
74615
|
+
}, function (err) {
|
74616
|
+
return err.msg == "did it broke?";
|
74617
|
+
}, 'Correct error was thrown');
|
74618
|
+
};
|
74620
74619
|
|
74621
|
-
|
74620
|
+
_class3.prototype['@test Handled errors that are thrown through rejection aren\'t swallowed'] = function (assert) {
|
74621
|
+
var _this23 = this;
|
74622
74622
|
|
74623
|
-
|
74624
|
-
equal(appController.get('currentPath'), 'grandma.mom_error', 'Initial route fully loaded');
|
74625
|
-
});
|
74623
|
+
var handledError = void 0;
|
74626
74624
|
|
74627
|
-
|
74628
|
-
|
74625
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74626
|
+
model: function () {
|
74627
|
+
step(1, 'MomSallyRoute#model');
|
74628
|
+
return _emberRuntime.RSVP.reject({
|
74629
|
+
msg: 'did it broke?'
|
74630
|
+
});
|
74631
|
+
},
|
74629
74632
|
|
74630
|
-
|
74631
|
-
|
74633
|
+
actions: {
|
74634
|
+
error: function (err) {
|
74635
|
+
step(2, 'MomSallyRoute#actions.error');
|
74636
|
+
handledError = err;
|
74637
|
+
this.transitionTo('mom.this-route-throws');
|
74632
74638
|
|
74633
|
-
|
74634
|
-
|
74635
|
-
|
74636
|
-
});
|
74637
|
-
});
|
74639
|
+
return false;
|
74640
|
+
}
|
74641
|
+
}
|
74642
|
+
}));
|
74638
74643
|
|
74639
|
-
|
74644
|
+
this.add('route:mom.this-route-throws', _emberRouting.Route.extend({
|
74645
|
+
model: function () {
|
74646
|
+
step(3, 'MomThisRouteThrows#model');
|
74647
|
+
return _emberRuntime.RSVP.reject(handledError);
|
74648
|
+
}
|
74649
|
+
}));
|
74640
74650
|
|
74641
|
-
|
74642
|
-
|
74643
|
-
|
74644
|
-
return
|
74645
|
-
}
|
74646
|
-
}
|
74651
|
+
assert.throws(function () {
|
74652
|
+
_this23.visit('/grandma/mom/sally');
|
74653
|
+
}, function (err) {
|
74654
|
+
return err.msg === 'did it broke?';
|
74655
|
+
}, 'it broke');
|
74656
|
+
};
|
74647
74657
|
|
74648
|
-
|
74658
|
+
_class3.prototype['@test Default error events move into nested route, prioritizing more specifically named error routes - NEW'] = function (assert) {
|
74659
|
+
var _this24 = this;
|
74649
74660
|
|
74650
|
-
|
74661
|
+
this.addTemplate('grandma.error', 'ERROR: {{model.msg}}');
|
74662
|
+
this.addTemplate('mom_error', 'MOM ERROR: {{model.msg}}');
|
74651
74663
|
|
74652
|
-
|
74664
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74665
|
+
model: function () {
|
74666
|
+
step(1, 'MomSallyRoute#model');
|
74667
|
+
return _emberRuntime.RSVP.reject({
|
74668
|
+
msg: 'did it broke?'
|
74669
|
+
});
|
74670
|
+
},
|
74653
74671
|
|
74654
|
-
|
74655
|
-
|
74672
|
+
actions: {
|
74673
|
+
error: function () {
|
74674
|
+
step(2, 'MomSallyRoute#actions.error');
|
74675
|
+
return true;
|
74676
|
+
}
|
74677
|
+
}
|
74678
|
+
}));
|
74656
74679
|
|
74657
|
-
|
74658
|
-
|
74680
|
+
return this.visit('/grandma/mom/sally').then(function () {
|
74681
|
+
step(3, 'Application finished booting');
|
74659
74682
|
|
74660
|
-
|
74661
|
-
templates['bar/index'] = 'YAY';
|
74683
|
+
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');
|
74662
74684
|
|
74663
|
-
|
74664
|
-
this.route('foo', function () {
|
74665
|
-
this.route('bar', { path: '/bar', resetNamespace: true }, function () {});
|
74685
|
+
assert.equal(_this24.currentPath, 'grandma.mom_error', 'Initial route fully loaded');
|
74666
74686
|
});
|
74667
|
-
}
|
74668
|
-
|
74669
|
-
App.ApplicationController = _emberRuntime.Controller.extend();
|
74687
|
+
};
|
74670
74688
|
|
74671
|
-
|
74672
|
-
|
74673
|
-
model: function () {
|
74674
|
-
return deferred.promise;
|
74675
|
-
}
|
74676
|
-
});
|
74689
|
+
_class3.prototype['@test Slow promises waterfall on startup'] = function (assert) {
|
74690
|
+
var _this25 = this;
|
74677
74691
|
|
74678
|
-
|
74692
|
+
var grandmaDeferred = _emberRuntime.RSVP.defer();
|
74693
|
+
var sallyDeferred = _emberRuntime.RSVP.defer();
|
74679
74694
|
|
74680
|
-
|
74695
|
+
this.addTemplate('loading', 'LOADING');
|
74696
|
+
this.addTemplate('mom', 'MOM {{outlet}}');
|
74697
|
+
this.addTemplate('mom.loading', 'MOMLOADING');
|
74698
|
+
this.addTemplate('mom.sally', 'SALLY');
|
74681
74699
|
|
74682
|
-
|
74700
|
+
this.add('route:grandma', _emberRouting.Route.extend({
|
74701
|
+
model: function () {
|
74702
|
+
step(1, 'GrandmaRoute#model');
|
74703
|
+
return grandmaDeferred.promise;
|
74704
|
+
}
|
74705
|
+
}));
|
74683
74706
|
|
74684
|
-
|
74685
|
-
|
74707
|
+
this.add('route:mom', _emberRouting.Route.extend({
|
74708
|
+
model: function () {
|
74709
|
+
step(2, 'MomRoute#model');
|
74710
|
+
return {};
|
74711
|
+
}
|
74712
|
+
}));
|
74686
74713
|
|
74687
|
-
|
74688
|
-
|
74714
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74715
|
+
model: function () {
|
74716
|
+
step(3, 'SallyRoute#model');
|
74717
|
+
return sallyDeferred.promise;
|
74718
|
+
},
|
74719
|
+
setupController: function () {
|
74720
|
+
step(4, 'SallyRoute#setupController');
|
74721
|
+
}
|
74722
|
+
}));
|
74689
74723
|
|
74690
|
-
|
74691
|
-
|
74724
|
+
var promise = this.visit('/grandma/mom/sally').then(function () {
|
74725
|
+
text = _this25.$('#app').text();
|
74692
74726
|
|
74693
|
-
|
74694
|
-
this.route('foo', function () {
|
74695
|
-
this.route('bar');
|
74727
|
+
assert.equal(text, 'GRANDMA MOM SALLY', 'Sally template displayed');
|
74696
74728
|
});
|
74697
|
-
|
74729
|
+
var text = this.$('#app').text();
|
74698
74730
|
|
74699
|
-
|
74731
|
+
assert.equal(text, 'LOADING', 'The loading template is nested in application template\'s outlet');
|
74700
74732
|
|
74701
|
-
|
74702
|
-
|
74703
|
-
|
74704
|
-
|
74705
|
-
}
|
74706
|
-
});
|
74733
|
+
this.runTask(function () {
|
74734
|
+
return grandmaDeferred.resolve();
|
74735
|
+
});
|
74736
|
+
text = this.$('#app').text();
|
74707
74737
|
|
74708
|
-
|
74738
|
+
assert.equal(text, 'GRANDMA MOM MOMLOADING', 'Mom\'s child loading route is displayed due to sally\'s slow promise');
|
74709
74739
|
|
74710
|
-
|
74740
|
+
sallyDeferred.resolve();
|
74711
74741
|
|
74712
|
-
|
74742
|
+
return promise;
|
74743
|
+
};
|
74713
74744
|
|
74714
|
-
|
74715
|
-
|
74745
|
+
_class3.prototype['@test Enter child loading state of pivot route'] = function (assert) {
|
74746
|
+
var _this26 = this;
|
74716
74747
|
|
74717
|
-
|
74718
|
-
|
74748
|
+
var deferred = _emberRuntime.RSVP.defer();
|
74749
|
+
this.addTemplate('grandma.loading', 'GMONEYLOADING');
|
74719
74750
|
|
74720
|
-
|
74721
|
-
|
74751
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74752
|
+
setupController: function () {
|
74753
|
+
step(1, 'SallyRoute#setupController');
|
74754
|
+
}
|
74755
|
+
}));
|
74722
74756
|
|
74723
|
-
|
74724
|
-
|
74725
|
-
|
74726
|
-
|
74727
|
-
|
74757
|
+
this.add('route:grandma.puppies', _emberRouting.Route.extend({
|
74758
|
+
model: function () {
|
74759
|
+
return deferred.promise;
|
74760
|
+
}
|
74761
|
+
}));
|
74728
74762
|
|
74729
|
-
|
74763
|
+
return this.visit('/grandma/mom/sally').then(function () {
|
74764
|
+
assert.equal(_this26.currentPath, 'grandma.mom.sally', 'Initial route fully loaded');
|
74730
74765
|
|
74731
|
-
|
74732
|
-
|
74733
|
-
return _emberRuntime.RSVP.reject({
|
74734
|
-
msg: 'did it broke?'
|
74766
|
+
var promise = _this26.visit('/grandma/puppies').then(function () {
|
74767
|
+
assert.equal(_this26.currentPath, 'grandma.puppies', 'Finished transition');
|
74735
74768
|
});
|
74736
|
-
}
|
74737
|
-
});
|
74738
74769
|
|
74739
|
-
|
74740
|
-
|
74741
|
-
}, function (err) {
|
74742
|
-
return err.msg === 'did it broke?';
|
74743
|
-
});
|
74770
|
+
assert.equal(_this26.currentPath, 'grandma.loading', 'in pivot route\'s child loading state');
|
74771
|
+
deferred.resolve();
|
74744
74772
|
|
74745
|
-
|
74746
|
-
});
|
74747
|
-
|
74748
|
-
QUnit.test('Prioritized loading substate entry works with auto-generated index routes', function () {
|
74749
|
-
expect(2);
|
74750
|
-
|
74751
|
-
templates['foo/index_loading'] = 'FOO LOADING';
|
74752
|
-
templates['foo/index'] = 'YAY';
|
74753
|
-
templates['foo'] = '{{outlet}}';
|
74754
|
-
|
74755
|
-
Router.map(function () {
|
74756
|
-
this.route('foo', function () {
|
74757
|
-
this.route('bar');
|
74773
|
+
return promise;
|
74758
74774
|
});
|
74759
|
-
}
|
74775
|
+
};
|
74760
74776
|
|
74761
|
-
|
74777
|
+
_class3.prototype['@test Error events that aren\'t bubbled don\'t throw application assertions'] = function (assert) {
|
74778
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74779
|
+
model: function () {
|
74780
|
+
step(1, 'MomSallyRoute#model');
|
74781
|
+
return _emberRuntime.RSVP.reject({
|
74782
|
+
msg: 'did it broke?'
|
74783
|
+
});
|
74784
|
+
},
|
74762
74785
|
|
74763
|
-
|
74764
|
-
|
74765
|
-
|
74766
|
-
|
74767
|
-
|
74768
|
-
|
74769
|
-
|
74770
|
-
|
74771
|
-
return true;
|
74772
|
-
}
|
74773
|
-
});
|
74786
|
+
actions: {
|
74787
|
+
error: function (err) {
|
74788
|
+
step(2, 'MomSallyRoute#actions.error');
|
74789
|
+
assert.equal(err.msg, 'did it broke?', 'it didn\'t break');
|
74790
|
+
return false;
|
74791
|
+
}
|
74792
|
+
}
|
74793
|
+
}));
|
74774
74794
|
|
74775
|
-
|
74795
|
+
return this.visit('/grandma/mom/sally');
|
74796
|
+
};
|
74776
74797
|
|
74777
|
-
|
74798
|
+
_class3.prototype['@test Handled errors that bubble can be handled at a higher level'] = function (assert) {
|
74799
|
+
var handledError = void 0;
|
74778
74800
|
|
74779
|
-
|
74801
|
+
this.add('route:mom', _emberRouting.Route.extend({
|
74802
|
+
actions: {
|
74803
|
+
error: function (err) {
|
74804
|
+
step(3, 'MomRoute#actions.error');
|
74805
|
+
assert.equal(err, handledError, 'error handled and rebubbled is handleable at higher route');
|
74806
|
+
}
|
74807
|
+
}
|
74808
|
+
}));
|
74780
74809
|
|
74781
|
-
|
74782
|
-
|
74810
|
+
this.add('route:mom.sally', _emberRouting.Route.extend({
|
74811
|
+
model: function () {
|
74812
|
+
step(1, 'MomSallyRoute#model');
|
74813
|
+
return _emberRuntime.RSVP.reject({
|
74814
|
+
msg: 'did it broke?'
|
74815
|
+
});
|
74816
|
+
},
|
74783
74817
|
|
74784
|
-
|
74785
|
-
|
74818
|
+
actions: {
|
74819
|
+
error: function (err) {
|
74820
|
+
step(2, 'MomSallyRoute#actions.error');
|
74821
|
+
handledError = err;
|
74786
74822
|
|
74787
|
-
|
74788
|
-
|
74789
|
-
|
74823
|
+
return true;
|
74824
|
+
}
|
74825
|
+
}
|
74826
|
+
}));
|
74790
74827
|
|
74791
|
-
|
74792
|
-
|
74793
|
-
this.route('bar');
|
74794
|
-
});
|
74795
|
-
});
|
74828
|
+
return this.visit('/grandma/mom/sally');
|
74829
|
+
};
|
74796
74830
|
|
74797
|
-
|
74831
|
+
_class3.prototype['@test Setting a query param during a slow transition should work'] = function (assert) {
|
74832
|
+
var _this27 = this;
|
74798
74833
|
|
74799
|
-
|
74800
|
-
|
74801
|
-
return _emberRuntime.RSVP.reject({
|
74802
|
-
msg: 'did it broke?'
|
74803
|
-
});
|
74804
|
-
}
|
74805
|
-
});
|
74806
|
-
App.FooRoute = _emberRouting.Route.extend({
|
74807
|
-
model: function () {
|
74808
|
-
return true;
|
74809
|
-
}
|
74810
|
-
});
|
74834
|
+
var deferred = _emberRuntime.RSVP.defer();
|
74835
|
+
this.addTemplate('memere.loading', 'MMONEYLOADING');
|
74811
74836
|
|
74812
|
-
|
74813
|
-
|
74814
|
-
|
74815
|
-
|
74816
|
-
|
74837
|
+
this.add('route:grandma', _emberRouting.Route.extend({
|
74838
|
+
beforeModel: function () {
|
74839
|
+
this.transitionTo('memere', 1);
|
74840
|
+
}
|
74841
|
+
}));
|
74817
74842
|
|
74818
|
-
|
74819
|
-
|
74843
|
+
this.add('route:memere', _emberRouting.Route.extend({
|
74844
|
+
queryParams: {
|
74845
|
+
test: { defaultValue: 1 }
|
74846
|
+
}
|
74847
|
+
}));
|
74820
74848
|
|
74821
|
-
|
74822
|
-
|
74849
|
+
this.add('route:memere.index', _emberRouting.Route.extend({
|
74850
|
+
model: function () {
|
74851
|
+
return deferred.promise;
|
74852
|
+
}
|
74853
|
+
}));
|
74823
74854
|
|
74824
|
-
|
74855
|
+
var promise = this.visit('/grandma').then(function () {
|
74856
|
+
assert.equal(_this27.currentPath, 'memere.index', 'Transition should be complete');
|
74857
|
+
});
|
74858
|
+
var memereController = this.getController('memere');
|
74825
74859
|
|
74826
|
-
|
74827
|
-
App.ApplicationRoute = _emberRouting.Route.extend({
|
74828
|
-
model: function () {
|
74829
|
-
if (reject) {
|
74830
|
-
return _emberRuntime.RSVP.reject({ msg: 'BAD NEWS BEARS' });
|
74831
|
-
} else {
|
74832
|
-
return {};
|
74833
|
-
}
|
74834
|
-
}
|
74835
|
-
});
|
74860
|
+
assert.equal(this.currentPath, 'memere.loading', 'Initial route should be loading');
|
74836
74861
|
|
74837
|
-
|
74838
|
-
return bootApplication();
|
74839
|
-
}, function (err) {
|
74840
|
-
return err.msg === 'BAD NEWS BEARS';
|
74841
|
-
});
|
74862
|
+
memereController.set('test', 3);
|
74842
74863
|
|
74843
|
-
|
74864
|
+
assert.equal(this.currentPath, 'memere.loading', 'Initial route should still be loading');
|
74844
74865
|
|
74845
|
-
|
74846
|
-
|
74866
|
+
assert.equal(memereController.get('test'), 3, 'Controller query param value should have changed');
|
74867
|
+
deferred.resolve();
|
74847
74868
|
|
74848
|
-
|
74849
|
-
|
74869
|
+
return promise;
|
74870
|
+
};
|
74871
|
+
|
74872
|
+
(0, _emberBabel.createClass)(_class3, [{
|
74873
|
+
key: 'currentPath',
|
74874
|
+
get: function () {
|
74875
|
+
return this.getController('application').get('currentPath');
|
74876
|
+
}
|
74877
|
+
}]);
|
74878
|
+
return _class3;
|
74879
|
+
}(_internalTestHelpers.ApplicationTestCase));
|
74850
74880
|
});
|
74851
74881
|
enifed('ember/tests/routing/toplevel_dom_test', ['ember-babel', 'internal-test-helpers'], function (_emberBabel, _internalTestHelpers) {
|
74852
74882
|
'use strict';
|