dist/ember-tests.js in ember-source-2.17.0.beta.4 vs dist/ember-tests.js in ember-source-2.17.0.beta.5
- old
+ new
@@ -4,11 +4,11 @@
* @copyright Copyright 2011-2017 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
- * @version 2.17.0-beta.4
+ * @version 2.17.0-beta.5
*/
var enifed, requireModule, Ember;
var mainContext = this; // Used in ember-environment/lib/global.js
@@ -30135,14 +30135,20 @@
var _templateObject = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#each model.items as |item|}}\n {{item}}: {{partial \'show-item\'}} |\n {{/each}}'], ['\n {{#each model.items as |item|}}\n {{item}}: {{partial \'show-item\'}} |\n {{/each}}']),
_templateObject2 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#with model as |item|}}\n {{item.name}}: {{partial \'show-id\'}}\n {{/with}}'], ['\n {{#with model as |item|}}\n {{item.name}}: {{partial \'show-id\'}}\n {{/with}}']),
_templateObject3 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#each items as |item|}}\n {{item.id}}: {{partial \'show-item\'}} |\n {{/each}}'], ['\n {{#each items as |item|}}\n {{item.id}}: {{partial \'show-item\'}} |\n {{/each}}']),
_templateObject4 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#each items as |item|}}\n {{item}}: {{partial \'show-item\'}} |\n {{/each}}'], ['\n {{#each items as |item|}}\n {{item}}: {{partial \'show-item\'}} |\n {{/each}}']),
- _templateObject5 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#each model.items as |template i|}}\n {{model.type}}: {{partial template}}\n {{/each}}'], ['\n {{#each model.items as |template i|}}\n {{model.type}}: {{partial template}}\n {{/each}}']),
- _templateObject6 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#with item.thing as |t|}}\n {{partial t}}\n {{else}}\n Nothing!\n {{/with}}'], ['\n {{#with item.thing as |t|}}\n {{partial t}}\n {{else}}\n Nothing!\n {{/with}}']),
- _templateObject7 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#outer.inner as |inner|}}\n inner.name: {{inner.name}}\n {{/outer.inner}}\n '], ['\n {{#outer.inner as |inner|}}\n inner.name: {{inner.name}}\n {{/outer.inner}}\n ']),
- _templateObject8 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#outer-component name=name as |outer|}}\n {{partial \'some-partial\'}}\n {{/outer-component}}'], ['\n {{#outer-component name=name as |outer|}}\n {{partial \'some-partial\'}}\n {{/outer-component}}']);
+ _templateObject5 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n [outer: {{name}}] {{partial \'inner-partial\'}}\n '], ['\n [outer: {{name}}] {{partial \'inner-partial\'}}\n ']),
+ _templateObject6 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#each names as |name i|}}\n {{i}}: {{partial \'outer-partial\'}}\n {{/each}}'], ['\n {{#each names as |name i|}}\n {{i}}: {{partial \'outer-partial\'}}\n {{/each}}']),
+ _templateObject7 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#with \'Ben\' as |person2|}}\n Hi {{person1}} (aged {{age}}) and {{person2}}. {{partial \'person3-partial\'}}\n {{/with}}\n '], ['\n {{#with \'Ben\' as |person2|}}\n Hi {{person1}} (aged {{age}}) and {{person2}}. {{partial \'person3-partial\'}}\n {{/with}}\n ']),
+ _templateObject8 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#with \'Alex\' as |person3|}}\n Hi {{person1}} (aged {{age}}), {{person2}} and {{person3}}. {{partial \'person4-partial\'}}\n {{/with}}\n '], ['\n {{#with \'Alex\' as |person3|}}\n Hi {{person1}} (aged {{age}}), {{person2}} and {{person3}}. {{partial \'person4-partial\'}}\n {{/with}}\n ']),
+ _templateObject9 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#with \'Sarah\' as |person4|}}\n Hi {{person1}} (aged {{age}}), {{person2}}, {{person3}} and {{person4}}.\n {{/with}}\n '], ['\n {{#with \'Sarah\' as |person4|}}\n Hi {{person1}} (aged {{age}}), {{person2}}, {{person3}} and {{person4}}.\n {{/with}}\n ']),
+ _templateObject10 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#with \'Sophie\' as |person1|}}\n Hi {{person1}} (aged {{age}}). {{partial \'person2-partial\'}}\n {{/with}}'], ['\n {{#with \'Sophie\' as |person1|}}\n Hi {{person1}} (aged {{age}}). {{partial \'person2-partial\'}}\n {{/with}}']),
+ _templateObject11 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#each model.items as |template i|}}\n {{model.type}}: {{partial template}}\n {{/each}}'], ['\n {{#each model.items as |template i|}}\n {{model.type}}: {{partial template}}\n {{/each}}']),
+ _templateObject12 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#with item.thing as |t|}}\n {{partial t}}\n {{else}}\n Nothing!\n {{/with}}'], ['\n {{#with item.thing as |t|}}\n {{partial t}}\n {{else}}\n Nothing!\n {{/with}}']),
+ _templateObject13 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#outer.inner as |inner|}}\n inner.name: {{inner.name}}\n {{/outer.inner}}\n '], ['\n {{#outer.inner as |inner|}}\n inner.name: {{inner.name}}\n {{/outer.inner}}\n ']),
+ _templateObject14 = (0, _emberBabel.taggedTemplateLiteralLoose)(['\n {{#outer-component name=name as |outer|}}\n {{partial \'some-partial\'}}\n {{/outer-component}}'], ['\n {{#outer-component name=name as |outer|}}\n {{partial \'some-partial\'}}\n {{/outer-component}}']);
(0, _testCase.moduleFor)('Helpers test: {{partial}}', function (_RenderingTest) {
(0, _emberBabel.inherits)(_class, _RenderingTest);
function _class() {
@@ -30344,17 +30350,73 @@
});
this.assertText('apple: apple |: |orange: orange |banana: banana |');
};
- _class.prototype['@test dynamic partials in {{#each}}'] = function testDynamicPartialsInEach() {
+ _class.prototype['@test nested partials using data from {{#each}}'] = function testNestedPartialsUsingDataFromEach() {
var _this8 = this;
+ this.registerPartial('_outer-partial', (0, _abstractTestCase.strip)(_templateObject5));
+
+ this.registerPartial('inner-partial', '[inner: {{name}}]');
+
+ this.render((0, _abstractTestCase.strip)(_templateObject6), {
+ names: (0, _emberRuntime.A)(['Alex', 'Ben'])
+ });
+
+ this.assertStableRerender();
+
+ this.assertText('0: [outer: Alex] [inner: Alex]1: [outer: Ben] [inner: Ben]');
+
+ this.runTask(function () {
+ return _this8.context.names.pushObject('Sophie');
+ });
+
+ this.assertText('0: [outer: Alex] [inner: Alex]1: [outer: Ben] [inner: Ben]2: [outer: Sophie] [inner: Sophie]');
+
+ this.runTask(function () {
+ return (0, _emberMetal.set)(_this8.context, 'names', (0, _emberRuntime.A)(['Alex', 'Ben']));
+ });
+
+ this.assertText('0: [outer: Alex] [inner: Alex]1: [outer: Ben] [inner: Ben]');
+ };
+
+ _class.prototype['@test nested partials within nested `{{#with}}` blocks'] = function testNestedPartialsWithinNestedWithBlocks() {
+ var _this9 = this;
+
+ this.registerPartial('_person2-partial', (0, _abstractTestCase.strip)(_templateObject7));
+
+ this.registerPartial('_person3-partial', (0, _abstractTestCase.strip)(_templateObject8));
+
+ this.registerPartial('_person4-partial', (0, _abstractTestCase.strip)(_templateObject9));
+
+ this.render((0, _abstractTestCase.strip)(_templateObject10), { age: 0 });
+
+ this.assertStableRerender();
+
+ this.assertText('Hi Sophie (aged 0). Hi Sophie (aged 0) and Ben. Hi Sophie (aged 0), Ben and Alex. Hi Sophie (aged 0), Ben, Alex and Sarah.');
+
+ this.runTask(function () {
+ return (0, _emberMetal.set)(_this9.context, 'age', 1);
+ });
+
+ this.assertText('Hi Sophie (aged 1). Hi Sophie (aged 1) and Ben. Hi Sophie (aged 1), Ben and Alex. Hi Sophie (aged 1), Ben, Alex and Sarah.');
+
+ this.runTask(function () {
+ return (0, _emberMetal.set)(_this9.context, 'age', 0);
+ });
+
+ this.assertText('Hi Sophie (aged 0). Hi Sophie (aged 0) and Ben. Hi Sophie (aged 0), Ben and Alex. Hi Sophie (aged 0), Ben, Alex and Sarah.');
+ };
+
+ _class.prototype['@test dynamic partials in {{#each}}'] = function testDynamicPartialsInEach() {
+ var _this10 = this;
+
this.registerPartial('_odd', 'ODD{{i}}');
this.registerPartial('_even', 'EVEN{{i}}');
- this.render((0, _abstractTestCase.strip)(_templateObject5), {
+ this.render((0, _abstractTestCase.strip)(_templateObject11), {
model: {
items: ['even', 'odd', 'even', 'odd'],
type: 'number'
}
});
@@ -30362,77 +30424,77 @@
this.assertStableRerender();
this.assertText('number: EVEN0number: ODD1number: EVEN2number: ODD3');
this.runTask(function () {
- return (0, _emberMetal.set)(_this8.context, 'model.type', 'integer');
+ return (0, _emberMetal.set)(_this10.context, 'model.type', 'integer');
});
this.assertText('integer: EVEN0integer: ODD1integer: EVEN2integer: ODD3');
this.runTask(function () {
- return (0, _emberMetal.set)(_this8.context, 'model', {
+ return (0, _emberMetal.set)(_this10.context, 'model', {
items: ['even', 'odd', 'even', 'odd'],
type: 'number'
});
});
this.assertText('number: EVEN0number: ODD1number: EVEN2number: ODD3');
};
_class.prototype['@test dynamic partials in {{#with}}'] = function testDynamicPartialsInWith() {
- var _this9 = this;
+ var _this11 = this;
this.registerPartial('_thing', '{{t}}');
- this.render((0, _abstractTestCase.strip)(_templateObject6), {
+ this.render((0, _abstractTestCase.strip)(_templateObject12), {
item: { thing: false }
});
this.assertStableRerender();
this.assertText('Nothing!');
this.runTask(function () {
- return (0, _emberMetal.set)(_this9.context, 'item.thing', 'thing');
+ return (0, _emberMetal.set)(_this11.context, 'item.thing', 'thing');
});
this.assertText('thing');
this.runTask(function () {
- return (0, _emberMetal.set)(_this9.context, 'item', { thing: false });
+ return (0, _emberMetal.set)(_this11.context, 'item', { thing: false });
});
this.assertText('Nothing!');
};
_class.prototype['@test partials which contain contextual components'] = function testPartialsWhichContainContextualComponents() {
- var _this10 = this;
+ var _this12 = this;
this.registerComponent('outer-component', {
template: '{{yield (hash inner=(component "inner-component" name=name))}}'
});
this.registerComponent('inner-component', {
template: '{{yield (hash name=name)}}'
});
- this.registerPartial('_some-partial', (0, _abstractTestCase.strip)(_templateObject7));
+ this.registerPartial('_some-partial', (0, _abstractTestCase.strip)(_templateObject13));
- this.render((0, _abstractTestCase.strip)(_templateObject8), { name: 'Sophie' });
+ this.render((0, _abstractTestCase.strip)(_templateObject14), { name: 'Sophie' });
this.assertStableRerender();
this.assertText('inner.name: Sophie');
this.runTask(function () {
- return (0, _emberMetal.set)(_this10.context, 'name', 'Ben');
+ return (0, _emberMetal.set)(_this12.context, 'name', 'Ben');
});
this.assertText('inner.name: Ben');
this.runTask(function () {
- return (0, _emberMetal.set)(_this10.context, 'name', 'Sophie');
+ return (0, _emberMetal.set)(_this12.context, 'name', 'Sophie');
});
this.assertText('inner.name: Sophie');
};