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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,44 @@ describe('TwoStepRegion', () => {
expect(select).toBeEnabled();
});

it('should only display core regions in the Core tab region select', async () => {
const {
getByPlaceholderText,
getByRole,
} = renderWithThemeAndHookFormContext({
component: <TwoStepRegion onChange={vi.fn()} />,
});

const select = getByPlaceholderText('Select a Region');
await userEvent.click(select);

const dropdown = getByRole('listbox');
expect(dropdown.innerHTML).toContain('US, Newark');
expect(dropdown.innerHTML).not.toContain(
'US, Gecko Distributed Region Test'
);
});

it('should only display distributed regions in the Distributed tab region select', async () => {
const {
getAllByRole,
getByPlaceholderText,
getByRole,
} = renderWithThemeAndHookFormContext({
component: <TwoStepRegion onChange={vi.fn()} />,
});

const tabs = getAllByRole('tab');
await userEvent.click(tabs[1]);

const select = getByPlaceholderText('Select a Region');
await userEvent.click(select);

const dropdown = getByRole('listbox');
expect(dropdown.innerHTML).toContain('US, Gecko Distributed Region Test');
expect(dropdown.innerHTML).not.toContain('US, Newark');
});

it('should render a Geographical Area select with All pre-selected and a Region Select for the Distributed tab', async () => {
const { getAllByRole } = renderWithThemeAndHookFormContext({
component: <TwoStepRegion onChange={vi.fn()} />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const TwoStepRegion = (props: CombinedProps) => {
disabledRegions={disabledRegions}
errorText={errorText}
onChange={(e, region) => onChange(region)}
regionFilter={regionFilter}
regionFilter="core"
regions={regions ?? []}
showDistributedRegionIconHelperText={false}
value={value}
Expand Down