Skip to content

Commit

Permalink
fix bug exposed by eslint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav0 committed Nov 6, 2024
1 parent 364beef commit 268afff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addon/components/bs-button.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<button
disabled={{this.__disabled}}
type={{this.buttonType}}
type={{this._buttonType}}
class="btn {{if @active "active"}} {{if this.block "btn-block"}} {{bs-size-class "btn" @size}} {{bs-type-class "btn" @type default=(if (macroCondition (macroGetOwnConfig "isBS3")) "default" "secondary") outline=@outline}}"
...attributes
{{on "click" this.handleClick}}
Expand Down
7 changes: 7 additions & 0 deletions addon/components/bs-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ export default class Button extends Component {
*/
@arg buttonType = 'button';

get _buttonType() {
if (this.args.buttonType === 'primary') {
return 'submit';
}
return this.args.buttonType;
}

/**
* Set the 'active' class to apply active/pressed CSS styling
*
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/components/bs-modal/footer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module('Integration | Component | bs-modal/footer', function (hooks) {
assert.strictEqual(
this.element.querySelector('.modal-footer button').getAttribute('type'),
'button',
'Submit button is of type submit.'
'Submit button is of type button.'
);
assert.dom('.modal-footer button').hasText('close', 'Button title is correct.');
});
Expand All @@ -31,7 +31,7 @@ module('Integration | Component | bs-modal/footer', function (hooks) {
assert.strictEqual(
this.element.querySelector('.modal-footer button:first-child').getAttribute('type'),
'button',
'Submit button is of type submit.'
'Submit button is of type button.'
);
assert.dom('.modal-footer button:first-child').hasText('close', 'Close button title is correct.');
assert.dom('.modal-footer button:last-child').hasClass('btn-primary', 'Submit button is a primary button.');
Expand Down

0 comments on commit 268afff

Please sign in to comment.