ember-source 1.11.0.beta.1 → 1.11.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ember-source might be problematic. Click here for more details.

@@ -5,7 +5,7 @@
5
5
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
6
6
  * @license Licensed under MIT license
7
7
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
8
- * @version 1.11.0-beta.1
8
+ * @version 1.11.0-beta.2
9
9
  */
10
10
 
11
11
  (function() {
@@ -2702,51 +2702,65 @@ enifed("dom-helper",
2702
2702
  };
2703
2703
 
2704
2704
  prototype.createMorph = function(parent, start, end, contextualElement){
2705
+ if (contextualElement && contextualElement.nodeType === 11) {
2706
+ throw new Error("Cannot pass a fragment as the contextual element to createMorph");
2707
+ }
2708
+
2705
2709
  if (!contextualElement && parent.nodeType === 1) {
2706
2710
  contextualElement = parent;
2707
2711
  }
2708
- return new Morph(parent, start, end, this, contextualElement);
2712
+ var morph = new Morph(this, contextualElement);
2713
+ morph.firstNode = start;
2714
+ morph.lastNode = end;
2715
+ morph.state = {};
2716
+ morph.isDirty = true;
2717
+ return morph;
2709
2718
  };
2710
2719
 
2711
2720
  prototype.createUnsafeMorph = function(parent, start, end, contextualElement){
2712
2721
  var morph = this.createMorph(parent, start, end, contextualElement);
2713
- morph.escaped = false;
2722
+ morph.parseTextAsHTML = true;
2714
2723
  return morph;
2715
2724
  };
2716
2725
 
2717
2726
  // This helper is just to keep the templates good looking,
2718
2727
  // passing integers instead of element references.
2719
2728
  prototype.createMorphAt = function(parent, startIndex, endIndex, contextualElement){
2720
- var start = startIndex === -1 ? null : this.childAtIndex(parent, startIndex),
2721
- end = endIndex === -1 ? null : this.childAtIndex(parent, endIndex);
2729
+ var single = startIndex === endIndex;
2730
+ var start = this.childAtIndex(parent, startIndex);
2731
+ var end = single ? start : this.childAtIndex(parent, endIndex);
2722
2732
  return this.createMorph(parent, start, end, contextualElement);
2723
2733
  };
2724
2734
 
2725
2735
  prototype.createUnsafeMorphAt = function(parent, startIndex, endIndex, contextualElement) {
2726
2736
  var morph = this.createMorphAt(parent, startIndex, endIndex, contextualElement);
2727
- morph.escaped = false;
2737
+ morph.parseTextAsHTML = true;
2728
2738
  return morph;
2729
2739
  };
2730
2740
 
2731
2741
  prototype.insertMorphBefore = function(element, referenceChild, contextualElement) {
2732
- var start = this.document.createTextNode('');
2733
- var end = this.document.createTextNode('');
2734
- element.insertBefore(start, referenceChild);
2735
- element.insertBefore(end, referenceChild);
2736
- return this.createMorph(element, start, end, contextualElement);
2742
+ var insertion = this.document.createComment('');
2743
+ element.insertBefore(insertion, referenceChild);
2744
+ return this.createMorph(element, insertion, insertion, contextualElement);
2737
2745
  };
2738
2746
 
2739
2747
  prototype.appendMorph = function(element, contextualElement) {
2740
- var start = this.document.createTextNode('');
2741
- var end = this.document.createTextNode('');
2742
- element.appendChild(start);
2743
- element.appendChild(end);
2744
- return this.createMorph(element, start, end, contextualElement);
2748
+ var insertion = this.document.createComment('');
2749
+ element.appendChild(insertion);
2750
+ return this.createMorph(element, insertion, insertion, contextualElement);
2751
+ };
2752
+
2753
+ prototype.insertBoundary = function(fragment, index) {
2754
+ // this will always be null or firstChild
2755
+ var child = index === null ? null : this.childAtIndex(fragment, index);
2756
+ this.insertBefore(fragment, this.createTextNode(''), child);
2745
2757
  };
2746
2758
 
2747
2759
  prototype.parseHTML = function(html, contextualElement) {
2760
+ var childNodes;
2761
+
2748
2762
  if (interiorNamespace(contextualElement) === svgNamespace) {
2749
- return buildSVGDOM(html, this);
2763
+ childNodes = buildSVGDOM(html, this);
2750
2764
  } else {
2751
2765
  var nodes = buildHTMLDOM(html, contextualElement, this);
2752
2766
  if (detectOmittedStartTag(html, contextualElement)) {
@@ -2754,11 +2768,33 @@ enifed("dom-helper",
2754
2768
  while (node && node.nodeType !== 1) {
2755
2769
  node = node.nextSibling;
2756
2770
  }
2757
- return node.childNodes;
2771
+ childNodes = node.childNodes;
2758
2772
  } else {
2759
- return nodes;
2773
+ childNodes = nodes;
2760
2774
  }
2761
2775
  }
2776
+
2777
+ // Copy node list to a fragment.
2778
+ var fragment = this.document.createDocumentFragment();
2779
+
2780
+ if (childNodes && childNodes.length > 0) {
2781
+ var currentNode = childNodes[0];
2782
+
2783
+ // We prepend an <option> to <select> boxes to absorb any browser bugs
2784
+ // related to auto-select behavior. Skip past it.
2785
+ if (contextualElement.tagName === 'SELECT') {
2786
+ currentNode = currentNode.nextSibling;
2787
+ }
2788
+
2789
+ while (currentNode) {
2790
+ var tempNode = currentNode;
2791
+ currentNode = currentNode.nextSibling;
2792
+
2793
+ fragment.appendChild(tempNode);
2794
+ }
2795
+ }
2796
+
2797
+ return fragment;
2762
2798
  };
2763
2799
 
2764
2800
  var parsingNode;
@@ -2817,33 +2853,6 @@ enifed("dom-helper/build-html-dom",
2817
2853
  testEl.childNodes[2].nodeValue === ' Value';
2818
2854
  })(doc);
2819
2855
 
2820
- // IE8 create a selected attribute where they should only
2821
- // create a property
2822
- var createsSelectedAttribute = doc && (function(document) {
2823
- var testEl = document.createElement('div');
2824
- testEl.innerHTML = "<select><option></option></select>";
2825
- return testEl.childNodes[0].childNodes[0].getAttribute('selected') === 'selected';
2826
- })(doc);
2827
-
2828
- var detectAutoSelectedOption;
2829
- if (createsSelectedAttribute) {
2830
- detectAutoSelectedOption = (function(){
2831
- var detectAutoSelectedOptionRegex = /<option[^>]*selected/;
2832
- return function detectAutoSelectedOption(select, option, html) { //jshint ignore:line
2833
- return select.selectedIndex === 0 &&
2834
- !detectAutoSelectedOptionRegex.test(html);
2835
- };
2836
- })();
2837
- } else {
2838
- detectAutoSelectedOption = function detectAutoSelectedOption(select, option, html) { //jshint ignore:line
2839
- var selectedAttribute = option.getAttribute('selected');
2840
- return select.selectedIndex === 0 && (
2841
- selectedAttribute === null ||
2842
- ( selectedAttribute !== '' && selectedAttribute.toLowerCase() !== 'selected' )
2843
- );
2844
- };
2845
- }
2846
-
2847
2856
  var tagNamesRequiringInnerHTMLFix = doc && (function(document) {
2848
2857
  var tagNamesRequiringInnerHTMLFix;
2849
2858
  // IE 9 and earlier don't allow us to set innerHTML on col, colgroup, frameset,
@@ -2918,7 +2927,10 @@ enifed("dom-helper/build-html-dom",
2918
2927
  throw "Can't set innerHTML on "+tagName+" in this browser";
2919
2928
  }
2920
2929
 
2930
+ html = fixSelect(html, contextualElement);
2931
+
2921
2932
  var wrappingTags = tagNamesRequiringInnerHTMLFix[tagName.toLowerCase()];
2933
+
2922
2934
  var startTag = outerHTML.match(new RegExp("<"+tagName+"([^>]*)>", 'i'))[0];
2923
2935
  var endTag = '</'+tagName+'>';
2924
2936
 
@@ -2949,18 +2961,30 @@ enifed("dom-helper/build-html-dom",
2949
2961
  var buildDOM;
2950
2962
  if (needsShy) {
2951
2963
  buildDOM = function buildDOM(html, contextualElement, dom){
2964
+ html = fixSelect(html, contextualElement);
2965
+
2952
2966
  contextualElement = dom.cloneNode(contextualElement, false);
2953
2967
  scriptSafeInnerHTML(contextualElement, html);
2954
2968
  return contextualElement.childNodes;
2955
2969
  };
2956
2970
  } else {
2957
2971
  buildDOM = function buildDOM(html, contextualElement, dom){
2972
+ html = fixSelect(html, contextualElement);
2973
+
2958
2974
  contextualElement = dom.cloneNode(contextualElement, false);
2959
2975
  contextualElement.innerHTML = html;
2960
2976
  return contextualElement.childNodes;
2961
2977
  };
2962
2978
  }
2963
2979
 
2980
+ function fixSelect(html, contextualElement) {
2981
+ if (contextualElement.tagName === 'SELECT') {
2982
+ html = "<option></option>" + html;
2983
+ }
2984
+
2985
+ return html;
2986
+ }
2987
+
2964
2988
  var buildIESafeDOM;
2965
2989
  if (tagNamesRequiringInnerHTMLFix || movesWhitespace) {
2966
2990
  buildIESafeDOM = function buildIESafeDOM(html, contextualElement, dom) {
@@ -3031,45 +3055,17 @@ enifed("dom-helper/build-html-dom",
3031
3055
  buildIESafeDOM = buildDOM;
3032
3056
  }
3033
3057
 
3034
- // When parsing innerHTML, the browser may set up DOM with some things
3035
- // not desired. For example, with a select element context and option
3036
- // innerHTML the first option will be marked selected.
3037
- //
3038
- // This method cleans up some of that, resetting those values back to
3039
- // their defaults.
3040
- //
3041
- function buildSafeDOM(html, contextualElement, dom) {
3042
- var childNodes = buildIESafeDOM(html, contextualElement, dom);
3043
-
3044
- if (contextualElement.tagName === 'SELECT') {
3045
- // Walk child nodes
3046
- for (var i = 0; childNodes[i]; i++) {
3047
- // Find and process the first option child node
3048
- if (childNodes[i].tagName === 'OPTION') {
3049
- if (detectAutoSelectedOption(childNodes[i].parentNode, childNodes[i], html)) {
3050
- // If the first node is selected but does not have an attribute,
3051
- // presume it is not really selected.
3052
- childNodes[i].parentNode.selectedIndex = -1;
3053
- }
3054
- break;
3055
- }
3056
- }
3057
- }
3058
-
3059
- return childNodes;
3060
- }
3061
-
3062
3058
  var buildHTMLDOM;
3063
3059
  if (needsIntegrationPointFix) {
3064
3060
  buildHTMLDOM = function buildHTMLDOM(html, contextualElement, dom){
3065
3061
  if (svgHTMLIntegrationPoints[contextualElement.tagName]) {
3066
- return buildSafeDOM(html, document.createElement('div'), dom);
3062
+ return buildIESafeDOM(html, document.createElement('div'), dom);
3067
3063
  } else {
3068
- return buildSafeDOM(html, contextualElement, dom);
3064
+ return buildIESafeDOM(html, contextualElement, dom);
3069
3065
  }
3070
3066
  };
3071
3067
  } else {
3072
- buildHTMLDOM = buildSafeDOM;
3068
+ buildHTMLDOM = buildIESafeDOM;
3073
3069
  }
3074
3070
 
3075
3071
  __exports__.buildHTMLDOM = buildHTMLDOM;
@@ -3962,12 +3958,6 @@ enifed('ember-application/tests/system/dependency_injection/default_resolver_tes
3962
3958
  helpers.registerHelper('fooresolvertest', fooresolvertestHelper);
3963
3959
  helpers.registerHelper('bar-baz-resolver-test', barBazResolverTestHelper);
3964
3960
 
3965
- var retrievedFooResolverTestHelper, retrievedBarBazResolverTestHelper;
3966
-
3967
-
3968
- retrievedFooResolverTestHelper = locator.lookup('helper:fooresolvertest').helperFunction;
3969
- retrievedBarBazResolverTestHelper = locator.lookup('helper:bar-baz-resolver-test').helperFunction;
3970
-
3971
3961
  fooresolvertestHelper();
3972
3962
  barBazResolverTestHelper();
3973
3963
  });
@@ -4639,28 +4629,7 @@ enifed('ember-application/tests/system/initializers_test', ['ember-metal/run_loo
4639
4629
  });
4640
4630
  });
4641
4631
 
4642
- if (Ember.FEATURES.isEnabled("ember-application-initializer-context")) {
4643
- QUnit.test("initializers should be executed in their own context", function() {
4644
- expect(1);
4645
- var MyApplication = Application['default'].extend();
4646
-
4647
- MyApplication.initializer({
4648
- name: 'coolBabeInitializer',
4649
- myProperty: 'coolBabe',
4650
- initialize: function(registry, application) {
4651
- equal(this.myProperty, 'coolBabe', 'should have access to its own context');
4652
- }
4653
- });
4654
-
4655
- run['default'](function() {
4656
- app = MyApplication.create({
4657
- router: false,
4658
- rootElement: '#qunit-fixture'
4659
- });
4660
- });
4661
- });
4662
- }
4663
-
4632
+
4664
4633
  });
4665
4634
  enifed('ember-application/tests/system/initializers_test.jscs-test', function () {
4666
4635
 
@@ -4686,349 +4655,10 @@ enifed('ember-application/tests/system/instance_initializers_test', ['ember-meta
4686
4655
 
4687
4656
  'use strict';
4688
4657
 
4689
- var app;
4690
-
4691
- if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) {
4692
- QUnit.module("Ember.Application instance initializers", {
4693
- setup: function() {
4694
- },
4695
-
4696
- teardown: function() {
4697
- if (app) {
4698
- run['default'](function() { app.destroy(); });
4699
- }
4700
- }
4701
- });
4702
-
4703
- QUnit.test("initializers require proper 'name' and 'initialize' properties", function() {
4704
- var MyApplication = Application['default'].extend();
4705
-
4706
- expectAssertion(function() {
4707
- run['default'](function() {
4708
- MyApplication.instanceInitializer({ name: 'initializer' });
4709
- });
4710
- });
4711
-
4712
- expectAssertion(function() {
4713
- run['default'](function() {
4714
- MyApplication.instanceInitializer({ initialize: Ember.K });
4715
- });
4716
- });
4717
-
4718
- });
4719
-
4720
- QUnit.test("initializers are passed an app instance", function() {
4721
- var MyApplication = Application['default'].extend();
4722
-
4723
- MyApplication.instanceInitializer({
4724
- name: 'initializer',
4725
- initialize: function(instance) {
4726
- ok(instance instanceof ApplicationInstance['default'], "initialize is passed an application instance");
4727
- }
4728
- });
4729
-
4730
- run['default'](function() {
4731
- app = MyApplication.create({
4732
- router: false,
4733
- rootElement: '#qunit-fixture'
4734
- });
4735
- });
4736
- });
4737
-
4738
- QUnit.test("initializers can be registered in a specified order", function() {
4739
- var order = [];
4740
- var MyApplication = Application['default'].extend();
4741
- MyApplication.instanceInitializer({
4742
- name: 'fourth',
4743
- after: 'third',
4744
- initialize: function(registry) {
4745
- order.push('fourth');
4746
- }
4747
- });
4748
-
4749
- MyApplication.instanceInitializer({
4750
- name: 'second',
4751
- after: 'first',
4752
- before: 'third',
4753
- initialize: function(registry) {
4754
- order.push('second');
4755
- }
4756
- });
4757
-
4758
- MyApplication.instanceInitializer({
4759
- name: 'fifth',
4760
- after: 'fourth',
4761
- before: 'sixth',
4762
- initialize: function(registry) {
4763
- order.push('fifth');
4764
- }
4765
- });
4766
-
4767
- MyApplication.instanceInitializer({
4768
- name: 'first',
4769
- before: 'second',
4770
- initialize: function(registry) {
4771
- order.push('first');
4772
- }
4773
- });
4774
-
4775
- MyApplication.instanceInitializer({
4776
- name: 'third',
4777
- initialize: function(registry) {
4778
- order.push('third');
4779
- }
4780
- });
4781
-
4782
- MyApplication.instanceInitializer({
4783
- name: 'sixth',
4784
- initialize: function(registry) {
4785
- order.push('sixth');
4786
- }
4787
- });
4788
-
4789
- run['default'](function() {
4790
- app = MyApplication.create({
4791
- router: false,
4792
- rootElement: '#qunit-fixture'
4793
- });
4794
- });
4795
-
4796
- deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']);
4797
- });
4798
-
4799
- QUnit.test("initializers can be registered in a specified order as an array", function() {
4800
- var order = [];
4801
- var MyApplication = Application['default'].extend();
4802
-
4803
-
4804
- MyApplication.instanceInitializer({
4805
- name: 'third',
4806
- initialize: function(registry) {
4807
- order.push('third');
4808
- }
4809
- });
4810
-
4811
- MyApplication.instanceInitializer({
4812
- name: 'second',
4813
- after: 'first',
4814
- before: ['third', 'fourth'],
4815
- initialize: function(registry) {
4816
- order.push('second');
4817
- }
4818
- });
4819
-
4820
- MyApplication.instanceInitializer({
4821
- name: 'fourth',
4822
- after: ['second', 'third'],
4823
- initialize: function(registry) {
4824
- order.push('fourth');
4825
- }
4826
- });
4827
-
4828
- MyApplication.instanceInitializer({
4829
- name: 'fifth',
4830
- after: 'fourth',
4831
- before: 'sixth',
4832
- initialize: function(registry) {
4833
- order.push('fifth');
4834
- }
4835
- });
4836
-
4837
- MyApplication.instanceInitializer({
4838
- name: 'first',
4839
- before: ['second'],
4840
- initialize: function(registry) {
4841
- order.push('first');
4842
- }
4843
- });
4844
-
4845
- MyApplication.instanceInitializer({
4846
- name: 'sixth',
4847
- initialize: function(registry) {
4848
- order.push('sixth');
4849
- }
4850
- });
4851
-
4852
- run['default'](function() {
4853
- app = MyApplication.create({
4854
- router: false,
4855
- rootElement: '#qunit-fixture'
4856
- });
4857
- });
4858
-
4859
- deepEqual(order, ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']);
4860
- });
4861
-
4862
- QUnit.test("initializers can have multiple dependencies", function () {
4863
- var order = [];
4864
- var a = {
4865
- name: "a",
4866
- before: "b",
4867
- initialize: function(registry) {
4868
- order.push('a');
4869
- }
4870
- };
4871
- var b = {
4872
- name: "b",
4873
- initialize: function(registry) {
4874
- order.push('b');
4875
- }
4876
- };
4877
- var c = {
4878
- name: "c",
4879
- after: "b",
4880
- initialize: function(registry) {
4881
- order.push('c');
4882
- }
4883
- };
4884
- var afterB = {
4885
- name: "after b",
4886
- after: "b",
4887
- initialize: function(registry) {
4888
- order.push("after b");
4889
- }
4890
- };
4891
- var afterC = {
4892
- name: "after c",
4893
- after: "c",
4894
- initialize: function(registry) {
4895
- order.push("after c");
4896
- }
4897
- };
4898
-
4899
- Application['default'].instanceInitializer(b);
4900
- Application['default'].instanceInitializer(a);
4901
- Application['default'].instanceInitializer(afterC);
4902
- Application['default'].instanceInitializer(afterB);
4903
- Application['default'].instanceInitializer(c);
4904
-
4905
- run['default'](function() {
4906
- app = Application['default'].create({
4907
- router: false,
4908
- rootElement: '#qunit-fixture'
4909
- });
4910
- });
4911
-
4912
- ok(array.indexOf.call(order, a.name) < array.indexOf.call(order, b.name), 'a < b');
4913
- ok(array.indexOf.call(order, b.name) < array.indexOf.call(order, c.name), 'b < c');
4914
- ok(array.indexOf.call(order, b.name) < array.indexOf.call(order, afterB.name), 'b < afterB');
4915
- ok(array.indexOf.call(order, c.name) < array.indexOf.call(order, afterC.name), 'c < afterC');
4916
- });
4917
-
4918
- QUnit.test("initializers set on Application subclasses should not be shared between apps", function() {
4919
- var firstInitializerRunCount = 0;
4920
- var secondInitializerRunCount = 0;
4921
- var FirstApp = Application['default'].extend();
4922
- FirstApp.instanceInitializer({
4923
- name: 'first',
4924
- initialize: function(registry) {
4925
- firstInitializerRunCount++;
4926
- }
4927
- });
4928
- var SecondApp = Application['default'].extend();
4929
- SecondApp.instanceInitializer({
4930
- name: 'second',
4931
- initialize: function(registry) {
4932
- secondInitializerRunCount++;
4933
- }
4934
- });
4935
- jQuery['default']('#qunit-fixture').html('<div id="first"></div><div id="second"></div>');
4936
- run['default'](function() {
4937
- FirstApp.create({
4938
- router: false,
4939
- rootElement: '#qunit-fixture #first'
4940
- });
4941
- });
4942
- equal(firstInitializerRunCount, 1, 'first initializer only was run');
4943
- equal(secondInitializerRunCount, 0, 'first initializer only was run');
4944
- run['default'](function() {
4945
- SecondApp.create({
4946
- router: false,
4947
- rootElement: '#qunit-fixture #second'
4948
- });
4949
- });
4950
- equal(firstInitializerRunCount, 1, 'second initializer only was run');
4951
- equal(secondInitializerRunCount, 1, 'second initializer only was run');
4952
- });
4953
-
4954
- QUnit.test("initializers are concatenated", function() {
4955
- var firstInitializerRunCount = 0;
4956
- var secondInitializerRunCount = 0;
4957
- var FirstApp = Application['default'].extend();
4958
- FirstApp.instanceInitializer({
4959
- name: 'first',
4960
- initialize: function(registry) {
4961
- firstInitializerRunCount++;
4962
- }
4963
- });
4964
-
4965
- var SecondApp = FirstApp.extend();
4966
- SecondApp.instanceInitializer({
4967
- name: 'second',
4968
- initialize: function(registry) {
4969
- secondInitializerRunCount++;
4970
- }
4971
- });
4972
-
4973
- jQuery['default']('#qunit-fixture').html('<div id="first"></div><div id="second"></div>');
4974
- run['default'](function() {
4975
- FirstApp.create({
4976
- router: false,
4977
- rootElement: '#qunit-fixture #first'
4978
- });
4979
- });
4980
- equal(firstInitializerRunCount, 1, 'first initializer only was run when base class created');
4981
- equal(secondInitializerRunCount, 0, 'first initializer only was run when base class created');
4982
- firstInitializerRunCount = 0;
4983
- run['default'](function() {
4984
- SecondApp.create({
4985
- router: false,
4986
- rootElement: '#qunit-fixture #second'
4987
- });
4988
- });
4989
- equal(firstInitializerRunCount, 1, 'first initializer was run when subclass created');
4990
- equal(secondInitializerRunCount, 1, 'second initializers was run when subclass created');
4991
- });
4992
-
4993
- QUnit.test("initializers are per-app", function() {
4994
- expect(0);
4995
- var FirstApp = Application['default'].extend();
4996
- FirstApp.instanceInitializer({
4997
- name: 'shouldNotCollide',
4998
- initialize: function(registry) {}
4999
- });
5000
-
5001
- var SecondApp = Application['default'].extend();
5002
- SecondApp.instanceInitializer({
5003
- name: 'shouldNotCollide',
5004
- initialize: function(registry) {}
5005
- });
5006
- });
5007
-
5008
- if (Ember.FEATURES.isEnabled("ember-application-initializer-context")) {
5009
- QUnit.test("initializers should be executed in their own context", function() {
5010
- expect(1);
5011
-
5012
- var MyApplication = Application['default'].extend();
5013
-
5014
- MyApplication.instanceInitializer({
5015
- name: 'coolBabeInitializer',
5016
- myProperty: 'coolBabe',
5017
- initialize: function(registry, application) {
5018
- equal(this.myProperty, 'coolBabe', 'should have access to its own context');
5019
- }
5020
- });
5021
-
5022
- run['default'](function() {
5023
- app = MyApplication.create({
5024
- router: false,
5025
- rootElement: '#qunit-fixture'
5026
- });
5027
- });
5028
- });
5029
- }
5030
- }
4658
+ var app, initializeContextFeatureEnabled;
5031
4659
 
4660
+
4661
+
5032
4662
  });
5033
4663
  enifed('ember-application/tests/system/instance_initializers_test.jscs-test', function () {
5034
4664
 
@@ -5050,7 +4680,7 @@ enifed('ember-application/tests/system/instance_initializers_test.jshint', funct
5050
4680
  });
5051
4681
 
5052
4682
  });
5053
- enifed('ember-application/tests/system/logging_test', ['ember-metal/run_loop', 'ember-application/system/application', 'ember-views/views/view', 'ember-runtime/controllers/controller', 'ember-routing/system/route', 'ember-runtime/ext/rsvp', 'ember-metal/keys', 'ember-routing'], function (run, Application, View, Controller, Route, RSVP, keys) {
4683
+ enifed('ember-application/tests/system/logging_test', ['ember-metal/run_loop', 'ember-application/system/application', 'ember-views/views/view', 'ember-runtime/controllers/controller', 'ember-routing/system/route', 'ember-runtime/ext/rsvp', 'ember-metal/keys', 'ember-template-compiler/system/compile', 'ember-routing'], function (run, Application, View, Controller, Route, RSVP, keys, compile) {
5054
4684
 
5055
4685
  'use strict';
5056
4686
 
@@ -5228,7 +4858,7 @@ enifed('ember-application/tests/system/logging_test', ['ember-metal/run_loop', '
5228
4858
  return;
5229
4859
  }
5230
4860
 
5231
- App.register('template:application', function() { return ''; });
4861
+ App.register('template:application', compile['default']("{{outlet}}"));
5232
4862
  run['default'](App, 'advanceReadiness');
5233
4863
 
5234
4864
  visit('/posts').then(function() {
@@ -5256,7 +4886,7 @@ enifed('ember-application/tests/system/logging_test', ['ember-metal/run_loop', '
5256
4886
  return;
5257
4887
  }
5258
4888
 
5259
- App.register('template:application', function() { return 'Template with default view'; });
4889
+ App.register('template:application', compile['default']('{{outlet}}'));
5260
4890
  App.register('template:foo', function() { return 'Template with custom view'; });
5261
4891
  App.register('view:posts', View['default'].extend({ templateName: 'foo' }));
5262
4892
  run['default'](App, 'advanceReadiness');
@@ -5770,73 +5400,7 @@ enifed('ember-application/tests/system/visit_test', ['ember-metal/run_loop', 'em
5770
5400
  return App;
5771
5401
  }
5772
5402
 
5773
- if (Ember.FEATURES.isEnabled('ember-application-visit')) {
5774
- QUnit.module("Ember.Application - visit()");
5775
-
5776
- // This tests whether the application is "autobooted" by registering an
5777
- // instance initializer and asserting it never gets run. Since this is
5778
- // inherently testing that async behavior *doesn't* happen, we set a
5779
- // 500ms timeout to verify that when autoboot is set to false, the
5780
- // instance initializer that would normally get called on DOM ready
5781
- // does not fire.
5782
- QUnit.test("Applications with autoboot set to false do not autoboot", function(assert) {
5783
- QUnit.expect(1);
5784
- QUnit.stop();
5785
-
5786
- run['default'](function() {
5787
- var app = createApplication();
5788
-
5789
- // Start the timeout
5790
- var timeout = setTimeout(function() {
5791
- ok(true, "500ms elapsed without initializers being called");
5792
- QUnit.start();
5793
- }, 500);
5794
-
5795
- // Create an instance initializer that should *not* get run.
5796
- app.instanceInitializer({
5797
- name: "assert-no-autoboot",
5798
- initialize: function() {
5799
- clearTimeout(timeout);
5800
- QUnit.start();
5801
- assert.ok(false, "instance should not have been created");
5802
- }
5803
- });
5804
- });
5805
- });
5806
-
5807
- QUnit.test("visit() returns a promise that resolves when the view has rendered", function(assert) {
5808
- QUnit.expect(3);
5809
- QUnit.stop();
5810
-
5811
- var app;
5812
-
5813
- run['default'](function() {
5814
- app = createApplication();
5815
- app.instanceInitializer({
5816
- name: 'register-application-template',
5817
- initialize: function(app) {
5818
- app.registry.register('template:application', compile['default']('<h1>Hello world</h1>'));
5819
- }
5820
- });
5821
- });
5822
-
5823
- assert.equal(Ember.$('#qunit-fixture').children().length, 0, "there are no elements in the fixture element");
5824
-
5825
- app.visit('/').then(function(instance) {
5826
- QUnit.start();
5827
- assert.ok(instance instanceof ApplicationInstance['default'], "promise is resolved with an ApplicationInstance");
5828
-
5829
- run['default'](instance.view, 'appendTo', '#qunit-fixture');
5830
- assert.equal(Ember.$("#qunit-fixture > .ember-view h1").text(), "Hello world", "the application was rendered once the promise resolves");
5831
-
5832
- instance.destroy();
5833
- }, function(error) {
5834
- QUnit.start();
5835
- assert.ok(false, "The visit() promise was rejected: " + error);
5836
- });
5837
- });
5838
- }
5839
-
5403
+
5840
5404
  });
5841
5405
  enifed('ember-application/tests/system/visit_test.jscs-test', function () {
5842
5406
 
@@ -9004,9 +8568,6 @@ enifed('ember-htmlbars/tests/compat/helper_test', ['ember-htmlbars/compat/helper
9004
8568
 
9005
8569
  var view;
9006
8570
 
9007
-
9008
- // jscs:disable validateIndentation
9009
-
9010
8571
  QUnit.module('ember-htmlbars: Handlebars compatible helpers', {
9011
8572
  teardown: function() {
9012
8573
  utils.runDestroy(view);
@@ -9263,9 +8824,6 @@ enifed('ember-htmlbars/tests/compat/helper_test', ['ember-htmlbars/compat/helper
9263
8824
  utils.runAppend(view);
9264
8825
  });
9265
8826
 
9266
- // jscs:enable validateIndentation
9267
-
9268
-
9269
8827
  });
9270
8828
  enifed('ember-htmlbars/tests/compat/helper_test.jscs-test', function () {
9271
8829
 
@@ -9945,7 +9503,6 @@ enifed('ember-htmlbars/tests/compat/precompile_test', ['ember-htmlbars/compat'],
9945
9503
  'use strict';
9946
9504
 
9947
9505
  var precompile = EmberHandlebars['default'].precompile;
9948
- var parse = EmberHandlebars['default'].parse;
9949
9506
  var template = 'Hello World';
9950
9507
  var result;
9951
9508
 
@@ -9966,18 +9523,6 @@ enifed('ember-htmlbars/tests/compat/precompile_test', ['ember-htmlbars/compat'],
9966
9523
  equal(typeof(result), "string");
9967
9524
  });
9968
9525
 
9969
- if (!Ember.FEATURES.isEnabled('ember-htmlbars')) {
9970
- // jscs:disable validateIndentation
9971
-
9972
- QUnit.test("precompile creates an object when passed an AST", function() {
9973
- var ast = parse(template);
9974
- result = precompile(ast);
9975
- equal(typeof(result), "object");
9976
- });
9977
-
9978
- // jscs:enable validateIndentation
9979
- }
9980
-
9981
9526
  });
9982
9527
  enifed('ember-htmlbars/tests/compat/precompile_test.jscs-test', function () {
9983
9528
 
@@ -10194,22 +9739,20 @@ enifed('ember-htmlbars/tests/helpers/bind_attr_test', ['ember-metal/core', 'embe
10194
9739
  var originalBindAttr = helpers['default']['bind-attr'];
10195
9740
 
10196
9741
  try {
10197
-
10198
- helpers['default']['bind-attr'] = {
10199
- helperFunction: function() {
10200
- equal(arguments[0], 'foo', 'First arg match');
10201
- equal(arguments[1], 'bar', 'Second arg match');
9742
+ helpers['default']['bind-attr'] = {
9743
+ helperFunction: function() {
9744
+ equal(arguments[0], 'foo', 'First arg match');
9745
+ equal(arguments[1], 'bar', 'Second arg match');
9746
+
9747
+ return 'result';
9748
+ }
9749
+ };
10202
9750
 
10203
- return 'result';
10204
- }
10205
- };
10206
-
10207
9751
  expectDeprecation(function() {
10208
9752
  var result;
10209
9753
 
10210
-
10211
- result = helpers['default'].bindAttr.helperFunction('foo', 'bar');
10212
- equal(result, 'result', 'Result match');
9754
+ result = helpers['default'].bindAttr.helperFunction('foo', 'bar');
9755
+ equal(result, 'result', 'Result match');
10213
9756
  }, "The 'bindAttr' view helper is deprecated in favor of 'bind-attr'");
10214
9757
  } finally {
10215
9758
  helpers['default']['bind-attr'] = originalBindAttr;
@@ -10566,6 +10109,32 @@ enifed('ember-htmlbars/tests/helpers/bind_attr_test', ['ember-metal/core', 'embe
10566
10109
  }, /You cannot set `data-bar` manually and via `{{bind-attr}}` helper on the same element/);
10567
10110
  });
10568
10111
 
10112
+ QUnit.test("src attribute bound to undefined is not present", function() {
10113
+ var template = compile['default']("<img {{bind-attr src=view.undefinedValue}}>");
10114
+
10115
+ view = EmberView['default'].create({
10116
+ template: template,
10117
+ undefinedValue: undefined
10118
+ });
10119
+
10120
+ utils.runAppend(view);
10121
+
10122
+ ok(!view.element.hasAttribute('src'), "src attribute not present");
10123
+ });
10124
+
10125
+ QUnit.test("src attribute bound to null is not present", function() {
10126
+ var template = compile['default']("<img {{bind-attr src=view.nullValue}}>");
10127
+
10128
+ view = EmberView['default'].create({
10129
+ template: template,
10130
+ nullValue: null
10131
+ });
10132
+
10133
+ utils.runAppend(view);
10134
+
10135
+ ok(!view.element.hasAttribute('src'), "src attribute not present");
10136
+ });
10137
+
10569
10138
  });
10570
10139
  enifed('ember-htmlbars/tests/helpers/bind_attr_test.jscs-test', function () {
10571
10140
 
@@ -10664,10 +10233,7 @@ enifed('ember-htmlbars/tests/helpers/collection_test', ['ember-views/views/colle
10664
10233
  template: compile['default']('{{#collection content=view.exampleController itemViewClass=TemplateTests.ExampleItemView}}beta{{/collection}}')
10665
10234
  });
10666
10235
 
10667
- var deprecation = /Resolved the view "TemplateTests.ExampleItemView" on the global context/;
10668
-
10669
- deprecation = /Global lookup of TemplateTests.ExampleItemView from a Handlebars template is deprecated/;
10670
-
10236
+ var deprecation = /Global lookup of TemplateTests.ExampleItemView from a Handlebars template is deprecated/;
10671
10237
  expectDeprecation(function() {
10672
10238
  utils.runAppend(view);
10673
10239
  }, deprecation);
@@ -12088,10 +11654,7 @@ enifed('ember-htmlbars/tests/helpers/each_test', ['ember-metal/core', 'ember-run
12088
11654
  people: people
12089
11655
  });
12090
11656
 
12091
- var deprecation = /Resolved the view "MyView" on the global context/;
12092
-
12093
- deprecation = /Global lookup of MyView from a Handlebars template is deprecated/;
12094
-
11657
+ var deprecation = /Global lookup of MyView from a Handlebars template is deprecated/;
12095
11658
 
12096
11659
  expectDeprecation(function() {
12097
11660
  utils.runAppend(view);
@@ -12207,11 +11770,7 @@ enifed('ember-htmlbars/tests/helpers/each_test', ['ember-metal/core', 'ember-run
12207
11770
  people: native_array.A()
12208
11771
  });
12209
11772
 
12210
- var deprecation = /Resolved the view "MyEmptyView" on the global context/;
12211
-
12212
-
12213
- deprecation = /Global lookup of MyEmptyView from a Handlebars template is deprecated/;
12214
-
11773
+ var deprecation = /Global lookup of MyEmptyView from a Handlebars template is deprecated/;
12215
11774
 
12216
11775
  expectDeprecation(function() {
12217
11776
  utils.runAppend(view);
@@ -12616,10 +12175,7 @@ enifed('ember-htmlbars/tests/helpers/each_test', ['ember-metal/core', 'ember-run
12616
12175
  }
12617
12176
 
12618
12177
  testEachWithItem("{{#each foo in bar}}", false);
12619
-
12620
-
12621
- testEachWithItem("{{#each bar as |foo|}}", true);
12622
-
12178
+ testEachWithItem("{{#each bar as |foo|}}", true);
12623
12179
 
12624
12180
  });
12625
12181
  enifed('ember-htmlbars/tests/helpers/each_test.jscs-test', function () {
@@ -13921,8 +13477,6 @@ enifed('ember-htmlbars/tests/helpers/loc_test', ['ember-views/views/view', 'embe
13921
13477
  utils.runDestroy(view);
13922
13478
  });
13923
13479
 
13924
-
13925
- // jscs:disable validateIndentation
13926
13480
  QUnit.test('localize throws an assertion if the second parameter is a binding', function() {
13927
13481
  var view = buildView('{{loc "Hello %@" name}}', {
13928
13482
  name: 'Bob Foster'
@@ -13946,8 +13500,6 @@ enifed('ember-htmlbars/tests/helpers/loc_test', ['ember-views/views/view', 'embe
13946
13500
 
13947
13501
  utils.runDestroy(view);
13948
13502
  });
13949
- // jscs:enable validateIndentation
13950
-
13951
13503
 
13952
13504
  });
13953
13505
  enifed('ember-htmlbars/tests/helpers/loc_test.jscs-test', function () {
@@ -16612,61 +16164,57 @@ enifed('ember-htmlbars/tests/helpers/with_test', ['ember-views/views/view', 'emb
16612
16164
  equal(view.$().text(), "We have: this is from the view and this is from the context", "should render");
16613
16165
  });
16614
16166
 
16615
-
16616
- testWithAs("ember-htmlbars: {{#with x as |y|}}", "{{#with person as |tom|}}{{title}}: {{tom.name}}{{/with}}");
16617
-
16167
+ testWithAs("ember-htmlbars: {{#with x as |y|}}", "{{#with person as |tom|}}{{title}}: {{tom.name}}{{/with}}");
16618
16168
 
16619
-
16620
- QUnit.module("Multiple Handlebars {{with foo as |bar|}} helpers", {
16621
- setup: function() {
16622
- Ember.lookup = lookup = { Ember: Ember };
16169
+ QUnit.module("Multiple Handlebars {{with foo as |bar|}} helpers", {
16170
+ setup: function() {
16171
+ Ember.lookup = lookup = { Ember: Ember };
16623
16172
 
16624
- view = EmberView['default'].create({
16625
- template: compile['default']("Admin: {{#with admin as |person|}}{{person.name}}{{/with}} User: {{#with user as |person|}}{{person.name}}{{/with}}"),
16626
- context: {
16627
- admin: { name: "Tom Dale" },
16628
- user: { name: "Yehuda Katz" }
16629
- }
16630
- });
16173
+ view = EmberView['default'].create({
16174
+ template: compile['default']("Admin: {{#with admin as |person|}}{{person.name}}{{/with}} User: {{#with user as |person|}}{{person.name}}{{/with}}"),
16175
+ context: {
16176
+ admin: { name: "Tom Dale" },
16177
+ user: { name: "Yehuda Katz" }
16178
+ }
16179
+ });
16631
16180
 
16632
- utils.runAppend(view);
16633
- },
16181
+ utils.runAppend(view);
16182
+ },
16634
16183
 
16635
- teardown: function() {
16636
- utils.runDestroy(view);
16637
- Ember.lookup = originalLookup;
16638
- }
16639
- });
16184
+ teardown: function() {
16185
+ utils.runDestroy(view);
16186
+ Ember.lookup = originalLookup;
16187
+ }
16188
+ });
16640
16189
 
16641
- QUnit.test("re-using the same variable with different #with blocks does not override each other", function() {
16642
- equal(view.$().text(), "Admin: Tom Dale User: Yehuda Katz", "should be properly scoped");
16643
- });
16190
+ QUnit.test("re-using the same variable with different #with blocks does not override each other", function() {
16191
+ equal(view.$().text(), "Admin: Tom Dale User: Yehuda Katz", "should be properly scoped");
16192
+ });
16644
16193
 
16645
- QUnit.test("the scoped variable is not available outside the {{with}} block.", function() {
16646
- run['default'](function() {
16647
- view.set('template', compile['default']("{{name}}-{{#with other as |name|}}{{name}}{{/with}}-{{name}}"));
16648
- view.set('context', {
16649
- name: 'Stef',
16650
- other: 'Yehuda'
16651
- });
16194
+ QUnit.test("the scoped variable is not available outside the {{with}} block.", function() {
16195
+ run['default'](function() {
16196
+ view.set('template', compile['default']("{{name}}-{{#with other as |name|}}{{name}}{{/with}}-{{name}}"));
16197
+ view.set('context', {
16198
+ name: 'Stef',
16199
+ other: 'Yehuda'
16652
16200
  });
16653
-
16654
- equal(view.$().text(), "Stef-Yehuda-Stef", "should be properly scoped after updating");
16655
16201
  });
16656
16202
 
16657
- QUnit.test("nested {{with}} blocks shadow the outer scoped variable properly.", function() {
16658
- run['default'](function() {
16659
- view.set('template', compile['default']("{{#with first as |ring|}}{{ring}}-{{#with fifth as |ring|}}{{ring}}-{{#with ninth as |ring|}}{{ring}}-{{/with}}{{ring}}-{{/with}}{{ring}}{{/with}}"));
16660
- view.set('context', {
16661
- first: 'Limbo',
16662
- fifth: 'Wrath',
16663
- ninth: 'Treachery'
16664
- });
16665
- });
16203
+ equal(view.$().text(), "Stef-Yehuda-Stef", "should be properly scoped after updating");
16204
+ });
16666
16205
 
16667
- equal(view.$().text(), "Limbo-Wrath-Treachery-Wrath-Limbo", "should be properly scoped after updating");
16206
+ QUnit.test("nested {{with}} blocks shadow the outer scoped variable properly.", function() {
16207
+ run['default'](function() {
16208
+ view.set('template', compile['default']("{{#with first as |ring|}}{{ring}}-{{#with fifth as |ring|}}{{ring}}-{{#with ninth as |ring|}}{{ring}}-{{/with}}{{ring}}-{{/with}}{{ring}}{{/with}}"));
16209
+ view.set('context', {
16210
+ first: 'Limbo',
16211
+ fifth: 'Wrath',
16212
+ ninth: 'Treachery'
16213
+ });
16668
16214
  });
16669
-
16215
+
16216
+ equal(view.$().text(), "Limbo-Wrath-Treachery-Wrath-Limbo", "should be properly scoped after updating");
16217
+ });
16670
16218
 
16671
16219
  });
16672
16220
  enifed('ember-htmlbars/tests/helpers/with_test.jscs-test', function () {
@@ -16892,31 +16440,6 @@ enifed('ember-htmlbars/tests/helpers/yield_test', ['ember-metal/run_loop', 'embe
16892
16440
  equal(view.$('div p:contains(update) + p:contains(update)').length, 1, "keyword has correctly propagated update");
16893
16441
  });
16894
16442
 
16895
- if (!Ember.FEATURES.isEnabled('ember-htmlbars')) {
16896
- // jscs:disable validateIndentation
16897
-
16898
- QUnit.test("yield uses the layout context for non component [DEPRECATED]", function() {
16899
- view = EmberView['default'].create({
16900
- controller: {
16901
- boundText: "outer",
16902
- inner: {
16903
- boundText: "inner"
16904
- }
16905
- },
16906
- layout: compile['default']("<p>{{boundText}}</p>{{#with inner}}<p>{{yield}}</p>{{/with}}"),
16907
- template: compile['default']('{{boundText}}')
16908
- });
16909
-
16910
- expectDeprecation(function() {
16911
- utils.runAppend(view);
16912
- }, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead.');
16913
-
16914
- equal('outerinner', view.$('p').text(), "Yield points at the right context");
16915
- });
16916
-
16917
- // jscs:enable validateIndentation
16918
- }
16919
-
16920
16443
  QUnit.test("yield view should be a virtual view", function() {
16921
16444
  var component = Component['default'].extend({
16922
16445
  isParentComponent: true,
@@ -17087,57 +16610,7 @@ enifed('ember-htmlbars/tests/hooks/component_test', ['ember-views/component_look
17087
16610
 
17088
16611
  var view, registry, container;
17089
16612
 
17090
- // this is working around a bug in defeatureify that prevents nested flags
17091
- // from being stripped
17092
- var componentGenerationEnabled = false;
17093
- if (Ember.FEATURES.isEnabled('ember-htmlbars-component-generation')) {
17094
- componentGenerationEnabled = true;
17095
- }
17096
-
17097
16613
 
17098
- if (componentGenerationEnabled) {
17099
- QUnit.module("ember-htmlbars: component hook", {
17100
- setup: function() {
17101
- registry = new Registry['default']();
17102
- container = registry.container();
17103
-
17104
- registry.optionsForType('template', { instantiate: false });
17105
- registry.register('component-lookup:main', ComponentLookup['default']);
17106
- },
17107
-
17108
- teardown: function() {
17109
- utils.runDestroy(view);
17110
- utils.runDestroy(container);
17111
- registry = container = view = null;
17112
- }
17113
- });
17114
-
17115
- QUnit.test("component is looked up from the container", function() {
17116
- registry.register('template:components/foo-bar', compile['default']('yippie!'));
17117
-
17118
- view = EmberView['default'].create({
17119
- container: container,
17120
- template: compile['default']("<foo-bar />")
17121
- });
17122
-
17123
- utils.runAppend(view);
17124
-
17125
- equal(view.$().text(), 'yippie!', 'component was looked up and rendered');
17126
- });
17127
-
17128
- QUnit.test("asserts if component is not found", function() {
17129
- view = EmberView['default'].create({
17130
- container: container,
17131
- template: compile['default']("<foo-bar />")
17132
- });
17133
-
17134
- expectAssertion(function() {
17135
- utils.runAppend(view);
17136
- }, 'You specified `foo-bar` in your template, but a component for `foo-bar` could not be found.');
17137
- });
17138
- }
17139
-
17140
-
17141
16614
  });
17142
16615
  enifed('ember-htmlbars/tests/hooks/component_test.jscs-test', function () {
17143
16616
 
@@ -17259,48 +16732,46 @@ enifed('ember-htmlbars/tests/hooks/text_node_test', ['ember-views/views/view', '
17259
16732
 
17260
16733
  var view;
17261
16734
 
17262
-
17263
- QUnit.module("ember-htmlbars: hooks/text_node_test", {
17264
- teardown: function() {
17265
- utils.runDestroy(view);
17266
- }
16735
+ QUnit.module("ember-htmlbars: hooks/text_node_test", {
16736
+ teardown: function() {
16737
+ utils.runDestroy(view);
16738
+ }
16739
+ });
16740
+
16741
+ QUnit.test("property is output", function() {
16742
+ view = EmberView['default'].create({
16743
+ context: { name: 'erik' },
16744
+ template: compile['default']("ohai {{name}}")
17267
16745
  });
16746
+ utils.runAppend(view);
17268
16747
 
17269
- QUnit.test("property is output", function() {
17270
- view = EmberView['default'].create({
17271
- context: { name: 'erik' },
17272
- template: compile['default']("ohai {{name}}")
17273
- });
17274
- utils.runAppend(view);
16748
+ htmlbars_test_helpers.equalInnerHTML(view.element, 'ohai erik', "property is output");
16749
+ });
17275
16750
 
17276
- htmlbars_test_helpers.equalInnerHTML(view.element, 'ohai erik', "property is output");
16751
+ QUnit.test("path is output", function() {
16752
+ view = EmberView['default'].create({
16753
+ context: { name: { firstName: 'erik' } },
16754
+ template: compile['default']("ohai {{name.firstName}}")
17277
16755
  });
16756
+ utils.runAppend(view);
17278
16757
 
17279
- QUnit.test("path is output", function() {
17280
- view = EmberView['default'].create({
17281
- context: { name: { firstName: 'erik' } },
17282
- template: compile['default']("ohai {{name.firstName}}")
17283
- });
17284
- utils.runAppend(view);
16758
+ htmlbars_test_helpers.equalInnerHTML(view.element, 'ohai erik', "path is output");
16759
+ });
17285
16760
 
17286
- htmlbars_test_helpers.equalInnerHTML(view.element, 'ohai erik', "path is output");
16761
+ QUnit.test("changed property updates", function() {
16762
+ var context = EmberObject['default'].create({ name: 'erik' });
16763
+ view = EmberView['default'].create({
16764
+ context: context,
16765
+ template: compile['default']("ohai {{name}}")
17287
16766
  });
16767
+ utils.runAppend(view);
17288
16768
 
17289
- QUnit.test("changed property updates", function() {
17290
- var context = EmberObject['default'].create({ name: 'erik' });
17291
- view = EmberView['default'].create({
17292
- context: context,
17293
- template: compile['default']("ohai {{name}}")
17294
- });
17295
- utils.runAppend(view);
17296
-
17297
- htmlbars_test_helpers.equalInnerHTML(view.element, 'ohai erik', "precond - original property is output");
16769
+ htmlbars_test_helpers.equalInnerHTML(view.element, 'ohai erik', "precond - original property is output");
17298
16770
 
17299
- run['default'](context, context.set, 'name', 'mmun');
16771
+ run['default'](context, context.set, 'name', 'mmun');
17300
16772
 
17301
- htmlbars_test_helpers.equalInnerHTML(view.element, 'ohai mmun', "new property is output");
17302
- });
17303
-
16773
+ htmlbars_test_helpers.equalInnerHTML(view.element, 'ohai mmun', "new property is output");
16774
+ });
17304
16775
 
17305
16776
  });
17306
16777
  enifed('ember-htmlbars/tests/hooks/text_node_test.jscs-test', function () {
@@ -17327,19 +16798,16 @@ enifed('ember-htmlbars/tests/htmlbars_test', ['ember-template-compiler/system/co
17327
16798
 
17328
16799
  'use strict';
17329
16800
 
17330
-
17331
-
17332
- QUnit.module("ember-htmlbars: main");
16801
+ QUnit.module("ember-htmlbars: main");
17333
16802
 
17334
- QUnit.test("HTMLBars is present and can be executed", function() {
17335
- var template = compile['default']("ohai");
16803
+ QUnit.test("HTMLBars is present and can be executed", function() {
16804
+ var template = compile['default']("ohai");
17336
16805
 
17337
- var env = merge['default']({ dom: defaultEnv.domHelper }, defaultEnv['default']);
16806
+ var env = merge['default']({ dom: defaultEnv.domHelper }, defaultEnv['default']);
17338
16807
 
17339
- var output = template.render({}, env, document.body);
17340
- htmlbars_test_helpers.equalHTML(output, "ohai");
17341
- });
17342
-
16808
+ var output = template.render({}, env, document.body);
16809
+ htmlbars_test_helpers.equalHTML(output, "ohai");
16810
+ });
17343
16811
 
17344
16812
  });
17345
16813
  enifed('ember-htmlbars/tests/htmlbars_test.jscs-test', function () {
@@ -17569,9 +17037,6 @@ enifed('ember-htmlbars/tests/integration/block_params_test', ['container/registr
17569
17037
  });
17570
17038
  }
17571
17039
 
17572
-
17573
- // jscs:disable validateIndentation
17574
-
17575
17040
  QUnit.module("ember-htmlbars: block params", {
17576
17041
  setup: function() {
17577
17042
  helpers.registerHelper('alias', aliasHelper);
@@ -17688,9 +17153,6 @@ enifed('ember-htmlbars/tests/integration/block_params_test', ['container/registr
17688
17153
  equal(view.$().text(), "ebryn[trek[machty]trek]ebryn[machty[trek]machty]ebryn");
17689
17154
  });
17690
17155
 
17691
- // jscs:enable validateIndentation
17692
-
17693
-
17694
17156
  });
17695
17157
  enifed('ember-htmlbars/tests/integration/block_params_test.jscs-test', function () {
17696
17158
 
@@ -18973,9 +18435,6 @@ enifed('ember-htmlbars/tests/system/make_bound_helper_test', ['ember-views/views
18973
18435
  }));
18974
18436
  }
18975
18437
 
18976
-
18977
- // jscs:disable validateIndentation
18978
-
18979
18438
  QUnit.module("ember-htmlbars: makeBoundHelper", {
18980
18439
  setup: function() {
18981
18440
  registry = new Registry['default']();
@@ -19231,9 +18690,6 @@ enifed('ember-htmlbars/tests/system/make_bound_helper_test', ['ember-views/views
19231
18690
  equal(view.$().text(), 'aaa');
19232
18691
  });
19233
18692
 
19234
- // jscs:enable validateIndentation
19235
-
19236
-
19237
18693
  });
19238
18694
  enifed('ember-htmlbars/tests/system/make_bound_helper_test.jscs-test', function () {
19239
18695
 
@@ -19310,6 +18766,7 @@ enifed('ember-htmlbars/tests/system/render_view_test', ['ember-runtime/tests/uti
19310
18766
  view = EmberView['default'].create({
19311
18767
  template: {
19312
18768
  isHTMLBars: true,
18769
+ revision: 'Ember@1.11.0-beta.2',
19313
18770
  render: function(view, env, contextualElement, blockArguments) {
19314
18771
  for (var i = 0, l = keyNames.length; i < l; i++) {
19315
18772
  var keyName = keyNames[i];
@@ -19323,6 +18780,21 @@ enifed('ember-htmlbars/tests/system/render_view_test', ['ember-runtime/tests/uti
19323
18780
  utils.runAppend(view);
19324
18781
  });
19325
18782
 
18783
+ QUnit.test('Provides a helpful assertion if revisions do not match.', function() {
18784
+ view = EmberView['default'].create({
18785
+ template: {
18786
+ isHTMLBars: true,
18787
+ revision: 'Foo-Bar-Baz',
18788
+ render: function() { }
18789
+ }
18790
+ });
18791
+
18792
+ expectAssertion(function() {
18793
+ utils.runAppend(view);
18794
+ },
18795
+ /was compiled with `Foo-Bar-Baz`/);
18796
+ });
18797
+
19326
18798
  });
19327
18799
  enifed('ember-htmlbars/tests/system/render_view_test.jscs-test', function () {
19328
18800
 
@@ -19763,15 +19235,13 @@ enifed('ember-metal-views/tests/test_helpers', ['exports', 'ember-metal/platform
19763
19235
  }
19764
19236
  }
19765
19237
  if (view.childViews) {
19766
- view._childViewsMorph = this._dom.createMorph(el, null, null);
19238
+ view._childViewsMorph = this._dom.appendMorph(el);
19767
19239
  } else if (view.textContent) {
19768
19240
  setElementText(el, view.textContent);
19769
19241
  } else if (view.innerHTML) {
19770
19242
  this._dom.detectNamespace(el);
19771
- var nodes = this._dom.parseHTML(view.innerHTML, el);
19772
- while (nodes[0]) {
19773
- el.appendChild(nodes[0]);
19774
- }
19243
+ var frag = this._dom.parseHTML(view.innerHTML, el);
19244
+ el.appendChild(frag);
19775
19245
  }
19776
19246
  return el;
19777
19247
  };
@@ -22776,71 +22246,7 @@ enifed('ember-metal/tests/computed_test', ['ember-metal/core', 'ember-metal/test
22776
22246
  // improved-cp-syntax
22777
22247
  //
22778
22248
 
22779
- if (Ember['default'].FEATURES.isEnabled("new-computed-syntax")) {
22780
- QUnit.module('computed - improved cp syntax');
22781
-
22782
- QUnit.test('setter and getters are passed using an object', function() {
22783
- var testObj = Ember['default'].Object.extend({
22784
- a: '1',
22785
- b: '2',
22786
- aInt: computed.computed('a', {
22787
- get: function(keyName) {
22788
- equal(keyName, 'aInt', 'getter receives the keyName');
22789
- return parseInt(this.get('a'));
22790
- },
22791
- set: function(keyName, value, oldValue) {
22792
- equal(keyName, 'aInt', 'setter receives the keyName');
22793
- equal(value, 123, 'setter receives the new value');
22794
- equal(oldValue, 1, 'setter receives the old value');
22795
- this.set('a', ""+value); // side effect
22796
- return parseInt(this.get('a'));
22797
- }
22798
- })
22799
- }).create();
22800
-
22801
- ok(testObj.get('aInt') === 1, 'getter works');
22802
- testObj.set('aInt', 123);
22803
- ok(testObj.get('a') === '123', 'setter works');
22804
- ok(testObj.get('aInt') === 123, 'cp has been updated too');
22805
- });
22806
-
22807
- QUnit.test('setter can be omited', function() {
22808
- var testObj = Ember['default'].Object.extend({
22809
- a: '1',
22810
- b: '2',
22811
- aInt: computed.computed('a', {
22812
- get: function(keyName) {
22813
- equal(keyName, 'aInt', 'getter receives the keyName');
22814
- return parseInt(this.get('a'));
22815
- }
22816
- })
22817
- }).create();
22818
-
22819
- ok(testObj.get('aInt') === 1, 'getter works');
22820
- ok(testObj.get('a') === '1');
22821
- testObj.set('aInt', '123');
22822
- ok(testObj.get('aInt') === '123', 'cp has been updated too');
22823
- });
22824
-
22825
- QUnit.test('the return value of the setter gets cached', function() {
22826
- var testObj = Ember['default'].Object.extend({
22827
- a: '1',
22828
- sampleCP: computed.computed('a', {
22829
- get: function(keyName) {
22830
- ok(false, "The getter should not be invoked");
22831
- return 'get-value';
22832
- },
22833
- set: function(keyName, value, oldValue) {
22834
- return 'set-value';
22835
- }
22836
- })
22837
- }).create();
22838
-
22839
- testObj.set('sampleCP', 'abcd');
22840
- ok(testObj.get('sampleCP') === 'set-value', 'The return value of the CP was cached');
22841
- });
22842
- }
22843
-
22249
+
22844
22250
  // ..........................................................
22845
22251
  // BUGS
22846
22252
  //
@@ -31336,8 +30742,6 @@ enifed('ember-routing-htmlbars/tests/helpers/action_test', ['ember-metal/core',
31336
30742
  equal(watted, true, "The action was called on the right context");
31337
30743
  });
31338
30744
 
31339
- if (!Ember['default'].FEATURES.isEnabled('ember-htmlbars')) {
31340
- // jscs:disable validateIndentation
31341
30745
  QUnit.test("should target the current controller inside an {{each}} loop [DEPRECATED]", function() {
31342
30746
  var registeredTarget;
31343
30747
 
@@ -31360,7 +30764,7 @@ enifed('ember-routing-htmlbars/tests/helpers/action_test', ['ember-metal/core',
31360
30764
 
31361
30765
  view = EmberView['default'].create({
31362
30766
  controller: controller,
31363
- template: compile['default']('{{#each controller}}{{action "editTodo"}}{{/each}}')
30767
+ template: compile['default']('{{#each controller}}<button {{action "editTodo"}}>Edit</button>{{/each}}')
31364
30768
  });
31365
30769
 
31366
30770
  expectDeprecation(function() {
@@ -31369,8 +30773,6 @@ enifed('ember-routing-htmlbars/tests/helpers/action_test', ['ember-metal/core',
31369
30773
 
31370
30774
  equal(registeredTarget, itemController, "the item controller is the target of action");
31371
30775
  });
31372
- // jscs:enable validateIndentation
31373
- }
31374
30776
 
31375
30777
  QUnit.test("should target the with-controller inside an {{#with controller='person'}} [DEPRECATED]", function() {
31376
30778
  var registeredTarget;
@@ -32411,13 +31813,13 @@ enifed('ember-routing-htmlbars/tests/helpers/link-to_test.jshint', function () {
32411
31813
  });
32412
31814
 
32413
31815
  });
32414
- enifed('ember-routing-htmlbars/tests/helpers/outlet_test', ['ember-metal/core', 'ember-metal/run_loop', 'ember-runtime/system/namespace', 'ember-views/views/metamorph_view', 'ember-routing/ext/view', 'ember-views/views/container_view', 'ember-views/system/jquery', 'ember-routing-htmlbars/helpers/outlet', 'ember-template-compiler/system/compile', 'ember-htmlbars/helpers', 'ember-runtime/tests/utils', 'ember-routing-htmlbars/tests/utils'], function (Ember, run, Namespace, _MetamorphView, EmberView, EmberContainerView, jQuery, outlet, compile, helpers, utils, tests__utils) {
31816
+ enifed('ember-routing-htmlbars/tests/helpers/outlet_test', ['ember-metal/run_loop', 'ember-runtime/system/namespace', 'ember-views/views/view', 'ember-views/system/jquery', 'ember-routing-htmlbars/helpers/outlet', 'ember-template-compiler/system/compile', 'ember-htmlbars/helpers', 'ember-runtime/tests/utils', 'ember-routing-htmlbars/tests/utils'], function (run, Namespace, EmberView, jQuery, outlet, compile, helpers, utils, tests__utils) {
32415
31817
 
32416
31818
  'use strict';
32417
31819
 
32418
31820
  var trim = jQuery['default'].trim;
32419
31821
 
32420
- var view, registry, container, originalOutletHelper;
31822
+ var registry, container, originalOutletHelper, top;
32421
31823
 
32422
31824
  QUnit.module("ember-routing-htmlbars: {{outlet}} helper", {
32423
31825
  setup: function() {
@@ -32427,6 +31829,9 @@ enifed('ember-routing-htmlbars/tests/helpers/outlet_test', ['ember-metal/core',
32427
31829
  var namespace = Namespace['default'].create();
32428
31830
  registry = tests__utils.buildRegistry(namespace);
32429
31831
  container = registry.container();
31832
+
31833
+ var CoreOutlet = container.lookupFactory('view:core-outlet');
31834
+ top = CoreOutlet.create();
32430
31835
  },
32431
31836
 
32432
31837
  teardown: function() {
@@ -32434,301 +31839,231 @@ enifed('ember-routing-htmlbars/tests/helpers/outlet_test', ['ember-metal/core',
32434
31839
  helpers['default']['outlet'] = originalOutletHelper;
32435
31840
 
32436
31841
  utils.runDestroy(container);
32437
- utils.runDestroy(view);
32438
- registry = container = view = null;
31842
+ utils.runDestroy(top);
31843
+ registry = container = top = null;
32439
31844
  }
32440
31845
  });
32441
31846
 
32442
- QUnit.test("view should support connectOutlet for the main outlet", function() {
32443
- var template = "<h1>HI</h1>{{outlet}}";
32444
- view = EmberView['default'].create({
32445
- template: compile['default'](template)
32446
- });
31847
+ QUnit.test("view should render the outlet when set after dom insertion", function() {
31848
+ var routerState = withTemplate("<h1>HI</h1>{{outlet}}");
31849
+ top.setOutletState(routerState);
31850
+ utils.runAppend(top);
32447
31851
 
32448
- utils.runAppend(view);
31852
+ equal(top.$().text(), 'HI');
32449
31853
 
32450
- equal(view.$().text(), 'HI');
31854
+ routerState.outlets.main = withTemplate("<p>BYE</p>");
32451
31855
 
32452
31856
  run['default'](function() {
32453
- view.connectOutlet('main', EmberView['default'].create({
32454
- template: compile['default']("<p>BYE</p>")
32455
- }));
31857
+ top.setOutletState(routerState);
32456
31858
  });
32457
31859
 
32458
31860
  // Replace whitespace for older IE
32459
- equal(trim(view.$().text()), 'HIBYE');
31861
+ equal(trim(top.$().text()), 'HIBYE');
32460
31862
  });
32461
31863
 
32462
- QUnit.test("outlet should support connectOutlet in slots in prerender state", function() {
32463
- var template = "<h1>HI</h1>{{outlet}}";
32464
- view = EmberView['default'].create({
32465
- template: compile['default'](template)
32466
- });
32467
-
32468
- view.connectOutlet('main', EmberView['default'].create({
32469
- template: compile['default']("<p>BYE</p>")
32470
- }));
32471
-
32472
- utils.runAppend(view);
31864
+ QUnit.test("view should render the outlet when set before dom insertion", function() {
31865
+ var routerState = withTemplate("<h1>HI</h1>{{outlet}}");
31866
+ routerState.outlets.main = withTemplate("<p>BYE</p>");
31867
+ top.setOutletState(routerState);
31868
+ utils.runAppend(top);
32473
31869
 
32474
- equal(view.$().text(), 'HIBYE');
31870
+ // Replace whitespace for older IE
31871
+ equal(trim(top.$().text()), 'HIBYE');
32475
31872
  });
32476
31873
 
31874
+
32477
31875
  QUnit.test("outlet should support an optional name", function() {
32478
- var template = "<h1>HI</h1>{{outlet 'mainView'}}";
32479
- view = EmberView['default'].create({
32480
- template: compile['default'](template)
32481
- });
31876
+ var routerState = withTemplate("<h1>HI</h1>{{outlet 'mainView'}}");
31877
+ top.setOutletState(routerState);
31878
+ utils.runAppend(top);
32482
31879
 
32483
- utils.runAppend(view);
31880
+ equal(top.$().text(), 'HI');
32484
31881
 
32485
- equal(view.$().text(), 'HI');
31882
+ routerState.outlets.mainView = withTemplate("<p>BYE</p>");
32486
31883
 
32487
31884
  run['default'](function() {
32488
- view.connectOutlet('mainView', EmberView['default'].create({
32489
- template: compile['default']("<p>BYE</p>")
32490
- }));
31885
+ top.setOutletState(routerState);
32491
31886
  });
32492
31887
 
32493
31888
  // Replace whitespace for older IE
32494
- equal(trim(view.$().text()), 'HIBYE');
31889
+ equal(trim(top.$().text()), 'HIBYE');
32495
31890
  });
32496
31891
 
32497
31892
 
32498
31893
  QUnit.test("outlet should correctly lookup a view", function() {
32499
-
32500
- var template,
32501
- ContainerView,
32502
- childView;
32503
-
32504
- ContainerView = EmberContainerView['default'].extend();
32505
-
32506
- registry.register("view:containerView", ContainerView);
32507
-
32508
- template = "<h1>HI</h1>{{outlet view='containerView'}}";
32509
-
32510
- view = EmberView['default'].create({
32511
- template: compile['default'](template),
32512
- container : container
31894
+ var CoreOutlet = container.lookupFactory('view:core-outlet');
31895
+ var SpecialOutlet = CoreOutlet.extend({
31896
+ classNames: ['special']
32513
31897
  });
32514
31898
 
32515
- childView = EmberView['default'].create({
32516
- template: compile['default']("<p>BYE</p>")
32517
- });
31899
+ registry.register("view:special-outlet", SpecialOutlet);
32518
31900
 
32519
- utils.runAppend(view);
31901
+ var routerState = withTemplate("<h1>HI</h1>{{outlet view='special-outlet'}}");
31902
+ top.setOutletState(routerState);
31903
+ utils.runAppend(top);
32520
31904
 
32521
- equal(view.$().text(), 'HI');
31905
+ equal(top.$().text(), 'HI');
32522
31906
 
31907
+ routerState.outlets.main = withTemplate("<p>BYE</p>");
32523
31908
  run['default'](function() {
32524
- view.connectOutlet('main', childView);
31909
+ top.setOutletState(routerState);
32525
31910
  });
32526
31911
 
32527
- ok(ContainerView.detectInstance(childView._parentView), "The custom view class should be used for the outlet");
32528
-
32529
31912
  // Replace whitespace for older IE
32530
- equal(trim(view.$().text()), 'HIBYE');
32531
-
31913
+ equal(trim(top.$().text()), 'HIBYE');
31914
+ equal(top.$().find('.special').length, 1, "expected to find .special element");
32532
31915
  });
32533
31916
 
32534
31917
  QUnit.test("outlet should assert view is specified as a string", function() {
32535
-
32536
- var template = "<h1>HI</h1>{{outlet view=containerView}}";
31918
+ top.setOutletState(withTemplate("<h1>HI</h1>{{outlet view=containerView}}"));
32537
31919
 
32538
31920
  expectAssertion(function () {
32539
-
32540
- view = EmberView['default'].create({
32541
- template: compile['default'](template),
32542
- container : container
32543
- });
32544
-
32545
- utils.runAppend(view);
32546
-
32547
- });
31921
+ utils.runAppend(top);
31922
+ }, /Using a quoteless view parameter with {{outlet}} is not supported/);
32548
31923
 
32549
31924
  });
32550
31925
 
32551
31926
  QUnit.test("outlet should assert view path is successfully resolved", function() {
32552
-
32553
- var template = "<h1>HI</h1>{{outlet view='someViewNameHere'}}";
31927
+ top.setOutletState(withTemplate("<h1>HI</h1>{{outlet view='someViewNameHere'}}"));
32554
31928
 
32555
31929
  expectAssertion(function () {
32556
-
32557
- view = EmberView['default'].create({
32558
- template: compile['default'](template),
32559
- container : container
32560
- });
32561
-
32562
- utils.runAppend(view);
32563
-
32564
- });
31930
+ utils.runAppend(top);
31931
+ }, "The view name you supplied 'someViewNameHere' did not resolve to a view.");
32565
31932
 
32566
31933
  });
32567
31934
 
32568
31935
  QUnit.test("outlet should support an optional view class", function() {
32569
- var template = "<h1>HI</h1>{{outlet viewClass=view.outletView}}";
32570
- view = EmberView['default'].create({
32571
- template: compile['default'](template),
32572
- outletView: EmberContainerView['default'].extend()
32573
- });
31936
+ var CoreOutlet = container.lookupFactory('view:core-outlet');
31937
+ var SpecialOutlet = CoreOutlet.extend({
31938
+ classNames: ['very-special']
31939
+ });
31940
+ var routerState = {
31941
+ render: {
31942
+ ViewClass: EmberView['default'].extend({
31943
+ template: compile['default']("<h1>HI</h1>{{outlet viewClass=view.outletView}}"),
31944
+ outletView: SpecialOutlet
31945
+ })
31946
+ },
31947
+ outlets: {}
31948
+ };
31949
+ top.setOutletState(routerState);
32574
31950
 
32575
- utils.runAppend(view);
31951
+ utils.runAppend(top);
32576
31952
 
32577
- equal(view.$().text(), 'HI');
31953
+ equal(top.$().text(), 'HI');
31954
+ equal(top.$().find('.very-special').length, 1, "Should find .very-special");
32578
31955
 
32579
- var childView = EmberView['default'].create({
32580
- template: compile['default']("<p>BYE</p>")
32581
- });
31956
+ routerState.outlets.main = withTemplate("<p>BYE</p>");
32582
31957
 
32583
31958
  run['default'](function() {
32584
- view.connectOutlet('main', childView);
31959
+ top.setOutletState(routerState);
32585
31960
  });
32586
31961
 
32587
- ok(view.outletView.detectInstance(childView._parentView), "The custom view class should be used for the outlet");
32588
-
32589
31962
  // Replace whitespace for older IE
32590
- equal(trim(view.$().text()), 'HIBYE');
31963
+ equal(trim(top.$().text()), 'HIBYE');
32591
31964
  });
32592
31965
 
32593
31966
 
32594
31967
  QUnit.test("Outlets bind to the current view, not the current concrete view", function() {
32595
- var parentTemplate = "<h1>HI</h1>{{outlet}}";
32596
- var middleTemplate = "<h2>MIDDLE</h2>{{outlet}}";
32597
- var bottomTemplate = "<h3>BOTTOM</h3>";
32598
-
32599
- view = EmberView['default'].create({
32600
- template: compile['default'](parentTemplate)
32601
- });
32602
-
32603
- var middleView = _MetamorphView['default'].create({
32604
- template: compile['default'](middleTemplate)
32605
- });
32606
-
32607
- var bottomView = _MetamorphView['default'].create({
32608
- template: compile['default'](bottomTemplate)
32609
- });
32610
-
32611
- utils.runAppend(view);
32612
-
31968
+ var routerState = withTemplate("<h1>HI</h1>{{outlet}}");
31969
+ top.setOutletState(routerState);
31970
+ utils.runAppend(top);
31971
+ routerState.outlets.main = withTemplate("<h2>MIDDLE</h2>{{outlet}}");
32613
31972
  run['default'](function() {
32614
- view.connectOutlet('main', middleView);
31973
+ top.setOutletState(routerState);
32615
31974
  });
32616
-
31975
+ routerState.outlets.main.outlets.main = withTemplate("<h3>BOTTOM</h3>");
32617
31976
  run['default'](function() {
32618
- middleView.connectOutlet('main', bottomView);
31977
+ top.setOutletState(routerState);
32619
31978
  });
32620
31979
 
32621
31980
  var output = jQuery['default']('#qunit-fixture h1 ~ h2 ~ h3').text();
32622
31981
  equal(output, "BOTTOM", "all templates were rendered");
32623
31982
  });
32624
31983
 
32625
- QUnit.test("view should support disconnectOutlet for the main outlet", function() {
32626
- var template = "<h1>HI</h1>{{outlet}}";
32627
- view = EmberView['default'].create({
32628
- template: compile['default'](template)
32629
- });
32630
-
32631
- utils.runAppend(view);
32632
-
32633
- equal(view.$().text(), 'HI');
32634
-
32635
- run['default'](function() {
32636
- view.connectOutlet('main', EmberView['default'].create({
32637
- template: compile['default']("<p>BYE</p>")
32638
- }));
32639
- });
32640
-
32641
- // Replace whitespace for older IE
32642
- equal(trim(view.$().text()), 'HIBYE');
32643
-
32644
- run['default'](function() {
32645
- view.disconnectOutlet('main');
32646
- });
32647
-
32648
- // Replace whitespace for older IE
32649
- equal(trim(view.$().text()), 'HI');
32650
- });
32651
-
32652
- // TODO: Remove flag when {{with}} is fixed.
32653
- if (!Ember['default'].FEATURES.isEnabled('ember-htmlbars')) {
32654
- // jscs:disable validateIndentation
32655
-
32656
31984
  QUnit.test("Outlets bind to the current template's view, not inner contexts [DEPRECATED]", function() {
32657
- var parentTemplate = "<h1>HI</h1>{{#if view.alwaysTrue}}{{#with this}}{{outlet}}{{/with}}{{/if}}";
31985
+ var parentTemplate = "<h1>HI</h1>{{#if view.alwaysTrue}}{{outlet}}{{/if}}";
32658
31986
  var bottomTemplate = "<h3>BOTTOM</h3>";
32659
31987
 
32660
- view = EmberView['default'].create({
32661
- alwaysTrue: true,
32662
- template: compile['default'](parentTemplate)
32663
- });
31988
+ var routerState = {
31989
+ render: {
31990
+ ViewClass: EmberView['default'].extend({
31991
+ alwaysTrue: true,
31992
+ template: compile['default'](parentTemplate)
31993
+ })
31994
+ },
31995
+ outlets: {}
31996
+ };
32664
31997
 
32665
- var bottomView = _MetamorphView['default'].create({
32666
- template: compile['default'](bottomTemplate)
32667
- });
31998
+ top.setOutletState(routerState);
32668
31999
 
32669
- expectDeprecation(function() {
32670
- utils.runAppend(view);
32671
- }, 'Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead.');
32000
+ utils.runAppend(top);
32001
+
32002
+ routerState.outlets.main = withTemplate(bottomTemplate);
32672
32003
 
32673
32004
  run['default'](function() {
32674
- view.connectOutlet('main', bottomView);
32005
+ top.setOutletState(routerState);
32675
32006
  });
32676
32007
 
32677
32008
  var output = jQuery['default']('#qunit-fixture h1 ~ h3').text();
32678
32009
  equal(output, "BOTTOM", "all templates were rendered");
32679
32010
  });
32680
32011
 
32681
- // jscs:enable validateIndentation
32682
- }
32683
-
32684
32012
  QUnit.test("should support layouts", function() {
32685
32013
  var template = "{{outlet}}";
32686
32014
  var layout = "<h1>HI</h1>{{yield}}";
32015
+ var routerState = {
32016
+ render: {
32017
+ ViewClass: EmberView['default'].extend({
32018
+ template: compile['default'](template),
32019
+ layout: compile['default'](layout)
32020
+ })
32021
+ },
32022
+ outlets: {}
32023
+ };
32024
+ top.setOutletState(routerState);
32025
+ utils.runAppend(top);
32687
32026
 
32688
- view = EmberView['default'].create({
32689
- template: compile['default'](template),
32690
- layout: compile['default'](layout)
32691
- });
32692
-
32693
- utils.runAppend(view);
32027
+ equal(top.$().text(), 'HI');
32694
32028
 
32695
- equal(view.$().text(), 'HI');
32029
+ routerState.outlets.main = withTemplate("<p>BYE</p>");
32696
32030
 
32697
32031
  run['default'](function() {
32698
- view.connectOutlet('main', EmberView['default'].create({
32699
- template: compile['default']("<p>BYE</p>")
32700
- }));
32032
+ top.setOutletState(routerState);
32701
32033
  });
32034
+
32702
32035
  // Replace whitespace for older IE
32703
- equal(trim(view.$().text()), 'HIBYE');
32036
+ equal(trim(top.$().text()), 'HIBYE');
32704
32037
  });
32705
32038
 
32706
32039
  QUnit.test("should not throw deprecations if {{outlet}} is used without a name", function() {
32707
32040
  expectNoDeprecation();
32708
- view = EmberView['default'].create({
32709
- template: compile['default']("{{outlet}}")
32710
- });
32711
- utils.runAppend(view);
32041
+ top.setOutletState(withTemplate("{{outlet}}"));
32042
+ utils.runAppend(top);
32712
32043
  });
32713
32044
 
32714
32045
  QUnit.test("should not throw deprecations if {{outlet}} is used with a quoted name", function() {
32715
32046
  expectNoDeprecation();
32716
- view = EmberView['default'].create({
32717
- template: compile['default']("{{outlet \"foo\"}}")
32718
- });
32719
- utils.runAppend(view);
32047
+ top.setOutletState(withTemplate("{{outlet \"foo\"}}"));
32048
+ utils.runAppend(top);
32720
32049
  });
32721
32050
 
32722
-
32723
- QUnit.test("should throw an assertion if {{outlet}} used with unquoted name", function() {
32724
- view = EmberView['default'].create({
32725
- template: compile['default']("{{outlet foo}}")
32726
- });
32727
- expectAssertion(function() {
32728
- utils.runAppend(view);
32729
- }, "Using {{outlet}} with an unquoted name is not supported.");
32730
- });
32731
-
32051
+ QUnit.test("should throw an assertion if {{outlet}} used with unquoted name", function() {
32052
+ top.setOutletState(withTemplate("{{outlet foo}}"));
32053
+ expectAssertion(function() {
32054
+ utils.runAppend(top);
32055
+ }, "Using {{outlet}} with an unquoted name is not supported.");
32056
+ });
32057
+
32058
+ function withTemplate(string) {
32059
+ return {
32060
+ render: {
32061
+ template: compile['default'](string)
32062
+ },
32063
+ outlets: {}
32064
+ };
32065
+ }
32066
+
32732
32067
  });
32733
32068
  enifed('ember-routing-htmlbars/tests/helpers/outlet_test.jscs-test', function () {
32734
32069
 
@@ -32750,7 +32085,7 @@ enifed('ember-routing-htmlbars/tests/helpers/outlet_test.jshint', function () {
32750
32085
  });
32751
32086
 
32752
32087
  });
32753
- enifed('ember-routing-htmlbars/tests/helpers/render_test', ['ember-metal/core', 'ember-metal/property_set', 'ember-metal/run_loop', 'ember-metal/platform/define_property', 'ember-metal/mixin', 'ember-runtime/system/namespace', 'ember-runtime/controllers/controller', 'ember-runtime/controllers/array_controller', 'ember-htmlbars/helpers', 'ember-template-compiler/system/compile', 'ember-routing/ext/view', 'ember-views/system/jquery', 'ember-views/system/action_manager', 'ember-routing-htmlbars/helpers/render', 'ember-routing-htmlbars/helpers/action', 'ember-routing-htmlbars/helpers/outlet', 'ember-routing-htmlbars/tests/utils', 'ember-runtime/tests/utils'], function (Ember, property_set, run, define_property, mixin, Namespace, controllers__controller, EmberArrayController, helpers, compile, EmberView, jQuery, ActionManager, render, helpers__action, outlet, utils, tests__utils) {
32088
+ enifed('ember-routing-htmlbars/tests/helpers/render_test', ['ember-metal/core', 'ember-metal/property_set', 'ember-metal/run_loop', 'ember-metal/platform/define_property', 'ember-metal/mixin', 'ember-runtime/system/namespace', 'ember-runtime/controllers/controller', 'ember-runtime/controllers/array_controller', 'ember-htmlbars/helpers', 'ember-template-compiler/system/compile', 'ember-views/views/view', 'ember-views/system/jquery', 'ember-views/system/action_manager', 'ember-routing-htmlbars/helpers/render', 'ember-routing-htmlbars/helpers/action', 'ember-routing-htmlbars/helpers/outlet', 'ember-routing-htmlbars/tests/utils', 'ember-runtime/tests/utils'], function (Ember, property_set, run, define_property, mixin, Namespace, controllers__controller, EmberArrayController, helpers, compile, EmberView, jQuery, ActionManager, render, helpers__action, outlet, utils, tests__utils) {
32754
32089
 
32755
32090
  'use strict';
32756
32091
 
@@ -33157,30 +32492,40 @@ enifed('ember-routing-htmlbars/tests/helpers/render_test', ['ember-metal/core',
33157
32492
  });
33158
32493
 
33159
32494
  QUnit.test("{{render}} helper should be able to render a template again when it was removed", function() {
33160
- var template = "<h1>HI</h1>{{outlet}}";
33161
32495
  var controller = controllers__controller["default"].extend({ container: container });
33162
- view = EmberView['default'].create({
33163
- template: compile['default'](template)
33164
- });
32496
+ var CoreOutlet = container.lookupFactory('view:core-outlet');
32497
+ view = CoreOutlet.create();
32498
+ tests__utils.runAppend(view);
33165
32499
 
33166
32500
  Ember['default'].TEMPLATES['home'] = compile['default']("<p>BYE</p>");
33167
32501
 
33168
- tests__utils.runAppend(view);
32502
+ var liveRoutes = {
32503
+ render: {
32504
+ template: compile['default']("<h1>HI</h1>{{outlet}}")
32505
+ },
32506
+ outlets: {}
32507
+ };
33169
32508
 
33170
32509
  run['default'](function() {
33171
- view.connectOutlet('main', EmberView['default'].create({
33172
- controller: controller.create(),
33173
- template: compile['default']("<div>1{{render 'home'}}</div>")
33174
- }));
32510
+ liveRoutes.outlets.main = {
32511
+ render: {
32512
+ controller: controller.create(),
32513
+ template: compile['default']("<div>1{{render 'home'}}</div>")
32514
+ }
32515
+ };
32516
+ view.setOutletState(liveRoutes);
33175
32517
  });
33176
32518
 
33177
32519
  equal(view.$().text(), 'HI1BYE');
33178
32520
 
33179
32521
  run['default'](function() {
33180
- view.connectOutlet('main', EmberView['default'].create({
33181
- controller: controller.create(),
33182
- template: compile['default']("<div>2{{render 'home'}}</div>")
33183
- }));
32522
+ liveRoutes.outlets.main = {
32523
+ render: {
32524
+ controller: controller.create(),
32525
+ template: compile['default']("<div>2{{render 'home'}}</div>")
32526
+ }
32527
+ };
32528
+ view.setOutletState(liveRoutes);
33184
32529
  });
33185
32530
 
33186
32531
  equal(view.$().text(), 'HI2BYE');
@@ -33226,9 +32571,6 @@ enifed('ember-routing-htmlbars/tests/helpers/render_test', ['ember-metal/core',
33226
32571
  equal(container.lookup('controller:blog.post'), renderedView.get('controller'), 'rendered with correct controller');
33227
32572
  });
33228
32573
 
33229
-
33230
- // jscs:disable validateIndentation
33231
-
33232
32574
  QUnit.test("throws an assertion if {{render}} is called with an unquoted template name", function() {
33233
32575
  var template = '<h1>HI</h1>{{render home}}';
33234
32576
  var controller = controllers__controller["default"].extend({ container: container });
@@ -33259,8 +32601,6 @@ enifed('ember-routing-htmlbars/tests/helpers/render_test', ['ember-metal/core',
33259
32601
  }, "The second argument of {{render}} must be a path, e.g. {{render \"post\" post}}.");
33260
32602
  });
33261
32603
 
33262
- // jscs:enable validateIndentation
33263
-
33264
32604
  });
33265
32605
  enifed('ember-routing-htmlbars/tests/helpers/render_test.jscs-test', function () {
33266
32606
 
@@ -33282,7 +32622,7 @@ enifed('ember-routing-htmlbars/tests/helpers/render_test.jshint', function () {
33282
32622
  });
33283
32623
 
33284
32624
  });
33285
- enifed('ember-routing-htmlbars/tests/utils', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-runtime/system/string', 'container/registry', 'ember-runtime/controllers/controller', 'ember-runtime/controllers/object_controller', 'ember-runtime/controllers/array_controller', 'ember-views/views/metamorph_view', 'ember-routing/system/router', 'ember-routing/location/hash_location'], function (exports, property_get, property_set, string, Registry, Controller, ObjectController, ArrayController, _MetamorphView, EmberRouter, HashLocation) {
32625
+ enifed('ember-routing-htmlbars/tests/utils', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-runtime/system/string', 'container/registry', 'ember-runtime/controllers/controller', 'ember-runtime/controllers/object_controller', 'ember-runtime/controllers/array_controller', 'ember-views/views/metamorph_view', 'ember-views/views/view', 'ember-routing/system/router', 'ember-routing-views/views/outlet', 'ember-routing/location/hash_location'], function (exports, property_get, property_set, string, Registry, Controller, ObjectController, ArrayController, _MetamorphView, EmberView, EmberRouter, outlet, HashLocation) {
33286
32626
 
33287
32627
  'use strict';
33288
32628
 
@@ -33326,6 +32666,9 @@ enifed('ember-routing-htmlbars/tests/utils', ['exports', 'ember-metal/property_g
33326
32666
  registry.register("controller:array", ArrayController['default'], { instantiate: false });
33327
32667
 
33328
32668
  registry.register("view:default", _MetamorphView['default']);
32669
+ registry.register("view:toplevel", EmberView['default'].extend());
32670
+ registry.register("view:-outlet", outlet.OutletView);
32671
+ registry.register("view:core-outlet", outlet.CoreOutletView);
33329
32672
  registry.register("router:main", EmberRouter['default'].extend());
33330
32673
 
33331
32674
  registry.typeInjection("route", "router", "router:main");
@@ -33374,7 +32717,7 @@ enifed('ember-routing-views.jshint', function () {
33374
32717
  });
33375
32718
 
33376
32719
  });
33377
- enifed('ember-routing-views/tests/main_test', ['ember-routing-views', 'ember-metal/core'], function (__dep0__, Ember) {
32720
+ enifed('ember-routing-views/tests/main_test', ['ember-metal/core'], function (Ember) {
33378
32721
 
33379
32722
  'use strict';
33380
32723
 
@@ -33505,26 +32848,6 @@ enifed('ember-routing/ext/run_loop.jshint', function () {
33505
32848
  ok(true, 'ember-routing/ext/run_loop.js should pass jshint.');
33506
32849
  });
33507
32850
 
33508
- });
33509
- enifed('ember-routing/ext/view.jscs-test', function () {
33510
-
33511
- 'use strict';
33512
-
33513
- module('JSCS - ember-routing/ext');
33514
- test('ember-routing/ext/view.js should pass jscs', function() {
33515
- ok(true, 'ember-routing/ext/view.js should pass jscs.');
33516
- });
33517
-
33518
- });
33519
- enifed('ember-routing/ext/view.jshint', function () {
33520
-
33521
- 'use strict';
33522
-
33523
- module('JSHint - ember-routing/ext');
33524
- test('ember-routing/ext/view.js should pass jshint', function() {
33525
- ok(true, 'ember-routing/ext/view.js should pass jshint.');
33526
- });
33527
-
33528
32851
  });
33529
32852
  enifed('ember-routing/location/api.jscs-test', function () {
33530
32853
 
@@ -54488,9 +53811,6 @@ enifed('ember-template-compiler/tests/system/compile_test', ['ember-template-com
54488
53811
 
54489
53812
  'use strict';
54490
53813
 
54491
-
54492
- // jscs:disable validateIndentation
54493
-
54494
53814
  QUnit.module('ember-htmlbars: compile');
54495
53815
 
54496
53816
  QUnit.test('compiles the provided template with htmlbars', function() {
@@ -54511,8 +53831,22 @@ enifed('ember-template-compiler/tests/system/compile_test', ['ember-template-com
54511
53831
  ok(actual.isMethod === false, 'sets isMethod via template function');
54512
53832
  });
54513
53833
 
54514
- // jscs:enable validateIndentation
54515
-
53834
+ QUnit.test('includes the current revision in the compiled template', function() {
53835
+ var templateString = "{{foo}} -- {{some-bar blah='foo'}}";
53836
+
53837
+ var actual = compile['default'](templateString);
53838
+
53839
+ equal(actual.revision, 'Ember@1.11.0-beta.2', 'revision is included in generated template');
53840
+ });
53841
+
53842
+ QUnit.test('the template revision is different than the HTMLBars default revision', function() {
53843
+ var templateString = "{{foo}} -- {{some-bar blah='foo'}}";
53844
+
53845
+ var actual = compile['default'](templateString);
53846
+ var expected = compiler.compile(templateString);
53847
+
53848
+ ok(actual.revision !== expected.revision, 'revision differs from default');
53849
+ });
54516
53850
 
54517
53851
  });
54518
53852
  enifed('ember-template-compiler/tests/system/compile_test.jscs-test', function () {
@@ -54539,9 +53873,6 @@ enifed('ember-template-compiler/tests/system/template_test', ['ember-template-co
54539
53873
 
54540
53874
  'use strict';
54541
53875
 
54542
-
54543
- // jscs:disable validateIndentation
54544
-
54545
53876
  QUnit.module('ember-htmlbars: template');
54546
53877
 
54547
53878
  QUnit.test('sets `isTop` on the provided function', function() {
@@ -54560,9 +53891,6 @@ enifed('ember-template-compiler/tests/system/template_test', ['ember-template-co
54560
53891
  equal(test.isMethod, false, 'sets isMethod on the provided function');
54561
53892
  });
54562
53893
 
54563
- // jscs:enable validateIndentation
54564
-
54565
-
54566
53894
  });
54567
53895
  enifed('ember-template-compiler/tests/system/template_test.jscs-test', function () {
54568
53896
 
@@ -55450,11 +54778,7 @@ enifed('ember-testing/tests/helpers_test', ['ember-metal/core', 'ember-metal/run
55450
54778
  checkHelperPresent('wait', expected);
55451
54779
  checkHelperPresent('triggerEvent', expected);
55452
54780
 
55453
- if (Ember['default'].FEATURES.isEnabled('ember-testing-checkbox-helpers')) {
55454
- checkHelperPresent('check', expected);
55455
- checkHelperPresent('uncheck', expected);
55456
- }
55457
- }
54781
+ }
55458
54782
 
55459
54783
  function assertNoHelpers(application, helperContainer) {
55460
54784
  assertHelpers(application, helperContainer, false);
@@ -55973,94 +55297,7 @@ enifed('ember-testing/tests/helpers_test', ['ember-metal/core', 'ember-metal/run
55973
55297
  });
55974
55298
  });
55975
55299
 
55976
- if (Ember['default'].FEATURES.isEnabled('ember-testing-checkbox-helpers')) {
55977
- QUnit.test("`check` ensures checkboxes are `checked` state for checkboxes", function() {
55978
- expect(2);
55979
- var check, find, visit, andThen;
55980
-
55981
- App.IndexView = EmberView['default'].extend({
55982
- template: compile['default']('<input type="checkbox" id="unchecked"><input type="checkbox" id="checked" checked>')
55983
- });
55984
-
55985
- run['default'](App, App.advanceReadiness);
55986
-
55987
- check = App.testHelpers.check;
55988
- find = App.testHelpers.find;
55989
- visit = App.testHelpers.visit;
55990
- andThen = App.testHelpers.andThen;
55991
-
55992
- visit('/');
55993
- check('#unchecked');
55994
- check('#checked');
55995
- andThen(function() {
55996
- equal(find('#unchecked').is(":checked"), true, "can check an unchecked checkbox");
55997
- equal(find('#checked').is(":checked"), true, "can check a checked checkbox");
55998
- });
55999
- });
56000
-
56001
- QUnit.test("`uncheck` ensures checkboxes are not `checked`", function() {
56002
- expect(2);
56003
- var uncheck, find, visit, andThen;
56004
-
56005
- App.IndexView = EmberView['default'].extend({
56006
- template: compile['default']('<input type="checkbox" id="unchecked"><input type="checkbox" id="checked" checked>')
56007
- });
56008
-
56009
- run['default'](App, App.advanceReadiness);
56010
-
56011
- uncheck = App.testHelpers.uncheck;
56012
- find = App.testHelpers.find;
56013
- visit = App.testHelpers.visit;
56014
- andThen = App.testHelpers.andThen;
56015
-
56016
- visit('/');
56017
- uncheck('#unchecked');
56018
- uncheck('#checked');
56019
- andThen(function() {
56020
- equal(find('#unchecked').is(":checked"), false, "can uncheck an unchecked checkbox");
56021
- equal(find('#checked').is(":checked"), false, "can uncheck a checked checkbox");
56022
- });
56023
- });
56024
-
56025
- QUnit.test("`check` asserts the selected inputs are checkboxes", function() {
56026
- var check, visit;
56027
-
56028
- App.IndexView = EmberView['default'].extend({
56029
- template: compile['default']('<input type="text" id="text">')
56030
- });
56031
-
56032
- run['default'](App, App.advanceReadiness);
56033
-
56034
- check = App.testHelpers.check;
56035
- visit = App.testHelpers.visit;
56036
-
56037
- visit('/').then(function() {
56038
- expectAssertion(function() {
56039
- check('#text');
56040
- }, /must be a checkbox/);
56041
- });
56042
- });
56043
-
56044
- QUnit.test("`uncheck` asserts the selected inputs are checkboxes", function() {
56045
- var visit, uncheck;
56046
-
56047
- App.IndexView = EmberView['default'].extend({
56048
- template: compile['default']('<input type="text" id="text">')
56049
- });
56050
-
56051
- run['default'](App, App.advanceReadiness);
56052
-
56053
- visit = App.testHelpers.visit;
56054
- uncheck = App.testHelpers.uncheck;
56055
-
56056
- visit('/').then(function() {
56057
- expectAssertion(function() {
56058
- uncheck('#text');
56059
- }, /must be a checkbox/);
56060
- });
56061
- });
56062
- }
56063
-
55300
+
56064
55301
  QUnit.test("`triggerEvent accepts an optional options hash and context", function() {
56065
55302
  expect(3);
56066
55303
 
@@ -56638,6 +55875,46 @@ enifed('ember-views/component_lookup.jshint', function () {
56638
55875
  ok(true, 'ember-views/component_lookup.js should pass jshint.');
56639
55876
  });
56640
55877
 
55878
+ });
55879
+ enifed('ember-views/mixins/attribute_bindings_support.jscs-test', function () {
55880
+
55881
+ 'use strict';
55882
+
55883
+ module('JSCS - ember-views/mixins');
55884
+ test('ember-views/mixins/attribute_bindings_support.js should pass jscs', function() {
55885
+ ok(true, 'ember-views/mixins/attribute_bindings_support.js should pass jscs.');
55886
+ });
55887
+
55888
+ });
55889
+ enifed('ember-views/mixins/attribute_bindings_support.jshint', function () {
55890
+
55891
+ 'use strict';
55892
+
55893
+ module('JSHint - ember-views/mixins');
55894
+ test('ember-views/mixins/attribute_bindings_support.js should pass jshint', function() {
55895
+ ok(true, 'ember-views/mixins/attribute_bindings_support.js should pass jshint.');
55896
+ });
55897
+
55898
+ });
55899
+ enifed('ember-views/mixins/class_names_support.jscs-test', function () {
55900
+
55901
+ 'use strict';
55902
+
55903
+ module('JSCS - ember-views/mixins');
55904
+ test('ember-views/mixins/class_names_support.js should pass jscs', function() {
55905
+ ok(true, 'ember-views/mixins/class_names_support.js should pass jscs.');
55906
+ });
55907
+
55908
+ });
55909
+ enifed('ember-views/mixins/class_names_support.jshint', function () {
55910
+
55911
+ 'use strict';
55912
+
55913
+ module('JSHint - ember-views/mixins');
55914
+ test('ember-views/mixins/class_names_support.js should pass jshint', function() {
55915
+ ok(true, 'ember-views/mixins/class_names_support.js should pass jshint.');
55916
+ });
55917
+
56641
55918
  });
56642
55919
  enifed('ember-views/mixins/component_template_deprecation.jscs-test', function () {
56643
55920
 
@@ -56658,6 +55935,46 @@ enifed('ember-views/mixins/component_template_deprecation.jshint', function () {
56658
55935
  ok(true, 'ember-views/mixins/component_template_deprecation.js should pass jshint.');
56659
55936
  });
56660
55937
 
55938
+ });
55939
+ enifed('ember-views/mixins/instrumentation_support.jscs-test', function () {
55940
+
55941
+ 'use strict';
55942
+
55943
+ module('JSCS - ember-views/mixins');
55944
+ test('ember-views/mixins/instrumentation_support.js should pass jscs', function() {
55945
+ ok(true, 'ember-views/mixins/instrumentation_support.js should pass jscs.');
55946
+ });
55947
+
55948
+ });
55949
+ enifed('ember-views/mixins/instrumentation_support.jshint', function () {
55950
+
55951
+ 'use strict';
55952
+
55953
+ module('JSHint - ember-views/mixins');
55954
+ test('ember-views/mixins/instrumentation_support.js should pass jshint', function() {
55955
+ ok(true, 'ember-views/mixins/instrumentation_support.js should pass jshint.');
55956
+ });
55957
+
55958
+ });
55959
+ enifed('ember-views/mixins/legacy_view_support.jscs-test', function () {
55960
+
55961
+ 'use strict';
55962
+
55963
+ module('JSCS - ember-views/mixins');
55964
+ test('ember-views/mixins/legacy_view_support.js should pass jscs', function() {
55965
+ ok(true, 'ember-views/mixins/legacy_view_support.js should pass jscs.');
55966
+ });
55967
+
55968
+ });
55969
+ enifed('ember-views/mixins/legacy_view_support.jshint', function () {
55970
+
55971
+ 'use strict';
55972
+
55973
+ module('JSHint - ember-views/mixins');
55974
+ test('ember-views/mixins/legacy_view_support.js should pass jshint', function() {
55975
+ ok(true, 'ember-views/mixins/legacy_view_support.js should pass jshint.');
55976
+ });
55977
+
56661
55978
  });
56662
55979
  enifed('ember-views/mixins/normalized_rerender_if_needed.jscs-test', function () {
56663
55980
 
@@ -56678,6 +55995,26 @@ enifed('ember-views/mixins/normalized_rerender_if_needed.jshint', function () {
56678
55995
  ok(true, 'ember-views/mixins/normalized_rerender_if_needed.js should pass jshint.');
56679
55996
  });
56680
55997
 
55998
+ });
55999
+ enifed('ember-views/mixins/template_rendering_support.jscs-test', function () {
56000
+
56001
+ 'use strict';
56002
+
56003
+ module('JSCS - ember-views/mixins');
56004
+ test('ember-views/mixins/template_rendering_support.js should pass jscs', function() {
56005
+ ok(true, 'ember-views/mixins/template_rendering_support.js should pass jscs.');
56006
+ });
56007
+
56008
+ });
56009
+ enifed('ember-views/mixins/template_rendering_support.jshint', function () {
56010
+
56011
+ 'use strict';
56012
+
56013
+ module('JSHint - ember-views/mixins');
56014
+ test('ember-views/mixins/template_rendering_support.js should pass jshint', function() {
56015
+ ok(true, 'ember-views/mixins/template_rendering_support.js should pass jshint.');
56016
+ });
56017
+
56681
56018
  });
56682
56019
  enifed('ember-views/mixins/text_support.jscs-test', function () {
56683
56020
 
@@ -56698,6 +56035,106 @@ enifed('ember-views/mixins/text_support.jshint', function () {
56698
56035
  ok(true, 'ember-views/mixins/text_support.js should pass jshint.');
56699
56036
  });
56700
56037
 
56038
+ });
56039
+ enifed('ember-views/mixins/view_child_views_support.jscs-test', function () {
56040
+
56041
+ 'use strict';
56042
+
56043
+ module('JSCS - ember-views/mixins');
56044
+ test('ember-views/mixins/view_child_views_support.js should pass jscs', function() {
56045
+ ok(true, 'ember-views/mixins/view_child_views_support.js should pass jscs.');
56046
+ });
56047
+
56048
+ });
56049
+ enifed('ember-views/mixins/view_child_views_support.jshint', function () {
56050
+
56051
+ 'use strict';
56052
+
56053
+ module('JSHint - ember-views/mixins');
56054
+ test('ember-views/mixins/view_child_views_support.js should pass jshint', function() {
56055
+ ok(true, 'ember-views/mixins/view_child_views_support.js should pass jshint.');
56056
+ });
56057
+
56058
+ });
56059
+ enifed('ember-views/mixins/view_context_support.jscs-test', function () {
56060
+
56061
+ 'use strict';
56062
+
56063
+ module('JSCS - ember-views/mixins');
56064
+ test('ember-views/mixins/view_context_support.js should pass jscs', function() {
56065
+ ok(true, 'ember-views/mixins/view_context_support.js should pass jscs.');
56066
+ });
56067
+
56068
+ });
56069
+ enifed('ember-views/mixins/view_context_support.jshint', function () {
56070
+
56071
+ 'use strict';
56072
+
56073
+ module('JSHint - ember-views/mixins');
56074
+ test('ember-views/mixins/view_context_support.js should pass jshint', function() {
56075
+ ok(true, 'ember-views/mixins/view_context_support.js should pass jshint.');
56076
+ });
56077
+
56078
+ });
56079
+ enifed('ember-views/mixins/view_keyword_support.jscs-test', function () {
56080
+
56081
+ 'use strict';
56082
+
56083
+ module('JSCS - ember-views/mixins');
56084
+ test('ember-views/mixins/view_keyword_support.js should pass jscs', function() {
56085
+ ok(true, 'ember-views/mixins/view_keyword_support.js should pass jscs.');
56086
+ });
56087
+
56088
+ });
56089
+ enifed('ember-views/mixins/view_keyword_support.jshint', function () {
56090
+
56091
+ 'use strict';
56092
+
56093
+ module('JSHint - ember-views/mixins');
56094
+ test('ember-views/mixins/view_keyword_support.js should pass jshint', function() {
56095
+ ok(true, 'ember-views/mixins/view_keyword_support.js should pass jshint.');
56096
+ });
56097
+
56098
+ });
56099
+ enifed('ember-views/mixins/view_state_support.jscs-test', function () {
56100
+
56101
+ 'use strict';
56102
+
56103
+ module('JSCS - ember-views/mixins');
56104
+ test('ember-views/mixins/view_state_support.js should pass jscs', function() {
56105
+ ok(true, 'ember-views/mixins/view_state_support.js should pass jscs.');
56106
+ });
56107
+
56108
+ });
56109
+ enifed('ember-views/mixins/view_state_support.jshint', function () {
56110
+
56111
+ 'use strict';
56112
+
56113
+ module('JSHint - ember-views/mixins');
56114
+ test('ember-views/mixins/view_state_support.js should pass jshint', function() {
56115
+ ok(true, 'ember-views/mixins/view_state_support.js should pass jshint.');
56116
+ });
56117
+
56118
+ });
56119
+ enifed('ember-views/mixins/view_stream_support.jscs-test', function () {
56120
+
56121
+ 'use strict';
56122
+
56123
+ module('JSCS - ember-views/mixins');
56124
+ test('ember-views/mixins/view_stream_support.js should pass jscs', function() {
56125
+ ok(true, 'ember-views/mixins/view_stream_support.js should pass jscs.');
56126
+ });
56127
+
56128
+ });
56129
+ enifed('ember-views/mixins/view_stream_support.jshint', function () {
56130
+
56131
+ 'use strict';
56132
+
56133
+ module('JSHint - ember-views/mixins');
56134
+ test('ember-views/mixins/view_stream_support.js should pass jshint', function() {
56135
+ ok(true, 'ember-views/mixins/view_stream_support.js should pass jshint.');
56136
+ });
56137
+
56701
56138
  });
56702
56139
  enifed('ember-views/mixins/view_target_action_support.jscs-test', function () {
56703
56140
 
@@ -56718,6 +56155,26 @@ enifed('ember-views/mixins/view_target_action_support.jshint', function () {
56718
56155
  ok(true, 'ember-views/mixins/view_target_action_support.js should pass jshint.');
56719
56156
  });
56720
56157
 
56158
+ });
56159
+ enifed('ember-views/mixins/visibility_support.jscs-test', function () {
56160
+
56161
+ 'use strict';
56162
+
56163
+ module('JSCS - ember-views/mixins');
56164
+ test('ember-views/mixins/visibility_support.js should pass jscs', function() {
56165
+ ok(true, 'ember-views/mixins/visibility_support.js should pass jscs.');
56166
+ });
56167
+
56168
+ });
56169
+ enifed('ember-views/mixins/visibility_support.jshint', function () {
56170
+
56171
+ 'use strict';
56172
+
56173
+ module('JSHint - ember-views/mixins');
56174
+ test('ember-views/mixins/visibility_support.js should pass jshint', function() {
56175
+ ok(true, 'ember-views/mixins/visibility_support.js should pass jshint.');
56176
+ });
56177
+
56721
56178
  });
56722
56179
  enifed('ember-views/streams/class_name_binding.jscs-test', function () {
56723
56180
 
@@ -59744,7 +59201,7 @@ enifed('ember-views/tests/views/container_view_test', ['ember-metal/property_get
59744
59201
  container.removeObject(view);
59745
59202
  });
59746
59203
  equal(property_get.get(view, 'childViews.length'), 0, "child views are cleared when removed from container view");
59747
- equal(container.$().html(), '', "the child view is removed from the DOM");
59204
+ equal(container.$().text(), '', "the child view is removed from the DOM");
59748
59205
  });
59749
59206
 
59750
59207
  QUnit.test("if a ContainerView starts with an empty currentView, nothing is displayed", function() {
@@ -67245,7 +66702,9 @@ enifed('ember/tests/component_registration_test', ['ember', 'ember-template-comp
67245
66702
 
67246
66703
  function cleanup() {
67247
66704
  Ember.run(function() {
67248
- App.destroy();
66705
+ if (App) {
66706
+ App.destroy();
66707
+ }
67249
66708
  App = null;
67250
66709
  Ember.TEMPLATES = {};
67251
66710
 
@@ -67410,21 +66869,14 @@ enifed('ember/tests/component_registration_test', ['ember', 'ember-template-comp
67410
66869
  equal(Ember.$('#wrapper').text(), "inner-outer", "The component is composed correctly");
67411
66870
  });
67412
66871
 
67413
- if (!Ember.FEATURES.isEnabled('ember-htmlbars')) {
67414
- // jscs:disable validateIndentation
67415
- // ember-htmlbars doesn't throw an exception when a helper is not found
67416
-
67417
66872
  QUnit.test('Using name of component that does not exist', function () {
67418
66873
  Ember.TEMPLATES.application = compile['default']("<div id='wrapper'>{{#no-good}} {{/no-good}}</div>");
67419
66874
 
67420
- throws(function () {
66875
+ expectAssertion(function () {
67421
66876
  boot();
67422
- }, /Could not find component or helper named 'no-good'/);
66877
+ }, /A helper named `no-good` could not be found/);
67423
66878
  });
67424
66879
 
67425
- // jscs:enable validateIndentation
67426
- }
67427
-
67428
66880
  QUnit.module("Application Lifecycle - Component Context", {
67429
66881
  setup: prepare,
67430
66882
  teardown: cleanup
@@ -67638,7 +67090,10 @@ enifed('ember/tests/helpers/helper_registration_test', ['ember', 'ember-htmlbars
67638
67090
  QUnit.module("Application Lifecycle - Helper Registration", {
67639
67091
  teardown: function() {
67640
67092
  Ember.run(function() {
67641
- App.destroy();
67093
+ if (App) {
67094
+ App.destroy();
67095
+ }
67096
+
67642
67097
  App = null;
67643
67098
  Ember.TEMPLATES = {};
67644
67099
  });
@@ -67701,41 +67156,28 @@ enifed('ember/tests/helpers/helper_registration_test', ['ember', 'ember-htmlbars
67701
67156
  ok(!helpers['x-reverse'], "Container-registered helper doesn't wind up on global helpers hash");
67702
67157
  });
67703
67158
 
67704
- if (!Ember.FEATURES.isEnabled('ember-htmlbars')) {
67705
- // jscs:disable validateIndentation
67706
-
67707
67159
  // we have unit tests for this in ember-htmlbars/tests/system/lookup-helper
67708
67160
  // and we are not going to recreate the handlebars helperMissing concept
67709
67161
  QUnit.test("Undashed helpers registered on the container can not (presently) be invoked", function() {
67710
67162
 
67711
- var realHelperMissing = helpers.helperMissing;
67712
- helpers.helperMissing = function() {
67713
- return "NOHALPER";
67714
- };
67715
-
67716
67163
  // Note: the reason we're not allowing undashed helpers is to avoid
67717
67164
  // a possible perf hit in hot code paths, i.e. _triageMustache.
67718
67165
  // We only presently perform container lookups if prop.indexOf('-') >= 0
67719
67166
 
67720
67167
  Ember.TEMPLATES.application = compile("<div id='wrapper'>{{omg}}|{{omg 'GRRR'}}|{{yorp}}|{{yorp 'ahh'}}</div>");
67721
67168
 
67722
- boot(function() {
67723
- registry.register('helper:omg', function() {
67724
- return "OMG";
67169
+ expectAssertion(function() {
67170
+ boot(function() {
67171
+ registry.register('helper:omg', function() {
67172
+ return "OMG";
67173
+ });
67174
+ registry.register('helper:yorp', makeBoundHelper(function() {
67175
+ return "YORP";
67176
+ }));
67725
67177
  });
67726
- registry.register('helper:yorp', makeBoundHelper(function() {
67727
- return "YORP";
67728
- }));
67729
- });
67730
-
67731
- equal(Ember.$('#wrapper').text(), "|NOHALPER||NOHALPER", "The undashed helper was invoked from the container");
67732
-
67733
- helpers.helperMissing = realHelperMissing;
67178
+ }, /A helper named 'omg' could not be found/);
67734
67179
  });
67735
67180
 
67736
- // jscs:enable validateIndentation
67737
- }
67738
-
67739
67181
  });
67740
67182
  enifed('ember/tests/helpers/helper_registration_test.jscs-test', function () {
67741
67183
 
@@ -69879,28 +69321,6 @@ enifed('ember/tests/routing/basic_test', ['ember', 'ember-metal/enumerable_utils
69879
69321
  equal(Ember.$('h3:contains(Hours)', '#qunit-fixture').length, 1, "The home template was rendered");
69880
69322
  });
69881
69323
 
69882
- QUnit.test("The Homepage register as activeView", function() {
69883
- Router.map(function() {
69884
- this.route("home", { path: "/" });
69885
- this.route("homepage");
69886
- });
69887
-
69888
- App.HomeRoute = Ember.Route.extend({
69889
- });
69890
-
69891
- App.HomepageRoute = Ember.Route.extend({
69892
- });
69893
-
69894
- bootApplication();
69895
-
69896
- ok(router._lookupActiveView('home'), '`home` active view is connected');
69897
-
69898
- handleURL('/homepage');
69899
-
69900
- ok(router._lookupActiveView('homepage'), '`homepage` active view is connected');
69901
- equal(router._lookupActiveView('home'), undefined, '`home` active view is disconnected');
69902
- });
69903
-
69904
69324
  QUnit.test("The Homepage with explicit template name in renderTemplate", function() {
69905
69325
  Router.map(function() {
69906
69326
  this.route("home", { path: "/" });
@@ -72277,6 +71697,22 @@ enifed('ember/tests/routing/basic_test', ['ember', 'ember-metal/enumerable_utils
72277
71697
  });
72278
71698
 
72279
71699
 
71700
+ QUnit.test("Route will assert if you try to explicitly render {into: ...} a missing template", function () {
71701
+ Router.map(function() {
71702
+ this.route("home", { path: "/" });
71703
+ });
71704
+
71705
+ App.HomeRoute = Ember.Route.extend({
71706
+ renderTemplate: function() {
71707
+ this.render({ into: 'nonexistent' });
71708
+ }
71709
+ });
71710
+
71711
+ expectAssertion(function() {
71712
+ bootApplication();
71713
+ }, "You attempted to render into 'nonexistent' but it was not found");
71714
+ });
71715
+
72280
71716
  QUnit.test("Route supports clearing outlet explicitly", function() {
72281
71717
  Ember.TEMPLATES.application = compile("{{outlet}}{{outlet 'modal'}}");
72282
71718
  Ember.TEMPLATES.posts = compile("{{outlet}}");
@@ -73146,6 +72582,160 @@ enifed('ember/tests/routing/basic_test', ['ember', 'ember-metal/enumerable_utils
73146
72582
  }, /\bboom\b/);
73147
72583
  });
73148
72584
 
72585
+ QUnit.test("{{outlet}} works when created after initial render", function() {
72586
+ Ember.TEMPLATES.sample = compile("Hi{{#if showTheThing}}{{outlet}}{{/if}}Bye");
72587
+ Ember.TEMPLATES['sample/inner'] = compile("Yay");
72588
+ Ember.TEMPLATES['sample/inner2'] = compile("Boo");
72589
+ Router.map(function() {
72590
+ this.route('sample', { path: '/' }, function() {
72591
+ this.route('inner', { path: '/' });
72592
+ this.route('inner2', { path: '/2' });
72593
+ });
72594
+ });
72595
+
72596
+ bootApplication();
72597
+
72598
+ equal(Ember.$('#qunit-fixture').text(), "HiBye", "initial render");
72599
+
72600
+ Ember.run(function() {
72601
+ container.lookup('controller:sample').set('showTheThing', true);
72602
+ });
72603
+
72604
+ equal(Ember.$('#qunit-fixture').text(), "HiYayBye", "second render");
72605
+
72606
+ handleURL('/2');
72607
+
72608
+ equal(Ember.$('#qunit-fixture').text(), "HiBooBye", "third render");
72609
+ });
72610
+
72611
+ QUnit.test("Can rerender application view multiple times when it contains an outlet", function() {
72612
+ Ember.TEMPLATES.application = compile("App{{outlet}}");
72613
+ Ember.TEMPLATES.index = compile("Hello world");
72614
+
72615
+ registry.register('view:application', Ember.View.extend({
72616
+ elementId: 'im-special'
72617
+ }));
72618
+
72619
+ bootApplication();
72620
+
72621
+ equal(Ember.$('#qunit-fixture').text(), "AppHello world", "initial render");
72622
+
72623
+ Ember.run(function() {
72624
+ Ember.View.views['im-special'].rerender();
72625
+ });
72626
+
72627
+ equal(Ember.$('#qunit-fixture').text(), "AppHello world", "second render");
72628
+
72629
+ Ember.run(function() {
72630
+ Ember.View.views['im-special'].rerender();
72631
+ });
72632
+
72633
+ equal(Ember.$('#qunit-fixture').text(), "AppHello world", "third render");
72634
+ });
72635
+
72636
+ QUnit.test("Can render into a named outlet at the top level", function() {
72637
+ Ember.TEMPLATES.application = compile("A-{{outlet}}-B-{{outlet \"other\"}}-C");
72638
+ Ember.TEMPLATES.modal = compile("Hello world");
72639
+ Ember.TEMPLATES.index = compile("The index");
72640
+
72641
+ registry.register('route:application', Ember.Route.extend({
72642
+ renderTemplate: function() {
72643
+ this.render();
72644
+ this.render('modal', {
72645
+ into: 'application',
72646
+ outlet: 'other'
72647
+ });
72648
+ }
72649
+ }));
72650
+
72651
+ bootApplication();
72652
+
72653
+ equal(Ember.$('#qunit-fixture').text(), "A-The index-B-Hello world-C", "initial render");
72654
+ });
72655
+
72656
+ QUnit.test("Can disconnect a named outlet at the top level", function() {
72657
+ Ember.TEMPLATES.application = compile("A-{{outlet}}-B-{{outlet \"other\"}}-C");
72658
+ Ember.TEMPLATES.modal = compile("Hello world");
72659
+ Ember.TEMPLATES.index = compile("The index");
72660
+
72661
+ registry.register('route:application', Ember.Route.extend({
72662
+ renderTemplate: function() {
72663
+ this.render();
72664
+ this.render('modal', {
72665
+ into: 'application',
72666
+ outlet: 'other'
72667
+ });
72668
+ },
72669
+ actions: {
72670
+ banish: function() {
72671
+ this.disconnectOutlet({
72672
+ parentView: 'application',
72673
+ outlet: 'other'
72674
+ });
72675
+ }
72676
+ }
72677
+ }));
72678
+
72679
+ bootApplication();
72680
+
72681
+ equal(Ember.$('#qunit-fixture').text(), "A-The index-B-Hello world-C", "initial render");
72682
+
72683
+ Ember.run(router, 'send', 'banish');
72684
+
72685
+ equal(Ember.$('#qunit-fixture').text(), "A-The index-B--C", "second render");
72686
+ });
72687
+
72688
+ QUnit.test("Can render into a named outlet at the top level, with empty main outlet", function() {
72689
+ Ember.TEMPLATES.application = compile("A-{{outlet}}-B-{{outlet \"other\"}}-C");
72690
+ Ember.TEMPLATES.modal = compile("Hello world");
72691
+
72692
+ Router.map(function() {
72693
+ this.route('hasNoTemplate', { path: '/' });
72694
+ });
72695
+
72696
+ registry.register('route:application', Ember.Route.extend({
72697
+ renderTemplate: function() {
72698
+ this.render();
72699
+ this.render('modal', {
72700
+ into: 'application',
72701
+ outlet: 'other'
72702
+ });
72703
+ }
72704
+ }));
72705
+
72706
+ bootApplication();
72707
+
72708
+ equal(Ember.$('#qunit-fixture').text(), "A--B-Hello world-C", "initial render");
72709
+ });
72710
+
72711
+
72712
+ QUnit.test("Can render into a named outlet at the top level, later", function() {
72713
+ Ember.TEMPLATES.application = compile("A-{{outlet}}-B-{{outlet \"other\"}}-C");
72714
+ Ember.TEMPLATES.modal = compile("Hello world");
72715
+ Ember.TEMPLATES.index = compile("The index");
72716
+
72717
+ registry.register('route:application', Ember.Route.extend({
72718
+ actions: {
72719
+ launch: function() {
72720
+ this.render('modal', {
72721
+ into: 'application',
72722
+ outlet: 'other'
72723
+ });
72724
+ }
72725
+ }
72726
+ }));
72727
+
72728
+ bootApplication();
72729
+
72730
+ equal(Ember.$('#qunit-fixture').text(), "A-The index-B--C", "initial render");
72731
+
72732
+ Ember.run(router, 'send', 'launch');
72733
+
72734
+ //debugger;
72735
+ //router._setOutlets();
72736
+ equal(Ember.$('#qunit-fixture').text(), "A-The index-B-Hello world-C", "second render");
72737
+ });
72738
+
73149
72739
  });
73150
72740
  enifed('ember/tests/routing/basic_test.jscs-test', function () {
73151
72741
 
@@ -76059,298 +75649,310 @@ enifed("morph-attr/sanitize-attribute-value",
76059
75649
  __exports__.sanitizeAttributeValue = sanitizeAttributeValue;
76060
75650
  });
76061
75651
  enifed("morph-range",
76062
- ["exports"],
76063
- function(__exports__) {
75652
+ ["./morph-range/utils","exports"],
75653
+ function(__dependency1__, __exports__) {
76064
75654
  "use strict";
76065
- var splice = Array.prototype.splice;
75655
+ var clear = __dependency1__.clear;
75656
+ var insertBefore = __dependency1__.insertBefore;
76066
75657
 
76067
- function ensureStartEnd(start, end) {
76068
- if (start === null || end === null) {
76069
- throw new Error('a fragment parent must have boundary nodes in order to detect insertion');
76070
- }
75658
+ function Morph(domHelper, contextualElement) {
75659
+ this.domHelper = domHelper;
75660
+ // context if content if current content is detached
75661
+ this.contextualElement = contextualElement;
75662
+
75663
+ // flag to force text to setContent to be treated as html
75664
+ this.parseTextAsHTML = false;
75665
+
75666
+ this.firstNode = null;
75667
+ this.lastNode = null;
75668
+
75669
+ // morph graph
75670
+ this.parentMorph = null;
75671
+ this.firstChildMorph = null;
75672
+ this.lastChildMorph = null;
75673
+
75674
+ this.previousMorph = null;
75675
+ this.nextMorph = null;
76071
75676
  }
76072
75677
 
76073
- function ensureContext(contextualElement) {
76074
- if (!contextualElement || contextualElement.nodeType !== 1) {
76075
- throw new Error('An element node must be provided for a contextualElement, you provided ' +
76076
- (contextualElement ? 'nodeType ' + contextualElement.nodeType : 'nothing'));
75678
+ Morph.prototype.setContent = function Morph$setContent(content) {
75679
+ if (content === null || content === undefined) {
75680
+ return this.clear();
76077
75681
  }
76078
- }
76079
75682
 
76080
- // TODO: this is an internal API, this should be an assert
76081
- function Morph(parent, start, end, domHelper, contextualElement) {
76082
- if (parent.nodeType === 11) {
76083
- ensureStartEnd(start, end);
76084
- this.element = null;
76085
- } else {
76086
- this.element = parent;
75683
+ var type = typeof content;
75684
+ switch (type) {
75685
+ case 'string':
75686
+ if (this.parseTextAsHTML) {
75687
+ return this.setHTML(content);
75688
+ }
75689
+ return this.setText(content);
75690
+ case 'object':
75691
+ if (typeof content.nodeType === 'number') {
75692
+ return this.setNode(content);
75693
+ }
75694
+ /* Handlebars.SafeString */
75695
+ if (typeof content.string === 'string') {
75696
+ return this.setHTML(content.string);
75697
+ }
75698
+ if (this.parseTextAsHTML) {
75699
+ return this.setHTML(content.toString());
75700
+ }
75701
+ /* falls through */
75702
+ case 'boolean':
75703
+ case 'number':
75704
+ return this.setText(content.toString());
75705
+ default:
75706
+ throw new TypeError('unsupported content');
76087
75707
  }
76088
- this._parent = parent;
76089
- this.start = start;
76090
- this.end = end;
76091
- this.domHelper = domHelper;
76092
- ensureContext(contextualElement);
76093
- this.contextualElement = contextualElement;
76094
- this.escaped = true;
76095
- this.reset();
76096
- }
75708
+ };
76097
75709
 
76098
- Morph.prototype.reset = function() {
76099
- this.text = null;
76100
- this.owner = null;
76101
- this.morphs = null;
76102
- this.before = null;
76103
- this.after = null;
75710
+ Morph.prototype.clear = function Morph$clear() {
75711
+ return this.setNode(this.domHelper.createComment(''));
76104
75712
  };
76105
75713
 
76106
- Morph.prototype.parent = function () {
76107
- if (!this.element) {
76108
- var parent = this.start.parentNode;
76109
- if (this._parent !== parent) {
76110
- this._parent = parent;
76111
- }
76112
- if (parent.nodeType === 1) {
76113
- this.element = parent;
76114
- }
75714
+ Morph.prototype.setText = function Morph$setText(text) {
75715
+ var firstNode = this.firstNode;
75716
+ var lastNode = this.lastNode;
75717
+
75718
+ if (firstNode &&
75719
+ lastNode === firstNode &&
75720
+ firstNode.nodeType === 3) {
75721
+ firstNode.nodeValue = text;
75722
+ return firstNode;
76115
75723
  }
76116
- return this._parent;
75724
+
75725
+ return this.setNode(
75726
+ text ? this.domHelper.createTextNode(text) : this.domHelper.createComment('')
75727
+ );
76117
75728
  };
76118
75729
 
76119
- Morph.prototype.destroy = function () {
76120
- if (this.owner) {
76121
- this.owner.removeMorph(this);
76122
- } else {
76123
- clear(this.element || this.parent(), this.start, this.end);
75730
+ Morph.prototype.setNode = function Morph$setNode(newNode) {
75731
+ var firstNode, lastNode;
75732
+ switch (newNode.nodeType) {
75733
+ case 3:
75734
+ firstNode = newNode;
75735
+ lastNode = newNode;
75736
+ break;
75737
+ case 11:
75738
+ firstNode = newNode.firstChild;
75739
+ lastNode = newNode.lastChild;
75740
+ if (firstNode === null) {
75741
+ firstNode = this.domHelper.createComment('');
75742
+ newNode.appendChild(firstNode);
75743
+ lastNode = firstNode;
75744
+ }
75745
+ break;
75746
+ default:
75747
+ firstNode = newNode;
75748
+ lastNode = newNode;
75749
+ break;
76124
75750
  }
75751
+
75752
+ var previousFirstNode = this.firstNode;
75753
+ if (previousFirstNode !== null) {
75754
+
75755
+ var parentNode = previousFirstNode.parentNode;
75756
+ insertBefore(parentNode, firstNode, lastNode, previousFirstNode);
75757
+ clear(parentNode, previousFirstNode, this.lastNode);
75758
+ }
75759
+
75760
+ this.firstNode = firstNode;
75761
+ this.lastNode = lastNode;
75762
+
75763
+ if (this.parentMorph) {
75764
+ syncFirstNode(this);
75765
+ syncLastNode(this);
75766
+ }
75767
+
75768
+ return newNode;
76125
75769
  };
76126
75770
 
76127
- Morph.prototype.removeMorph = function (morph) {
76128
- var morphs = this.morphs;
76129
- for (var i=0, l=morphs.length; i<l; i++) {
76130
- if (morphs[i] === morph) {
76131
- this.replace(i, 1);
75771
+ function syncFirstNode(_morph) {
75772
+ var morph = _morph;
75773
+ var parentMorph;
75774
+ while (parentMorph = morph.parentMorph) {
75775
+ if (morph !== parentMorph.firstChildMorph) {
75776
+ break;
75777
+ }
75778
+ if (morph.firstNode === parentMorph.firstNode) {
76132
75779
  break;
76133
75780
  }
76134
- }
76135
- };
76136
75781
 
76137
- Morph.prototype.setContent = function (nodeOrString) {
76138
- this._update(this.element || this.parent(), nodeOrString);
76139
- };
75782
+ parentMorph.firstNode = morph.firstNode;
76140
75783
 
76141
- Morph.prototype.updateNode = function (node) {
76142
- var parent = this.element || this.parent();
76143
- if (!node) {
76144
- return this._updateText(parent, '');
75784
+ morph = parentMorph;
76145
75785
  }
76146
- this._updateNode(parent, node);
76147
- };
75786
+ }
76148
75787
 
76149
- Morph.prototype.updateText = function (text) {
76150
- this._updateText(this.element || this.parent(), text);
76151
- };
75788
+ function syncLastNode(_morph) {
75789
+ var morph = _morph;
75790
+ var parentMorph;
75791
+ while (parentMorph = morph.parentMorph) {
75792
+ if (morph !== parentMorph.lastChildMorph) {
75793
+ break;
75794
+ }
75795
+ if (morph.lastNode === parentMorph.lastNode) {
75796
+ break;
75797
+ }
76152
75798
 
76153
- Morph.prototype.updateHTML = function (html) {
76154
- var parent = this.element || this.parent();
76155
- if (!html) {
76156
- return this._updateText(parent, '');
75799
+ parentMorph.lastNode = morph.lastNode;
75800
+
75801
+ morph = parentMorph;
76157
75802
  }
76158
- this._updateHTML(parent, html);
75803
+ }
75804
+
75805
+ // return morph content to an undifferentiated state
75806
+ // drops knowledge that the node has content.
75807
+ // this is for rerender, I need to test, but basically
75808
+ // the idea is to leave the content, but allow render again
75809
+ // without appending, so n
75810
+ Morph.prototype.reset = function Morph$reset() {
75811
+ this.firstChildMorph = null;
75812
+ this.lastChildMorph = null;
76159
75813
  };
76160
75814
 
76161
- Morph.prototype._update = function (parent, nodeOrString) {
76162
- if (nodeOrString === null || nodeOrString === undefined) {
76163
- this._updateText(parent, '');
76164
- } else if (typeof nodeOrString === 'string') {
76165
- if (this.escaped) {
76166
- this._updateText(parent, nodeOrString);
75815
+ Morph.prototype.destroy = function Morph$destroy() {
75816
+ var parentMorph = this.parentMorph;
75817
+ var previousMorph = this.previousMorph;
75818
+ var nextMorph = this.nextMorph;
75819
+ var firstNode = this.firstNode;
75820
+ var lastNode = this.lastNode;
75821
+ var parentNode = firstNode && firstNode.parentNode;
75822
+
75823
+ if (previousMorph) {
75824
+ if (nextMorph) {
75825
+ previousMorph.nextMorph = nextMorph;
75826
+ nextMorph.previousMorph = previousMorph;
76167
75827
  } else {
76168
- this._updateHTML(parent, nodeOrString);
75828
+ previousMorph.nextMorph = null;
75829
+ if (parentMorph) { parentMorph.lastChildMorph = previousMorph; }
76169
75830
  }
76170
- } else if (nodeOrString.nodeType) {
76171
- this._updateNode(parent, nodeOrString);
76172
- } else if (nodeOrString.string) { // duck typed SafeString
76173
- this._updateHTML(parent, nodeOrString.string);
76174
75831
  } else {
76175
- this._updateText(parent, nodeOrString.toString());
75832
+ if (nextMorph) {
75833
+ nextMorph.previousMorph = null;
75834
+ if (parentMorph) { parentMorph.firstChildMorph = nextMorph; }
75835
+ } else if (parentMorph) {
75836
+ parentMorph.lastChildMorph = parentMorph.firstChildMorph = null;
75837
+ }
76176
75838
  }
76177
- };
76178
75839
 
76179
- Morph.prototype._updateNode = function (parent, node) {
76180
- if (this.text) {
76181
- if (node.nodeType === 3) {
76182
- this.text.nodeValue = node.nodeValue;
75840
+ this.parentMorph = null;
75841
+ this.firstNode = null;
75842
+ this.lastNode = null;
75843
+
75844
+ if (parentMorph) {
75845
+ if (!parentMorph.firstChildMorph) {
75846
+ // list is empty
75847
+ parentMorph.clear();
76183
75848
  return;
76184
75849
  } else {
76185
- this.text = null;
75850
+ syncFirstNode(parentMorph.firstChildMorph);
75851
+ syncLastNode(parentMorph.lastChildMorph);
76186
75852
  }
76187
75853
  }
76188
- var start = this.start, end = this.end;
76189
- clear(parent, start, end);
76190
- parent.insertBefore(node, end);
76191
- if (this.before !== null) {
76192
- this.before.end = start.nextSibling;
76193
- }
76194
- if (this.after !== null) {
76195
- this.after.start = end.previousSibling;
76196
- }
76197
- };
76198
75854
 
76199
- Morph.prototype._updateText = function (parent, text) {
76200
- if (this.text) {
76201
- this.text.nodeValue = text;
76202
- return;
76203
- }
76204
- var node = this.domHelper.createTextNode(text);
76205
- this.text = node;
76206
- clear(parent, this.start, this.end);
76207
- parent.insertBefore(node, this.end);
76208
- if (this.before !== null) {
76209
- this.before.end = node;
76210
- }
76211
- if (this.after !== null) {
76212
- this.after.start = node;
76213
- }
75855
+ clear(parentNode, firstNode, lastNode);
76214
75856
  };
76215
75857
 
76216
- Morph.prototype._updateHTML = function (parent, html) {
76217
- var start = this.start, end = this.end;
76218
- clear(parent, start, end);
76219
- this.text = null;
76220
- var childNodes = this.domHelper.parseHTML(html, this.contextualElement);
76221
- appendChildren(parent, end, childNodes);
76222
- if (this.before !== null) {
76223
- this.before.end = start.nextSibling;
76224
- }
76225
- if (this.after !== null) {
76226
- this.after.start = end.previousSibling;
76227
- }
75858
+ Morph.prototype.setHTML = function(text) {
75859
+ var fragment = this.domHelper.parseHTML(text, this.contextualElement);
75860
+ return this.setNode(fragment);
76228
75861
  };
76229
75862
 
76230
- Morph.prototype.append = function (node) {
76231
- if (this.morphs === null) {
76232
- this.morphs = [];
76233
- }
76234
- var index = this.morphs.length;
76235
- return this.insert(index, node);
75863
+ Morph.prototype.appendContent = function(content) {
75864
+ return this.insertContentBeforeMorph(content, null);
76236
75865
  };
76237
75866
 
76238
- Morph.prototype.insert = function (index, node) {
76239
- if (this.morphs === null) {
76240
- this.morphs = [];
76241
- }
76242
- var parent = this.element || this.parent();
76243
- var morphs = this.morphs;
76244
- var before = index > 0 ? morphs[index-1] : null;
76245
- var after = index < morphs.length ? morphs[index] : null;
76246
- var start = before === null ? this.start : (before.end === null ? parent.lastChild : before.end.previousSibling);
76247
- var end = after === null ? this.end : (after.start === null ? parent.firstChild : after.start.nextSibling);
76248
- var morph = new Morph(parent, start, end, this.domHelper, this.contextualElement);
75867
+ Morph.prototype.insertContentBeforeMorph = function (content, referenceMorph) {
75868
+ var morph = new Morph(this.domHelper, this.contextualElement);
75869
+ morph.setContent(content);
75870
+ this.insertBeforeMorph(morph, referenceMorph);
75871
+ return morph;
75872
+ };
76249
75873
 
76250
- morph.owner = this;
76251
- morph._update(parent, node);
75874
+ Morph.prototype.appendMorph = function(morph) {
75875
+ this.insertBeforeMorph(morph, null);
75876
+ };
76252
75877
 
76253
- if (before !== null) {
76254
- morph.before = before;
76255
- before.end = start.nextSibling;
76256
- before.after = morph;
75878
+ Morph.prototype.insertBeforeMorph = function(morph, referenceMorph) {
75879
+ if (referenceMorph && referenceMorph.parentMorph !== this) {
75880
+ throw new Error('The morph before which the new morph is to be inserted is not a child of this morph.');
76257
75881
  }
76258
75882
 
76259
- if (after !== null) {
76260
- morph.after = after;
76261
- after.before = morph;
76262
- after.start = end.previousSibling;
76263
- }
75883
+ morph.parentMorph = this;
76264
75884
 
76265
- this.morphs.splice(index, 0, morph);
76266
- return morph;
76267
- };
75885
+ var parentNode = this.firstNode.parentNode;
76268
75886
 
76269
- Morph.prototype.replace = function (index, removedLength, addedNodes) {
76270
- if (this.morphs === null) {
76271
- this.morphs = [];
76272
- }
76273
- var parent = this.element || this.parent();
76274
- var morphs = this.morphs;
76275
- var before = index > 0 ? morphs[index-1] : null;
76276
- var after = index+removedLength < morphs.length ? morphs[index+removedLength] : null;
76277
- var start = before === null ? this.start : (before.end === null ? parent.lastChild : before.end.previousSibling);
76278
- var end = after === null ? this.end : (after.start === null ? parent.firstChild : after.start.nextSibling);
76279
- var addedLength = addedNodes === undefined ? 0 : addedNodes.length;
76280
- var args, i, current;
75887
+ insertBefore(
75888
+ parentNode,
75889
+ morph.firstNode,
75890
+ morph.lastNode,
75891
+ referenceMorph ? referenceMorph.firstNode : this.lastNode.nextSibling
75892
+ );
76281
75893
 
76282
- if (removedLength > 0) {
76283
- clear(parent, start, end);
75894
+ // was not in list mode replace current content
75895
+ if (!this.firstChildMorph) {
75896
+ clear(parentNode, this.firstNode, this.lastNode);
76284
75897
  }
76285
75898
 
76286
- if (addedLength === 0) {
76287
- if (before !== null) {
76288
- before.after = after;
76289
- before.end = end;
76290
- }
76291
- if (after !== null) {
76292
- after.before = before;
76293
- after.start = start;
76294
- }
76295
- morphs.splice(index, removedLength);
76296
- return;
75899
+ var previousMorph = referenceMorph ? referenceMorph.previousMorph : this.lastChildMorph;
75900
+ if (previousMorph) {
75901
+ previousMorph.nextMorph = morph;
75902
+ morph.previousMorph = previousMorph;
75903
+ } else {
75904
+ this.firstChildMorph = morph;
76297
75905
  }
76298
75906
 
76299
- args = new Array(addedLength+2);
76300
- if (addedLength > 0) {
76301
- for (i=0; i<addedLength; i++) {
76302
- args[i+2] = current = new Morph(parent, start, end, this.domHelper, this.contextualElement);
76303
- current._update(parent, addedNodes[i]);
76304
- current.owner = this;
76305
- if (before !== null) {
76306
- current.before = before;
76307
- before.end = start.nextSibling;
76308
- before.after = current;
76309
- }
76310
- before = current;
76311
- start = end === null ? parent.lastChild : end.previousSibling;
76312
- }
76313
- if (after !== null) {
76314
- current.after = after;
76315
- after.before = current;
76316
- after.start = end.previousSibling;
76317
- }
75907
+ if (referenceMorph) {
75908
+ referenceMorph.previousMorph = morph;
75909
+ morph.nextMorph = referenceMorph;
75910
+ } else {
75911
+ this.lastChildMorph = morph;
76318
75912
  }
76319
75913
 
76320
- args[0] = index;
76321
- args[1] = removedLength;
76322
-
76323
- splice.apply(morphs, args);
75914
+ syncFirstNode(this.firstChildMorph);
75915
+ syncLastNode(this.lastChildMorph);
76324
75916
  };
76325
75917
 
76326
- function appendChildren(parent, end, nodeList) {
76327
- var ref = end;
76328
- var i = nodeList.length;
76329
- var node;
76330
-
76331
- while (i--) {
76332
- node = nodeList[i];
76333
- parent.insertBefore(node, ref);
76334
- ref = node;
76335
- }
75918
+ __exports__["default"] = Morph;
75919
+ });
75920
+ enifed("morph-range/utils",
75921
+ ["exports"],
75922
+ function(__exports__) {
75923
+ "use strict";
75924
+ // inclusive of both nodes
75925
+ function clear(parentNode, firstNode, lastNode) {
75926
+ if (!parentNode) { return; }
75927
+
75928
+ var node = firstNode;
75929
+ var nextNode;
75930
+ do {
75931
+ nextNode = node.nextSibling;
75932
+ parentNode.removeChild(node);
75933
+ if (node === lastNode) {
75934
+ break;
75935
+ }
75936
+ node = nextNode;
75937
+ } while (node);
76336
75938
  }
76337
75939
 
76338
- function clear(parent, start, end) {
76339
- var current, previous;
76340
- if (end === null) {
76341
- current = parent.lastChild;
76342
- } else {
76343
- current = end.previousSibling;
76344
- }
76345
-
76346
- while (current !== null && current !== start) {
76347
- previous = current.previousSibling;
76348
- parent.removeChild(current);
76349
- current = previous;
76350
- }
75940
+ __exports__.clear = clear;function insertBefore(parentNode, firstNode, lastNode, _refNode) {
75941
+ var node = lastNode;
75942
+ var refNode = _refNode;
75943
+ var prevNode;
75944
+ do {
75945
+ prevNode = node.previousSibling;
75946
+ parentNode.insertBefore(node, refNode);
75947
+ if (node === firstNode) {
75948
+ break;
75949
+ }
75950
+ refNode = node;
75951
+ node = prevNode;
75952
+ } while (node);
76351
75953
  }
76352
75954
 
76353
- __exports__["default"] = Morph;
75955
+ __exports__.insertBefore = insertBefore;
76354
75956
  });
76355
75957
  enifed("route-recognizer",
76356
75958
  ["./route-recognizer/dsl","exports"],