-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(select-modal): add cancelText prop #30282
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
niconaso
wants to merge
12
commits into
ionic-team:feature-8.8
Choose a base branch
from
niconaso:feature/add-close-text
base: feature-8.8
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.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4804ab3
feat(select): allow to pass custom close button text
30d3d3f
fix(select-modal): delete old screenshots
b2f0a4e
fix(select-modal): update screenshots
5225f7b
fix(select-modal): rename closeText to cancelText
920564f
test(select-modal): remove darwin screenshots
thetaPC d792aeb
chore(select, select-modal): revert import order changes
thetaPC 561b1bc
refactor(select-modal): update default to match others
thetaPC 443095b
docs(select-modal): add description to new prop
thetaPC b0d82fc
test(select-modal): update new tests to be "custom"
thetaPC 1bfe987
test(select-modal): update cancelText within test
thetaPC 4ac61e4
test(select-modal): add default value check
thetaPC e30f907
test(select): update snapshots for modal interface
thetaPC 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
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
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 |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en" dir="ltr"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <title>Select - Custom</title> | ||
| <meta | ||
| name="viewport" | ||
| content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" | ||
| /> | ||
| <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" /> | ||
| <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" /> | ||
| <script src="../../../../../scripts/testing/scripts.js"></script> | ||
| <script nomodule src="../../../../../dist/ionic/ionic.js"></script> | ||
| <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script> | ||
| </head> | ||
|
|
||
| <body> | ||
| <ion-app> | ||
| <ion-header> | ||
| <ion-toolbar> | ||
| <ion-title>Select Modal - Custom</ion-title> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
|
|
||
| <ion-content> | ||
| <ion-modal is-open="true"> | ||
| <ion-select-modal multiple="false" cancel-text="Close me"></ion-select-modal> | ||
| </ion-modal> | ||
| </ion-content> | ||
| </ion-app> | ||
|
|
||
| <script> | ||
| const selectModal = document.querySelector('ion-select-modal'); | ||
| selectModal.options = [ | ||
| { value: 'apple', text: 'Apple', disabled: false, checked: true }, | ||
| { value: 'banana', text: 'Banana', disabled: false, checked: false }, | ||
| ]; | ||
| </script> | ||
| </body> | ||
| </html> |
45 changes: 45 additions & 0 deletions
45
core/src/components/select-modal/test/custom/select-modal.e2e.ts
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 |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { expect } from '@playwright/test'; | ||
| import { configs, test } from '@utils/test/playwright'; | ||
|
|
||
| import type { SelectModalOption } from '../../select-modal-interface'; | ||
| import { SelectModalPage } from '../fixtures'; | ||
|
|
||
| const options: SelectModalOption[] = [ | ||
| { value: 'apple', text: 'Apple', disabled: false, checked: false }, | ||
| { value: 'banana', text: 'Banana', disabled: false, checked: false }, | ||
| ]; | ||
|
|
||
| /** | ||
| * This behavior does not vary across modes/directions. | ||
| */ | ||
| configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => { | ||
| test.describe(title('select-modal: custom'), () => { | ||
| let selectModalPage: SelectModalPage; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| selectModalPage = new SelectModalPage(page); | ||
| }); | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| test('should render custom cancel text when prop is provided', async ({ page: _page }, testInfo) => { | ||
| testInfo.annotations.push({ | ||
| type: 'issue', | ||
| description: 'https://github.com/ionic-team/ionic-framework/issues/30295', | ||
| }); | ||
|
|
||
| await selectModalPage.setup(config, options, false); | ||
|
|
||
| const cancelButton = selectModalPage.selectModal.locator('ion-button'); | ||
|
|
||
| // Verify the default text on the cancel button | ||
| await expect(cancelButton).toHaveText('Close'); | ||
|
|
||
| await selectModalPage.selectModal.evaluate((selectModal: HTMLIonSelectModalElement) => { | ||
| selectModal.cancelText = 'Close me'; | ||
| }); | ||
|
|
||
| // Verify the cancel button text has been updated | ||
| await expect(cancelButton).toHaveText('Close me'); | ||
| }); | ||
| }); | ||
| }); |
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
Binary file modified
BIN
-543 Bytes
(97%)
...snapshots/select-basic-modal-scroll-to-selected-ios-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+62 Bytes
(100%)
...napshots/select-basic-modal-scroll-to-selected-ios-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+83 Bytes
(100%)
...snapshots/select-basic-modal-scroll-to-selected-ios-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-509 Bytes
(97%)
...-snapshots/select-basic-modal-scroll-to-selected-md-ltr-Mobile-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-38 Bytes
(100%)
...snapshots/select-basic-modal-scroll-to-selected-md-ltr-Mobile-Firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+143 Bytes
(100%)
...-snapshots/select-basic-modal-scroll-to-selected-md-ltr-Mobile-Safari-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference is the cancel button text. Since we are passing the cancel button text from
select, it now uses the default value thatselectsets for cancel button. I believe this is actually a fix because it lines up with the other interfaces.