Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG beta] attributeBindings not working for "role" #14007

Closed
cibernox opened this issue Aug 2, 2016 · 4 comments
Closed

[BUG beta] attributeBindings not working for "role" #14007

cibernox opened this issue Aug 2, 2016 · 4 comments

Comments

@cibernox
Copy link
Contributor

cibernox commented Aug 2, 2016

This works in 2.7 and fails in 2.8. Funny enough, it seems to work in general, it just fails (that I've know of) with the role attribute.

Twiddle with a demo: https://ember-twiddle.com/ba0c926a18c53ee7155dc23059c70caa?openFiles=components.my-component.js%2Ctemplates.components.my-component.hbs

@cibernox
Copy link
Contributor Author

cibernox commented Aug 3, 2016

Ok, I've bisected this to this PR: #13887 /cc @krisselden

My failing test is this one:

diff --git a/packages/ember-glimmer/tests/integration/components/attribute-bindings-test.js b/packages/ember-glimmer/tests/integration/components/attribute-bindings-test.js
index 072284b..0fe13f7 100644
--- a/packages/ember-glimmer/tests/integration/components/attribute-bindings-test.js
+++ b/packages/ember-glimmer/tests/integration/components/attribute-bindings-test.js
@@ -517,4 +517,17 @@ moduleFor('Attribute bindings integration', class extends RenderingTest {

     this.assertComponentElement(this.firstChild, { tagName: 'a', attrs: { href: 'unsafe:javascript:alert(\'foo\')' } });
   }
+
+  ['@test it can bind the role attribute (issue #14007)']() {
+    let FooBarComponent = Component.extend({
+      role: 'button',
+      attributeBindings: ['role']
+    });
+
+    this.registerComponent('foo-bar', { ComponentClass: FooBarComponent, template: 'hello' });
+
+    this.render('{{foo-bar}}');
+
+    this.assertComponentElement(this.firstChild, { tagName: 'div', attrs: { role: 'button' } });
+  }
 });

Enough for today. 😴

@rwjblue
Copy link
Member

rwjblue commented Aug 3, 2016

I believe that https://github.com/emberjs/ember.js/pull/13887/files#diff-1654f1d069eb2138afd01d960e2a78a7R187 is clobbering the user specified attributeBinding for 'role'. We should add this as the default before the loop over attributeBindings.

@krisselden
Copy link
Contributor

Should be easy to fix, I'll try to get to it soonish, a failing test PR would be nice, just need to check role before defaulting it

@cibernox
Copy link
Contributor Author

cibernox commented Aug 3, 2016

@krisselden Yep, that was enough #14009

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants