-
-
Notifications
You must be signed in to change notification settings - Fork 639
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into scripts_newsroom_meetings_tests
- Loading branch information
Showing
3 changed files
with
42 additions
and
12 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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { mount } from 'cypress/react' | ||
import CodeBlock from '../../../components/editor/CodeBlock' | ||
|
||
describe('CodeBlock component', () => { | ||
beforeEach(() => { | ||
mount( | ||
<CodeBlock> | ||
{ `const message = 'Hello, World!';\nconsole.log(message);` } | ||
</CodeBlock> | ||
) | ||
}); | ||
|
||
it('should render correctly', () => { | ||
cy.get('.bg-code-editor-dark').should('exist') | ||
|
||
}) | ||
it('should copy code to clipboard when clicking the copy button', () => { | ||
const copiedText = "const message = 'Hello, World!';\r\nconsole.log(message);" | ||
|
||
cy.get('[data-test="copy-button"]').click({force:true}) | ||
cy.get('[data-testid="clicked-text"]').should('exist'); | ||
|
||
cy.window().then((win) => { | ||
cy.document().then((doc) => { | ||
cy.wrap(win.navigator.clipboard.readText()).should('eq', copiedText) | ||
}) | ||
}) | ||
}) | ||
|
||
}) |
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