language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
emberjs
ember.js
d31876afb241986978d7c4472fc12ddfc195f9c7.json
Resolve master merge conflicts
packages/ember-views/lib/views/view.js
@@ -730,13 +730,13 @@ var View = CoreView.extend( */ template: computed('templateName', { - get: function() { + get() { var templateName = get(this, 'templateName'); var template = this.templateForName(templateName, 'template'); Ember.assert("You specified the templateName " + templateName + " for " + this + ", but it did not exist.", !templateName || !!template); return template || get(this, 'defaultTemplate'); }, - set: function(key, value) { + set(key, value) { if (value !== undefined) { return value; } return get(this, key); } @@ -755,15 +755,21 @@ var View = CoreView.extend( @property layout @type Function - */ - layout: computed(function(key) { - var layoutName = get(this, 'layoutName'); - var layout = this.templateForName(layoutName, 'layout'); + */ + layout: computed('layoutName', { + get(key) { + var layoutName = get(this, 'layoutName'); + var layout = this.templateForName(layoutName, 'layout'); + + Ember.assert("You specified the layoutName " + layoutName + " for " + this + ", but it did not exist.", !layoutName || !!layout); - Ember.assert("You specified the layoutName " + layoutName + " for " + this + ", but it did not exist.", !layoutName || !!layout); + return layout || get(this, 'defaultLayout'); + }, - return layout || get(this, 'defaultLayout'); - }).property('layoutName'), + set(key, value) { + return value; + } + }), _yield(context, options, morph) { var template = get(this, 'template'); @@ -860,6 +866,19 @@ var View = CoreView.extend( return this.currentState.rerender(this); }, + /* + * @private + * + * @method _rerender + */ + _rerender() { + if (this.isDestroying || this.isDestroyed) { + return; + } + + this._renderer.renderTree(this, this._parentView); + }, + /** Given a property name, returns a dasherized version of that property name if the property evaluates to a non-falsy value.
true
Other
emberjs
ember.js
d31876afb241986978d7c4472fc12ddfc195f9c7.json
Resolve master merge conflicts
packages/ember-views/tests/views/select_test.js
@@ -4,6 +4,7 @@ import run from "ember-metal/run_loop"; import jQuery from "ember-views/system/jquery"; import { map } from "ember-metal/enumerable_utils"; import EventDispatcher from "ember-views/system/event_dispatcher"; +import SafeString from 'htmlbars-util/safe-string'; var trim = jQuery.trim; @@ -133,6 +134,44 @@ QUnit.test("can specify the property path for an option's label and value", func deepEqual(map(select.$('option').toArray(), function(el) { return jQuery(el).attr('value'); }), ["1", "2"], "Options should have values"); }); +QUnit.test("XSS: does not escape label value when it is a SafeString", function() { + select.set('content', Ember.A([ + { id: 1, firstName: new SafeString('<p>Yehuda</p>') }, + { id: 2, firstName: new SafeString('<p>Tom</p>') } + ])); + + select.set('optionLabelPath', 'content.firstName'); + select.set('optionValuePath', 'content.id'); + + append(); + + equal(select.$('option').length, 2, "Should have two options"); + equal(select.$('option[value=1] p').length, 1, "Should have child elements"); + + // IE 8 adds whitespace + equal(trim(select.$().text()), "YehudaTom", "Options should have content"); + deepEqual(map(select.$('option').toArray(), function(el) { return jQuery(el).attr('value'); }), ["1", "2"], "Options should have values"); +}); + +QUnit.test("XSS: escapes label value content", function() { + select.set('content', Ember.A([ + { id: 1, firstName: '<p>Yehuda</p>' }, + { id: 2, firstName: '<p>Tom</p>' } + ])); + + select.set('optionLabelPath', 'content.firstName'); + select.set('optionValuePath', 'content.id'); + + append(); + + equal(select.$('option').length, 2, "Should have two options"); + equal(select.$('option[value=1] b').length, 0, "Should have no child elements"); + + // IE 8 adds whitespace + equal(trim(select.$().text()), "<p>Yehuda</p><p>Tom</p>", "Options should have content"); + deepEqual(map(select.$('option').toArray(), function(el) { return jQuery(el).attr('value'); }), ["1", "2"], "Options should have values"); +}); + QUnit.test("can retrieve the current selected option when multiple=false", function() { var yehuda = { id: 1, firstName: 'Yehuda' }; var tom = { id: 2, firstName: 'Tom' };
true
Other
emberjs
ember.js
d31876afb241986978d7c4472fc12ddfc195f9c7.json
Resolve master merge conflicts
packages/ember-views/tests/views/view/replace_in_test.js
@@ -45,18 +45,26 @@ QUnit.test("raises an assert when a target does not exist in the DOM", function( QUnit.test("should remove previous elements when calling replaceIn()", function() { - jQuery("#qunit-fixture").html('<div id="menu"><p>Foo</p></div>'); - var viewElem = jQuery('#menu').children(); + jQuery("#qunit-fixture").html(` + <div id="menu"> + <p id="child"></p> + </div> + `); view = View.create(); - ok(viewElem.length === 1, "should have one element"); + var originalChild = jQuery('#child'); + ok(originalChild.length === 1, "precond - target starts with child element"); run(function() { view.replaceIn('#menu'); }); - ok(viewElem.length === 1, "should have one element"); + originalChild = jQuery('#child'); + ok(originalChild.length === 0, "target's original child was removed"); + + var newChild = jQuery('#menu').children(); + ok(newChild.length === 1, "target has new child element"); });
true
Other
emberjs
ember.js
d31876afb241986978d7c4472fc12ddfc195f9c7.json
Resolve master merge conflicts
tests/node/app-boot-test.js
@@ -29,7 +29,8 @@ global.EmberENV = { FEATURES: features }; -var Ember, compile, domHelper, run; +var Ember, compile, domHelper, run, DOMHelper, app; + var SimpleDOM = require('simple-dom'); var URL = require('url'); @@ -84,17 +85,18 @@ function registerTemplates(app, templates) { function renderToElement(instance) { var element; - Ember.run(function() { + run(function() { element = instance.view.renderToElement(); }); return element; } -function assertHTMLMatches(actualElement, expectedHTML) { +function assertHTMLMatches(assert, actualElement, expectedHTML) { var serializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap); var serialized = serializer.serialize(actualElement); - ok(serialized.match(expectedHTML), serialized + " matches " + expectedHTML); + + assert.ok(serialized.match(expectedHTML), serialized + " matches " + expectedHTML); } @@ -118,20 +120,18 @@ QUnit.module("App boot", { }); if (canUseInstanceInitializers && canUseApplicationVisit) { - QUnit.test("App is created without throwing an exception", function() { - var app; - - Ember.run(function() { + QUnit.test("App is created without throwing an exception", function(assert) { + run(function() { app = createApplication(); registerDOMHelper(app); app.visit('/'); }); - QUnit.ok(app); + assert.ok(app); }); - QUnit.test("It is possible to render a view in Node", function() { + QUnit.test("It is possible to render a view in Node", function(assert) { var View = Ember.View.extend({ renderer: new Ember.View._Renderer(new DOMHelper(new SimpleDOM.Document())), template: compile("<h1>Hello</h1>") @@ -144,10 +144,10 @@ if (canUseInstanceInitializers && canUseApplicationVisit) { run(view, view.createElement); var serializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap); - ok(serializer.serialize(view.element).match(/<h1>Hello<\/h1>/)); + assert.ok(serializer.serialize(view.element).match(/<h1>Hello<\/h1>/)); }); - QUnit.test("It is possible to render a view with curlies in Node", function() { + QUnit.test("It is possible to render a view with curlies in Node", function(assert) { var View = Ember.Component.extend({ renderer: new Ember.View._Renderer(new DOMHelper(new SimpleDOM.Document())), layout: compile("<h1>Hello {{location}}</h1>"), @@ -161,10 +161,11 @@ if (canUseInstanceInitializers && canUseApplicationVisit) { run(view, view.createElement); var serializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap); - ok(serializer.serialize(view.element).match(/<h1>Hello World<\/h1>/)); + + assert.ok(serializer.serialize(view.element).match(/<h1>Hello World<\/h1>/)); }); - QUnit.skip("It is possible to render a view with a nested {{view}} helper in Node", function() { + QUnit.skip("It is possible to render a view with a nested {{view}} helper in Node", function(assert) { var View = Ember.Component.extend({ renderer: new Ember.View._Renderer(new DOMHelper(new SimpleDOM.Document())), layout: compile("<h1>Hello {{#if hasExistence}}{{location}}{{/if}}</h1> <div>{{view bar}}</div>"), @@ -182,14 +183,10 @@ if (canUseInstanceInitializers && canUseApplicationVisit) { run(view, view.createElement); var serializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap); - ok(serializer.serialize(view.element).match(/<h1>Hello World<\/h1> <div><div id="(.*)" class="ember-view"><p>The files are \*inside\* the computer\?\!<\/p><\/div><\/div>/)); + assert.ok(serializer.serialize(view.element).match(/<h1>Hello World<\/h1> <div><div id="(.*)" class="ember-view"><p>The files are \*inside\* the computer\?\!<\/p><\/div><\/div>/)); }); - QUnit.skip("It is possible to render a view with {{link-to}} in Node", function() { - QUnit.stop(); - - var app; - + QUnit.skip("It is possible to render a view with {{link-to}} in Node", function(assert) { run(function() { app = createApplication(); @@ -203,22 +200,14 @@ if (canUseInstanceInitializers && canUseApplicationVisit) { }); }); - app.visit('/').then(function(instance) { - QUnit.start(); - + return app.visit('/').then(function(instance) { var element = renderToElement(instance); - assertHTMLMatches(element.firstChild, /^<div id="ember\d+" class="ember-view"><h1><a id="ember\d+" class="ember-view" href="\/photos">Go to photos<\/a><\/h1><\/div>$/); + assertHTMLMatches(assert, element.firstChild, /^<div id="ember\d+" class="ember-view"><h1><a id="ember\d+" class="ember-view" href="\/photos">Go to photos<\/a><\/h1><\/div>$/); }); }); - QUnit.skip("It is possible to render outlets in Node", function() { - QUnit.stop(); - QUnit.stop(); - - var run = Ember.run; - var app; - + QUnit.skip("It is possible to render outlets in Node", function(assert) { run(function() { app = createApplication(); @@ -234,20 +223,19 @@ if (canUseInstanceInitializers && canUseApplicationVisit) { }); }); - app.visit('/').then(function(instance) { - QUnit.start(); - + var visits = []; + visits.push(app.visit('/').then(function(instance) { var element = renderToElement(instance); - assertHTMLMatches(element.firstChild, /<div id="ember(.*)" class="ember-view"><p><span>index<\/span><\/p><\/div>/); - }); - - app.visit('/photos').then(function(instance) { - QUnit.start(); + assertHTMLMatches(assert, element.firstChild, /<div id="ember(.*)" class="ember-view"><p><span>index<\/span><\/p><\/div>/); + })); + visits.push(app.visit('/photos').then(function(instance) { var element = renderToElement(instance); - assertHTMLMatches(element.firstChild, /<div id="ember(.*)" class="ember-view"><p><em>photos<\/em><\/p><\/div>/); - }); + assertHTMLMatches(assert, element.firstChild, /<div id="ember(.*)" class="ember-view"><p><em>photos<\/em><\/p><\/div>/); + })); + + return Ember.RSVP.Promise.all(visits); }); }
true
Other
emberjs
ember.js
97c10391c8d3a98c5ffba3a940f2b3dcf73485e2.json
Get remainder of query_params_test.js passing And a link-to test
packages/ember-htmlbars/tests/system/make_view_helper_test.js
@@ -2,6 +2,7 @@ import makeViewHelper from "ember-htmlbars/system/make-view-helper"; QUnit.module("ember-htmlbars: makeViewHelper"); +// note: fixing this probably means breaking link-to component, which accepts params QUnit.skip("makes helpful assertion when called with invalid arguments", function() { var viewClass = { toString() { return 'Some Random Class'; } };
true
Other
emberjs
ember.js
97c10391c8d3a98c5ffba3a940f2b3dcf73485e2.json
Get remainder of query_params_test.js passing And a link-to test
packages/ember-routing-htmlbars/lib/helpers/link-to.js
@@ -287,6 +287,7 @@ import 'ember-htmlbars'; @return {String} HTML string @see {Ember.LinkView} */ +// this has been replaced by link-to component function linkToHelper(params, hash) { // TODO: Implement more than just stub functionality here this.yieldIn(linkToTemplate, { href: "#", classes: hash.class });
true
Other
emberjs
ember.js
97c10391c8d3a98c5ffba3a940f2b3dcf73485e2.json
Get remainder of query_params_test.js passing And a link-to test
packages/ember-routing-views/lib/views/link.js
@@ -283,7 +283,7 @@ var LinkComponent = EmberComponent.extend({ } } - if (this.bubbles === false) { event.stopPropagation(); } + if (this.attrs.bubbles === false) { event.stopPropagation(); } if (get(this, '_isDisabled')) { return false; } @@ -297,7 +297,7 @@ var LinkComponent = EmberComponent.extend({ return false; } - get(this, '_routing').transitionTo(get(this, 'targetRouteName'), get(this, 'models'), get(this, 'queryParams'), get(this, 'attrs.replace')); + get(this, '_routing').transitionTo(get(this, 'targetRouteName'), get(this, 'models'), get(this, 'queryParams.values'), get(this, 'attrs.replace')); }, queryParams: null, @@ -311,7 +311,7 @@ var LinkComponent = EmberComponent.extend({ @property href **/ - href: computed('models', 'targetRouteName', function computeLinkViewHref() { + href: computed('models', 'targetRouteName', '_routing.currentState', function computeLinkViewHref() { if (get(this, 'tagName') !== 'a') { return; } var targetRouteName = get(this, 'targetRouteName'); @@ -320,7 +320,7 @@ var LinkComponent = EmberComponent.extend({ if (get(this, 'loading')) { return get(this, 'loadingHref'); } var routing = get(this, '_routing'); - return routing.generateURL(targetRouteName, models, get(this, 'queryParams')); + return routing.generateURL(targetRouteName, models, get(this, 'queryParams.values')); }), loading: computed('models', 'targetRouteName', function() {
true
Other
emberjs
ember.js
97c10391c8d3a98c5ffba3a940f2b3dcf73485e2.json
Get remainder of query_params_test.js passing And a link-to test
packages/ember/tests/helpers/link_to_test.js
@@ -402,7 +402,7 @@ QUnit.test("The {{link-to}} helper defaults to bubbling", function() { equal(hidden, 1, "The link bubbles"); }); -QUnit.skip("The {{link-to}} helper supports bubbles=false", function() { +QUnit.test("The {{link-to}} helper supports bubbles=false", function() { Ember.TEMPLATES.about = compile("<div {{action 'hide'}}>{{#link-to 'about.contact' id='about-contact' bubbles=false}}About{{/link-to}}</div>{{outlet}}"); Ember.TEMPLATES['about/contact'] = compile("<h1 id='contact'>Contact</h1>");
true
Other
emberjs
ember.js
97c10391c8d3a98c5ffba3a940f2b3dcf73485e2.json
Get remainder of query_params_test.js passing And a link-to test
packages/ember/tests/routing/query_params_test.js
@@ -261,7 +261,7 @@ QUnit.test("model hooks receives query params", function() { equal(router.get('location.path'), ""); }); -QUnit.skip("controllers won't be eagerly instantiated by internal query params logic", function() { +QUnit.test("controllers won't be eagerly instantiated by internal query params logic", function() { expect(10); Router.map(function() { this.resource('cats', function() { @@ -700,7 +700,7 @@ QUnit.test("An explicit replace:false on a changed QP always wins and causes a p Ember.run(appController, 'setProperties', { alex: 'sriracha' }); }); -QUnit.skip("can opt into full transition by setting refreshModel in route queryParams when transitioning from child to parent", function() { +QUnit.test("can opt into full transition by setting refreshModel in route queryParams when transitioning from child to parent", function() { Ember.TEMPLATES.parent = compile('{{outlet}}'); Ember.TEMPLATES['parent/child'] = compile("{{link-to 'Parent' 'parent' (query-params foo='change') id='parent-link'}}"); @@ -843,7 +843,7 @@ QUnit.test("URL transitions that remove QPs still register as QP changes", funct equal(indexController.get('omg'), 'lol'); }); -QUnit.skip("Subresource naming style is supported", function() { +QUnit.test("Subresource naming style is supported", function() { Router.map(function() { this.resource('abc.def', { path: '/abcdef' }, function() { @@ -1137,12 +1137,12 @@ QUnit.test("A child of a resource route still defaults to parent route's model e bootApplication(); }); -QUnit.skip("opting into replace does not affect transitions between routes", function() { +QUnit.test("opting into replace does not affect transitions between routes", function() { expect(5); Ember.TEMPLATES.application = compile( "{{link-to 'Foo' 'foo' id='foo-link'}}" + "{{link-to 'Bar' 'bar' id='bar-no-qp-link'}}" + - "{{link-to 'Bar' 'bar' (query-params raytiley='isanerd') id='bar-link'}}" + + "{{link-to 'Bar' 'bar' (query-params raytiley='isthebest') id='bar-link'}}" + "{{outlet}}" ); App.Router.map(function() { @@ -1152,7 +1152,7 @@ QUnit.skip("opting into replace does not affect transitions between routes", fun App.BarController = Ember.Controller.extend({ queryParams: ['raytiley'], - raytiley: 'isadork' + raytiley: 'israd' }); App.BarRoute = Ember.Route.extend({ @@ -1172,13 +1172,13 @@ QUnit.skip("opting into replace does not affect transitions between routes", fun expectedPushURL = '/bar'; Ember.run(Ember.$('#bar-no-qp-link'), 'click'); - expectedReplaceURL = '/bar?raytiley=boo'; - setAndFlush(controller, 'raytiley', 'boo'); + expectedReplaceURL = '/bar?raytiley=woot'; + setAndFlush(controller, 'raytiley', 'woot'); expectedPushURL = '/foo'; Ember.run(Ember.$('#foo-link'), 'click'); - expectedPushURL = '/bar?raytiley=isanerd'; + expectedPushURL = '/bar?raytiley=isthebest'; Ember.run(Ember.$('#bar-link'), 'click'); }); @@ -1312,7 +1312,7 @@ QUnit.module("Model Dep Query Params", { } }); -QUnit.skip("query params have 'model' stickiness by default", function() { +QUnit.test("query params have 'model' stickiness by default", function() { this.boot(); Ember.run(this.$link1, 'click'); @@ -1334,7 +1334,7 @@ QUnit.skip("query params have 'model' stickiness by default", function() { equal(this.$link3.attr('href'), '/a/a-3'); }); -QUnit.skip("query params have 'model' stickiness by default (url changes)", function() { +QUnit.test("query params have 'model' stickiness by default (url changes)", function() { this.boot(); @@ -1369,7 +1369,7 @@ QUnit.skip("query params have 'model' stickiness by default (url changes)", func }); -QUnit.skip("query params have 'model' stickiness by default (params-based transitions)", function() { +QUnit.test("query params have 'model' stickiness by default (params-based transitions)", function() { Ember.TEMPLATES.application = compile("{{#each a in articles}} {{link-to 'Article' 'article' a.id id=a.id}} {{/each}}"); this.boot(); @@ -1415,7 +1415,7 @@ QUnit.skip("query params have 'model' stickiness by default (params-based transi equal(this.$link3.attr('href'), '/a/a-3?q=hay'); }); -QUnit.skip("'controller' stickiness shares QP state between models", function() { +QUnit.test("'controller' stickiness shares QP state between models", function() { App.ArticleController.reopen({ queryParams: { q: { scope: 'controller' } } });
true
Other
emberjs
ember.js
0f66c76d5c2453a06f001c1089510de8da8d22ae.json
Use nicer ES6 syntax for get/set on CPs
packages/ember-metal/lib/computed_macros.js
@@ -675,12 +675,12 @@ export function readOnly(dependentKey) { */ export function defaultTo(defaultPath) { return computed({ - get: function(key) { + get(key) { Ember.deprecate('Usage of Ember.computed.defaultTo is deprecated, use `Ember.computed.oneWay` instead.'); return get(this, defaultPath); }, - set: function(key, newValue, cachedValue) { + set(key, newValue, cachedValue) { Ember.deprecate('Usage of Ember.computed.defaultTo is deprecated, use `Ember.computed.oneWay` instead.'); return newValue != null ? newValue : get(this, defaultPath); } @@ -702,11 +702,11 @@ export function defaultTo(defaultPath) { */ export function deprecatingAlias(dependentKey) { return computed(dependentKey, { - get: function(key) { + get(key) { Ember.deprecate(`Usage of \`${key}\` is deprecated, use \`${dependentKey}\` instead.`); return get(this, dependentKey); }, - set: function(key, value) { + set(key, value) { Ember.deprecate(`Usage of \`${key}\` is deprecated, use \`${dependentKey}\` instead.`); set(this, dependentKey, value); return value;
true
Other
emberjs
ember.js
0f66c76d5c2453a06f001c1089510de8da8d22ae.json
Use nicer ES6 syntax for get/set on CPs
packages/ember-routing-views/lib/views/link.js
@@ -271,10 +271,10 @@ var LinkView = EmberComponent.extend({ @property disabled */ disabled: computed({ - get: function(key, value) { + get(key, value) { return false; }, - set: function(key, value) { + set(key, value) { if (value !== undefined) { this.set('_isDisabled', value); } return value ? get(this, 'disabledClass') : false;
true
Other
emberjs
ember.js
0f66c76d5c2453a06f001c1089510de8da8d22ae.json
Use nicer ES6 syntax for get/set on CPs
packages/ember-runtime/lib/controllers/array_controller.js
@@ -205,10 +205,10 @@ export default ArrayProxy.extend(ControllerMixin, SortableMixin, { }, model: computed({ - get: function(key) { + get(key) { return Ember.A(); }, - set: function(key, value) { + set(key, value) { Ember.assert( 'ArrayController expects `model` to implement the Ember.Array mixin. ' + 'This can often be fixed by wrapping your model with `Ember.A()`.',
true
Other
emberjs
ember.js
0f66c76d5c2453a06f001c1089510de8da8d22ae.json
Use nicer ES6 syntax for get/set on CPs
packages/ember-runtime/lib/mixins/array.js
@@ -168,10 +168,10 @@ export default Mixin.create(Enumerable, { @return this */ '[]': computed({ - get: function(key) { + get(key) { return this; }, - set: function(key, value) { + set(key, value) { this.replace(0, get(this, 'length'), value); return this; }
true
Other
emberjs
ember.js
0f66c76d5c2453a06f001c1089510de8da8d22ae.json
Use nicer ES6 syntax for get/set on CPs
packages/ember-runtime/lib/mixins/enumerable.js
@@ -957,7 +957,7 @@ export default Mixin.create({ @return this */ '[]': computed({ - get: function(key) { return this; } + get(key) { return this; } }), // ..........................................................
true
Other
emberjs
ember.js
0f66c76d5c2453a06f001c1089510de8da8d22ae.json
Use nicer ES6 syntax for get/set on CPs
packages/ember-runtime/lib/mixins/promise_proxy.js
@@ -157,10 +157,10 @@ export default Mixin.create({ @property promise */ promise: computed({ - get: function() { + get() { throw new EmberError("PromiseProxy's promise must be set"); }, - set: function(key, promise) { + set(key, promise) { return tap(this, promise); } }),
true
Other
emberjs
ember.js
0f66c76d5c2453a06f001c1089510de8da8d22ae.json
Use nicer ES6 syntax for get/set on CPs
packages/ember-runtime/lib/mixins/sortable.js
@@ -162,7 +162,7 @@ export default Mixin.create(MutableEnumerable, { @property arrangedContent */ arrangedContent: computed('content', 'sortProperties.@each', { - get: function(key) { + get(key) { var content = get(this, 'content'); var isSorted = get(this, 'isSorted'); var sortProperties = get(this, 'sortProperties');
true
Other
emberjs
ember.js
0f66c76d5c2453a06f001c1089510de8da8d22ae.json
Use nicer ES6 syntax for get/set on CPs
packages/ember-views/lib/mixins/view_context_support.js
@@ -25,10 +25,10 @@ var ViewContextSupport = Mixin.create({ @type Object */ context: computed({ - get: function() { + get() { return get(this, '_context'); }, - set: function(key, value) { + set(key, value) { set(this, '_context', value); return value; } @@ -53,7 +53,7 @@ var ViewContextSupport = Mixin.create({ @private */ _context: computed({ - get: function() { + get() { var parentView, controller; if (controller = get(this, 'controller')) { @@ -66,7 +66,7 @@ var ViewContextSupport = Mixin.create({ } return null; }, - set: function(key, value) { + set(key, value) { return value; } }), @@ -81,14 +81,14 @@ var ViewContextSupport = Mixin.create({ @type Object */ controller: computed({ - get: function() { + get() { if (this._controller) { return this._controller; } return this._parentView ? get(this._parentView, 'controller') : null; }, - set: function(_, value) { + set(_, value) { this._controller = value; return value; }
true
Other
emberjs
ember.js
0f66c76d5c2453a06f001c1089510de8da8d22ae.json
Use nicer ES6 syntax for get/set on CPs
packages/ember-views/lib/views/select.js
@@ -417,11 +417,11 @@ var Select = View.extend({ @default null */ value: computed({ - get: function(key) { + get(key) { var valuePath = get(this, '_valuePath'); return valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection'); }, - set: function(key, value) { + set(key, value) { return value; } }).property('_valuePath', 'selection'),
true
Other
emberjs
ember.js
0f66c76d5c2453a06f001c1089510de8da8d22ae.json
Use nicer ES6 syntax for get/set on CPs
packages/ember-views/lib/views/text_field.js
@@ -38,11 +38,11 @@ function canSetTypeOfInput(type) { function getTypeComputed() { if (Ember.FEATURES.isEnabled('new-computed-syntax')) { return computed({ - get: function() { + get() { return 'text'; }, - set: function(key, value) { + set(key, value) { var type = 'text'; if (canSetTypeOfInput(value)) {
true
Other
emberjs
ember.js
210a47c1118ddf293ddc2720c4335443ae9f5fc0.json
Update HTMLBars to 0.13.8.
package.json
@@ -23,7 +23,7 @@ "express": "^4.5.0", "github": "^0.2.3", "glob": "~4.3.2", - "htmlbars": "0.13.6", + "htmlbars": "0.13.8", "qunit-extras": "^1.3.0", "qunitjs": "^1.16.0", "route-recognizer": "0.1.5",
false
Other
emberjs
ember.js
8578ade9755a3ddf4e9436e89e09502f1bae9d83.json
Fix layout tests
packages/ember-views/tests/views/view/layout_test.js
@@ -2,6 +2,8 @@ import Registry from "container/registry"; import { get } from "ember-metal/property_get"; import run from "ember-metal/run_loop"; import EmberView from "ember-views/views/view"; +import { compile } from "ember-template-compiler"; +import { registerHelper } from "ember-htmlbars/helpers"; var registry, container, view; @@ -32,12 +34,20 @@ QUnit.test("Layout views return throw if their layout cannot be found", function }, /cantBeFound/); }); -QUnit.skip("should call the function of the associated layout", function() { +QUnit.test("should use the template of the associated layout", function() { var templateCalled = 0; var layoutCalled = 0; - registry.register('template:template', function() { templateCalled++; }); - registry.register('template:layout', function() { layoutCalled++; }); + registerHelper('call-template', function() { + templateCalled++; + }); + + registerHelper('call-layout', function() { + layoutCalled++; + }); + + registry.register('template:template', compile("{{call-template}}")); + registry.register('template:layout', compile("{{call-layout}}")); view = EmberView.create({ container: container, @@ -53,10 +63,10 @@ QUnit.skip("should call the function of the associated layout", function() { equal(layoutCalled, 1, "layout is called when layout is present"); }); -QUnit.skip("should call the function of the associated template with itself as the context", function() { - registry.register('template:testTemplate', function(dataSource) { - return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>"; - }); +QUnit.test("should use the associated template with itself as the context", function() { + registry.register('template:testTemplate', compile( + "<h1 id='twas-called'>template was called for {{personName}}</h1>" + )); view = EmberView.create({ container: container, @@ -71,62 +81,35 @@ QUnit.skip("should call the function of the associated template with itself as t view.createElement(); }); - equal("template was called for Tom DAAAALE", view.$('#twas-called').text(), "the named template was called with the view as the data source"); + equal("template was called for Tom DAAAALE", view.$('#twas-called').text(), + "the named template was called with the view as the data source"); }); -QUnit.skip("should fall back to defaultTemplate if neither template nor templateName are provided", function() { - var View; - - View = EmberView.extend({ - defaultLayout(dataSource) { return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>"; } +QUnit.test("should fall back to defaultLayout if neither template nor templateName are provided", function() { + var View = EmberView.extend({ + defaultLayout: compile('used default layout') }); - view = View.create({ - context: { - personName: "Tom DAAAALE" - } - }); + view = View.create(); run(function() { view.createElement(); }); - equal("template was called for Tom DAAAALE", view.$('#twas-called').text(), "the named template was called with the view as the data source"); + equal("used default layout", view.$().text(), + "the named template was called with the view as the data source"); }); -QUnit.skip("should not use defaultLayout if layout is provided", function() { - var View; - - View = EmberView.extend({ - layout() { return "foo"; }, - defaultLayout(dataSource) { return "<h1 id='twas-called'>template was called for " + get(dataSource, 'personName') + "</h1>"; } +QUnit.test("should not use defaultLayout if layout is provided", function() { + var View = EmberView.extend({ + layout: compile("used layout"), + defaultLayout: compile("used default layout") }); view = View.create(); run(function() { view.createElement(); }); - - equal("foo", view.$().text(), "default layout was not printed"); + equal("used layout", view.$().text(), "default layout was not printed"); }); - -QUnit.skip("the template property is available to the layout template", function() { - view = EmberView.create({ - template(context, options) { - options.data.buffer.push(" derp"); - }, - - layout(context, options) { - options.data.buffer.push("Herp"); - get(options.data.view, 'template')(context, options); - } - }); - - run(function() { - view.createElement(); - }); - - equal("Herp derp", view.$().text(), "the layout has access to the template"); -}); -
false
Other
emberjs
ember.js
e5d76eec9e857f3eabe47ccbeac7768ba61f6916.json
Add assertion on 'class' for attributeBindings
packages/ember-views/lib/system/build-component-template.js
@@ -104,19 +104,26 @@ function normalizeComponentAttributes(component, attrs) { var attr = attributeBindings[i]; var colonIndex = attr.indexOf(':'); + var attrName, expression; if (colonIndex !== -1) { var attrProperty = attr.substring(0, colonIndex); - var attrName = attr.substring(colonIndex + 1); - normalized[attrName] = ['get', 'view.' + attrProperty]; + attrName = attr.substring(colonIndex + 1); + expression = ['get', 'view.' + attrProperty]; } else if (attrs[attr]) { // TODO: For compatibility with 1.x, we probably need to `set` // the component's attribute here if it is a CP, but we also // probably want to suspend observers and allow the // willUpdateAttrs logic to trigger observers at the correct time. - normalized[attr] = ['value', attrs[attr]]; + attrName = attr; + expression = ['value', attrs[attr]]; } else { - normalized[attr] = ['get', 'view.' + attr]; + attrName = attr; + expression = ['get', 'view.' + attr]; } + + Ember.assert('You cannot use class as an attributeBinding, use classNameBindings instead.', attrName !== 'class'); + + normalized[attrName] = expression; } }
true
Other
emberjs
ember.js
e5d76eec9e857f3eabe47ccbeac7768ba61f6916.json
Add assertion on 'class' for attributeBindings
packages/ember-views/tests/views/view/attribute_bindings_test.js
@@ -397,14 +397,18 @@ QUnit.test("attributeBindings should not fail if view has been destroyed", funct ok(!error, error); }); -QUnit.skip("asserts if an attributeBinding is setup on class", function() { +QUnit.test("asserts if an attributeBinding is setup on class", function() { view = EmberView.create({ attributeBindings: ['class'] }); expectAssertion(function() { appendView(); }, 'You cannot use class as an attributeBinding, use classNameBindings instead.'); + + // Remove render node to avoid "Render node exists without concomitant env" + // assertion on teardown. + view.renderNode = null; }); QUnit.test("blacklists href bindings based on protocol", function() {
true
Other
emberjs
ember.js
97fa5ea1e36bbb9fece7dc13e9706ba82d8e6d50.json
Use unbound to assert dom rerender
packages/ember-views/tests/views/view/view_lifecycle_test.js
@@ -197,32 +197,34 @@ QUnit.test("should throw an exception when calling appendChild when DOM element }, null, "throws an exception when calling appendChild after element is created"); }); -QUnit.skip("should replace DOM representation if rerender() is called after element is created", function() { +QUnit.test("should replace DOM representation if rerender() is called after element is created", function() { run(function() { - view = EmberView.create({ - template(context, options) { - var buffer = options.data.buffer; - var value = context.get('shape'); - - buffer.push("Do not taunt happy fun "+value); + view = EmberView.createWithMixins({ + template: compile("Do not taunt happy fun {{unbound view.shape}}"), + rerender() { + this._super.apply(this, arguments); }, - - context: EmberObject.create({ - shape: 'sphere' - }) + shape: 'sphere' }); + view.volatileProp = view.get('context.shape'); view.append(); }); - equal(view.$().text(), "Do not taunt happy fun sphere", "precond - creates DOM element"); + equal(view.$().text(), "Do not taunt happy fun sphere", + "precond - creates DOM element"); + + view.shape = 'ball'; + + equal(view.$().text(), "Do not taunt happy fun sphere", + "precond - keeps DOM element"); - view.set('context.shape', 'ball'); run(function() { view.rerender(); }); - equal(view.$().text(), "Do not taunt happy fun ball", "rerenders DOM element when rerender() is called"); + equal(view.$().text(), "Do not taunt happy fun ball", + "rerenders DOM element when rerender() is called"); }); QUnit.test("should destroy DOM representation when destroyElement is called", function() {
false
Other
emberjs
ember.js
4181cc962399cbce4d4b36a2f95bd6c696f168b1.json
Remove unnnecessary test
packages/ember-views/tests/views/view/view_lifecycle_test.js
@@ -98,29 +98,6 @@ QUnit.module("views/view/view_lifecycle_test - in render", { } }); -QUnit.skip("appendChild should work inside a template", function() { - run(function() { - view = EmberView.create({ - template(context, options) { - var buffer = options.data.buffer; - - buffer.push("<h1>Hi!</h1>"); - - options.data.view.appendChild(EmberView, { - template: compile("Inception reached") - }); - - buffer.push("<div class='footer'>Wait for the kick</div>"); - } - }); - - view.appendTo("#qunit-fixture"); - }); - - ok(view.$('h1').length === 1 && view.$('div').length === 2, - "The appended child is visible"); -}); - QUnit.skip("rerender should throw inside a template", function() { throws(function() { run(function() {
false
Other
emberjs
ember.js
32d625b9ca0860bb29bb0bf425e9549449f814ad.json
Destroy ember views in destroy-render-node hook The way `clearRender` works, it won’t call destroy on the top level view if given `destroySelf` flag set to false. By moving the `view.destroy` call into this hook, we can avoid destroying the top level view when it is being cleared by `clearRender`. The `view.lastResult` check seemed to just happen to work and needed to be changed to get more tests passing.
packages/ember-htmlbars/lib/hooks/destroy-render-node.js
@@ -4,6 +4,10 @@ */ export default function destroyRenderNode(renderNode) { + if (renderNode.emberView) { + renderNode.emberView.destroy(); + } + var state = renderNode.state; if (!state) { return; }
true
Other
emberjs
ember.js
32d625b9ca0860bb29bb0bf425e9549449f814ad.json
Destroy ember views in destroy-render-node hook The way `clearRender` works, it won’t call destroy on the top level view if given `destroySelf` flag set to false. By moving the `view.destroy` call into this hook, we can avoid destroying the top level view when it is being cleared by `clearRender`. The `view.lastResult` check seemed to just happen to work and needed to be changed to get more tests passing.
packages/ember-htmlbars/lib/hooks/will-cleanup-tree.js
@@ -1,6 +1,6 @@ -export default function willCleanupTree(env, morph) { +export default function willCleanupTree(env, morph, destroySelf) { var view = morph.emberView; - if (view && view.parentView) { + if (destroySelf && view && view.parentView) { view.parentView.removeChild(view); }
true
Other
emberjs
ember.js
32d625b9ca0860bb29bb0bf425e9549449f814ad.json
Destroy ember views in destroy-render-node hook The way `clearRender` works, it won’t call destroy on the top level view if given `destroySelf` flag set to false. By moving the `view.destroy` call into this hook, we can avoid destroying the top level view when it is being cleared by `clearRender`. The `view.lastResult` check seemed to just happen to work and needed to be changed to get more tests passing.
packages/ember-htmlbars/lib/morphs/morph.js
@@ -30,8 +30,6 @@ proto.cleanup = function() { view.ownerView.isDestroyingSubtree = true; if (view.parentView) { view.parentView.removeChild(view); } } - - view.destroy(); } var toDestroy = this.emberToDestroy;
true
Other
emberjs
ember.js
32d625b9ca0860bb29bb0bf425e9549449f814ad.json
Destroy ember views in destroy-render-node hook The way `clearRender` works, it won’t call destroy on the top level view if given `destroySelf` flag set to false. By moving the `view.destroy` call into this hook, we can avoid destroying the top level view when it is being cleared by `clearRender`. The `view.lastResult` check seemed to just happen to work and needed to be changed to get more tests passing.
packages/ember-metal-views/lib/renderer.js
@@ -189,7 +189,7 @@ Renderer.prototype.renderElementRemoval = if (view._willRemoveElement) { view._willRemoveElement = false; - if (view.lastResult) { + if (view.renderNode) { view.renderNode.clear(); } this.didDestroyElement(view);
true
Other
emberjs
ember.js
32d625b9ca0860bb29bb0bf425e9549449f814ad.json
Destroy ember views in destroy-render-node hook The way `clearRender` works, it won’t call destroy on the top level view if given `destroySelf` flag set to false. By moving the `view.destroy` call into this hook, we can avoid destroying the top level view when it is being cleared by `clearRender`. The `view.lastResult` check seemed to just happen to work and needed to be changed to get more tests passing.
packages/ember-views/tests/views/view/destroy_element_test.js
@@ -28,7 +28,7 @@ QUnit.test("if it has no element, does nothing", function() { equal(callCount, 0, 'did not invoke callback'); }); -QUnit.skip("if it has a element, calls willDestroyElement on receiver and child views then deletes the element", function() { +QUnit.test("if it has a element, calls willDestroyElement on receiver and child views then deletes the element", function() { expectDeprecation("Setting `childViews` on a Container is deprecated."); var parentCount = 0; @@ -72,7 +72,7 @@ QUnit.test("returns receiver", function() { equal(ret, view, 'returns receiver'); }); -QUnit.skip("removes element from parentNode if in DOM", function() { +QUnit.test("removes element from parentNode if in DOM", function() { view = EmberView.create(); run(function() {
true
Other
emberjs
ember.js
32d625b9ca0860bb29bb0bf425e9549449f814ad.json
Destroy ember views in destroy-render-node hook The way `clearRender` works, it won’t call destroy on the top level view if given `destroySelf` flag set to false. By moving the `view.destroy` call into this hook, we can avoid destroying the top level view when it is being cleared by `clearRender`. The `view.lastResult` check seemed to just happen to work and needed to be changed to get more tests passing.
packages/ember-views/tests/views/view/remove_test.js
@@ -86,7 +86,7 @@ QUnit.module("View#removeFromParent", { } }); -QUnit.skip("removes view from parent view", function() { +QUnit.test("removes view from parent view", function() { expectDeprecation("Setting `childViews` on a Container is deprecated."); parentView = ContainerView.create({ childViews: [View] });
true
Other
emberjs
ember.js
32d625b9ca0860bb29bb0bf425e9549449f814ad.json
Destroy ember views in destroy-render-node hook The way `clearRender` works, it won’t call destroy on the top level view if given `destroySelf` flag set to false. By moving the `view.destroy` call into this hook, we can avoid destroying the top level view when it is being cleared by `clearRender`. The `view.lastResult` check seemed to just happen to work and needed to be changed to get more tests passing.
packages/ember-views/tests/views/view/view_lifecycle_test.js
@@ -248,7 +248,7 @@ QUnit.skip("should replace DOM representation if rerender() is called after elem equal(view.$().text(), "Do not taunt happy fun ball", "rerenders DOM element when rerender() is called"); }); -QUnit.skip("should destroy DOM representation when destroyElement is called", function() { +QUnit.test("should destroy DOM representation when destroyElement is called", function() { run(function() { view = EmberView.create({ template: compile("Don't fear the reaper")
true
Other
emberjs
ember.js
54ed612c6b214861e480308b4201c1deab04e09e.json
Get more tests with view#remove working
packages/ember-metal-views/lib/renderer.js
@@ -170,9 +170,26 @@ Renderer.prototype.willRender = function (view) { Renderer.prototype.remove = function (view, shouldDestroy) { this.willDestroyElement(view); - view._transitionTo('destroying', false); + + view._willRemoveElement = true; + run.schedule('render', this, this.renderElementRemoval, view); }; +Renderer.prototype.renderElementRemoval = + function Renderer_renderElementRemoval(view) { + // Use the _willRemoveElement flag to avoid mulitple removal attempts in + // case many have been scheduled. This should be more performant than using + // `scheduleOnce`. + if (view._willRemoveElement) { + view._willRemoveElement = false; + + if (view.lastResult) { + view.renderNode.clear(); + } + this.didDestroyElement(view); + } + }; + Renderer.prototype.willRemoveElement = function (view) {}; Renderer.prototype.willDestroyElement = function (view) { @@ -183,13 +200,34 @@ Renderer.prototype.willDestroyElement = function (view) { view.trigger('willDestroyElement'); view.trigger('willClearRender'); } + + view._transitionTo('destroying', false); + + var childViews = view.childViews; + if (childViews) { + for (var i = 0; i < childViews.length; i++) { + this.willDestroyElement(childViews[i]); + } + } }; Renderer.prototype.didDestroyElement = function (view) { view.element = null; - if (view._transitionTo) { + + // Views that are being destroyed should never go back to the preRender state. + // However if we're just destroying an element on a view (as is the case when + // using View#remove) then the view should go to a preRender state so that + // it can be rendered again later. + if (view._state !== 'destroying') { view._transitionTo('preRender'); } + + var childViews = view.childViews; + if (childViews) { + for (var i = 0; i < childViews.length; i++) { + this.didDestroyElement(childViews[i]); + } + } }; // element destroyed so view.destroy shouldn't try to remove it removedFromDOM export default Renderer;
true
Other
emberjs
ember.js
54ed612c6b214861e480308b4201c1deab04e09e.json
Get more tests with view#remove working
packages/ember-views/tests/system/event_dispatcher_test.js
@@ -98,9 +98,11 @@ QUnit.test("should not dispatch events to views not inDOM", function() { var $element = view.$(); - // TODO change this test not to use private API - // Force into preRender - view.renderer.remove(view, false, true); + run(function() { + // TODO change this test not to use private API + // Force into preRender + view.renderer.remove(view, false, true); + }); $element.trigger('mousedown');
true
Other
emberjs
ember.js
54ed612c6b214861e480308b4201c1deab04e09e.json
Get more tests with view#remove working
packages/ember-views/tests/views/view/append_to_test.js
@@ -186,7 +186,7 @@ QUnit.test("trigger rerender of parent and SimpleBoundView", function () { }); }); -QUnit.skip("remove removes an element from the DOM", function() { +QUnit.test("remove removes an element from the DOM", function() { willDestroyCalled = 0; view = View.create({ @@ -213,7 +213,7 @@ QUnit.skip("remove removes an element from the DOM", function() { equal(willDestroyCalled, 1, "the willDestroyElement hook was called once"); }); -QUnit.skip("destroy more forcibly removes the view", function() { +QUnit.test("destroy more forcibly removes the view", function() { willDestroyCalled = 0; view = View.create({ @@ -315,7 +315,7 @@ QUnit.module("EmberView - removing views in a view hierarchy", { } }); -QUnit.skip("remove removes child elements from the DOM", function() { +QUnit.test("remove removes child elements from the DOM", function() { ok(!get(childView, 'element'), "precond - should not have an element"); run(function() { @@ -335,7 +335,7 @@ QUnit.skip("remove removes child elements from the DOM", function() { equal(willDestroyCalled, 1, "the willDestroyElement hook was called once"); }); -QUnit.skip("destroy more forcibly removes child views", function() { +QUnit.test("destroy more forcibly removes child views", function() { ok(!get(childView, 'element'), "precond - should not have an element"); run(function() {
true
Other
emberjs
ember.js
54ed612c6b214861e480308b4201c1deab04e09e.json
Get more tests with view#remove working
packages/ember-views/tests/views/view/remove_test.js
@@ -134,7 +134,7 @@ QUnit.test("does nothing if not in parentView", function() { }); -QUnit.skip("the DOM element is gone after doing append and remove in two separate runloops", function() { +QUnit.test("the DOM element is gone after doing append and remove in two separate runloops", function() { view = View.create(); run(function() { view.append();
true
Other
emberjs
ember.js
f11e02afce4056734ec7ebb994a8860200cb384c.json
Use template instead of render buffer
packages/ember-views/tests/system/ext_test.js
@@ -1,9 +1,10 @@ import run from "ember-metal/run_loop"; import View from "ember-views/views/view"; +import { compile } from "ember-template-compiler"; QUnit.module("Ember.View additions to run queue"); -QUnit.skip("View hierarchy is done rendering to DOM when functions queued in afterRender execute", function() { +QUnit.test("View hierarchy is done rendering to DOM when functions queued in afterRender execute", function() { var didInsert = 0; var childView = View.create({ elementId: 'child_view', @@ -13,9 +14,8 @@ QUnit.skip("View hierarchy is done rendering to DOM when functions queued in aft }); var parentView = View.create({ elementId: 'parent_view', - render(buffer) { - this.appendChild(childView); - }, + template: compile("{{view view.childView}}"), + childView: childView, didInsertElement() { didInsert++; }
false
Other
emberjs
ember.js
1d55056cd4a0966aa577d1fa355e11627a62f462.json
prefer promises to semaphores * test now correctly fail, not just hang
tests/node/app-boot-test.js
@@ -186,8 +186,6 @@ if (canUseInstanceInitializers && canUseApplicationVisit) { }); QUnit.test("It is possible to render a view with {{link-to}} in Node", function() { - QUnit.stop(); - var app; run(function() { @@ -203,19 +201,14 @@ if (canUseInstanceInitializers && canUseApplicationVisit) { }); }); - app.visit('/').then(function(instance) { - QUnit.start(); - + return app.visit('/').then(function(instance) { var element = renderToElement(instance); assertHTMLMatches(element.firstChild, /^<div id="ember\d+" class="ember-view"><h1><a id="ember\d+" class="ember-view" href="\/photos">Go to photos<\/a><\/h1><\/div>$/); }); }); QUnit.test("It is possible to render outlets in Node", function() { - QUnit.stop(); - QUnit.stop(); - var app; run(function() { @@ -233,20 +226,19 @@ if (canUseInstanceInitializers && canUseApplicationVisit) { }); }); - app.visit('/').then(function(instance) { - QUnit.start(); - + var visits = []; + visits.push(app.visit('/').then(function(instance) { var element = renderToElement(instance); assertHTMLMatches(element.firstChild, /<div id="ember(.*)" class="ember-view"><p><span>index<\/span><\/p><\/div>/); - }); - - app.visit('/photos').then(function(instance) { - QUnit.start(); + })); + visits.push(app.visit('/photos').then(function(instance) { var element = renderToElement(instance); assertHTMLMatches(element.firstChild, /<div id="ember(.*)" class="ember-view"><p><em>photos<\/em><\/p><\/div>/); - }); + })); + + return Ember.RSVP.Promise.all(visits); }); }
false
Other
emberjs
ember.js
b325125a1f54c2e4a6e034da5ebfb55b15c8db2f.json
fix action targeting when there is no view
packages/ember-routing-htmlbars/lib/keywords/action.js
@@ -36,7 +36,7 @@ export default { target = read(hash.target); } } else { - target = get(env.view, 'controller'); + target = get(env.view, 'controller') || read(scope.self); } return { actionName, actionArgs, target };
true
Other
emberjs
ember.js
b325125a1f54c2e4a6e034da5ebfb55b15c8db2f.json
fix action targeting when there is no view
packages/ember-routing-htmlbars/tests/helpers/action_test.js
@@ -99,7 +99,7 @@ QUnit.test("should by default target the view's controller", function() { equal(registeredTarget, controller, "The controller was registered as the target"); }); -QUnit.skip("Inside a yield, the target points at the original target", function() { +QUnit.test("Inside a yield, the target points at the original target", function() { var watted = false; var component = EmberComponent.extend({
true
Other
emberjs
ember.js
b325125a1f54c2e4a6e034da5ebfb55b15c8db2f.json
fix action targeting when there is no view
packages/ember/tests/component_registration_test.js
@@ -283,7 +283,7 @@ QUnit.skip("properties of a component without a template should not collide wit equal(Ember.$('#wrapper').text(), "Some text inserted by jQuery", "The component is composed correctly"); }); -QUnit.skip("Components trigger actions in the parents context when called from within a block", function() { +QUnit.test("Components trigger actions in the parents context when called from within a block", function() { Ember.TEMPLATES.application = compile("<div id='wrapper'>{{#my-component}}<a href='#' id='fizzbuzz' {{action 'fizzbuzz'}}>Fizzbuzz</a>{{/my-component}}</div>"); boot(function() { @@ -303,7 +303,7 @@ QUnit.skip("Components trigger actions in the parents context when called from w }); }); -QUnit.skip("Components trigger actions in the components context when called from within its template", function() { +QUnit.test("Components trigger actions in the components context when called from within its template", function() { Ember.TEMPLATES.application = compile("<div id='wrapper'>{{#my-component}}{{text}}{{/my-component}}</div>"); Ember.TEMPLATES['components/my-component'] = compile("<a href='#' id='fizzbuzz' {{action 'fizzbuzz'}}>Fizzbuzz</a>");
true
Other
emberjs
ember.js
b325125a1f54c2e4a6e034da5ebfb55b15c8db2f.json
fix action targeting when there is no view
packages/ember/tests/helpers/link_to_test.js
@@ -367,7 +367,7 @@ QUnit.test("The {{link-to}} helper supports multiple current-when routes", funct equal(Ember.$('#link3.active', '#qunit-fixture').length, 0, "The link is not active since current-when does not contain the active route"); }); -QUnit.skip("The {{link-to}} helper defaults to bubbling", function() { +QUnit.test("The {{link-to}} helper defaults to bubbling", function() { Ember.TEMPLATES.about = compile("<div {{action 'hide'}}>{{#link-to 'about.contact' id='about-contact'}}About{{/link-to}}</div>{{outlet}}"); Ember.TEMPLATES['about/contact'] = compile("<h1 id='contact'>Contact</h1>");
true
Other
emberjs
ember.js
b325125a1f54c2e4a6e034da5ebfb55b15c8db2f.json
fix action targeting when there is no view
packages/ember/tests/routing/basic_test.js
@@ -1126,8 +1126,7 @@ asyncTest("Nested callbacks are not exited when moving to siblings", function() }); }); -// Revert QUnit.skip to QUnit.asyncTest -QUnit.skip("Events are triggered on the controller if a matching action name is implemented", function() { +QUnit.asyncTest("Events are triggered on the controller if a matching action name is implemented", function() { Router.map(function() { this.route("home", { path: "/" }); }); @@ -1171,8 +1170,7 @@ QUnit.skip("Events are triggered on the controller if a matching action name is action.handler(event); }); -// Revert QUnit.skip to QUnit.asyncTest -QUnit.skip("Events are triggered on the current state when defined in `actions` object", function() { +QUnit.asyncTest("Events are triggered on the current state when defined in `actions` object", function() { Router.map(function() { this.route("home", { path: "/" }); }); @@ -1206,8 +1204,7 @@ QUnit.skip("Events are triggered on the current state when defined in `actions` action.handler(event); }); -// Revert QUnit.skip to QUnit.asyncTest -QUnit.skip("Events defined in `actions` object are triggered on the current state when routes are nested", function() { +QUnit.asyncTest("Events defined in `actions` object are triggered on the current state when routes are nested", function() { Router.map(function() { this.resource("root", { path: "/" }, function() { this.route("index", { path: "/" }); @@ -1245,8 +1242,7 @@ QUnit.skip("Events defined in `actions` object are triggered on the current stat action.handler(event); }); -// Revert QUnit.skip to QUnit.asyncTest -QUnit.skip("Events are triggered on the current state when defined in `events` object (DEPRECATED)", function() { +QUnit.asyncTest("Events are triggered on the current state when defined in `events` object (DEPRECATED)", function() { Router.map(function() { this.route("home", { path: "/" }); }); @@ -1281,8 +1277,7 @@ QUnit.skip("Events are triggered on the current state when defined in `events` o action.handler(event); }); -// Revert QUnit.skip to QUnit.asyncTest -QUnit.skip("Events defined in `events` object are triggered on the current state when routes are nested (DEPRECATED)", function() { +QUnit.asyncTest("Events defined in `events` object are triggered on the current state when routes are nested (DEPRECATED)", function() { Router.map(function() { this.resource("root", { path: "/" }, function() { this.route("index", { path: "/" }); @@ -1360,8 +1355,7 @@ QUnit.test("Events can be handled by inherited event handlers", function() { router.send("baz"); }); -// Revert QUnit.skip to QUnit.asyncTest -QUnit.skip("Actions are not triggered on the controller if a matching action name is implemented as a method", function() { +QUnit.asyncTest("Actions are not triggered on the controller if a matching action name is implemented as a method", function() { Router.map(function() { this.route("home", { path: "/" }); }); @@ -1404,8 +1398,7 @@ QUnit.skip("Actions are not triggered on the controller if a matching action nam action.handler(event); }); -// Revert QUnit.skip to QUnit.asyncTest -QUnit.skip("actions can be triggered with multiple arguments", function() { +QUnit.asyncTest("actions can be triggered with multiple arguments", function() { Router.map(function() { this.resource("root", { path: "/" }, function() { this.route("index", { path: "/" });
true
Other
emberjs
ember.js
fda788458e8d40454c343a3ccf34f05e7a98bf69.json
drop dead code this argument was used by the pre-glimmer OutletView only
packages/ember-routing/lib/system/router.js
@@ -214,7 +214,7 @@ var EmberRouter = EmberObject.extend(Evented, { } if (!this._toplevelView) { var OutletView = this.container.lookupFactory('view:-outlet'); - this._toplevelView = OutletView.create({ _isTopLevel: true }); + this._toplevelView = OutletView.create(); var instance = this.container.lookup('-application-instance:main'); instance.didCreateRootView(this._toplevelView); }
false
Other
emberjs
ember.js
bbc901d90dc1aca1f926579deecbcca05b930214.json
fix tests that don't cleanup Application instances
packages/ember-application/tests/system/application_test.js
@@ -86,7 +86,6 @@ QUnit.test("you cannot make two default applications without a rootElement error QUnit.test("acts like a namespace", function() { var lookup = Ember.lookup = {}; - var app; run(function() { app = lookup.TestApp = Application.create({ rootElement: '#two', router: false });
true
Other
emberjs
ember.js
bbc901d90dc1aca1f926579deecbcca05b930214.json
fix tests that don't cleanup Application instances
packages/ember-application/tests/system/initializers_test.js
@@ -237,6 +237,7 @@ QUnit.test("initializers set on Application subclasses should not be shared betw var firstInitializerRunCount = 0; var secondInitializerRunCount = 0; var FirstApp = Application.extend(); + var firstApp, secondApp; FirstApp.initializer({ name: 'first', initialize(registry) { @@ -252,27 +253,32 @@ QUnit.test("initializers set on Application subclasses should not be shared betw }); jQuery('#qunit-fixture').html('<div id="first"></div><div id="second"></div>'); run(function() { - FirstApp.create({ + firstApp = FirstApp.create({ router: false, rootElement: '#qunit-fixture #first' }); }); equal(firstInitializerRunCount, 1, 'first initializer only was run'); equal(secondInitializerRunCount, 0, 'first initializer only was run'); run(function() { - SecondApp.create({ + secondApp = SecondApp.create({ router: false, rootElement: '#qunit-fixture #second' }); }); equal(firstInitializerRunCount, 1, 'second initializer only was run'); equal(secondInitializerRunCount, 1, 'second initializer only was run'); + run(function() { + firstApp.destroy(); + secondApp.destroy(); + }); }); QUnit.test("initializers are concatenated", function() { var firstInitializerRunCount = 0; var secondInitializerRunCount = 0; var FirstApp = Application.extend(); + var firstApp, secondApp; FirstApp.initializer({ name: 'first', initialize(registry) { @@ -290,7 +296,7 @@ QUnit.test("initializers are concatenated", function() { jQuery('#qunit-fixture').html('<div id="first"></div><div id="second"></div>'); run(function() { - FirstApp.create({ + firstApp = FirstApp.create({ router: false, rootElement: '#qunit-fixture #first' }); @@ -299,13 +305,17 @@ QUnit.test("initializers are concatenated", function() { equal(secondInitializerRunCount, 0, 'first initializer only was run when base class created'); firstInitializerRunCount = 0; run(function() { - SecondApp.create({ + secondApp = SecondApp.create({ router: false, rootElement: '#qunit-fixture #second' }); }); equal(firstInitializerRunCount, 1, 'first initializer was run when subclass created'); equal(secondInitializerRunCount, 1, 'second initializers was run when subclass created'); + run(function() { + firstApp.destroy(); + secondApp.destroy(); + }); }); QUnit.test("initializers are per-app", function() {
true
Other
emberjs
ember.js
bbc901d90dc1aca1f926579deecbcca05b930214.json
fix tests that don't cleanup Application instances
packages/ember-application/tests/system/instance_initializers_test.js
@@ -241,6 +241,8 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) { var firstInitializerRunCount = 0; var secondInitializerRunCount = 0; var FirstApp = Application.extend(); + var firstApp, secondApp; + FirstApp.instanceInitializer({ name: 'first', initialize(registry) { @@ -256,27 +258,34 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) { }); jQuery('#qunit-fixture').html('<div id="first"></div><div id="second"></div>'); run(function() { - FirstApp.create({ + firstApp = FirstApp.create({ router: false, rootElement: '#qunit-fixture #first' }); }); equal(firstInitializerRunCount, 1, 'first initializer only was run'); equal(secondInitializerRunCount, 0, 'first initializer only was run'); run(function() { - SecondApp.create({ + secondApp = SecondApp.create({ router: false, rootElement: '#qunit-fixture #second' }); }); equal(firstInitializerRunCount, 1, 'second initializer only was run'); equal(secondInitializerRunCount, 1, 'second initializer only was run'); + run(function() { + firstApp.destroy(); + secondApp.destroy(); + }); + }); QUnit.test("initializers are concatenated", function() { var firstInitializerRunCount = 0; var secondInitializerRunCount = 0; var FirstApp = Application.extend(); + var firstApp, secondApp; + FirstApp.instanceInitializer({ name: 'first', initialize(registry) { @@ -294,7 +303,7 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) { jQuery('#qunit-fixture').html('<div id="first"></div><div id="second"></div>'); run(function() { - FirstApp.create({ + firstApp = FirstApp.create({ router: false, rootElement: '#qunit-fixture #first' }); @@ -303,13 +312,17 @@ if (Ember.FEATURES.isEnabled('ember-application-instance-initializers')) { equal(secondInitializerRunCount, 0, 'first initializer only was run when base class created'); firstInitializerRunCount = 0; run(function() { - SecondApp.create({ + secondApp = SecondApp.create({ router: false, rootElement: '#qunit-fixture #second' }); }); equal(firstInitializerRunCount, 1, 'first initializer was run when subclass created'); equal(secondInitializerRunCount, 1, 'second initializers was run when subclass created'); + run(function() { + firstApp.destroy(); + secondApp.destroy(); + }); }); QUnit.test("initializers are per-app", function() {
true
Other
emberjs
ember.js
06aab7c7f986540a5446cc903d6303ade58d5129.json
Reimplement hasBlock and hasBlockParams
package.json
@@ -23,7 +23,7 @@ "express": "^4.5.0", "github": "^0.2.3", "glob": "~4.3.2", - "htmlbars": "0.13.4", + "htmlbars": "0.13.5", "qunit-extras": "^1.3.0", "qunitjs": "^1.16.0", "route-recognizer": "0.1.5",
true
Other
emberjs
ember.js
06aab7c7f986540a5446cc903d6303ade58d5129.json
Reimplement hasBlock and hasBlockParams
packages/ember-htmlbars/lib/hooks/get-root.js
@@ -10,6 +10,10 @@ import SimpleStream from "ember-metal/streams/simple-stream"; export default function getRoot(scope, key) { if (key === 'this') { return [scope.self]; + } else if (key === 'hasBlock') { + return [!!scope.block]; + } else if (key === 'hasBlockParams') { + return [!!(scope.block && scope.block.arity)]; } else if (isGlobal(key) && Ember.lookup[key]) { return [getGlobal(key)]; } else if (scope.locals[key]) {
true
Other
emberjs
ember.js
06aab7c7f986540a5446cc903d6303ade58d5129.json
Reimplement hasBlock and hasBlockParams
packages/ember-htmlbars/lib/system/component-node.js
@@ -91,7 +91,9 @@ ComponentNode.prototype.render = function(env, attrs, visitor) { env.renderer.willRender(component); } - this.block(newEnv, [], undefined, this.renderNode, this.scope, visitor); + if (this.block) { + this.block(newEnv, [], undefined, this.renderNode, this.scope, visitor); + } if (component) { env.renderer.didCreateElement(component, this.expectElement && this.renderNode.firstNode); @@ -121,7 +123,9 @@ ComponentNode.prototype.rerender = function(env, attrs, visitor) { env.renderer.willRender(component); } - this.block(newEnv, [], undefined, this.renderNode, this.scope, visitor); + if (this.block) { + this.block(newEnv, [], undefined, this.renderNode, this.scope, visitor); + } if (component) { env.lifecycleHooks.push({ type: 'didUpdate', view: component });
true
Other
emberjs
ember.js
06aab7c7f986540a5446cc903d6303ade58d5129.json
Reimplement hasBlock and hasBlockParams
packages/ember-htmlbars/tests/integration/component_invocation_test.js
@@ -173,7 +173,7 @@ QUnit.test('[DEPRECATED] block with properties on self', function() { }); if (Ember.FEATURES.isEnabled('ember-views-component-block-info')) { - QUnit.skip('`Component.prototype.hasBlock` when block supplied', function() { + QUnit.test('hasBlock is true when block supplied', function() { expect(1); registry.register('template:components/with-block', compile('{{#if hasBlock}}{{yield}}{{else}}No Block!{{/if}}')); @@ -188,7 +188,7 @@ if (Ember.FEATURES.isEnabled('ember-views-component-block-info')) { equal(jQuery('#qunit-fixture').text(), 'In template'); }); - QUnit.test('`Component.prototype.hasBlock` when no block supplied', function() { + QUnit.test('hasBlock is false when no block supplied', function() { expect(1); registry.register('template:components/with-block', compile('{{#if hasBlock}}{{yield}}{{else}}No Block!{{/if}}')); @@ -203,7 +203,7 @@ if (Ember.FEATURES.isEnabled('ember-views-component-block-info')) { equal(jQuery('#qunit-fixture').text(), 'No Block!'); }); - QUnit.skip('`Component.prototype.hasBlockParams` when block param supplied', function() { + QUnit.test('hasBlockParams is true when block param supplied', function() { expect(1); registry.register('template:components/with-block', compile('{{#if hasBlockParams}}{{yield this}} - In Component{{else}}{{yield}} No Block!{{/if}}')); @@ -218,7 +218,7 @@ if (Ember.FEATURES.isEnabled('ember-views-component-block-info')) { equal(jQuery('#qunit-fixture').text(), 'In template - In Component'); }); - QUnit.test('`Component.prototype.hasBlockParams` when no block param supplied', function() { + QUnit.test('hasBlockParams is false when no block param supplied', function() { expect(1); registry.register('template:components/with-block', compile('{{#if hasBlockParams}}{{yield this}}{{else}}{{yield}} No Block Param!{{/if}}'));
true
Other
emberjs
ember.js
06aab7c7f986540a5446cc903d6303ade58d5129.json
Reimplement hasBlock and hasBlockParams
packages/ember-views/lib/system/build-component-template.js
@@ -9,8 +9,6 @@ export default function buildComponentTemplate(componentInfo, attrs, content) { component = componentInfo.component; - blockToRender = function() {}; - if (content.template) { blockToRender = createContentBlock(content.template, content.scope, content.self, component || null); }
true
Other
emberjs
ember.js
f892dc8390f40ba84e825e946dea131afbaa01c1.json
Use templates to test View.nearestTypeOf.
packages/ember-views/tests/views/view/nearest_of_type_test.js
@@ -1,6 +1,7 @@ import run from "ember-metal/run_loop"; import { Mixin as EmberMixin } from "ember-metal/mixin"; import View from "ember-views/views/view"; +import compile from "ember-template-compiler/system/compile"; var parentView, view; @@ -16,12 +17,10 @@ QUnit.module("View#nearest*", { (function() { var Mixin = EmberMixin.create({}); var Parent = View.extend(Mixin, { - render(buffer) { - this.appendChild(View.create()); - } + template: compile(`{{view}}`) }); - QUnit.skip("nearestOfType should find the closest view by view class", function() { + QUnit.test("nearestOfType should find the closest view by view class", function() { var child; run(function() { @@ -33,7 +32,7 @@ QUnit.module("View#nearest*", { equal(child.nearestOfType(Parent), parentView, "finds closest view in the hierarchy by class"); }); - QUnit.skip("nearestOfType should find the closest view by mixin", function() { + QUnit.test("nearestOfType should find the closest view by mixin", function() { var child; run(function() { @@ -45,15 +44,12 @@ QUnit.module("View#nearest*", { equal(child.nearestOfType(Mixin), parentView, "finds closest view in the hierarchy by class"); }); - QUnit.skip("nearestWithProperty should search immediate parent", function() { + QUnit.test("nearestWithProperty should search immediate parent", function() { var childView; view = View.create({ myProp: true, - - render(buffer) { - this.appendChild(View.create()); - } + template: compile('{{view}}') }); run(function() { @@ -65,7 +61,7 @@ QUnit.module("View#nearest*", { }); - QUnit.skip("nearestChildOf should be deprecated", function() { + QUnit.test("nearestChildOf should be deprecated", function() { var child; run(function() {
false
Other
emberjs
ember.js
f34d66901205b8088821c14e1c78a77a6edd0a82.json
Remove prototype extensions example.
packages/ember-metal/lib/run_loop.js
@@ -126,12 +126,12 @@ run.join = function() { ```javascript App.RichTextEditorComponent = Ember.Component.extend({ - initializeTinyMCE: function() { + initializeTinyMCE: Ember.on('didInsertElement', function() { tinymce.init({ selector: '#' + this.$().prop('id'), setup: Ember.run.bind(this, this.setupEditor) }); - }.on('didInsertElement'), + }), setupEditor: function(editor) { this.set('editor', editor);
false
Other
emberjs
ember.js
ffedc10ea3c11ff17040175b28d3bbe3bfda24a3.json
Fix invalid assertion.
packages/ember-views/tests/views/select_test.js
@@ -146,7 +146,7 @@ QUnit.test("XSS: does not escape label value when it is a SafeString", function( append(); equal(select.$('option').length, 2, "Should have two options"); - equal(select.$('option[value=1] b').length, 1, "Should have child elements"); + equal(select.$('option[value=1] p').length, 1, "Should have child elements"); // IE 8 adds whitespace equal(trim(select.$().text()), "YehudaTom", "Options should have content");
false
Other
emberjs
ember.js
7d342b6682b95692d2d93e7a8a787dc3d6a1d655.json
Remove unused AttrNode.
packages/ember-views/lib/attr_nodes/attr_node.js
@@ -1,123 +0,0 @@ -/** -@module ember -@submodule ember-htmlbars -*/ - -import Ember from 'ember-metal/core'; -import { - read, - subscribe, - unsubscribe -} from "ember-metal/streams/utils"; -import run from "ember-metal/run_loop"; - -export default function AttrNode(attrName, attrValue) { - this.init(attrName, attrValue); -} - -export var styleWarning = 'Binding style attributes may introduce cross-site scripting vulnerabilities; ' + - 'please ensure that values being bound are properly escaped. For more information, ' + - 'including how to disable this warning, see ' + - 'http://emberjs.com/deprecations/v1.x/#toc_binding-style-attributes.'; - -AttrNode.prototype.init = function init(attrName, simpleAttrValue) { - this.isAttrNode = true; - this.isView = true; - - this.tagName = ''; - this.isVirtual = true; - - this.attrName = attrName; - this.attrValue = simpleAttrValue; - this.isDirty = true; - this.isDestroying = false; - this.lastValue = null; - this.hasRenderedInitially = false; - - subscribe(this.attrValue, this.rerender, this); -}; - -AttrNode.prototype.renderIfDirty = function renderIfDirty() { - if (this.isDirty && !this.isDestroying) { - var value = read(this.attrValue); - if (value !== this.lastValue) { - this._renderer.renderTree(this, this._parentView); - } else { - this.isDirty = false; - } - } -}; - -AttrNode.prototype.render = function render(buffer) { - this.isDirty = false; - if (this.isDestroying) { - return; - } - - var value = read(this.attrValue); - - if (this.attrName === 'value' && (value === null || value === undefined)) { - value = ''; - } - - if (value === undefined) { - value = null; - } - - - // If user is typing in a value we don't want to rerender and loose cursor position. - if (this.hasRenderedInitially && this.attrName === 'value' && this._morph.element.value === value) { - this.lastValue = value; - return; - } - - if (this.lastValue !== null || value !== null) { - this._deprecateEscapedStyle(value); - this._morph.setContent(value); - this.lastValue = value; - this.hasRenderedInitially = true; - } -}; - -AttrNode.prototype._deprecateEscapedStyle = function AttrNode_deprecateEscapedStyle(value) { - Ember.warn( - styleWarning, - (function(name, value, escaped) { - // SafeString - if (value && value.toHTML) { - return true; - } - - if (name !== 'style') { - return true; - } - - return !escaped; - }(this.attrName, value, this._morph.escaped)) - ); -}; - -AttrNode.prototype.rerender = function AttrNode_render() { - this.isDirty = true; - run.schedule('render', this, this.renderIfDirty); -}; - -AttrNode.prototype.destroy = function AttrNode_destroy() { - this.isDestroying = true; - this.isDirty = false; - - unsubscribe(this.attrValue, this.rerender, this); - - if (!this.removedFromDOM && this._renderer) { - this._renderer.remove(this, true); - } -}; - -AttrNode.prototype.propertyDidChange = function render() { -}; - -AttrNode.prototype._notifyBecameHidden = function render() { -}; - -AttrNode.prototype._notifyBecameVisible = function render() { -};
false
Other
emberjs
ember.js
f73264d685fda7e9b9d9d17bc7d39f9477ed225c.json
Fix a test using an undefined context Context-changing helpers no longer allow an undefined context. Instead, null is substituted for the context.
packages/ember-htmlbars/lib/helpers/each.js
@@ -1,5 +1,6 @@ import { get } from "ember-metal/property_get"; import { forEach } from "ember-metal/enumerable_utils"; +import normalizeSelf from "ember-htmlbars/utils/normalize-self"; export default function eachHelper(params, hash, blocks) { var list = params[0]; @@ -15,7 +16,7 @@ export default function eachHelper(params, hash, blocks) { var self; if (blocks.template.arity === 0) { Ember.deprecate(deprecation); - self = item; + self = normalizeSelf(item); } var key = keyPath ? get(item, keyPath) : String(i);
true
Other
emberjs
ember.js
f73264d685fda7e9b9d9d17bc7d39f9477ed225c.json
Fix a test using an undefined context Context-changing helpers no longer allow an undefined context. Instead, null is substituted for the context.
packages/ember-htmlbars/lib/helpers/with.js
@@ -3,6 +3,8 @@ @submodule ember-htmlbars */ +import normalizeSelf from "ember-htmlbars/utils/normalize-self"; + /** Use the `{{with}}` helper when you want to aliases the to a new name. It's helpful for semantic clarity and to retain default scope or to reference from another @@ -51,6 +53,6 @@ export default function withHelper(params, hash, options) { if (preserveContext) { this.yield([params[0]]); } else { - this.yield([], params[0]); + this.yield([], normalizeSelf(params[0])); } }
true
Other
emberjs
ember.js
f73264d685fda7e9b9d9d17bc7d39f9477ed225c.json
Fix a test using an undefined context Context-changing helpers no longer allow an undefined context. Instead, null is substituted for the context.
packages/ember-htmlbars/lib/utils/normalize-self.js
@@ -0,0 +1,7 @@ +export default function normalizeSelf(self) { + if (self === undefined) { + return null; + } else { + return self; + } +}
true
Other
emberjs
ember.js
f73264d685fda7e9b9d9d17bc7d39f9477ed225c.json
Fix a test using an undefined context Context-changing helpers no longer allow an undefined context. Instead, null is substituted for the context.
packages/ember-htmlbars/tests/compat/make_bound_helper_test.js
@@ -471,7 +471,7 @@ QUnit.test("shouldn't treat quoted strings as bound paths", function() { equal(helperCount, 5, "changing controller property with same name as quoted string doesn't re-render helper"); }); -QUnit.skip("bound helpers can handle nulls in array (with primitives) [DEPRECATED]", function() { +QUnit.test("bound helpers can handle nulls in array (with primitives) [DEPRECATED]", function() { expectDeprecationInHTMLBars(); // The problem here is that `undefined` is treated as "use the parent scope" in yieldItem
true
Other
emberjs
ember.js
c0561486baf574ffdcb07daa2159d88d5695abd2.json
Remove invalid test
packages/ember-htmlbars/tests/helpers/collection_test.js
@@ -407,38 +407,6 @@ QUnit.test("should give its item views the property specified by itemProperty", equal(view.$('ul li:first').text(), "yobaz", "change property of sub view"); }); -QUnit.skip("should unsubscribe stream bindings", function() { - view = EmberView.create({ - baz: "baz", - content: A([EmberObject.create(), EmberObject.create(), EmberObject.create()]), - template: compile('{{#collection content=view.content itemProperty=view.baz}}{{view.property}}{{/collection}}') - }); - - runAppend(view); - - var barStreamBinding = view._streamBindings['view.baz']; - - equal(countSubscribers(barStreamBinding), 3, "adds 3 subscribers"); - - run(function() { - view.get('content').popObject(); - }); - - equal(countSubscribers(barStreamBinding), 2, "removes 1 subscriber"); -}); - -function countSubscribers(stream) { - var count = 0; - var subscriber = stream.subscriberHead; - - while (subscriber) { - count++; - subscriber = subscriber.next; - } - - return count; -} - QUnit.test("should work inside a bound {{#if}}", function() { var testData = A([EmberObject.create({ isBaz: false }), EmberObject.create({ isBaz: true }), EmberObject.create({ isBaz: true })]); var IfTestCollectionView = CollectionView.extend({
false
Other
emberjs
ember.js
85ff4278f0c8f252cd35a1a9ef967aadc01412fc.json
fix use of template & layout together
packages/ember-htmlbars/lib/system/component-node.js
@@ -41,7 +41,19 @@ ComponentNode.create = function(renderNode, env, attrs, found, parentView, path, if (attrs && attrs.viewName) { options.viewName = read(attrs.viewName); } component = componentInfo.component = createOrUpdateComponent(found.component, options, renderNode); - componentInfo.layout = get(component, 'layout') || get(component, 'template') || componentInfo.layout; + + let layout = get(component, 'layout'); + if (layout) { + componentInfo.layout = layout; + if (!contentTemplate) { + let template = get(component, 'template'); + if (template) { + contentTemplate = template.raw; + } + } + } else { + componentInfo.layout = get(component, 'template') || componentInfo.layout; + } renderNode.emberView = component; }
true
Other
emberjs
ember.js
85ff4278f0c8f252cd35a1a9ef967aadc01412fc.json
fix use of template & layout together
packages/ember-routing-htmlbars/tests/helpers/outlet_test.js
@@ -199,7 +199,7 @@ QUnit.test("Outlets bind to the current template's view, not inner contexts [DEP equal(output, "BOTTOM", "all templates were rendered"); }); -QUnit.skip("should support layouts", function() { +QUnit.test("should support layouts", function() { var template = "{{outlet}}"; var layout = "<h1>HI</h1>{{yield}}"; var routerState = {
true
Other
emberjs
ember.js
85ff4278f0c8f252cd35a1a9ef967aadc01412fc.json
fix use of template & layout together
packages/ember/tests/component_registration_test.js
@@ -160,7 +160,7 @@ QUnit.test("Assigning templateName to a component should setup the template as a equal(Ember.$('#wrapper').text(), "inner-outer", "The component is composed correctly"); }); -QUnit.skip("Assigning templateName and layoutName should use the templates specified", function() { +QUnit.test("Assigning templateName and layoutName should use the templates specified", function() { expect(1); Ember.TEMPLATES.application = compile("<div id='wrapper'>{{my-component}}</div>");
true
Other
emberjs
ember.js
85ff4278f0c8f252cd35a1a9ef967aadc01412fc.json
fix use of template & layout together
packages/ember/tests/routing/basic_test.js
@@ -442,7 +442,7 @@ QUnit.test('defining templateName allows other templates to be rendered', functi }); -QUnit.skip('Specifying a name to render should have precedence over everything else', function() { +QUnit.test('Specifying a name to render should have precedence over everything else', function() { Router.map(function() { this.route("home", { path: "/" }); });
true
Other
emberjs
ember.js
c7f67e8806354e36497f68ec5644405c4d2b5e1f.json
Fix inverse block in compat helpers
packages/ember-htmlbars/lib/compat/helper.js
@@ -47,6 +47,12 @@ function HandlebarsCompatibleHelper(fn) { handlebarsOptions.fn = function() { options.template.yield(); }; + + if (options.inverse) { + handlebarsOptions.inverse = function() { + options.inverse.yield(); + }; + } } for (var prop in hash) {
true
Other
emberjs
ember.js
c7f67e8806354e36497f68ec5644405c4d2b5e1f.json
Fix inverse block in compat helpers
packages/ember-htmlbars/tests/compat/helper_test.js
@@ -225,7 +225,7 @@ QUnit.test('allows usage of the template fn', function() { equal(view.$().text(), 'foo'); }); -QUnit.skip('allows usage of the template inverse', function() { +QUnit.test('allows usage of the template inverse', function() { expect(1); function someHelper(options) {
true
Other
emberjs
ember.js
db465aefdbe4472dc90bfdd481b7cdedd1095bda.json
Add fix for overwriting style attribute bindings
packages/ember-views/lib/system/build-component-template.js
@@ -140,7 +140,14 @@ function normalizeComponentAttributes(component, attrs) { } if (component.isVisible === false) { - normalized.style = ['value', "display: none;"]; + var hiddenStyle = ['value', "display: none;"]; + var existingStyle = normalized.style; + + if (existingStyle) { + normalized.style = ['subexpr', '-concat', [existingStyle, hiddenStyle], ['separator', ' ']]; + } else { + normalized.style = hiddenStyle; + } } return normalized;
true
Other
emberjs
ember.js
db465aefdbe4472dc90bfdd481b7cdedd1095bda.json
Add fix for overwriting style attribute bindings
packages/ember-views/tests/views/view/is_visible_test.js
@@ -71,6 +71,20 @@ QUnit.test("should hide element if isVisible is false before element is created" }); }); +QUnit.test("doesn't overwrite existing style attribute bindings", function() { + view = EmberView.create({ + isVisible: false, + attributeBindings: ['style'], + style: 'color: blue;' + }); + + run(function() { + view.append(); + }); + + equal(view.$().attr('style'), 'color: blue; display: none;', "has concatenated style attribute"); +}); + QUnit.module("EmberView#isVisible with Container", { setup() { expectDeprecation("Setting `childViews` on a Container is deprecated.");
true
Other
emberjs
ember.js
c43cb492c073b079a6a69fc71a2c1e42ff837d83.json
Enable tests that are now passing.
packages/ember-htmlbars/tests/helpers/input_test.js
@@ -108,7 +108,6 @@ QUnit.test("cursor position is not lost when updating content", function() { input.selectionStart = 3; input.selectionEnd = 3; }); - run(null, set, controller, 'val', 'derp'); equal(view.$('input').val(), "derp", "updates text field after value changes"); @@ -407,7 +406,7 @@ QUnit.module("{{input type='text'}} - null/undefined values", { } }); -QUnit.skip("placeholder attribute bound to undefined is not present", function() { +QUnit.test("placeholder attribute bound to undefined is not present", function() { view = View.extend({ container: container, controller: {},
true
Other
emberjs
ember.js
c43cb492c073b079a6a69fc71a2c1e42ff837d83.json
Enable tests that are now passing.
packages/ember-template-compiler/tests/system/compile_test.js
@@ -40,7 +40,7 @@ QUnit.test('the template revision is different than the HTMLBars default revisio ok(actual.revision !== expected.revision, 'revision differs from default'); }); -QUnit.skip('{{with}} template deprecation includes moduleName if provided', function() { +QUnit.test('{{with}} template deprecation includes moduleName if provided', function() { var templateString = "{{#with foo as bar}} {{bar}} {{/with}}"; expectDeprecation(function() {
true
Other
emberjs
ember.js
9efd004ca7e7bd76e4451ebffaa31093c5c78557.json
Update HTMLBars to 0.13.1. Updates HTMLBars to ensure that initially undefined/null `attributeBindings` are not set on the views element.
package.json
@@ -23,7 +23,7 @@ "express": "^4.5.0", "github": "^0.2.3", "glob": "~4.3.2", - "htmlbars": "0.13.0", + "htmlbars": "0.13.1", "qunit-extras": "^1.3.0", "qunitjs": "^1.16.0", "route-recognizer": "0.1.5",
true
Other
emberjs
ember.js
9efd004ca7e7bd76e4451ebffaa31093c5c78557.json
Update HTMLBars to 0.13.1. Updates HTMLBars to ensure that initially undefined/null `attributeBindings` are not set on the views element.
packages/ember-htmlbars/tests/helpers/bind_attr_test.js
@@ -589,7 +589,7 @@ QUnit.test("src attribute bound to undefined is empty", function() { runAppend(view); - equal(view.element.firstChild.getAttribute('src'), '', "src attribute is empty"); + ok(!view.element.firstChild.hasAttribute('src'), "src attribute is empty"); }); QUnit.test("src attribute bound to null is not present", function() {
true
Other
emberjs
ember.js
47ddf42b2c10324d9e8d35397db8195c9108a465.json
Unify legacy class binding into AST preprocessor There are several paths and microsyntaxes for creating class name bindings for a component’s element via Handlebars. For example: `{{view ‘my-view’ class=“hello” classBindings=“:foo isApp:is-an-app”}}` With HTMLbars, these have been deprecated in favor of a single API: `{{view class=“hello foo (if isApp ‘is-an-app’)”}}` This commit rewrites the AST of templates that contain the old syntax into the new syntax at template compile time.
packages/ember-htmlbars/lib/helpers/-concat.js
@@ -0,0 +1,7 @@ +/** @private + This private helper is used by the legacy class bindings AST transformer + to concatenate class names together. +*/ +export default function concat(params, hash) { + return params.join(hash.separator); +}
true
Other
emberjs
ember.js
47ddf42b2c10324d9e8d35397db8195c9108a465.json
Unify legacy class binding into AST preprocessor There are several paths and microsyntaxes for creating class name bindings for a component’s element via Handlebars. For example: `{{view ‘my-view’ class=“hello” classBindings=“:foo isApp:is-an-app”}}` With HTMLbars, these have been deprecated in favor of a single API: `{{view class=“hello foo (if isApp ‘is-an-app’)”}}` This commit rewrites the AST of templates that contain the old syntax into the new syntax at template compile time.
packages/ember-htmlbars/lib/helpers/-normalize-class.js
@@ -1,4 +1,5 @@ import { dasherize } from "ember-runtime/system/string"; +import { isPath } from "ember-metal/path_cache"; /** @private This private helper is used by ComponentNode to convert the classNameBindings @@ -23,6 +24,12 @@ export default function normalizeClass(params, hash) { // If value is a Boolean and true, return the dasherized property // name. } else if (value === true) { + // Only apply to last segment in the path + if (propName && isPath(propName)) { + var segments = propName.split('.'); + propName = segments[segments.length - 1]; + } + return dasherize(propName); // If the value is not false, undefined, or null, return the current
true
Other
emberjs
ember.js
47ddf42b2c10324d9e8d35397db8195c9108a465.json
Unify legacy class binding into AST preprocessor There are several paths and microsyntaxes for creating class name bindings for a component’s element via Handlebars. For example: `{{view ‘my-view’ class=“hello” classBindings=“:foo isApp:is-an-app”}}` With HTMLbars, these have been deprecated in favor of a single API: `{{view class=“hello foo (if isApp ‘is-an-app’)”}}` This commit rewrites the AST of templates that contain the old syntax into the new syntax at template compile time.
packages/ember-htmlbars/lib/main.js
@@ -23,6 +23,7 @@ import logHelper from "ember-htmlbars/helpers/log"; import eachHelper from "ember-htmlbars/helpers/each"; import bindAttrClassHelper from "ember-htmlbars/helpers/bind-attr-class"; import normalizeClassHelper from "ember-htmlbars/helpers/-normalize-class"; +import concatHelper from "ember-htmlbars/helpers/-concat"; import DOMHelper from "ember-htmlbars/system/dom-helper"; // importing adds template bootstrapping @@ -41,6 +42,7 @@ registerHelper('log', logHelper); registerHelper('each', eachHelper); registerHelper('bind-attr-class', bindAttrClassHelper); registerHelper('-normalize-class', normalizeClassHelper); +registerHelper('-concat', concatHelper); Ember.HTMLBars = { _registerHelper: registerHelper,
true
Other
emberjs
ember.js
47ddf42b2c10324d9e8d35397db8195c9108a465.json
Unify legacy class binding into AST preprocessor There are several paths and microsyntaxes for creating class name bindings for a component’s element via Handlebars. For example: `{{view ‘my-view’ class=“hello” classBindings=“:foo isApp:is-an-app”}}` With HTMLbars, these have been deprecated in favor of a single API: `{{view class=“hello foo (if isApp ‘is-an-app’)”}}` This commit rewrites the AST of templates that contain the old syntax into the new syntax at template compile time.
packages/ember-htmlbars/tests/helpers/view_test.js
@@ -366,11 +366,13 @@ QUnit.test("allows you to pass attributes that will be assigned to the class ins equal(jQuery('#bar').text(), 'Bar'); }); -QUnit.skip("Should apply class without condition always", function() { - view = EmberView.create({ - controller: Ember.Object.create(), - template: compile('{{#view id="foo" classBinding=":foo"}} Foo{{/view}}') - }); +QUnit.test("Should apply class without condition always", function() { + expectDeprecation(function() { + view = EmberView.create({ + controller: Ember.Object.create(), + template: compile('{{#view id="foo" classBinding=":foo"}} Foo{{/view}}') + }); + }, /legacy class binding syntax/); runAppend(view); @@ -440,7 +442,7 @@ QUnit.test("Should not apply classes when bound property specified is false", fu ok(!jQuery('#foo').hasClass('some-prop'), "does not add class when value is falsey"); }); -QUnit.skip("Should apply classes of the dasherized property name when bound property specified is true", function() { +QUnit.test("Should apply classes of the dasherized property name when bound property specified is true", function() { view = EmberView.create({ controller: { someProp: true @@ -453,7 +455,7 @@ QUnit.skip("Should apply classes of the dasherized property name when bound prop ok(jQuery('#foo').hasClass('some-prop'), "adds dasherized class when value is true"); }); -QUnit.skip("Should update classes from a bound property", function() { +QUnit.test("Should update classes from a bound property", function() { var controller = { someProp: true }; @@ -838,7 +840,7 @@ QUnit.test('{{view}} should be able to point to a local view', function() { equal(view.$().text(), 'common', 'tries to look up view name locally'); }); -QUnit.skip('{{view}} should evaluate class bindings set to global paths DEPRECATED', function() { +QUnit.test('{{view}} should evaluate class bindings set to global paths DEPRECATED', function() { var App; run(function() { @@ -850,10 +852,12 @@ QUnit.skip('{{view}} should evaluate class bindings set to global paths DEPRECAT }); }); - view = EmberView.create({ - textField: TextField, - template: compile('{{view view.textField class="unbound" classBinding="App.isGreat:great App.directClass App.isApp App.isEnabled:enabled:disabled"}}') - }); + expectDeprecation(function() { + view = EmberView.create({ + textField: TextField, + template: compile('{{view view.textField class="unbound" classBinding="App.isGreat:great App.directClass App.isApp App.isEnabled:enabled:disabled"}}') + }); + }, /legacy class binding/); expectDeprecation(function() { runAppend(view); @@ -878,15 +882,17 @@ QUnit.skip('{{view}} should evaluate class bindings set to global paths DEPRECAT runDestroy(lookup.App); }); -QUnit.skip('{{view}} should evaluate class bindings set in the current context', function() { - view = EmberView.create({ - isView: true, - isEditable: true, - directClass: 'view-direct', - isEnabled: true, - textField: TextField, - template: compile('{{view view.textField class="unbound" classBinding="view.isEditable:editable view.directClass view.isView view.isEnabled:enabled:disabled"}}') - }); +QUnit.test('{{view}} should evaluate class bindings set in the current context', function() { + expectDeprecation(function() { + view = EmberView.create({ + isView: true, + isEditable: true, + directClass: 'view-direct', + isEnabled: true, + textField: TextField, + template: compile('{{view view.textField class="unbound" classBinding="view.isEditable:editable view.directClass view.isView view.isEnabled:enabled:disabled"}}') + }); + }, /legacy class binding syntax/); runAppend(view); @@ -907,7 +913,7 @@ QUnit.skip('{{view}} should evaluate class bindings set in the current context', ok(view.$('input').hasClass('disabled'), 'evaluates ternary operator in classBindings'); }); -QUnit.skip('{{view}} should evaluate class bindings set with either classBinding or classNameBindings from globals DEPRECATED', function() { +QUnit.test('{{view}} should evaluate class bindings set with either classBinding or classNameBindings from globals DEPRECATED', function() { var App; run(function() { @@ -917,10 +923,12 @@ QUnit.skip('{{view}} should evaluate class bindings set with either classBinding }); }); - view = EmberView.create({ - textField: TextField, - template: compile('{{view view.textField class="unbound" classBinding="App.isGreat:great App.isEnabled:enabled:disabled" classNameBindings="App.isGreat:really-great App.isEnabled:really-enabled:really-disabled"}}') - }); + expectDeprecation(function() { + view = EmberView.create({ + textField: TextField, + template: compile('{{view view.textField class="unbound" classBinding="App.isGreat:great App.isEnabled:enabled:disabled" classNameBindings="App.isGreat:really-great App.isEnabled:really-enabled:really-disabled"}}') + }); + }, /legacy class binding/); expectDeprecation(function() { runAppend(view); @@ -984,8 +992,10 @@ QUnit.test('{{view}} should evaluate other attributes bindings set in the curren equal(view.$('input').val(), 'myView', 'evaluates attributes bound in the current context'); }); -QUnit.skip('{{view}} should be able to bind class names to truthy properties', function() { - registry.register('template:template', compile('{{#view view.classBindingView classBinding="view.number:is-truthy"}}foo{{/view}}')); +QUnit.test('{{view}} should be able to bind class names to truthy properties', function() { + expectDeprecation(function() { + registry.register('template:template', compile('{{#view view.classBindingView classBinding="view.number:is-truthy"}}foo{{/view}}')); + }, /legacy class binding syntax/); var ClassBindingView = EmberView.extend(); @@ -1007,8 +1017,10 @@ QUnit.skip('{{view}} should be able to bind class names to truthy properties', f equal(view.$('.is-truthy').length, 0, 'removes class name if bound property is set to falsey'); }); -QUnit.skip('{{view}} should be able to bind class names to truthy or falsy properties', function() { - registry.register('template:template', compile('{{#view view.classBindingView classBinding="view.number:is-truthy:is-falsy"}}foo{{/view}}')); +QUnit.test('{{view}} should be able to bind class names to truthy or falsy properties', function() { + expectDeprecation(function() { + registry.register('template:template', compile('{{#view view.classBindingView classBinding="view.number:is-truthy:is-falsy"}}foo{{/view}}')); + }, /legacy class binding syntax/); var ClassBindingView = EmberView.extend(); @@ -1032,14 +1044,14 @@ QUnit.skip('{{view}} should be able to bind class names to truthy or falsy prope equal(view.$('.is-falsy').length, 1, "sets class name to falsy value"); }); -QUnit.skip('a view helper\'s bindings are to the parent context', function() { +QUnit.test('a view helper\'s bindings are to the parent context', function() { var Subview = EmberView.extend({ - classNameBindings: ['color'], + classNameBindings: ['attrs.color'], controller: EmberObject.create({ color: 'green', name: 'bar' }), - template: compile('{{view.someController.name}} {{name}}') + template: compile('{{attrs.someController.name}} {{name}}') }); var View = EmberView.extend({ @@ -1117,7 +1129,7 @@ QUnit.test('should expose a controller keyword that can be used in conditionals' equal(view.$().text(), '', 'updates the DOM when the controller is changed'); }); -QUnit.skip('should expose a controller keyword that persists through Ember.ContainerView', function() { +QUnit.test('should expose a controller keyword that persists through Ember.ContainerView', function() { var templateString = '{{view view.containerView}}'; view = EmberView.create({ containerView: ContainerView,
true
Other
emberjs
ember.js
47ddf42b2c10324d9e8d35397db8195c9108a465.json
Unify legacy class binding into AST preprocessor There are several paths and microsyntaxes for creating class name bindings for a component’s element via Handlebars. For example: `{{view ‘my-view’ class=“hello” classBindings=“:foo isApp:is-an-app”}}` With HTMLbars, these have been deprecated in favor of a single API: `{{view class=“hello foo (if isApp ‘is-an-app’)”}}` This commit rewrites the AST of templates that contain the old syntax into the new syntax at template compile time.
packages/ember-template-compiler/lib/main.js
@@ -10,6 +10,7 @@ import TransformBindAttrToAttributes from "ember-template-compiler/plugins/trans import TransformEachIntoCollection from "ember-template-compiler/plugins/transform-each-into-collection"; import TransformSingleArgEach from "ember-template-compiler/plugins/transform-single-arg-each"; import TransformOldBindingSyntax from "ember-template-compiler/plugins/transform-old-binding-syntax"; +import TransformOldClassBindingSyntax from "ember-template-compiler/plugins/transform-old-class-binding-syntax"; // used for adding Ember.Handlebars.compile for backwards compat import "ember-template-compiler/compat"; @@ -20,6 +21,7 @@ registerPlugin('ast', TransformBindAttrToAttributes); registerPlugin('ast', TransformSingleArgEach); registerPlugin('ast', TransformEachIntoCollection); registerPlugin('ast', TransformOldBindingSyntax); +registerPlugin('ast', TransformOldClassBindingSyntax); export { _Ember,
true
Other
emberjs
ember.js
47ddf42b2c10324d9e8d35397db8195c9108a465.json
Unify legacy class binding into AST preprocessor There are several paths and microsyntaxes for creating class name bindings for a component’s element via Handlebars. For example: `{{view ‘my-view’ class=“hello” classBindings=“:foo isApp:is-an-app”}}` With HTMLbars, these have been deprecated in favor of a single API: `{{view class=“hello foo (if isApp ‘is-an-app’)”}}` This commit rewrites the AST of templates that contain the old syntax into the new syntax at template compile time.
packages/ember-template-compiler/lib/plugins/transform-old-class-binding-syntax.js
@@ -0,0 +1,138 @@ +import Ember from 'ember-metal/core'; + +export default function TransformOldClassBindingSyntax() { + this.syntax = null; +} + +TransformOldClassBindingSyntax.prototype.transform = function TransformOldClassBindingSyntax_transform(ast) { + var b = this.syntax.builders; + var walker = new this.syntax.Walker(); + + walker.visit(ast, function(node) { + if (!validate(node)) { return; } + + let allOfTheMicrosyntaxes = []; + let allOfTheMicrosyntaxIndexes = []; + let classPair; + + each(node.hash.pairs, (pair, index) => { + let { key } = pair; + + if (key === 'classBinding' || key === 'classNameBindings') { + allOfTheMicrosyntaxIndexes.push(index); + allOfTheMicrosyntaxes.push(pair); + } else if (key === 'class') { + classPair = pair; + } + }); + + if (allOfTheMicrosyntaxes.length === 0) { return; } + + let classValue = []; + + if (classPair) { + classValue.push(classPair.value); + } else { + classPair = b.pair('class', null); + node.hash.pairs.push(classPair); + } + + each(allOfTheMicrosyntaxIndexes, index => { + node.hash.pairs.splice(index, 1); + }); + + each(allOfTheMicrosyntaxes, ({ value, loc }) => { + let sexprs = []; + + let sourceInformation = ""; + if (loc) { + let { start, source } = loc; + + sourceInformation = `@ ${start.line}:${start.column} in ${source || '(inline)'}`; + } + + // TODO: Parse the microsyntax and offer the correct information + Ember.deprecate(`You're using legacy class binding syntax: classBinding=${exprToString(value)} ${sourceInformation}. Please replace with class=""`); + + if (value.type === 'StringLiteral') { + let microsyntax = parseMicrosyntax(value.original); + + buildSexprs(microsyntax, sexprs, b); + + classValue.push.apply(classValue, sexprs); + } + }); + + let hash = b.hash([b.pair('separator', b.string(' '))]); + classPair.value = b.sexpr(b.string('-concat'), classValue, hash); + }); + + return ast; +}; + +function buildSexprs(microsyntax, sexprs, b) { + for (var i=0, l=microsyntax.length; i<l; i++) { + let [propName, activeClass, inactiveClass] = microsyntax[i]; + let sexpr; + + // :my-class-name microsyntax for static values + if (propName === '') { + sexpr = b.string(activeClass); + } else { + let params = [b.path(propName)]; + + if (activeClass) { + params.push(b.string(activeClass)); + } else { + let sexprParams = [b.string(propName), b.path(propName)]; + + let hash = b.hash(); + if (activeClass !== undefined) { + hash.pairs.push(b.pair('activeClass', b.string(activeClass))); + } + + if (inactiveClass !== undefined) { + hash.pairs.push(b.pair('inactiveClass', b.string(inactiveClass))); + } + + params.push(b.sexpr(b.string('-normalize-class'), sexprParams, hash)); + } + + if (inactiveClass) { + params.push(b.string(inactiveClass)); + } + + sexpr = b.sexpr(b.string('if'), params); + } + + sexprs.push(sexpr); + } +} + +function validate(node) { + return (node.type === 'BlockStatement' || node.type === 'MustacheStatement'); +} + +function each(list, callback) { + for (var i=0, l=list.length; i<l; i++) { + callback(list[i], i); + } +} + +function parseMicrosyntax(string) { + var segments = string.split(' '); + + for (var i=0, l=segments.length; i<l; i++) { + segments[i] = segments[i].split(':'); + } + + return segments; +} + +function exprToString(expr) { + switch (expr.type) { + case 'StringLiteral': return `"${expr.original}"`; + case 'PathExpression': return expr.original; + } +} +
true
Other
emberjs
ember.js
47ddf42b2c10324d9e8d35397db8195c9108a465.json
Unify legacy class binding into AST preprocessor There are several paths and microsyntaxes for creating class name bindings for a component’s element via Handlebars. For example: `{{view ‘my-view’ class=“hello” classBindings=“:foo isApp:is-an-app”}}` With HTMLbars, these have been deprecated in favor of a single API: `{{view class=“hello foo (if isApp ‘is-an-app’)”}}` This commit rewrites the AST of templates that contain the old syntax into the new syntax at template compile time.
packages/ember-views/lib/system/build-component-template.js
@@ -1,6 +1,7 @@ import { internal, render } from "htmlbars-runtime"; import { read } from "ember-metal/streams/utils"; import { get } from "ember-metal/property_get"; +import { isGlobal } from "ember-metal/path_cache"; export default function buildComponentTemplate(componentInfo, attrs, content) { var component, layoutTemplate, blockToRender; @@ -148,7 +149,15 @@ function normalizeClass(component, attrs) { var classNameBindings = get(component, 'classNameBindings'); if (attrs.class) { - normalizedClass.push(['value', attrs.class]); + if (typeof attrs.class === 'string') { + normalizedClass.push(attrs.class); + } else { + normalizedClass.push(['subexpr', '-normalize-class', [['value', attrs.class.path], ['value', attrs.class]], []]); + } + } + + if (attrs.classBinding) { + normalizeClasses(attrs.classBinding.split(' '), normalizedClass); } if (attrs.classNames) { @@ -162,21 +171,7 @@ function normalizeClass(component, attrs) { } if (classNameBindings) { - for (i=0, l=classNameBindings.length; i<l; i++) { - var className = classNameBindings[i]; - var [propName, activeClass, inactiveClass] = className.split(':'); - var prop = 'view.' + propName; - - normalizedClass.push(['subexpr', '-normalize-class', [ - // params - ['value', propName], - ['get', prop] - ], [ - // hash - 'activeClass', activeClass, - 'inactiveClass', inactiveClass - ]]); - } + normalizeClasses(classNameBindings, normalizedClass); } var last = normalizedClass.length - 1; @@ -190,3 +185,31 @@ function normalizeClass(component, attrs) { return ['concat', output]; } } + +function normalizeClasses(classes, output) { + var i, l; + + for (i=0, l=classes.length; i<l; i++) { + var className = classes[i]; + var [propName, activeClass, inactiveClass] = className.split(':'); + + // Legacy :class microsyntax for static class names + if (propName === '') { + output.push(activeClass); + return; + } + + // 2.0TODO: Remove deprecated global path + var prop = isGlobal(propName) ? propName : 'view.' + propName; + + output.push(['subexpr', '-normalize-class', [ + // params + ['value', propName], + ['get', prop] + ], [ + // hash + 'activeClass', activeClass, + 'inactiveClass', inactiveClass + ]]); + } +}
true
Other
emberjs
ember.js
6153cd8b2f93a90f2862de7ce7aabad978c146a7.json
Add note on Checkbox inheriting from Component
packages/ember-views/lib/views/checkbox.js
@@ -31,6 +31,7 @@ import View from "ember-views/views/view"; @namespace Ember @extends Ember.View */ +// 2.0TODO: Subclass Component rather than View export default View.extend({ instrumentDisplay: '{{input type="checkbox"}}',
false
Other
emberjs
ember.js
c692bd0464f393cb334fb8110e2c3c297df42931.json
Fix current node tests.
tests/node/app-boot-test.js
@@ -29,10 +29,7 @@ global.EmberENV = { FEATURES: features }; -var Ember = require(path.join(distPath, 'ember.debug.cjs')); -var compile = require(path.join(distPath, 'ember-template-compiler')).compile; -Ember.testing = true; -var DOMHelper = Ember.HTMLBars.DOMHelper; +var Ember, compile, domHelper, run; var SimpleDOM = require('simple-dom'); var URL = require('url'); @@ -76,6 +73,7 @@ function registerDOMHelper(app) { function registerTemplates(app, templates) { app.instanceInitializer({ name: 'register-application-template', + initialize: function(app) { for (var key in templates) { app.registry.register('template:' + key, compile(templates[key])); @@ -105,7 +103,7 @@ QUnit.module("App boot", { Ember = require(emberPath); compile = require(templateCompilerPath).compile; Ember.testing = true; - DOMHelper = Ember.View.DOMHelper; + DOMHelper = Ember.HTMLBars.DOMHelper; domHelper = createDOMHelper(); run = Ember.run; },
true
Other
emberjs
ember.js
c692bd0464f393cb334fb8110e2c3c297df42931.json
Fix current node tests.
tests/node/template-compiler-test.js
@@ -53,7 +53,7 @@ test('allows enabling of features', function() { templateCompiler._Ember.FEATURES['ember-htmlbars-component-generation'] = true; templateOutput = templateCompiler.precompile('<some-thing></some-thing>'); - ok(templateOutput.match(/component\(env, morph0, context, "some-thing"/), 'component generation can be enabled'); + ok(templateOutput.indexOf('["component","some-thing",[],0]') > -1, 'component generation can be enabled'); } else { ok(true, 'cannot test features in feature stripped build'); }
true
Other
emberjs
ember.js
66acf7fcbcb721ffb332dd48d3cad2b305ab327b.json
Update Ember.Select to use HTMLbars templates
packages/ember-htmlbars/lib/templates/select-option.hbs
@@ -0,0 +1 @@ +{{view.label}} \ No newline at end of file
true
Other
emberjs
ember.js
66acf7fcbcb721ffb332dd48d3cad2b305ab327b.json
Update Ember.Select to use HTMLbars templates
packages/ember-htmlbars/lib/templates/select.hbs
@@ -1 +1 @@ -{{#if view.prompt}}<option value="">{{view.prompt}}</option>{{/if}}{{#if view.optionGroupPath}}{{#each view.groupedContent keyword="group"}}{{view view.groupView content=group.content label=group.label}}{{/each}}{{else}}{{#each view.content keyword="item"}}{{view view.optionView content=item}}{{/each}}{{/if}} +{{#if view.prompt}}<option value="">{{view.prompt}}</option>{{/if}}{{#if view.optionGroupPath}}{{#each view.groupedContent as |group|}}{{view view.groupView content=group.content label=group.label}}{{/each}}{{else}}{{#each view.content as |item|}}{{view view.optionView content=item}}{{/each}}{{/if}}
true
Other
emberjs
ember.js
66acf7fcbcb721ffb332dd48d3cad2b305ab327b.json
Update Ember.Select to use HTMLbars templates
packages/ember-htmlbars/tests/integration/select_in_template_test.js
@@ -68,7 +68,7 @@ QUnit.skip("works from a template with bindings [DEPRECATED]", function() { expectDeprecation(function() { runAppend(view); - }, /You're attempting to render a view by passing .+Binding to a view helper, but this syntax is deprecated/); + }, /You tried to look up an attribute directly on the component/); var select = view.get('select'); ok(select.$().length, "Select was rendered"); @@ -89,7 +89,7 @@ QUnit.skip("works from a template with bindings [DEPRECATED]", function() { equal(select.get('selection'), erik, "Selection was maintained after new option was added"); }); -QUnit.skip("works from a template", function() { +QUnit.test("works from a template", function() { var Person = EmberObject.extend({ id: null, firstName: null, @@ -151,7 +151,7 @@ QUnit.skip("works from a template", function() { equal(select.get('selection'), erik, "Selection was maintained after new option was added"); }); -QUnit.skip("upon content change, the DOM should reflect the selection (#481)", function() { +QUnit.test("upon content change, the DOM should reflect the selection (#481)", function() { var userOne = { name: 'Mike', options: Ember.A(['a', 'b']), selectedOption: 'a' }; var userTwo = { name: 'John', options: Ember.A(['c', 'd']), selectedOption: 'd' }; @@ -181,7 +181,7 @@ QUnit.skip("upon content change, the DOM should reflect the selection (#481)", f equal(selectEl.selectedIndex, 1, "The DOM reflects the correct selection"); }); -QUnit.skip("upon content change with Array-like content, the DOM should reflect the selection", function() { +QUnit.test("upon content change with Array-like content, the DOM should reflect the selection", function() { var tom = { id: 4, name: 'Tom' }; var sylvain = { id: 5, name: 'Sylvain' };
true
Other
emberjs
ember.js
66acf7fcbcb721ffb332dd48d3cad2b305ab327b.json
Update Ember.Select to use HTMLbars templates
packages/ember-views/lib/views/select.js
@@ -21,33 +21,21 @@ import { computed } from "ember-metal/computed"; import { A as emberA } from "ember-runtime/system/native_array"; import { observer } from "ember-metal/mixin"; import { defineProperty } from "ember-metal/properties"; -import run from "ember-metal/run_loop"; import htmlbarsTemplate from "ember-htmlbars/templates/select"; +import selectOptionTemplate from "ember-htmlbars/templates/select-option"; var defaultTemplate = htmlbarsTemplate; -var selectOptionDefaultTemplate = { - isHTMLBars: true, - revision: 'Ember@VERSION_STRING_PLACEHOLDER', - render(context) { - var lazyValue = context.getStream('view.label'); - - lazyValue.subscribe(context._wrapAsScheduled(function() { - run.scheduleOnce('render', context, 'rerender'); - })); - - return { fragment: lazyValue.value() }; - } -}; - var SelectOption = View.extend({ instrumentDisplay: 'Ember.SelectOption', tagName: 'option', attributeBindings: ['value', 'selected'], - defaultTemplate: selectOptionDefaultTemplate, + defaultTemplate: selectOptionTemplate, + + content: null, init() { this.labelPathDidChange(); @@ -490,7 +478,7 @@ var Select = View.extend({ groupedContent: computed(function() { var groupPath = get(this, 'optionGroupPath'); var groupedContent = emberA(); - var content = get(this, 'content') || []; + var content = get(this, 'attrs.content') || []; forEach(content, function(item) { var label = get(item, groupPath); @@ -506,7 +494,7 @@ var Select = View.extend({ }); return groupedContent; - }).property('optionGroupPath', 'content.@each'), + }).property('optionGroupPath', 'attrs.content.@each'), /** The view class for option.
true
Other
emberjs
ember.js
36225a2df71bdfab5de9580a332963793a294ee1.json
Add skipped test for compat mode attrs-proxy.
packages/ember-views/tests/compat/attrs_proxy_test.js
@@ -0,0 +1,34 @@ +import View from "ember-views/views/view"; +import { runAppend, runDestroy } from "ember-runtime/tests/utils"; +import compile from "ember-template-compiler/system/compile"; +import Registry from "container/registry"; + +var view, registry, container; + +QUnit.module("ember-views: attrs-proxy", { + setup() { + registry = new Registry(); + container = registry.container(); + }, + + teardown() { + runDestroy(view); + } +}); + +QUnit.skip('works with properties setup in root of view', function() { + registry.register('view:foo', View.extend({ + bar: 'qux', + + template: compile('{{bar}}') + })); + + view = View.extend({ + container: registry.container(), + template: compile('{{view "foo" bar="baz"}}') + }).create(); + + runAppend(view); + + equal(view.$().text(), 'baz', 'value specified in the template is used'); +});
false
Other
emberjs
ember.js
508d9de45bd6d729c8cb0954f97fd7ed83531276.json
Fix unbound keyword This commit also adds several tests for the path and helper usages of the subexpression form, e.g. ```hbs {{capitalize (unbound foo)}} ``` and ```hbs {{capitalize (unbound if foo bar baz)}} ```
packages/ember-htmlbars/lib/hooks/subexpr.js
@@ -10,6 +10,13 @@ import create from "ember-metal/platform/create"; import { subscribe, addDependency, read, labelsFor, labelFor } from "ember-metal/streams/utils"; export default function subexpr(env, scope, helperName, params, hash) { + // TODO: Keywords and helper invocation should be integrated into + // the subexpr hook upstream in HTMLBars. + var keyword = env.hooks.keywords[helperName]; + if (keyword) { + return keyword(null, env, scope, params, hash, null, null); + } + var helper = lookupHelper(helperName, scope.self, env); var invoker = function(params, hash) { return env.hooks.invokeHelper(null, env, scope, null, params, hash, helper, { template: {}, inverse: {} }, undefined).value;
true
Other
emberjs
ember.js
508d9de45bd6d729c8cb0954f97fd7ed83531276.json
Fix unbound keyword This commit also adds several tests for the path and helper usages of the subexpression form, e.g. ```hbs {{capitalize (unbound foo)}} ``` and ```hbs {{capitalize (unbound if foo bar baz)}} ```
packages/ember-htmlbars/lib/keywords/unbound.js
@@ -10,6 +10,15 @@ export default function unbound(morph, env, scope, originalParams, hash, templat var params = originalParams.slice(); var valueStream = params.shift(); + // If `morph` is `null` the keyword is being invoked as a subexpression. + if (morph === null) { + if (originalParams.length > 1) { + valueStream = env.hooks.subexpr(env, scope, valueStream.key, params, hash); + } + + return new VolatileStream(valueStream); + } + if (params.length === 0) { env.hooks.range(morph, env, scope, null, valueStream); } else if (template === null) { @@ -20,3 +29,23 @@ export default function unbound(morph, env, scope, originalParams, hash, templat return true; } + +import merge from "ember-metal/merge"; +import create from "ember-metal/platform/create"; +import Stream from "ember-metal/streams/stream"; +import { read } from "ember-metal/streams/utils"; + +function VolatileStream(source) { + this.init(`(volatile ${source.label})`); + this.source = this.addDependency(source); +} + +VolatileStream.prototype = create(Stream.prototype); + +merge(VolatileStream.prototype, { + value() { + return read(this.source); + }, + + notify() {} +});
true
Other
emberjs
ember.js
508d9de45bd6d729c8cb0954f97fd7ed83531276.json
Fix unbound keyword This commit also adds several tests for the path and helper usages of the subexpression form, e.g. ```hbs {{capitalize (unbound foo)}} ``` and ```hbs {{capitalize (unbound if foo bar baz)}} ```
packages/ember-htmlbars/tests/helpers/unbound_test.js
@@ -56,6 +56,14 @@ QUnit.test('it should not re-render if the property changes', function() { equal(view.$().text(), 'BORK BORK', 'should not re-render if the property changes'); }); +QUnit.test('it should re-render if the parent view rerenders', function() { + run(function() { + view.set('context.foo', 'OOF'); + view.rerender(); + }); + equal(view.$().text(), 'OOF OOF', 'should re-render if the parent view rerenders'); +}); + QUnit.test('it should throw the helper missing error if multiple properties are provided', function() { expectAssertion(function() { runAppend(EmberView.create({ @@ -68,7 +76,7 @@ QUnit.test('it should throw the helper missing error if multiple properties are }, /A helper named 'foo' could not be found/); }); -QUnit.skip('should property escape unsafe hrefs', function() { +QUnit.test('should property escape unsafe hrefs', function() { /* jshint scripturl:true */ expect(3); @@ -98,6 +106,101 @@ QUnit.skip('should property escape unsafe hrefs', function() { } }); +QUnit.module('ember-htmlbars: {{#unbound}} subexpression', { + setup() { + Ember.lookup = lookup = { Ember: Ember }; + + registerBoundHelper('capitalize', function(value) { + return value.toUpperCase(); + }); + + view = EmberView.create({ + template: compile('{{capitalize (unbound foo)}}'), + context: EmberObject.create({ + foo: 'bork' + }) + }); + + runAppend(view); + }, + + teardown() { + delete helpers['capitalize']; + + runDestroy(view); + Ember.lookup = originalLookup; + } +}); + +QUnit.test('it should render the current value of a property on the context', function() { + equal(view.$().text(), 'BORK', 'should render the current value of a property'); +}); + +QUnit.test('it should not re-render if the property changes', function() { + run(function() { + view.set('context.foo', 'oof'); + }); + equal(view.$().text(), 'BORK', 'should not re-render if the property changes'); +}); + +QUnit.test('it should re-render if the parent view rerenders', function() { + run(function() { + view.set('context.foo', 'oof'); + view.rerender(); + }); + equal(view.$().text(), 'OOF', 'should re-render if the parent view rerenders'); +}); + +QUnit.module('ember-htmlbars: {{#unbound}} subexpression - helper form', { + setup() { + Ember.lookup = lookup = { Ember: Ember }; + + registerBoundHelper('capitalize', function(value) { + return value.toUpperCase(); + }); + + registerBoundHelper('doublize', function(value) { + return `${value} ${value}`; + }); + + view = EmberView.create({ + template: compile('{{capitalize (unbound doublize foo)}}'), + context: EmberObject.create({ + foo: 'bork' + }) + }); + + runAppend(view); + }, + + teardown() { + delete helpers['capitalize']; + delete helpers['doublize']; + + runDestroy(view); + Ember.lookup = originalLookup; + } +}); + +QUnit.test('it should render the current value of a property on the context', function() { + equal(view.$().text(), 'BORK BORK', 'should render the current value of a property'); +}); + +QUnit.test('it should not re-render if the property changes', function() { + run(function() { + view.set('context.foo', 'oof'); + }); + equal(view.$().text(), 'BORK BORK', 'should not re-render if the property changes'); +}); + +QUnit.test('it should re-render if the parent view rerenders', function() { + run(function() { + view.set('context.foo', 'oof'); + view.rerender(); + }); + equal(view.$().text(), 'OOF OOF', 'should re-render if the parent view rerenders'); +}); + QUnit.module("ember-htmlbars: {{#unbound boundHelper arg1 arg2... argN}} form: render unbound helper invocations", { setup() { Ember.lookup = lookup = { Ember: Ember }; @@ -433,7 +536,7 @@ QUnit.test("should be able to use unbound helper in #each helper (with objects)" equal(view.$('li').children().length, 0, 'No markers'); }); -QUnit.skip('should work properly with attributes', function() { +QUnit.test('should work properly with attributes', function() { expect(4); view = EmberView.create({
true
Other
emberjs
ember.js
793613059d3e029e17b38a89c67d592b4f535164.json
fix another outlet assertion
packages/ember-htmlbars/lib/keywords/real_outlet.js
@@ -6,6 +6,7 @@ import merge from "ember-metal/merge"; import { get } from "ember-metal/property_get"; import ComponentNode from "ember-htmlbars/system/component-node"; +import { isStream } from "ember-metal/streams/utils"; import topLevelViewTemplate from "ember-htmlbars/templates/top-level-view"; topLevelViewTemplate.revision = 'Ember@VERSION_STRING_PLACEHOLDER'; @@ -18,6 +19,11 @@ export default { var outletState = env.outletState; var read = env.hooks.getValue; + Ember.assert( + "Using {{outlet}} with an unquoted name is not supported.", + !params[0] || !isStream(params[0]) + ); + var outletName = read(params[0]) || 'main'; var selectedOutletState = outletState[outletName];
true
Other
emberjs
ember.js
793613059d3e029e17b38a89c67d592b4f535164.json
fix another outlet assertion
packages/ember-routing-htmlbars/tests/helpers/outlet_test.js
@@ -234,7 +234,7 @@ QUnit.test("should not throw deprecations if {{outlet}} is used with a quoted na runAppend(top); }); -QUnit.skip("should throw an assertion if {{outlet}} used with unquoted name", function() { +QUnit.test("should throw an assertion if {{outlet}} used with unquoted name", function() { top.setOutletState(withTemplate("{{outlet foo}}")); expectAssertion(function() { runAppend(top);
true
Other
emberjs
ember.js
2cb9069bd09ed9b4754eabb3f2edb02604676c91.json
drop unused code
packages/ember-htmlbars/lib/keywords/customized_outlet.js
@@ -10,8 +10,7 @@ export default { setupState(state, env, scope, params, hash) { var read = env.hooks.getValue; var viewClass = readViewFactory(read(hash.view), env.container); - var outletName = read(params[0]) || 'main'; - return { viewClass, outletName }; + return { viewClass }; }, render(renderNode, env, scope, params, hash, template, inverse, visitor) { var state = renderNode.state;
false
Other
emberjs
ember.js
51a560a3cf5254eecc3f3b6466a1ac3205d17264.json
drop unused argument
packages/ember-htmlbars/lib/system/component-node.js
@@ -15,7 +15,7 @@ function ComponentNode(component, scope, renderNode, block, expectElement) { export default ComponentNode; -ComponentNode.create = function(renderNode, env, attrs, found, parentView, path, contentScope, contentTemplate, visitor) { +ComponentNode.create = function(renderNode, env, attrs, found, parentView, path, contentScope, contentTemplate) { found = found || lookupComponent(env, path); Ember.assert('HTMLBars error: Could not find component named "' + path + '" (no component or template with that name was found)', function() { if (path) { @@ -140,4 +140,3 @@ export function createOrUpdateComponent(component, options, renderNode) { renderNode.emberView = component; return component; } -
false
Other
emberjs
ember.js
5d95e7b739dd40a91925625adf449ed1b785db98.json
implement textarea keyword Three more passing tests
packages/ember-htmlbars/lib/env.js
@@ -65,6 +65,7 @@ import view from "ember-htmlbars/keywords/view"; import componentKeyword from "ember-htmlbars/keywords/component"; import partial from "ember-htmlbars/keywords/partial"; import input from "ember-htmlbars/keywords/input"; +import textarea from "ember-htmlbars/keywords/textarea"; import collection from "ember-htmlbars/keywords/collection"; import templateKeyword from "ember-htmlbars/keywords/template"; @@ -77,6 +78,7 @@ registerKeyword('component', componentKeyword); registerKeyword('partial', partial); registerKeyword('template', templateKeyword); registerKeyword('input', input); +registerKeyword('textarea', textarea); registerKeyword('collection', collection); export default {
true
Other
emberjs
ember.js
5d95e7b739dd40a91925625adf449ed1b785db98.json
implement textarea keyword Three more passing tests
packages/ember-htmlbars/lib/keywords/textarea.js
@@ -0,0 +1,6 @@ +export default { + + render(morph, env, scope, params, hash, template, inverse, visitor) { + env.hooks.component(morph, env, scope, '-text-area', hash, template, visitor); + } +};
true
Other
emberjs
ember.js
5d95e7b739dd40a91925625adf449ed1b785db98.json
implement textarea keyword Three more passing tests
packages/ember-htmlbars/tests/helpers/text_area_test.js
@@ -3,6 +3,9 @@ import View from "ember-views/views/view"; import compile from "ember-template-compiler/system/compile"; import { set as o_set } from "ember-metal/property_set"; import { runAppend, runDestroy } from "ember-runtime/tests/utils"; +import TextArea from "ember-views/views/text_area"; +import Registry from "container/registry"; +import ComponentLookup from "ember-views/component_lookup"; var textArea, controller; @@ -16,7 +19,12 @@ QUnit.module("{{textarea}}", { val: 'Lorem ipsum dolor' }; + var registry = new Registry(); + registry.register('component:-text-area', TextArea); + registry.register('component-lookup:main', ComponentLookup); + textArea = View.extend({ + container: registry.container(), controller: controller, template: compile('{{textarea disabled=disabled value=val}}') }).create(); @@ -29,11 +37,11 @@ QUnit.module("{{textarea}}", { } }); -QUnit.skip("Should insert a textarea", function() { +QUnit.test("Should insert a textarea", function() { equal(textArea.$('textarea').length, 1, "There is a single textarea"); }); -QUnit.skip("Should become disabled when the controller changes", function() { +QUnit.test("Should become disabled when the controller changes", function() { ok(textArea.$('textarea').is(':not(:disabled)'), "Nothing is disabled yet"); set(controller, 'disabled', true); ok(textArea.$('textarea').is(':disabled'), "The disabled attribute is updated");
true
Other
emberjs
ember.js
5d95e7b739dd40a91925625adf449ed1b785db98.json
implement textarea keyword Three more passing tests
packages/ember-testing/tests/helpers_test.js
@@ -316,7 +316,7 @@ QUnit.test("`wait` helper can be passed a resolution value", function() { }); -QUnit.skip("`click` triggers appropriate events in order", function() { +QUnit.test("`click` triggers appropriate events in order", function() { expect(5); var click, wait, events;
true
Other
emberjs
ember.js
5d95e7b739dd40a91925625adf449ed1b785db98.json
implement textarea keyword Three more passing tests
packages/ember-views/lib/initializers/components.js
@@ -1,14 +1,15 @@ import { onLoad } from "ember-runtime/system/lazy_load"; import TextField from "ember-views/views/text_field"; +import TextArea from "ember-views/views/text_area"; import Checkbox from "ember-views/views/checkbox"; onLoad('Ember.Application', function(Application) { Application.initializer({ name: 'ember-views-components', initialize(registry) { registry.register('component:-text-field', TextField); + registry.register('component:-text-area', TextArea); registry.register('component:-checkbox', Checkbox); } }); }); -
true