Skip to content

Commit

Permalink
Merge pull request #10969 from machty/ir-qp
Browse files Browse the repository at this point in the history
Get remainder of query_params_test.js passing
  • Loading branch information
rwjblue committed Apr 28, 2015
2 parents f9a192a + 97c1039 commit b162d69
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'; } };

Expand Down
1 change: 1 addition & 0 deletions packages/ember-routing-htmlbars/lib/helpers/link-to.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
8 changes: 4 additions & 4 deletions packages/ember-routing-views/lib/views/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand All @@ -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,
Expand All @@ -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');
Expand All @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion packages/ember/tests/helpers/link_to_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>");

Expand Down
26 changes: 13 additions & 13 deletions packages/ember/tests/routing/query_params_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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'}}");

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand All @@ -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({
Expand All @@ -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');
});

Expand Down Expand Up @@ -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');
Expand All @@ -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();

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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' } }
});
Expand Down

0 comments on commit b162d69

Please sign in to comment.