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
3 changes: 1 addition & 2 deletions src/alert/__tests__/runtime-action.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { act, fireEvent, render, screen } from '@testing-library/react';

import Alert from '../../../lib/components/alert';
import awsuiPlugins from '../../../lib/components/internal/plugins';
import { awsuiPluginsInternal } from '../../../lib/components/internal/plugins/api';
import { ActionConfig } from '../../../lib/components/internal/plugins/controllers/action-buttons';

const defaultAction: ActionConfig = {
Expand All @@ -23,7 +22,7 @@ function delay() {
}

afterEach(() => {
awsuiPluginsInternal.alert.clearRegisteredActions();
awsuiPlugins.alert.clearRegisteredActionsForTesting();
});

test('renders runtime action button initially', async () => {
Expand Down
3 changes: 1 addition & 2 deletions src/alert/__tests__/runtime-content-initial.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import testRenderer, { ReactTestRendererJSON } from 'react-test-renderer';

import Alert from '../../../lib/components/alert';
import awsuiPlugins from '../../../lib/components/internal/plugins';
import { awsuiPluginsInternal } from '../../../lib/components/internal/plugins/api';
import { AlertFlashContentConfig } from '../../../lib/components/internal/plugins/controllers/alert-flash-content';

import stylesCss from '../../../lib/components/alert/styles.css.js';

afterEach(() => {
awsuiPluginsInternal.alertContent.clearRegisteredReplacer();
awsuiPlugins.alertContent.clearRegisteredReplacerForTesting();
jest.resetAllMocks();
jest.restoreAllMocks();
});
Expand Down
3 changes: 1 addition & 2 deletions src/alert/__tests__/runtime-content.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Alert from '../../../lib/components/alert';
import Button from '../../../lib/components/button';
import { metrics } from '../../../lib/components/internal/metrics';
import awsuiPlugins from '../../../lib/components/internal/plugins';
import { awsuiPluginsInternal } from '../../../lib/components/internal/plugins/api';
import { AlertFlashContentConfig } from '../../../lib/components/internal/plugins/controllers/alert-flash-content';
import createWrapper from '../../../lib/components/test-utils/dom';
import { expectContent } from './runtime-content-utils';
Expand Down Expand Up @@ -36,7 +35,7 @@ beforeEach(() => {
});

afterEach(() => {
awsuiPluginsInternal.alertContent.clearRegisteredReplacer();
awsuiPlugins.alertContent.clearRegisteredReplacerForTesting();
jest.resetAllMocks();
jest.restoreAllMocks();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { clearVisualRefreshState } from '@cloudscape-design/component-toolkit/in

import AppLayoutToolbar, { AppLayoutToolbarProps } from '../../../lib/components/app-layout-toolbar';
import Header from '../../../lib/components/header';
import { awsuiPlugins, awsuiPluginsInternal } from '../../../lib/components/internal/plugins/api';
import awsuiPlugins from '../../../lib/components/internal/plugins';
import SplitPanel from '../../../lib/components/split-panel';
import createWrapper from '../../../lib/components/test-utils/dom';
import { validateComponentNameAndLabels } from '../../internal/__tests__/analytics-metadata-test-utils';
Expand Down Expand Up @@ -48,7 +48,7 @@ const globalWithFlags = globalThis as any;

beforeEach(() => {
globalWithFlags[Symbol.for('awsui-visual-refresh-flag')] = () => true;
awsuiPluginsInternal.appLayout.clearRegisteredDrawers();
awsuiPlugins.appLayout.clearRegisteredDrawersForTesting();
});

afterEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/app-layout/__tests__/runtime-drawers-layout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { act, render, waitFor } from '@testing-library/react';
import AppLayout from '../../../lib/components/app-layout';
import { useAppLayoutPlacement } from '../../../lib/components/app-layout/utils/use-app-layout-placement';
import { computeHorizontalLayout } from '../../../lib/components/app-layout/visual-refresh-toolbar/compute-layout';
import { awsuiPlugins, awsuiPluginsInternal } from '../../../lib/components/internal/plugins/api';
import awsuiPlugins from '../../../lib/components/internal/plugins';
import { DrawerConfig } from '../../../lib/components/internal/plugins/controllers/drawers';
import * as awsuiWidgetInternal from '../../../lib/components/internal/plugins/widget/core';
import * as awsuiWidgetPlugins from '../../../lib/components/internal/plugins/widget/index';
Expand All @@ -15,7 +15,7 @@ import { KeyCode } from '../../internal/keycode';
import { describeEachAppLayout, getGlobalDrawersTestUtils, testDrawer } from './utils';

beforeEach(() => {
awsuiPluginsInternal.appLayout.clearRegisteredDrawers();
awsuiPlugins.appLayout.clearRegisteredDrawersForTesting();
awsuiWidgetInternal.clearInitialMessages();
});

Expand Down
4 changes: 2 additions & 2 deletions src/app-layout/__tests__/runtime-drawers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getGeneratedAnalyticsMetadata } from '@cloudscape-design/component-tool
import { Button } from '../../../lib/components';
import AppLayout, { AppLayoutProps } from '../../../lib/components/app-layout';
import { TOOLS_DRAWER_ID } from '../../../lib/components/app-layout/utils/use-drawers';
import { awsuiPlugins, awsuiPluginsInternal } from '../../../lib/components/internal/plugins/api';
import awsuiPlugins from '../../../lib/components/internal/plugins';
import { DrawerConfig } from '../../../lib/components/internal/plugins/controllers/drawers';
import * as awsuiWidgetInternal from '../../../lib/components/internal/plugins/widget/core';
import * as awsuiWidgetPlugins from '../../../lib/components/internal/plugins/widget/index';
Expand All @@ -32,7 +32,7 @@ import toolbarStyles from '../../../lib/components/app-layout/visual-refresh-too
import toolbarTriggerStyles from '../../../lib/components/app-layout/visual-refresh-toolbar/toolbar/trigger-button/styles.selectors.js';

beforeEach(() => {
awsuiPluginsInternal.appLayout.clearRegisteredDrawers();
awsuiPlugins.appLayout.clearRegisteredDrawersForTesting();
awsuiWidgetInternal.clearInitialMessages();
activateAnalyticsMetadata(true);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ReactDOM, { unmountComponentAtNode } from 'react-dom';
import { act, render } from '@testing-library/react';

import AppLayout from '../../../lib/components/app-layout';
import { awsuiPlugins, awsuiPluginsInternal } from '../../../lib/components/internal/plugins/api';
import awsuiPlugins from '../../../lib/components/internal/plugins';
import createWrapper from '../../../lib/components/test-utils/dom';
import { useRuntimeDrawerContext } from '../runtime-drawer/use-runtime-drawer-context';
import { describeEachAppLayout, getGlobalDrawersTestUtils, testDrawer } from './utils';
Expand All @@ -29,7 +29,7 @@ function delay() {
}

beforeEach(() => {
awsuiPluginsInternal.appLayout.clearRegisteredDrawers();
awsuiPlugins.appLayout.clearRegisteredDrawersForTesting();
});

jest.mock('@cloudscape-design/component-toolkit', () => ({
Expand Down
3 changes: 1 addition & 2 deletions src/flashbar/__tests__/runtime-action.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { act, fireEvent, render, screen } from '@testing-library/react';

import Flashbar, { FlashbarProps } from '../../../lib/components/flashbar';
import awsuiPlugins from '../../../lib/components/internal/plugins';
import { awsuiPluginsInternal } from '../../../lib/components/internal/plugins/api';
import { ActionConfig } from '../../../lib/components/internal/plugins/controllers/action-buttons';
import createWrapper, { ElementWrapper } from '../../../lib/components/test-utils/dom';

Expand All @@ -26,7 +25,7 @@ function delay() {
}

afterEach(() => {
awsuiPluginsInternal.flashbar.clearRegisteredActions();
awsuiPlugins.flashbar.clearRegisteredActionsForTesting();
});

test('renders runtime action button initially', async () => {
Expand Down
3 changes: 1 addition & 2 deletions src/flashbar/__tests__/runtime-content-initial.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import testRenderer, { ReactTestRenderer, ReactTestRendererJSON } from 'react-te

import Flashbar from '../../../lib/components/flashbar';
import awsuiPlugins from '../../../lib/components/internal/plugins';
import { awsuiPluginsInternal } from '../../../lib/components/internal/plugins/api';
import { AlertFlashContentConfig } from '../../../lib/components/internal/plugins/controllers/alert-flash-content';

import stylesCss from '../../../lib/components/flashbar/styles.css.js';

afterEach(() => {
awsuiPluginsInternal.flashContent.clearRegisteredReplacer();
awsuiPlugins.flashContent.clearRegisteredReplacerForTesting();
jest.resetAllMocks();
jest.restoreAllMocks();
});
Expand Down
3 changes: 1 addition & 2 deletions src/flashbar/__tests__/runtime-content.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Button from '../../../lib/components/button';
import Flashbar from '../../../lib/components/flashbar';
import { metrics } from '../../../lib/components/internal/metrics';
import awsuiPlugins from '../../../lib/components/internal/plugins';
import { awsuiPluginsInternal } from '../../../lib/components/internal/plugins/api';
import { AlertFlashContentConfig } from '../../../lib/components/internal/plugins/controllers/alert-flash-content';
import createWrapper from '../../../lib/components/test-utils/dom';
import { expectContent } from '../../alert/__tests__/runtime-content-utils';
Expand All @@ -29,7 +28,7 @@ const defaultContent: AlertFlashContentConfig = {
};

afterEach(() => {
awsuiPluginsInternal.flashContent.clearRegisteredReplacer();
awsuiPlugins.flashContent.clearRegisteredReplacerForTesting();
jest.resetAllMocks();
jest.restoreAllMocks();
});
Expand Down
6 changes: 3 additions & 3 deletions src/internal/plugins/controllers/action-buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ type ActionRegistrationListener = (action: Array<ActionConfig>) => void;

export interface ActionsApiPublic {
registerAction(config: ActionConfig): void;
clearRegisteredActionsForTesting(): void;
}

export interface ActionsApiInternal {
clearRegisteredActions(): void;
onActionRegistered(listener: ActionRegistrationListener): () => void;
}

Expand All @@ -47,7 +47,7 @@ export class ActionButtonsController {
this.scheduleUpdate();
};

clearRegisteredActions = () => {
clearRegisteredActionsForTesting = () => {
this.actions = [];
};

Expand All @@ -61,11 +61,11 @@ export class ActionButtonsController {

installPublic(api: Partial<ActionsApiPublic> = {}): ActionsApiPublic {
api.registerAction ??= this.registerAction;
api.clearRegisteredActionsForTesting ??= this.clearRegisteredActionsForTesting;
return api as ActionsApiPublic;
}

installInternal(internalApi: Partial<ActionsApiInternal> = {}): ActionsApiInternal {
internalApi.clearRegisteredActions ??= this.clearRegisteredActions;
internalApi.onActionRegistered ??= this.onActionRegistered;
return internalApi as ActionsApiInternal;
}
Expand Down
6 changes: 3 additions & 3 deletions src/internal/plugins/controllers/alert-flash-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ type AlertFlashContentRegistrationListener = (provider: AlertFlashContentConfig)

export interface AlertFlashContentApiPublic {
registerContentReplacer(config: AlertFlashContentConfig): void;
clearRegisteredReplacerForTesting(): void;
}

export interface AlertFlashContentApiInternal {
clearRegisteredReplacer(): void;
onContentRegistered(listener: AlertFlashContentRegistrationListener): () => void;
initialCheck(context: AlertFlashContentInitialContext): boolean;
}
Expand Down Expand Up @@ -89,7 +89,7 @@ export class AlertFlashContentController {
this.#scheduleUpdate();
};

clearRegisteredReplacer = () => {
clearRegisteredReplacerForTesting = () => {
this.#provider = undefined;
};

Expand Down Expand Up @@ -117,11 +117,11 @@ export class AlertFlashContentController {

installPublic(api: Partial<AlertFlashContentApiPublic> = {}): AlertFlashContentApiPublic {
api.registerContentReplacer ??= this.registerContentReplacer;
api.clearRegisteredReplacerForTesting ??= this.clearRegisteredReplacerForTesting;
return api as AlertFlashContentApiPublic;
}

installInternal(internalApi: Partial<AlertFlashContentApiInternal> = {}): AlertFlashContentApiInternal {
internalApi.clearRegisteredReplacer ??= this.clearRegisteredReplacer;
internalApi.onContentRegistered ??= this.onContentRegistered;
internalApi.initialCheck ??= this.initialCheck;
return internalApi as AlertFlashContentApiInternal;
Expand Down
6 changes: 3 additions & 3 deletions src/internal/plugins/controllers/drawers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ export interface DrawersApiPublic {
openDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;
closeDrawer(drawerId: string, params?: OpenCloseDrawerParams): void;
resizeDrawer(drawerId: string, size: number): void;
clearRegisteredDrawersForTesting(): void;
}

export interface DrawersApiInternal {
clearRegisteredDrawers(): void;
onDrawersRegistered(listener: DrawersRegistrationListener): () => void;
onDrawerOpened(listener: DrawersToggledListener): () => void;
onDrawerClosed(listener: DrawersToggledListener): () => void;
Expand Down Expand Up @@ -142,7 +142,7 @@ export class DrawersController {
};
};

clearRegisteredDrawers = () => {
clearRegisteredDrawersForTesting = () => {
this.drawers = [];
};

Expand Down Expand Up @@ -221,11 +221,11 @@ export class DrawersController {
api.openDrawer ??= this.openDrawer;
api.closeDrawer ??= this.closeDrawer;
api.resizeDrawer ??= this.resizeDrawer;
api.clearRegisteredDrawersForTesting ??= this.clearRegisteredDrawersForTesting;
return api as DrawersApiPublic;
}

installInternal(internalApi: Partial<DrawersApiInternal> = {}): DrawersApiInternal {
internalApi.clearRegisteredDrawers ??= this.clearRegisteredDrawers;
internalApi.onDrawersRegistered ??= this.onDrawersRegistered;
internalApi.onDrawerOpened ??= this.onDrawerOpened;
internalApi.onDrawerClosed ??= this.onDrawerClosed;
Expand Down
Loading