Skip to content

Commit

Permalink
[BUGFIX beta] fix regression of clicking link-to with disabled=true
Browse files Browse the repository at this point in the history
  • Loading branch information
simonihmig committed Dec 8, 2017
1 parent e1dc61f commit 52527e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/ember-glimmer/lib/components/link-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ const LinkComponent = EmberComponent.extend({
*/
init() {
this._super(...arguments);
this._isDisabled = false;
this._isDisabled = this._isDisabled || false;

// Map desired event name to invoke function
let eventName = get(this, 'eventName');
Expand Down
13 changes: 12 additions & 1 deletion packages/ember/tests/helpers/link_to_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ moduleFor('The {{link-to}} helper - basic tests', class extends ApplicationTestC
assert.equal(this.$('#about-link.do-not-want').length, 1, 'The link can apply a custom disabled class via bound param');
}

[`@test the {{link-to}} helper does not respond to clicks when disabled`](assert) {
[`@test the {{link-to}} helper does not respond to clicks when disabledWhen`](assert) {
this.addTemplate('index', `
{{#link-to "about" id="about-link" disabledWhen=true}}About{{/link-to}}
`);
Expand All @@ -145,6 +145,17 @@ moduleFor('The {{link-to}} helper - basic tests', class extends ApplicationTestC
assert.equal(this.$('h3:contains(About)').length, 0, 'Transitioning did not occur');
}

[`@test the {{link-to}} helper does not respond to clicks when disabled`](assert) {
this.addTemplate('index', `
{{#link-to "about" id="about-link" disabled=true}}About{{/link-to}}
`);

this.visit('/');
this.click('#about-link');

assert.equal(this.$('h3:contains(About)').length, 0, 'Transitioning did not occur');
}

[`@test the {{link-to}} helper responds to clicks according to its disabledWhen bound param`](assert) {
this.addTemplate('index', `
{{#link-to "about" id="about-link" disabledWhen=disabledWhen}}About{{/link-to}}
Expand Down

0 comments on commit 52527e0

Please sign in to comment.