Skip to content

Commit

Permalink
fix: htmlElementRef in Button component (#1813)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeandroTorresSicilia committed Sep 10, 2020
1 parent 11dc46c commit ea1ddfc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/components/Button/__test__/button.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,10 @@ describe('<Button/>', () => {
const component = mount(<Button label="OK">Test</Button>);
expect(component.text()).toBe('Test');
});
it('should return the html button element when access the htmlElementRef getter', () => {
const component = mount(<Button label="OK" />);
expect(component.instance().htmlElementRef).toEqual({
current: expect.any(HTMLButtonElement),
});
});
});
2 changes: 1 addition & 1 deletion src/components/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Button extends Component {
}

get htmlElementRef() {
return this.buttonRef.current;
return this.buttonRef;
}

isDisabled() {
Expand Down

0 comments on commit ea1ddfc

Please sign in to comment.