forked from baron/baron-sso
네이버 계정 정합성 맞춤
This commit is contained in:
@@ -46,8 +46,10 @@ describe("ParentTenantSelector picker", () => {
|
||||
fireEvent.click(screen.getByRole("button", { name: /테넌트 선택/ }));
|
||||
|
||||
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
||||
const pickerSrc = screen.getByTitle("테넌트 선택").getAttribute("src");
|
||||
expect(pickerSrc).toContain("/login");
|
||||
const pickerSrc = screen
|
||||
.getByTestId("parent-tenant-picker-frame")
|
||||
.getAttribute("src");
|
||||
expect(pickerSrc).toContain("http://localhost:5175/login");
|
||||
expect(decodeURIComponent(pickerSrc ?? "")).toContain("/embed/picker");
|
||||
|
||||
fireEvent(
|
||||
@@ -71,6 +73,30 @@ describe("ParentTenantSelector picker", () => {
|
||||
await waitFor(() => expect(onChange).toHaveBeenCalledWith("company-1"));
|
||||
});
|
||||
|
||||
it("scopes the org-chart picker to the requested tenant root", () => {
|
||||
const onChange = vi.fn();
|
||||
|
||||
render(
|
||||
<ParentTenantSelector
|
||||
id="parentId"
|
||||
label="상위 테넌트"
|
||||
value=""
|
||||
onChange={onChange}
|
||||
tenants={tenants}
|
||||
noneLabel="없음"
|
||||
orgChartTenantId="group-1"
|
||||
orgChartPickerLabel="한맥가족에서 선택"
|
||||
/>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "한맥가족에서 선택" }));
|
||||
|
||||
const pickerSrc = screen
|
||||
.getByTestId("parent-tenant-picker-frame")
|
||||
.getAttribute("src");
|
||||
expect(decodeURIComponent(pickerSrc ?? "")).toContain("tenantId=group-1");
|
||||
});
|
||||
|
||||
it("keeps the current tenant out of picker message selections", async () => {
|
||||
const onChange = vi.fn();
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ type ParentTenantSelectorProps = {
|
||||
labelAction?: ReactNode;
|
||||
contextLabel?: string;
|
||||
orgChartPickerLabel?: string;
|
||||
orgChartTenantId?: string;
|
||||
localPickerLabel?: string;
|
||||
localTenantFilter?: (tenant: TenantSummary) => boolean;
|
||||
compact?: boolean;
|
||||
@@ -49,6 +50,7 @@ export function ParentTenantSelector({
|
||||
labelAction,
|
||||
contextLabel,
|
||||
orgChartPickerLabel,
|
||||
orgChartTenantId,
|
||||
localPickerLabel,
|
||||
localTenantFilter,
|
||||
compact = false,
|
||||
@@ -66,6 +68,9 @@ export function ParentTenantSelector({
|
||||
);
|
||||
const pickerUrl = buildAuthenticatedOrgChartTenantPickerUrl(
|
||||
import.meta.env.ORGFRONT_URL,
|
||||
{
|
||||
tenantId: orgChartTenantId,
|
||||
},
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -135,6 +140,7 @@ export function ParentTenantSelector({
|
||||
title={t("ui.admin.tenants.parent.pick_tenant", "테넌트 선택")}
|
||||
src={pickerUrl}
|
||||
className="h-[600px] w-full rounded-md border"
|
||||
data-testid="parent-tenant-picker-frame"
|
||||
/>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
Reference in New Issue
Block a user