mirror of
https://github.com/strapi/strapi.git
synced 2025-09-21 22:40:24 +00:00
Fix tests
Signed-off-by: HichamELBSI <elabbassih@gmail.com>
This commit is contained in:
parent
cfb417689e
commit
3f23b6c01f
@ -187,7 +187,7 @@ const Wysiwyg = ({
|
||||
|
||||
Wysiwyg.defaultProps = {
|
||||
description: null,
|
||||
disabled: true,
|
||||
disabled: false,
|
||||
error: '',
|
||||
labelAction: undefined,
|
||||
placeholder: null,
|
||||
|
@ -1,7 +1,8 @@
|
||||
import * as React from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { render, waitFor, fireEvent } from '@testing-library/react';
|
||||
import { lightTheme, ThemeProvider } from '@strapi/design-system';
|
||||
import { ThemeProvider } from '@strapi/design-system/ThemeProvider';
|
||||
import { lightTheme } from '@strapi/design-system/themes';
|
||||
import Wysiwyg from '../index';
|
||||
|
||||
jest.mock('@strapi/helper-plugin', () => ({
|
||||
@ -39,6 +40,7 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
name="rich-text"
|
||||
intlLabel={{ id: 'hello world', defaultMessage: 'hello world' }}
|
||||
onChange={onChange}
|
||||
disabled={false}
|
||||
/>
|
||||
</IntlProvider>
|
||||
</ThemeProvider>
|
||||
@ -203,7 +205,7 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.c28 .sc-bjeSbO {
|
||||
.c28 .sc-pVTFL {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
@ -560,8 +562,6 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
background: #ffffff;
|
||||
overflow: hidden;
|
||||
min-height: 2rem;
|
||||
color: #666687;
|
||||
background: #eaeaef;
|
||||
outline: none;
|
||||
box-shadow: 0;
|
||||
-webkit-transition-property: border-color,box-shadow,fill;
|
||||
@ -598,7 +598,6 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
display: flex;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.c18 svg {
|
||||
@ -610,7 +609,7 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
}
|
||||
|
||||
.c32 {
|
||||
cursor: not-allowed !important;
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.c32 .CodeMirror-placeholder {
|
||||
@ -1062,13 +1061,11 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
>
|
||||
<div
|
||||
class="c9 c10"
|
||||
disabled=""
|
||||
>
|
||||
<button
|
||||
aria-disabled="true"
|
||||
aria-disabled="false"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="listbox"
|
||||
aria-label="Add a title"
|
||||
aria-labelledby="selectTitle-label selectTitle-content"
|
||||
class="c11"
|
||||
id="selectTitle"
|
||||
@ -1097,7 +1094,6 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
<button
|
||||
aria-hidden="true"
|
||||
class="c16 c17 c18"
|
||||
disabled=""
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
>
|
||||
@ -1126,7 +1122,7 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
>
|
||||
<span>
|
||||
<button
|
||||
aria-disabled="true"
|
||||
aria-disabled="false"
|
||||
aria-labelledby="tooltip-1"
|
||||
class="c22 c23 c24 c25"
|
||||
id="Bold"
|
||||
@ -1152,7 +1148,7 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
</span>
|
||||
<span>
|
||||
<button
|
||||
aria-disabled="true"
|
||||
aria-disabled="false"
|
||||
aria-labelledby="tooltip-3"
|
||||
class="c22 c23 c24 c25"
|
||||
id="Italic"
|
||||
@ -1178,7 +1174,7 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
</span>
|
||||
<span>
|
||||
<button
|
||||
aria-disabled="true"
|
||||
aria-disabled="false"
|
||||
aria-labelledby="tooltip-5"
|
||||
class="c22 c23 c24 c25"
|
||||
id="Underline"
|
||||
@ -1203,7 +1199,7 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
</div>
|
||||
<span>
|
||||
<button
|
||||
aria-disabled="true"
|
||||
aria-disabled="false"
|
||||
aria-labelledby="tooltip-7"
|
||||
class="c22 c23 c24 c26"
|
||||
id="more"
|
||||
@ -1234,7 +1230,7 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
<span
|
||||
class="c29 c30"
|
||||
>
|
||||
Markdown mode
|
||||
Preview mode
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
@ -1244,7 +1240,6 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
>
|
||||
<div
|
||||
class="c32"
|
||||
disabled=""
|
||||
>
|
||||
<textarea
|
||||
style="display: none;"
|
||||
@ -1260,8 +1255,6 @@ describe('Wysiwyg render and actions buttons', () => {
|
||||
aria-label="Editor"
|
||||
autocapitalize="off"
|
||||
autocorrect="off"
|
||||
disabled=""
|
||||
readonly=""
|
||||
spellcheck="false"
|
||||
style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; min-height: 1em; outline: none;"
|
||||
tabindex="0"
|
||||
@ -1669,7 +1662,7 @@ describe('Wysiwyg render actions with initial value', () => {
|
||||
renderedContainer = container;
|
||||
});
|
||||
|
||||
it.only('should add markdown with initial value', async () => {
|
||||
it('should add markdown with initial value', async () => {
|
||||
await waitFor(() => renderedContainer.querySelector('.CodeMirror-cursor'));
|
||||
expect(returnedValue).toEqual('hello world');
|
||||
const expected = `${returnedValue}**Bold**`;
|
||||
|
@ -94,10 +94,10 @@ describe('UploadAssetDialog', () => {
|
||||
target: { files: fileList },
|
||||
});
|
||||
|
||||
expect(screen.getByText('Upload new asset')).toBeInTheDocument();
|
||||
expect(screen.getAllByText(`Add new assets`).length).toBe(2);
|
||||
expect(
|
||||
screen.getByText(
|
||||
'{number, plural, =0 {No asset} one {1 asset} other {# assets}} selected'
|
||||
'{number, plural, =0 {No asset} one {1 asset} other {# assets}} ready to upload'
|
||||
)
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
@ -193,11 +193,11 @@ describe('UploadAssetDialog', () => {
|
||||
await waitFor(() =>
|
||||
expect(
|
||||
screen.getByText(
|
||||
'{number, plural, =0 {No asset} one {1 asset} other {# assets}} selected'
|
||||
'{number, plural, =0 {No asset} one {1 asset} other {# assets}} ready to upload'
|
||||
)
|
||||
).toBeInTheDocument()
|
||||
);
|
||||
expect(screen.getByText('Upload new asset')).toBeInTheDocument();
|
||||
expect(screen.getAllByText(`Add new assets`).length).toBe(2);
|
||||
expect(
|
||||
screen.getByText('Manage the assets before uploading them to the Media Library')
|
||||
).toBeInTheDocument();
|
||||
|
@ -179,7 +179,7 @@ describe('Media library homepage', () => {
|
||||
|
||||
renderML();
|
||||
|
||||
await waitFor(() => expect(screen.queryByText(`Upload assets`)).not.toBeInTheDocument());
|
||||
await waitFor(() => expect(screen.queryByText(`Add new assets`)).not.toBeInTheDocument());
|
||||
});
|
||||
|
||||
it('shows the "Upload assets" button when the user does have the permissions to', async () => {
|
||||
@ -193,7 +193,7 @@ describe('Media library homepage', () => {
|
||||
|
||||
renderML();
|
||||
|
||||
await waitFor(() => expect(screen.getByText(`Upload assets`)).toBeInTheDocument());
|
||||
await waitFor(() => expect(screen.getByText(`Add new assets`)).toBeInTheDocument());
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user