Skip to content

Commit

Permalink
Add correct screen shots
Browse files Browse the repository at this point in the history
  • Loading branch information
pivilartisant committed Nov 6, 2023
1 parent 4b5954e commit 9ae1f1a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 13 deletions.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 40 additions & 13 deletions cypress/component/integration/Clipboard.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import '../../../src/global.css';
import React from 'react';
import { Clipboard } from '../../../src/components';
import { compareSnapshot } from '../../compareSnapshot';

describe('Component | Integration | Clipboard', function () {
describe('Clipboard', () => {
describe('clipboard with only raw-content', () => {
beforeEach(() => {
cy.mount(<Clipboard rawContent={'raw content'} />);
cy.mount(
<div className="theme-dark">
<Clipboard rawContent={'raw content'} />
</div>,
);
});
it('should render', () => {
cy.get('[data-testid="clipboard-field"]').should('exist');
Expand All @@ -22,10 +25,13 @@ describe('Component | Integration | Clipboard', function () {
describe('clipboard with diplayed content', () => {
beforeEach(() => {
cy.mount(
<Clipboard
rawContent={'raw content'}
displayedContent={'formatted content'}
/>,
<div className="theme-dark">
<Clipboard
rawContent={'raw content'}
displayedContent={'formatted content'}
/>
,
</div>,
);
});
it('should render', () => {
Expand All @@ -43,11 +49,14 @@ describe('Component | Integration | Clipboard', function () {
describe('clipboard success flow', () => {
beforeEach(() => {
cy.mount(
<Clipboard
rawContent={'raw content'}
success="Copied!"
displayedContent={'formatted content'}
/>,
<div className="theme-dark">
<Clipboard
rawContent={'raw content'}
success="Copied!"
displayedContent={'formatted content'}
/>
,
</div>,
);
});
it('should render', () => {
Expand All @@ -63,6 +72,8 @@ describe('Component | Integration | Clipboard', function () {
cy.window().then((win) => {
cy.stub(win, 'prompt')
.returns(win.prompt)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
.as('copyToClipboardPrompt');
});

Expand All @@ -71,6 +82,8 @@ describe('Component | Integration | Clipboard', function () {

cy.get('@copyToClipboardPrompt')
.should((prompt) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(prompt.args[0][1]).to.equal('raw content');
})
.then(() => {
Expand All @@ -89,7 +102,11 @@ describe('Component | Integration | Clipboard', function () {

describe('clipboard raw content success flow', () => {
beforeEach(() => {
cy.mount(<Clipboard rawContent={'raw content'} success="Copied!" />);
cy.mount(
<div className="theme-dark">
<Clipboard rawContent={'raw content'} success="Copied!" />
</div>,
);
});
it('should render', () => {
cy.get('[data-testid="clipboard-field"]').should('exist');
Expand All @@ -104,6 +121,8 @@ describe('Component | Integration | Clipboard', function () {
cy.window().then((win) => {
cy.stub(win, 'prompt')
.returns(win.prompt)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
.as('copyToClipboardPrompt');
});

Expand All @@ -112,6 +131,8 @@ describe('Component | Integration | Clipboard', function () {

cy.get('@copyToClipboardPrompt')
.should((prompt) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(prompt.args[0][1]).to.equal('raw content');
})
.then(() => {
Expand All @@ -130,7 +151,11 @@ describe('Component | Integration | Clipboard', function () {

describe('clipboard error flow', () => {
beforeEach(() => {
cy.mount(<Clipboard rawContent={''} error="Oupps!" />);
cy.mount(
<div className="theme-dark">
<Clipboard rawContent={''} error="Oupps!" />
</div>,
);
});
it('should render', () => {
cy.get('[data-testid="clipboard-field"]').should('exist');
Expand All @@ -149,6 +174,8 @@ describe('Component | Integration | Clipboard', function () {
cy.window().then((win) => {
cy.stub(win, 'prompt')
.returns(win.prompt)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
.as('copyToClipboardPrompt');
});

Expand Down

0 comments on commit 9ae1f1a

Please sign in to comment.