-
Notifications
You must be signed in to change notification settings - Fork 13.4k
fix(button): sync disabled state in renderHiddenButton #31225
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
Open
Zac-Smucker-Bryan
wants to merge
15
commits into
ionic-team:main
Choose a base branch
from
Zac-Smucker-Bryan:zsb-ionic-framework-clean
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+51
−2
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1d4c704
fix(ion-button): sync disabled state in ion-button renderHiddenButton
Zac-Smucker-Bryan 2964bc6
test(ion-button): add e2e test for async disabled state change (issue…
Zac-Smucker-Bryan 31aff31
npm run lint.fix
Zac-Smucker-Bryan c235b79
revert: fix(ion-button): sync disabled state in ion-button renderHidd…
Zac-Smucker-Bryan 5fb20dd
revert: test(ion-button): add e2e test for async disabled state chang…
Zac-Smucker-Bryan 963ae43
test(button): add e2e test for async disabled state change
Zac-Smucker-Bryan fb1d9f6
fix(button): sync disabled state in renderHiddenButton
Zac-Smucker-Bryan a96a6b5
revert: test(button): add e2e test for async disabled state change
Zac-Smucker-Bryan 09a65ce
style: code comment
Zac-Smucker-Bryan 914a42c
test(button): add e2e test for async disabled state change
Zac-Smucker-Bryan 869ccd6
style
Zac-Smucker-Bryan 2c78cd0
revert: test(ion-button): add e2e test for async disabled state change
Zac-Smucker-Bryan 7e25d02
revert: test(ion-button): add e2e test for async disabled state change
Zac-Smucker-Bryan 26b8aae
style
Zac-Smucker-Bryan fb273ab
Merge branch 'zsb-ionic-framework-clean' of https://github.com/Zac-Sm…
Zac-Smucker-Bryan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -282,7 +282,52 @@ test.describe('Form', () => { | |
|
|
||
| await expect(control).toHaveClass(/ng-invalid/); | ||
| }); | ||
| }); | ||
|
|
||
| test('should keep hidden submit button disabled state in sync', async ({ page }) => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| // Get the disabled state of both visible and hidden button | ||
| const getDisabledState = () => | ||
| page.evaluate(() => { | ||
| const visible = document.querySelector( | ||
| '#submit-button' | ||
| ) as HTMLIonButtonElement; | ||
|
|
||
| const hidden = document.querySelector( | ||
| 'form button[type="submit"][style*="display: none"]' | ||
| ) as HTMLButtonElement; | ||
|
|
||
| return { | ||
| visible: visible?.disabled, | ||
| hidden: hidden?.disabled, | ||
| }; | ||
| }); | ||
|
|
||
| // Ensure disabled state of both visible and hidden button | ||
| // Should match each other and expected | ||
| const expectDisabledStatesMatch = async (expected: boolean) => { | ||
| const state = await getDisabledState(); | ||
| expect(state.visible).toBe(expected); | ||
| expect(state.hidden).toBe(expected); | ||
| expect(state.visible).toBe(state.hidden); | ||
| return state; | ||
| }; | ||
|
|
||
| // Initial state - should be disabled and both match | ||
| await expectDisabledStatesMatch(true); | ||
|
|
||
| // Set form values - should be enabled | ||
| await page.locator('#set-values').click(); | ||
|
|
||
| // After set values - should be enabled and both match | ||
| await expectDisabledStatesMatch(false); | ||
|
|
||
| // User clicks submit button | ||
| await page.locator('#submit-button').click(); | ||
|
|
||
| // Form should submit successfully | ||
| await expect(page.locator('#submit')).toHaveText('true'); | ||
| }); | ||
| }); | ||
|
|
||
| // Helper functions | ||
| async function testStatus(page: any, status: string) { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.