Skip to content

Commit

Permalink
Sync with master
Browse files Browse the repository at this point in the history
  • Loading branch information
smouillour committed Oct 23, 2023
2 parents 27f728b + 35263df commit fc54ed1
Show file tree
Hide file tree
Showing 46 changed files with 259 additions and 312 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-rockets-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/scripts-config-jest': minor
---

Fix peer dependencies and adapt code to be compatible with pnpm
5 changes: 5 additions & 0 deletions .changeset/small-kiwis-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/scripts-config-storybook-lib': patch
---

fix: icon url to support prefix
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import Component from './TreeHeader.component';

jest.mock('react-i18next', () => {
// eslint-disable-next-line global-require
const mockTranslations = require('../../../../test/i18nMock').default;

return mockTranslations();
});

describe('TreeHeader', () => {
it('should render a simple tree header', () => {
const { container } = render(<Component title="myTitle" />);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { render, screen } from '@testing-library/react';
import Component, { getDefaultIcon } from './TreeBranchIcon.component';
jest.unmock('@talend/design-system');
jest.mock('react-i18next', () => {
// eslint-disable-next-line global-require
const mockTranslations = require('../../../../test/i18nMock').default;

return mockTranslations();
});

describe('getDefaultIcon', () => {
it('should return a custom object icon', () => {
Expand Down
61 changes: 0 additions & 61 deletions packages/components/src/Toggle/Toggle.stories.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { useState } from 'react';
import PropTypes from 'prop-types';
import { action } from '@storybook/addon-actions';

import Toggle from './Toggle.component';
Expand Down Expand Up @@ -31,33 +29,6 @@ const withLabel = {
label: 'Some label',
};

const labelToggleProps = {
values: [
{ value: 'val1', label: 'Value 1' },
{ value: 'val2', label: 'Value 2' },
{ value: 'val3', label: 'Value 3' },
],
};

const InteractiveLabelToggle = ({ defaultValue = '', name, autoFocus }) => {
const [value, setValue] = useState(defaultValue);

return (
<Toggle.Label
{...labelToggleProps}
value={value}
onChange={setValue}
name={name}
autoFocus={autoFocus}
/>
);
};
InteractiveLabelToggle.propTypes = {
defaultValue: PropTypes.string,
autoFocus: PropTypes.bool,
name: PropTypes.string.isRequired,
};

export default {
title: 'Components/Form - Controls/Toggle',
};
Expand Down Expand Up @@ -89,35 +60,3 @@ export const Default = () => (
</form>
</div>
);

export const LabelToggle = () => (
<div>
<h1>Label Toggle</h1>
<form>
<h3>Non interactive two states</h3>
<Toggle.Label
name="toggle1"
values={[
{ value: 'basic', label: 'Basic' },
{ value: 'advanced', label: 'Advanced' },
]}
value="advanced"
onChange={onChange}
/>
<h3>Interactive</h3>
<InteractiveLabelToggle name="toggle2" />
<h3>Interactive autofocused</h3>
<InteractiveLabelToggle name="toggle3" autoFocus />
<h3>Interactive with default selected value</h3>
<InteractiveLabelToggle defaultValue="val3" name="toggle4" />
<h3>Disabled with selected value</h3>
<Toggle.Label
{...labelToggleProps}
value="val2"
disabled
name="toggle5"
onChange={onChange}
/>
</form>
</div>
);
57 changes: 0 additions & 57 deletions packages/components/test/i18nMock.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/faceted-search/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// DS is mocked by ui-scripts, preventing us to use testing-library getByLabelText & others selectors
jest.unmock('@talend/design-system');
jest.mock('ally.js');
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { BadgeTags } from './BadgeTags.component';
import { BadgeFacetedProvider } from '../../context/badgeFaceted.context';
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { BadgeTags } from './BadgeTags.component';
import { BadgeFacetedProvider } from '../../context/badgeFaceted.context';
import getDefaultT from '../../../translate';

jest.mock('ally.js');

const badgeFacetedContextValue = {
dispatch: jest.fn(),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';

import { Form, ToggleSwitch } from '@talend/design-system';
import { Form } from '@talend/design-system';
import { getTheme } from '@talend/react-components/lib/theme';

import { FACETED_MODE, USAGE_TRACKING_TAGS } from '../../constants';
Expand All @@ -11,7 +11,7 @@ const theme = getTheme(cssModule);

const SwitchFacetedMode = ({ facetedMode, onChange, t }) => (
<Form className={theme('tc-faceted-switch-mode')}>
<ToggleSwitch
<Form.ToggleSwitch
label={t('FACETED_SEARCH_QUERY', 'Query')}
checked={facetedMode === FACETED_MODE.ADVANCED}
onChange={() =>
Expand Down
2 changes: 0 additions & 2 deletions packages/forms/src/UIForm/UIForm.container.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import userEvent from '@testing-library/user-event';
import { actions, getMockData, getMockNestedData, initProps } from '../../__mocks__/data';
import UIForm from './UIForm.container';

jest.mock('ally.js');

describe('UIForm container', () => {
let props;
beforeEach(() => {
Expand Down
1 change: 0 additions & 1 deletion packages/forms/src/UIForm/Widget/Widget.component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { WidgetContext } from '../context';
import Widget from './Widget.component';

jest.unmock('@talend/design-system');
jest.mock('ally.js');

describe('Widget component', () => {
const schema = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import userEvent from '@testing-library/user-event';

import SingleButton from './SingleButton.component';

jest.mock('ally.js');
jest.unmock('@talend/design-system');

describe('SingleButton field', () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/forms/src/UIForm/fields/Code/Code.component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import 'ace-builds/src-noconflict/ext-language_tools';

import Code, { CodeProps } from './Code.component';

// fix cannot read appendChild of null;
jest.mock('ally.js');

declare global {
interface Window {
ReactAce: { default: typeof ReactAce };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import userEvent from '@testing-library/user-event';

import Datalist from './Datalist.component';

jest.mock('ally.js');
jest.unmock('@talend/design-system');

const schema = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { render, screen } from '@testing-library/react';
import DatalistTextMode from './TextMode.component';

jest.mock('ally.js');
jest.unmock('@talend/design-system');
const schema = {
title: 'My List',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { act, render, screen, fireEvent } from '@testing-library/react';
import DateWidget from './Date.component';
jest.mock('ally.js');

jest.unmock('@talend/design-system');

describe('Date widget', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { act, render, screen, fireEvent } from '@testing-library/react';
import DateTimeWidget from './DateTime.component';

jest.mock('ally.js');
jest.unmock('@talend/design-system');

describe('DateTime widget', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { act, render, screen, fireEvent } from '@testing-library/react';
import TimeWidget from './Time.component';

jest.unmock('@talend/design-system');
jest.mock('ally.js');

describe('Time component', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import userEvent from '@testing-library/user-event';
import EnumerationWidget from './EnumerationWidget';

jest.unmock('@talend/design-system');
jest.mock('ally.js');

describe('EnumerationWidget', () => {
it('should render items', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { screen, render } from '@testing-library/react';
import FieldTemplate from './FieldTemplate.component';

jest.unmock('@talend/design-system');
jest.mock('ally.js');

describe('FieldTemplate', () => {
const defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import File, { FileWidget, base64Decode } from './File.component';

jest.mock('ally.js');
jest.unmock('@talend/design-system');

describe('File field', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { screen, render } from '@testing-library/react';

jest.mock('ally.js');
jest.unmock('@talend/design-system');

import TextMode from './TextMode.component';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { screen, render } from '@testing-library/react';
import { WidgetContext } from '../../context';
import KeyValue from './KeyValue.component';

jest.mock('ally.js');
jest.unmock('@talend/design-system');

const widgets = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event';
import ListView from './ListView.component';

const NO_RESULT_MESSAGE = 'No results found';
jest.mock('ally.js');

jest.unmock('@talend/design-system');

describe('ListView field', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import userEvent from '@testing-library/user-event';

import MultiSelectTag from './MultiSelectTag.component';

jest.mock('ally.js');
jest.unmock('@talend/design-system');

describe('MultiSelectTag field', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { screen, render } from '@testing-library/react';

import RadioOrSelect from './RadioOrSelect.component';

jest.mock('ally.js');
jest.unmock('@talend/design-system');

describe('RadioOrSelect field', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { screen, render, fireEvent } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import Radios from './Radios.component';

jest.mock('ally.js');
jest.unmock('@talend/design-system');

describe('Radios field', () => {
Expand Down
Loading

0 comments on commit fc54ed1

Please sign in to comment.