mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
remove useless snapshot and the act
This commit is contained in:
parent
610b2d0fa4
commit
7094638c38
@ -35,24 +35,16 @@ describe('DeleteButton', () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
it('renders and matches the snapshot', () => {
|
||||
const { baseElement } = setup();
|
||||
expect(baseElement).toMatchSnapshot();
|
||||
});
|
||||
it('show confirmation delete dialog when the delete button is clicked', () => {
|
||||
const { baseElement, queryByText } = setup();
|
||||
act(() => {
|
||||
fireEvent.click(getButton(baseElement, 'delete'));
|
||||
});
|
||||
fireEvent.click(getButton(baseElement, 'delete'));
|
||||
|
||||
expect(queryByText('Are you sure you want to delete this?')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('closes the modal when you click on Cancel button', () => {
|
||||
const { baseElement, queryByText, getByText } = setup();
|
||||
act(() => {
|
||||
fireEvent.click(getButton(baseElement, 'delete'));
|
||||
});
|
||||
fireEvent.click(getButton(baseElement, 'delete'));
|
||||
|
||||
act(() => {
|
||||
fireEvent.click(getByText('Cancel'));
|
||||
@ -65,13 +57,8 @@ describe('DeleteButton', () => {
|
||||
const spy = jest.fn();
|
||||
const { baseElement, getByText } = setup({ onClickDelete: spy });
|
||||
|
||||
act(() => {
|
||||
fireEvent.click(getButton(baseElement, 'delete'));
|
||||
});
|
||||
|
||||
act(() => {
|
||||
fireEvent.click(getByText('Confirm'));
|
||||
});
|
||||
fireEvent.click(getButton(baseElement, 'delete'));
|
||||
fireEvent.click(getByText('Confirm'));
|
||||
|
||||
expect(spy).toBeCalledTimes(1);
|
||||
});
|
||||
|
||||
@ -1,215 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`DeleteButton renders and matches the snapshot 1`] = `
|
||||
.c6 {
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.33;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.c0 {
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.c4 {
|
||||
background: #212134;
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.c1 {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
background: #ffffff;
|
||||
border: 1px solid #dcdce4;
|
||||
position: relative;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.c1 svg {
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
}
|
||||
|
||||
.c1 svg > g,
|
||||
.c1 svg path {
|
||||
fill: #ffffff;
|
||||
}
|
||||
|
||||
.c1[aria-disabled='true'] {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.c1:after {
|
||||
-webkit-transition-property: all;
|
||||
transition-property: all;
|
||||
-webkit-transition-duration: 0.2s;
|
||||
transition-duration: 0.2s;
|
||||
border-radius: 8px;
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
bottom: -4px;
|
||||
left: -4px;
|
||||
right: -4px;
|
||||
border: 2px solid transparent;
|
||||
}
|
||||
|
||||
.c1:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.c1:focus-visible:after {
|
||||
border-radius: 8px;
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
bottom: -5px;
|
||||
left: -5px;
|
||||
right: -5px;
|
||||
border: 2px solid #4945ff;
|
||||
}
|
||||
|
||||
.c3 {
|
||||
border: 0;
|
||||
-webkit-clip: rect(0 0 0 0);
|
||||
clip: rect(0 0 0 0);
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
.c5 {
|
||||
z-index: 4;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.c2 {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-align-items: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-pack: center;
|
||||
-webkit-justify-content: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
height: 2rem;
|
||||
width: 2rem;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.c2 svg > g,
|
||||
.c2 svg path {
|
||||
fill: #8e8ea9;
|
||||
}
|
||||
|
||||
.c2:hover svg > g,
|
||||
.c2:hover svg path {
|
||||
fill: #666687;
|
||||
}
|
||||
|
||||
.c2:active svg > g,
|
||||
.c2:active svg path {
|
||||
fill: #a5a5ba;
|
||||
}
|
||||
|
||||
.c2[aria-disabled='true'] {
|
||||
background-color: #eaeaef;
|
||||
}
|
||||
|
||||
.c2[aria-disabled='true'] svg path {
|
||||
fill: #666687;
|
||||
}
|
||||
|
||||
<body>
|
||||
<div>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="c0"
|
||||
role="button"
|
||||
>
|
||||
<span>
|
||||
<button
|
||||
aria-disabled="false"
|
||||
aria-labelledby="0"
|
||||
class="c1 c2"
|
||||
name="delete"
|
||||
tabindex="0"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
class="c3"
|
||||
>
|
||||
Delete test
|
||||
</span>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="none"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="0 0 24 24"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M3.236 6.149a.2.2 0 00-.197.233L6 24h12l2.96-17.618a.2.2 0 00-.196-.233H3.236zM21.8 1.983c.11 0 .2.09.2.2v1.584a.2.2 0 01-.2.2H2.2a.2.2 0 01-.2-.2V2.183c0-.11.09-.2.2-.2h5.511c.9 0 1.631-1.09 1.631-1.983h5.316c0 .894.73 1.983 1.631 1.983H21.8z"
|
||||
fill="#32324D"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="c3"
|
||||
>
|
||||
<p
|
||||
aria-live="polite"
|
||||
aria-relevant="all"
|
||||
id="live-region-log"
|
||||
role="log"
|
||||
/>
|
||||
<p
|
||||
aria-live="polite"
|
||||
aria-relevant="all"
|
||||
id="live-region-status"
|
||||
role="status"
|
||||
/>
|
||||
<p
|
||||
aria-live="assertive"
|
||||
aria-relevant="all"
|
||||
id="live-region-alert"
|
||||
role="alert"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
data-react-portal="true"
|
||||
>
|
||||
<div
|
||||
class="c4 c5"
|
||||
id="0"
|
||||
role="tooltip"
|
||||
>
|
||||
<p
|
||||
class="c6"
|
||||
>
|
||||
Delete test
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
`;
|
||||
Loading…
x
Reference in New Issue
Block a user