-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for CopyToClipboard component (#304)
* add test for CopyToClipboard component * modify test description
- Loading branch information
1 parent
72832e3
commit 0239331
Showing
1 changed file
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
import CoopyToClipboard from './index'; | ||
import React from 'react'; | ||
import CopyToClipboard from './index'; | ||
import Button from '../Button' | ||
|
||
describe('CoopyToClipboard', () => { | ||
it('TODO', () => { | ||
expect(true).to.equal(true); | ||
it('Test component rendering and Test copy functionality', () => { | ||
const textToCopy = "boooo"; | ||
const displayText = "BUTTON_TEST_NAME" | ||
cy.mount( | ||
<div> | ||
<CopyToClipboard | ||
copy={textToCopy} | ||
display={displayText} | ||
theme="primary" | ||
element={Button} | ||
onCopy={() => { | ||
document.querySelector('.dummy').innerText = textToCopy | ||
}} | ||
/> | ||
<span className='dummy'>PLACEHOLDER</span> | ||
</div> | ||
); | ||
cy.get('span.dummy').invoke('text').should('eq', 'PLACEHOLDER'); | ||
cy.contains(textToCopy).should('not.exist'); | ||
cy.contains(displayText).should('exist').click() | ||
cy.get('span.dummy').invoke('text').should('eq', textToCopy); | ||
|
||
}); | ||
}); | ||
}); |