Skip to content

Commit

Permalink
Updated unit tests in Jest Test Suite #12 by updating tests that targ…
Browse files Browse the repository at this point in the history
…et EuiButton to simulate click events. Instead, these tests now target a generic button element to prevent undefined click event errors
  • Loading branch information
breehall committed Sep 28, 2022
1 parent 3d9236f commit 65cd552
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('StartCrawlContextMenu', () => {
beforeEach(() => {
wrapper = mountWithIntl(<StartCrawlContextMenu />);

wrapper.find(EuiButton).simulate('click');
wrapper.find('button').simulate('click');

menuItems = wrapper
.find(EuiContextMenuPanel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('StopCrawlsPopoverContextMenu', () => {
it('can be opened to stop crawls', () => {
const wrapper = mountWithIntl(<StopCrawlPopoverContextMenu stopCrawl={stopCrawl} />);

wrapper.find(EuiButton).simulate('click');
wrapper.find('button').simulate('click');

expect(wrapper.find(EuiPopover).prop('isOpen')).toEqual(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('StartCrawlContextMenu', () => {
beforeEach(() => {
wrapper = mountWithIntl(<StartCrawlContextMenu />);

wrapper.find(EuiButton).simulate('click');
wrapper.find('button').simulate('click');

menuItems = wrapper
.find(EuiContextMenuPanel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('StopCrawlsPopoverContextMenu', () => {
it('can be opened to stop crawls', () => {
const wrapper = mountWithIntl(<StopCrawlPopoverContextMenu />);

wrapper.find(EuiButton).simulate('click');
wrapper.find('button').simulate('click');

expect(wrapper.find(EuiPopover).prop('isOpen')).toEqual(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('CredentialItem', () => {

it('handles credential visible toggle click', () => {
const wrapper = shallow(<CredentialItem {...props} hideCopy />);
const button = wrapper.find(EuiButtonIcon).dive().find('button');
const button = wrapper.find(EuiButtonIcon);
button.simulate('click');

expect(wrapper.find(EuiFieldText)).toHaveLength(1);
Expand All @@ -51,7 +51,7 @@ describe('CredentialItem', () => {
it('handles select all button click', () => {
const wrapper = shallow(<CredentialItem {...props} hideCopy />);
// Toggle isVisible before EuiFieldText is visible
const button = wrapper.find(EuiButtonIcon).dive().find('button');
const button = wrapper.find(EuiButtonIcon);
button.simulate('click');

const simulatedEvent = {
Expand Down

0 comments on commit 65cd552

Please sign in to comment.