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

chore(Tooltip): updated unit tests #9295

Merged
merged 9 commits into from
Jul 19, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ test('renders dropdown', () => {
});

test('passes children', () => {
render(<Dropdown toggle={(toggleRef) => toggle(toggleRef)}>{dropdownChildren}</Dropdown>);
render(
<Dropdown isOpen toggle={(toggleRef) => toggle(toggleRef)}>
{dropdownChildren}
</Dropdown>
);

expect(screen.getByText('Dropdown children')).toBeVisible();
});
Expand Down Expand Up @@ -112,7 +116,7 @@ test('passes zIndex to popper', () => {
test('does not pass isOpen to popper by default', () => {
render(<Dropdown toggle={(toggleRef) => toggle(toggleRef)}>{dropdownChildren}</Dropdown>);

expect(screen.getByText('isOpen: undefined')).toBeVisible();
expect(screen.getByText('isVisible: undefined')).toBeVisible();
});

test('passes isOpen to popper', () => {
Expand All @@ -122,7 +126,7 @@ test('passes isOpen to popper', () => {
</Dropdown>
);

expect(screen.getByText('isOpen: true')).toBeVisible();
expect(screen.getByText('isVisible: true')).toBeVisible();
});

/* no default tests for callback props
Expand All @@ -134,7 +138,7 @@ test('passes onSelect callback', async () => {

const onSelect = jest.fn();
render(
<Dropdown onSelect={onSelect} toggle={(toggleRef) => toggle(toggleRef)}>
<Dropdown isOpen onSelect={onSelect} toggle={(toggleRef) => toggle(toggleRef)}>
{dropdownChildren}
</Dropdown>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,62 @@

exports[`match snapshot 1`] = `
<DocumentFragment>
<div>
<div
data-testid="mock-wrapper"
>
<div
class="customClass"
data-ouia-component-id="dropdown"
data-ouia-component-type="PF5/Dropdown"
data-ouia-safe="true"
data-testid="menu-mock"
data-testid="popper"
>
<div>
<div
class="customClass"
data-ouia-component-id="dropdown"
data-ouia-component-type="PF5/Dropdown"
data-ouia-safe="true"
data-testid="menu-mock"
>
<div>
Dropdown children
<div>
Dropdown children
</div>
</div>
</div>
<div>
Mock item
</div>
<p>
isPlain: true
</p>
<p>
isScrollable: true
</p>
<p>
minWidth: undefined
</p>
</div>
<div>
Mock item
</div>
<p>
isPlain: true
zIndex: 9999
</p>
<p>
isVisible: true
</p>
<p>
enableFlip: undefined
</p>
<p>
isScrollable: true
placement: undefined
</p>
<p>
appendTo: undefined
</p>
<p>
distance: undefined
</p>
<p>
flipBehavior: undefined
</p>
<p>
minWidth: undefined
</p>
</div>
<p>
zIndex: 9999
</p>
<p>
isOpen: true
</p>
<div>
<button>
Dropdown
</button>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading