Skip to content

BZ-40556:test: Add testId input property for modal and select properties #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
2 changes: 1 addition & 1 deletion src/lib/Button/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
on:click={handleButtonClick}
disabled={!(properties.enable && !properties.showLoader)}
type={properties.type}
data-pw={properties.dataPw}
data-pw={properties.testId}
>
{#if properties.showLoader && properties.loaderType === 'Circular'}
<div class="button-loader"><Loader /></div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Button/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type ButtonProperties = {
showLoader: boolean;
loaderType: LoaderType | null;
type: 'submit' | 'reset' | 'button';
dataPw?: string;
testId?: string;
};

export const defaultButtonProperties: ButtonProperties = {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Input/Input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
on:input={onInput}
on:paste={onPaste}
on:click={onClick}
data-pw={properties.dataPw}
data-pw={properties.testId}
class="
{properties.actionInput ? 'action-input' : ''}
"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Input/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type InputProperties = {
autoComplete: AutoCompleteType;
name: string;
textTransformers: TextTransformer[];
dataPw?: string;
testId?: string;
};

export const defaultInputProperties: InputProperties = {
Expand Down
10 changes: 2 additions & 8 deletions src/lib/Modal/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,12 @@
</div>
{/if}
{#if properties.header.text}
<div class="header-text">
<div class="header-text" data-pw={properties.header.testId}>
{properties.header.text}
</div>
{/if}
{#if properties.header.rightImage}
<div
role="button"
tabindex="0"
on:click={handleRightImageClick}
on:keydown
data-pw={properties.rightImageTestId}
>
<div role="button" tabindex="0" on:click={handleRightImageClick} on:keydown data-pw={properties.header.buttonTestId}>
<img class="header-right-img" src={properties.header.rightImage} alt="" />
</div>
{/if}
Expand Down
2 changes: 2 additions & 0 deletions src/lib/Modal/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export type ModalProperties = {
leftImage: string | null;
rightImage: string | null;
text: string | null;
testId?: string;
buttonTestId?: string;
};
footer?: {
primaryButton?: ButtonProperties,
Expand Down
4 changes: 3 additions & 1 deletion src/lib/Select/Select.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
</script>

{#if properties.label !== null && properties.label !== ''}
<label class="label-container" for={properties.label}>
<label class="label-container" for={properties.label} data-pw={properties.labelTestId}>
{properties.label}
</label>
{/if}
Expand All @@ -152,6 +152,7 @@
on:keydown
role="button"
tabindex="0"
data-pw={properties.testId}
>
{#if properties.leftIcon !== null}
<div class="icon-container">
Expand Down Expand Up @@ -219,6 +220,7 @@
class="item {isSelected(properties.selectedItem, item) ? ' item-selected' : ''}"
role="button"
tabindex="0"
data-pw={`${properties.itemTestId}-${item}`}
>
{#if properties.selectMultipleItems}
<CheckListItem checked={isSelected(properties.selectedItem, item)} text="" />
Expand Down
3 changes: 3 additions & 0 deletions src/lib/Select/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ export type SelectProperties = {
showSingleSelectButton?: boolean | null;
showSelectedItem?: boolean;
showSelectedItemCount?: boolean;
testId?: string;
labelTestId?: string;
itemTestId?: string;
};
6 changes: 3 additions & 3 deletions src/lib/Toast/Toast.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@
</div>
{/if}

<div class="toast-message">
<div class="toast-message" data-pw={properties.messageTestId}>
{properties.message}
{#if properties.subtext}
<div class="toast-subtext">{properties.subtext}</div>
<div class="toast-subtext" data-pw={properties.subTextTestId}>{properties.subtext}</div>
{/if}

{#if $$slots.bottomContent}
Expand All @@ -116,7 +116,7 @@
</div>

{#if properties.rightIcon}
<div class="close-button" tabindex="0" role="button" on:click={hideToast} on:keypress>
<div class="close-button" tabindex="0" role="button" on:click={hideToast} on:keypress data-pw={properties.closeIconTestId}>
<img class="toast-icon" src={properties.rightIcon} alt="close-icon" />
</div>
{/if}
Expand Down
4 changes: 4 additions & 0 deletions src/lib/Toast/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export type ToastProperties = {
inAnimationDuration?: number;
outAnimationOffset?: number;
outAnimationDuration?: number;
testId?: string;
messageTestId?: string;
subTextTestId?: string;
closeIconTestId?: string;
};

export const defaultToastProperties: ToastProperties = {
Expand Down