Skip to content

Commit ed13b08

Browse files
authored
Merge pull request #1424 from RedisInsight/bugfix/RI-3859_copy_btn
#RI-3858- add disabled condition to copy btn
2 parents a25fb03 + ccb5261 commit ed13b08

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.spec.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,10 @@ describe('QueryCardHeader', () => {
5151

5252
expect(screen.getByTestId('execution-time-tooltip')).toHaveTextContent('12 345 678.91 ms')
5353
})
54+
55+
it('should render disabled copy button', async () => {
56+
render(<QueryCardHeader {...instance(mockedProps)} emptyCommand />)
57+
58+
expect(screen.getByTestId('copy-command')).toBeDisabled()
59+
})
5460
})

redisinsight/ui/src/components/query-card/QueryCardHeader/QueryCardHeader.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ const QueryCardHeader = (props: Props) => {
257257
iconType="copy"
258258
aria-label="Copy query"
259259
className="copy-btn"
260+
disabled={emptyCommand}
260261
onClick={(event: React.MouseEvent) => handleCopy(event, query || '')}
261262
data-testid="copy-command"
262263
/>

0 commit comments

Comments
 (0)