Skip to content

test: use snapshots to properly test version-select component #1185

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

Closed
Closed
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
@@ -1,5 +1,90 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`VersionSelect component disableDownload disables download buttons when return value is true 1`] = `
<Blueprint3.Popover
autoFocus={false}
boundary="scrollParent"
canEscapeKeyClose={false}
captureDismiss={false}
className="disabled-menu-tooltip"
content="Version is not available on current OS"
defaultIsOpen={false}
disabled={false}
enforceFocus={false}
fill={false}
hasBackdrop={false}
hoverCloseDelay={0}
hoverOpenDelay={100}
inheritDarkTheme={true}
interactionKind="hover-target"
lazy={true}
minimal={false}
modifiers={
Object {
"flip": Object {
"enabled": false,
},
"hide": Object {
"enabled": false,
},
"preventOverflow": Object {
"enabled": false,
},
}
}
openOnTargetFocus={true}
popoverClassName="bp3-tooltip bp3-intent-primary"
targetTagName="span"
transitionDuration={100}
usePortal={true}
wrapperTagName="span"
>
<Blueprint3.MenuItem
active={true}
disabled={true}
icon="cloud"
key="1.0.0"
label="Not downloaded"
multiline={false}
popoverProps={Object {}}
shouldDismissPopover={true}
text={
Array [
"1.0.0",
]
}
/>
</Blueprint3.Popover>
`;

exports[`VersionSelect component disableDownload does not disable enabled download buttons when return value is false 1`] = `
<li
className=""
>
<a
className="bp3-menu-item bp3-active bp3-intent-primary bp3-popover-dismiss"
label="Not downloaded"
onClick={[Function]}
>
<Blueprint3.Icon
icon="cloud"
/>
<Blueprint3.Text
className="bp3-fill"
ellipsize={true}
tagName="div"
>
1.0.0
</Blueprint3.Text>
<span
className="bp3-menu-item-label"
>
Not downloaded
</span>
</a>
</li>
`;

exports[`VersionSelect component renderItem() renders an item 1`] = `
<Blueprint3.MenuItem
active={true}
Expand Down
6 changes: 2 additions & 4 deletions tests/renderer/components/version-select-spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ describe('VersionSelect component', () => {
})!;

const ItemWrapper = shallow(item);

expect(ItemWrapper.find('.disabled-menu-tooltip')).toHaveLength(1);
expect(ItemWrapper).toMatchSnapshot();
});

it('does not disable enabled download buttons when return value is false', () => {
Expand All @@ -117,8 +116,7 @@ describe('VersionSelect component', () => {
})!;

const ItemWrapper = shallow(item);

expect(ItemWrapper.exists('.disabled-menu-tooltip')).toBe(false);
expect(ItemWrapper).toMatchSnapshot();
});
});

Expand Down