Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions frontend/__mocks__/resizeObserver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global.ResizeObserver = class {
constructor() {}
disconnect() {}
observe() {}
unobserve() {}
};
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"./__mocks__/localStorage.ts",
"./__mocks__/matchMedia.js",
"./__mocks__/mutationObserver.js",
"./__mocks__/resizeObserver.js",
"./__mocks__/serverFlags.js",
"./__mocks__/textEncoderDecoder.ts",
"./__mocks__/webpack.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ import { renderWithProviders } from '../../../test-utils/unit-test-utils';
import type { FormFooterProps } from '../form-utils-types';
import { FormFooter } from '../FormFooter';

// Mock ResizeObserver
global.ResizeObserver = class ResizeObserver {
observe = () => {};

unobserve = () => {};

disconnect = () => {};
};

describe('FormFooter', () => {
let props: FormFooterProps;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@ import MockForm from '../__mocks__/MockForm';
import ContainerField from '../ContainerField';
import DeploymentForm from '../DeploymentForm';

class ResizeObserver {
observe() {
// do nothing
}

unobserve() {
// do nothing
}

disconnect() {
// do nothing
}
}

window.ResizeObserver = ResizeObserver;

const mockContainerField: FC = () => {
return <div>Container: xyz</div>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ import { renderWithProviders } from '@console/shared/src/test-utils/unit-test-ut
import { ApplicationFlowType } from '../edit-application-utils';
import EditApplicationForm from '../EditApplicationForm';

global.ResizeObserver = class ResizeObserver {
observe = () => {};

unobserve = () => {};

disconnect = () => {};
};

jest.mock('react-i18next', () => ({
__esModule: true,
useTranslation: () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ import { getResourcesType } from '../../edit-application/edit-application-utils'
import AddHealthChecks from '../AddHealthChecks';
import { getHealthChecksData } from '../create-health-checks-probe-utils';

global.ResizeObserver = class ResizeObserver {
observe = () => {};

unobserve = () => {};

disconnect = () => {};
};

jest.mock('react-i18next', () => ({
__esModule: true,
useTranslation: () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ import { EVENT_SOURCE_CONTAINER_KIND } from '../../../const';
import { getEventSourceIcon } from '../../../utils/get-knative-icon';
import { EventSource } from '../EventSource';

global.ResizeObserver = class ResizeObserver {
observe = () => {};

unobserve = () => {};

disconnect = () => {};
};

jest.mock('@console/shared/src/components/formik-fields/SyncedEditorField', () => ({
SyncedEditorField: ({ formContext }: { formContext?: { editor?: ReactNode } }) => (
<>{formContext?.editor}</>
Expand Down
16 changes: 0 additions & 16 deletions frontend/public/components/__tests__/command-line-tools.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,7 @@ const obj = {
loadError: null,
};

const nativeResizeObserver = window.ResizeObserver;
class ResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
}

describe('CommandLineTools', () => {
beforeAll(() => {
window.ResizeObserver = ResizeObserver;
});

afterAll(() => {
window.ResizeObserver = nativeResizeObserver;
jest.restoreAllMocks();
});

describe('When ordering is correct', () => {
it('shows oc CLI first in the displayed list', async () => {
renderWithProviders(<CommandLineTools obj={obj} />);
Expand Down