Skip to content

Commit

Permalink
feat(Button): Addition/support for title attribute on buttons. Thanks…
Browse files Browse the repository at this point in the history
… to basz

Fixes #148
  • Loading branch information
basz authored and simonihmig committed Nov 5, 2016
1 parent ed881b5 commit 3d63087
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions addon/components/bs-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default Ember.Component.extend(ComponentChild, TypeClass, SizeClass, {
*/
classTypePrefix: 'btn',

attributeBindings: ['disabled', 'buttonType:type'],
attributeBindings: ['disabled', 'buttonType:type', 'title'],

/**
* Default label of the button. Not need if used as a block component
Expand Down Expand Up @@ -219,6 +219,15 @@ export default Ember.Component.extend(ComponentChild, TypeClass, SizeClass, {
*/
reset: null,

/**
* The HTML title attribute
*
* @property title
* @type string
* @public
*/
title: null,

/**
* This will reset the state property to 'default', and with that the button's label to defaultText
*
Expand Down Expand Up @@ -294,4 +303,4 @@ export default Ember.Component.extend(ComponentChild, TypeClass, SizeClass, {
this.get('reset');
}

});
});
3 changes: 2 additions & 1 deletion tests/integration/components/bs-button-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ test('button has correct CSS classes', function(assert) {
});

test('button has HTML attributes', function(assert) {
this.render(hbs`{{#bs-button id="test" disabled=true}}Test{{/bs-button}}`);
this.render(hbs`{{#bs-button id="test" disabled=true title="title"}}Test{{/bs-button}}`);

assert.equal(this.$('button').attr('id'), 'test');
assert.equal(this.$('button').attr('disabled'), 'disabled');
assert.equal(this.$('button').attr('title'), 'title');
});

test('button has default label', function(assert) {
Expand Down

0 comments on commit 3d63087

Please sign in to comment.