chore(content-manager): update test and snapshot

This commit is contained in:
Alexandre Bodin 2023-12-12 09:48:49 +01:00
parent 1b654d7f4f
commit 495fe3fe78
2 changed files with 25 additions and 39 deletions

View File

@ -6,7 +6,6 @@ import { DraftAndPublishBadge } from '../DraftAndPublishBadge';
jest.mock('@strapi/helper-plugin', () => ({ jest.mock('@strapi/helper-plugin', () => ({
...jest.requireActual('@strapi/helper-plugin'), ...jest.requireActual('@strapi/helper-plugin'),
useCMEditViewDataManager: jest.fn().mockReturnValue({ useCMEditViewDataManager: jest.fn().mockReturnValue({
hasDraftAndPublish: true,
initialData: { initialData: {
publishedAt: '2021-08-10T14:00:00.000Z', publishedAt: '2021-08-10T14:00:00.000Z',
}, },
@ -34,17 +33,4 @@ describe('DraftAndPublishBadge', () => {
render(<DraftAndPublishBadge />); render(<DraftAndPublishBadge />);
}); });
it('should show return null when hasDraftAndPublish even if it has a publishedAt value', () => {
// @ts-expect-error mocking for testing
jest.mocked(useCMEditViewDataManager).mockReturnValue({
initialData: {
publishedAt: '2021-08-10T14:00:00.000Z',
},
});
render(<DraftAndPublishBadge />);
expect(screen.queryByText('Editing')).not.toBeInTheDocument();
});
}); });

View File

@ -73,7 +73,7 @@ describe('CONTENT MANAGER | EditView | Header', () => {
color: #ffffff; color: #ffffff;
} }
.c15 { .c16 {
font-size: 1rem; font-size: 1rem;
line-height: 1.5; line-height: 1.5;
color: #666687; color: #666687;
@ -106,6 +106,10 @@ describe('CONTENT MANAGER | EditView | Header', () => {
cursor: pointer; cursor: pointer;
} }
.c14 {
padding-left: 8px;
}
.c5 { .c5 {
-webkit-align-items: center; -webkit-align-items: center;
-webkit-box-align: center; -webkit-box-align: center;
@ -268,55 +272,55 @@ describe('CONTENT MANAGER | EditView | Header', () => {
fill: #271fe0; fill: #271fe0;
} }
.c14 { .c15 {
height: 2rem; height: 2rem;
} }
.c14 svg { .c15 svg {
height: 0.75rem; height: 0.75rem;
width: auto; width: auto;
} }
.c14[aria-disabled='true'] { .c15[aria-disabled='true'] {
border: 1px solid #dcdce4; border: 1px solid #dcdce4;
background: #eaeaef; background: #eaeaef;
} }
.c14[aria-disabled='true'] .c3 { .c15[aria-disabled='true'] .c3 {
color: #666687; color: #666687;
} }
.c14[aria-disabled='true'] svg > g, .c15[aria-disabled='true'] svg > g,
.c14[aria-disabled='true'] svg path { .c15[aria-disabled='true'] svg path {
fill: #666687; fill: #666687;
} }
.c14[aria-disabled='true']:active { .c15[aria-disabled='true']:active {
border: 1px solid #dcdce4; border: 1px solid #dcdce4;
background: #eaeaef; background: #eaeaef;
} }
.c14[aria-disabled='true']:active .c3 { .c15[aria-disabled='true']:active .c3 {
color: #666687; color: #666687;
} }
.c14[aria-disabled='true']:active svg > g, .c15[aria-disabled='true']:active svg > g,
.c14[aria-disabled='true']:active svg path { .c15[aria-disabled='true']:active svg path {
fill: #666687; fill: #666687;
} }
.c14:hover { .c15:hover {
border: 1px solid #7b79ff; border: 1px solid #7b79ff;
background: #7b79ff; background: #7b79ff;
} }
.c14:active { .c15:active {
border: 1px solid #4945ff; border: 1px solid #4945ff;
background: #4945ff; background: #4945ff;
} }
.c14 svg > g, .c15 svg > g,
.c14 svg path { .c15 svg path {
fill: #ffffff; fill: #ffffff;
} }
@ -432,9 +436,8 @@ describe('CONTENT MANAGER | EditView | Header', () => {
class="c7" class="c7"
> >
<button <button
aria-disabled="true" aria-disabled="false"
class="c10 c9 c11 c12" class="c9 c10 c11 c12"
disabled=""
type="button" type="button"
> >
<div <div
@ -460,15 +463,12 @@ describe('CONTENT MANAGER | EditView | Header', () => {
Publish Publish
</span> </span>
</button> </button>
<button <div
aria-disabled="true" class="c14"
class="c10 c9 c11 c14"
disabled=""
type="submit"
> >
<button <button
aria-disabled="true" aria-disabled="true"
class="c9 c10 c11 c12" class="c9 c10 c11 c15"
disabled="" disabled=""
type="submit" type="submit"
> >
@ -482,7 +482,7 @@ describe('CONTENT MANAGER | EditView | Header', () => {
</div> </div>
</div> </div>
<p <p
class="c3 c15" class="c3 c16"
> >
API ID : undefined API ID : undefined
</p> </p>