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
2 changes: 1 addition & 1 deletion core/src/components/input/input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -618,5 +618,5 @@
*/
:host([disabled]) ::slotted(ion-input-password-toggle),
:host([readonly]) ::slotted(ion-input-password-toggle) {
display: none;
visibility: hidden;
}
64 changes: 64 additions & 0 deletions core/src/components/input/test/states/input.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,69 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
const input = page.locator('ion-input');
await expect(input).toHaveScreenshot(screenshot(`input-disabled`));
});

test('should maintain consistent height when password toggle is hidden on disabled input', async ({
page,
}, testInfo) => {
testInfo.annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/29562',
});
await page.setContent(
`
<ion-input label="Password" type="password" value="password123">
<ion-input-password-toggle slot="end"></ion-input-password-toggle>
</ion-input>
`,
config
);

const input = page.locator('ion-input');

// Get the height when input is enabled
const enabledHeight = await input.boundingBox().then((box) => box?.height);

// Disable the input
await input.evaluate((el) => el.setAttribute('disabled', 'true'));
await page.waitForChanges();

// Get the height when input is disabled
const disabledHeight = await input.boundingBox().then((box) => box?.height);

// Verify heights are the same
expect(enabledHeight).toBe(disabledHeight);
});

test('should maintain consistent height when password toggle is hidden on readonly input', async ({
page,
}, testInfo) => {
testInfo.annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/29562',
});
await page.setContent(
`
<ion-input label="Password" type="password" value="password123">
<ion-input-password-toggle slot="end"></ion-input-password-toggle>
</ion-input>
`,
config
);

const input = page.locator('ion-input');

// Get the height when input is enabled
const enabledHeight = await input.boundingBox().then((box) => box?.height);

// Make the input readonly
await input.evaluate((el) => el.setAttribute('readonly', 'true'));
await page.waitForChanges();

// Get the height when input is readonly
const readonlyHeight = await input.boundingBox().then((box) => box?.height);

// Verify heights are the same
expect(enabledHeight).toBe(readonlyHeight);
});
});
});
Loading