-
Notifications
You must be signed in to change notification settings - Fork 9
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
#292 | Service Check - Add diff on expected vs actual body #402
base: master
Are you sure you want to change the base?
Changes from 1 commit
0988b84
297f448
9873110
0a73ed7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import React, { useState } from 'react'; | ||
import copy from 'copy-to-clipboard'; | ||
import { CaptionWithPointer, StyledPopoverText } from './styled'; | ||
import { | ||
CaptionWithPointer, | ||
StyledPopoverText, | ||
StyledPopoverTextWrapper, | ||
StyledPopoverHeader | ||
} from './styled'; | ||
import { Button, Popover } from '@material-ui/core'; | ||
|
||
export const PopoverWithControls = ({ | ||
title, | ||
titleHover, | ||
body, | ||
bodyMessage, | ||
expectedResponseBody, | ||
withCopy, | ||
className | ||
}) => { | ||
|
@@ -39,7 +46,20 @@ export const PopoverWithControls = ({ | |
> | ||
{withCopy ? <Button onClick={copyBody}>Copy</Button> : null} | ||
<Button onClick={handlePopoverClose}>Close</Button> | ||
<StyledPopoverText>{body}</StyledPopoverText> | ||
{bodyMessage === 'NO MATCH' ? ( | ||
<StyledPopoverTextWrapper> | ||
<StyledPopoverText> | ||
<StyledPopoverHeader>EXPECTED RESPONSE BODY</StyledPopoverHeader> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah and please move this to const too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in commit 297f448 |
||
{expectedResponseBody} | ||
</StyledPopoverText> | ||
<StyledPopoverText> | ||
<StyledPopoverHeader>RECIVED RESPONSE BODY</StyledPopoverHeader> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess you wanted to write 'RECEIVED' here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in commit 297f448 |
||
{body} | ||
</StyledPopoverText> | ||
</StyledPopoverTextWrapper> | ||
) : ( | ||
<StyledPopoverText>{body}</StyledPopoverText> | ||
)} | ||
</Popover> | ||
</> | ||
); | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -128,12 +128,29 @@ export const StyledFormControl = styled(FormControl)` | |||||
max-width: 300px; | ||||||
`; | ||||||
|
||||||
export const StyledPopoverText = styled(Typography)` | ||||||
export const StyledPopoverText = styled('div')` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you create a styled component for html selector you can simply write
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in commit 297f448 |
||||||
background: ${COLORS.WHITE}; | ||||||
color: ${COLORS.BLACK}; | ||||||
padding: 1rem; | ||||||
`; | ||||||
|
||||||
export const StyledPopoverHeader = styled(Typography)` | ||||||
font-size: 1.2rem; | ||||||
margin-bottom: 10px; | ||||||
font-weight: bold; | ||||||
color: ${COLORS.RED}; | ||||||
border-bottom: 2px ${COLORS.RED} solid; | ||||||
`; | ||||||
|
||||||
export const StyledPopoverTextWrapper = styled('div')` | ||||||
display: flex; | ||||||
justify-content: space-around; | ||||||
|
||||||
& > * { | ||||||
flex-basis: 50%; | ||||||
} | ||||||
`; | ||||||
|
||||||
export const StyledTabs = styled(Tabs)` | ||||||
margin-bottom: 12px; | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move 'NO MATCH' string to const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 297f448