chore: fix tests

This commit is contained in:
Roman Hotsiy 2020-07-06 15:53:31 +03:00
parent 30a27c116b
commit 371f3dfc4e
3 changed files with 6 additions and 5 deletions

View File

@ -62,7 +62,7 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
style={{ marginRight: '-25px' }}
/>
</EndpointInfo>
<ServersOverlay expanded={expanded}>
<ServersOverlay expanded={expanded} aria-hidden={!expanded}>
{operation.servers.map(server => {
const normalizedUrl = options.expandDefaultServerVariables
? expandDefaultServerVariables(server.url, server.variables)

View File

@ -67,7 +67,8 @@ export const ServersOverlay = styled.div<{ expanded: boolean }>`
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
transition: all 0.25s ease;
${props => (props.expanded ? '' : 'transform: translateY(-50%) scaleY(0);')}
visibility: hidden;
${props => (props.expanded ? 'visibility: visible;' : 'transform: translateY(-50%) scaleY(0);')}
`;
export const ServerItem = styled.div`

View File

@ -25,11 +25,11 @@ describe('Components', () => {
test('should collapse/uncollapse', () => {
expect(component.html()).not.toContain('class="hoverable"'); // all are collapsed by default
const expandAll = component.find('div > span[children=" Expand all "]');
const expandAll = component.find('div > button[children=" Expand all "]');
expandAll.simulate('click');
expect(component.html()).toContain('class="hoverable"'); // all are collapsed
const collapseAll = component.find('div > span[children=" Collapse all "]');
const collapseAll = component.find('div > button[children=" Collapse all "]');
collapseAll.simulate('click');
expect(component.html()).not.toContain('class="hoverable"'); // all are collapsed
});
@ -37,7 +37,7 @@ describe('Components', () => {
test('should collapse/uncollapse', () => {
ClipboardService.copySelected = jest.fn();
const copy = component.find('span[onClick]').first();
const copy = component.find('button[onClick]').first();
copy.simulate('click');
expect(ClipboardService.copySelected as jest.Mock).toHaveBeenCalled();