More explicit naming
This commit is contained in:
parent
aa9d3d1931
commit
089f0f7a87
@ -17,13 +17,13 @@ export function createGetKcContext<KcContextExtension extends { pageId: string }
|
|||||||
|
|
||||||
function getKcContext<PageId extends ExtendKcContext<KcContextExtension>["pageId"] | undefined = undefined>(params?: {
|
function getKcContext<PageId extends ExtendKcContext<KcContextExtension>["pageId"] | undefined = undefined>(params?: {
|
||||||
mockPageId?: PageId;
|
mockPageId?: PageId;
|
||||||
storyParams?: DeepPartial<Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>>;
|
storyPartialKcContext?: DeepPartial<Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>>;
|
||||||
}): {
|
}): {
|
||||||
kcContext: PageId extends undefined
|
kcContext: PageId extends undefined
|
||||||
? ExtendKcContext<KcContextExtension> | undefined
|
? ExtendKcContext<KcContextExtension> | undefined
|
||||||
: Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>;
|
: Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>;
|
||||||
} {
|
} {
|
||||||
const { mockPageId, storyParams } = params ?? {};
|
const { mockPageId, storyPartialKcContext } = params ?? {};
|
||||||
|
|
||||||
const realKcContext = getKcContextFromWindow<KcContextExtension>();
|
const realKcContext = getKcContextFromWindow<KcContextExtension>();
|
||||||
|
|
||||||
@ -52,10 +52,10 @@ export function createGetKcContext<KcContextExtension extends { pageId: string }
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storyParams !== undefined) {
|
if (storyPartialKcContext !== undefined) {
|
||||||
deepAssign({
|
deepAssign({
|
||||||
"target": out,
|
"target": out,
|
||||||
"source": storyParams
|
"source": storyPartialKcContext
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,13 +20,13 @@ export function createGetKcContext<KcContextExtension extends { pageId: string }
|
|||||||
|
|
||||||
function getKcContext<PageId extends ExtendKcContext<KcContextExtension>["pageId"] | undefined = undefined>(params?: {
|
function getKcContext<PageId extends ExtendKcContext<KcContextExtension>["pageId"] | undefined = undefined>(params?: {
|
||||||
mockPageId?: PageId;
|
mockPageId?: PageId;
|
||||||
storyParams?: DeepPartial<Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>>;
|
storyPartialKcContext?: DeepPartial<Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>>;
|
||||||
}): {
|
}): {
|
||||||
kcContext: PageId extends undefined
|
kcContext: PageId extends undefined
|
||||||
? ExtendKcContext<KcContextExtension> | undefined
|
? ExtendKcContext<KcContextExtension> | undefined
|
||||||
: Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>;
|
: Extract<ExtendKcContext<KcContextExtension>, { pageId: PageId }>;
|
||||||
} {
|
} {
|
||||||
const { mockPageId, storyParams } = params ?? {};
|
const { mockPageId, storyPartialKcContext } = params ?? {};
|
||||||
|
|
||||||
const realKcContext = getKcContextFromWindow<KcContextExtension>();
|
const realKcContext = getKcContextFromWindow<KcContextExtension>();
|
||||||
|
|
||||||
@ -55,10 +55,10 @@ export function createGetKcContext<KcContextExtension extends { pageId: string }
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storyParams !== undefined) {
|
if (storyPartialKcContext !== undefined) {
|
||||||
deepAssign({
|
deepAssign({
|
||||||
"target": out,
|
"target": out,
|
||||||
"source": storyParams
|
"source": storyPartialKcContext
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ describe("createGetKcContext", () => {
|
|||||||
|
|
||||||
const { kcContext } = getKcContext({
|
const { kcContext } = getKcContext({
|
||||||
"mockPageId": "login.ftl",
|
"mockPageId": "login.ftl",
|
||||||
"storyParams": {
|
"storyPartialKcContext": {
|
||||||
"realm": {
|
"realm": {
|
||||||
displayName
|
displayName
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user