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

md-button class bindings #365

Merged
merged 8 commits into from
May 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion addon/components/paper-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ export default BaseFocusable.extend(RippleMixin, ProxiableMixin, ColorMixin, {
type: 'button',
tagName: 'button',
classNames: ['paper-button', 'md-default-theme', 'md-button'],
raised: false,
iconButton: false,
fab: computed.reads('mini'), // circular button
mini: false,
classNameBindings: [
'raised:md-raised',
'iconButton:md-icon-button'
'iconButton:md-icon-button',
'fab:md-fab',
'mini:md-mini'
],

// Ripple Overrides
Expand Down
4 changes: 4 additions & 0 deletions tests/dummy/app/templates/button.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
{{#paper-button raised=true primary=true onClick=(action "targetButton") bubbles=false}}Button no bubble{{/paper-button}}
</p>
<p>
{{#paper-button raised=true fab=true}}Fab{{/paper-button}}
{{#paper-button raised=true mini=true}}Mini{{/paper-button}}
{{#paper-button iconButton=true}}{{paper-icon "accessibility"}}{{/paper-button}}
</p>
{{/custom-button}}
Expand All @@ -53,6 +55,8 @@
\{{#paper-button raised=true primary=true onClick=(action "targetButton") bubbles=false}}Button no bubble\{{/paper-button}}
&lt;/p&gt;
&lt;p&gt;
\{{#paper-button raised=true fab=true}}Fab\{{/paper-button}}
\{{#paper-button raised=true mini=true}}Mini\{{/paper-button}}
\{{#paper-button iconButton=true}}\{{paper-icon "more-vert"}}\{{/paper-button}}
&lt;/p&gt;
&lt;p&gt;
Expand Down
18 changes: 18 additions & 0 deletions tests/integration/components/paper-button-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,21 @@ test('uses md-icon-button class when iconButton=true', function(assert) {
`);
assert.ok(this.$('.md-button').hasClass('md-icon-button'));
});

test('uses md-fab class when fab=true', function(assert) {
this.render(hbs`
{{#paper-button fab=true}}
A label
{{/paper-button}}
`);
assert.ok(this.$('.md-button').hasClass('md-fab'));
});

test('uses md-mini and md-fab class when mini=true', function(assert) {
this.render(hbs`
{{#paper-button mini=true}}
A label
{{/paper-button}}
`);
assert.ok(this.$('.md-button').is('.md-fab', '.md-mini'));
});