-
Notifications
You must be signed in to change notification settings - Fork 13.5k
fix(ripple-effect): ripple displays on click or touch #25102
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
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b1fbd6a
fix(ripple-effect): ripple displays on click or touch
sean-perkins a50ef94
chore(): remove unnecessary undefined check
sean-perkins afeb2c1
test(ripple-effect): verify class for ripple is added
sean-perkins 1cbf25f
Merge remote-tracking branch 'origin/main' into FW-1171
sean-perkins 37389c1
fix(): check for shadow root element in composed path
sean-perkins a0fdd08
chore(): playwright maxDiffPixelRatio for screenshot comparisons
sean-perkins b960a45
Merge branch 'main' into FW-1171
sean-perkins 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
63 changes: 63 additions & 0 deletions
63
core/src/components/ripple-effect/test/basic/ripple-effect.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,63 @@ | ||
import { expect } from '@playwright/test'; | ||
import type { IonicPage } from '@utils/test/playwright'; | ||
import { test } from '@utils/test/playwright'; | ||
|
||
test.describe('ripple-effect: basic', () => { | ||
test('should add .ion-activated when pressed', async ({ page }) => { | ||
await verifyRippleEffect(page, '#small-btn'); | ||
await verifyRippleEffect(page, '#large-btn'); | ||
await verifyRippleEffect(page, '#large-btn-outline'); | ||
await verifyRippleEffect(page, '#large-btn-clear'); | ||
await verifyRippleEffect(page, '.block'); | ||
}); | ||
|
||
test.describe('ripple effect with nested ion-button', () => { | ||
test('should add .ion-activated when the block is pressed', async ({ page }) => { | ||
await page.goto(`/src/components/ripple-effect/test/basic?ionic:_testing=false&ionic:mode=md`); | ||
|
||
const el = page.locator('#ripple-with-button'); | ||
|
||
await el.scrollIntoViewIfNeeded(); | ||
|
||
const boundingBox = await el.boundingBox(); | ||
|
||
if (boundingBox) { | ||
await page.mouse.move(boundingBox.x + 5, boundingBox.y + 5); | ||
await page.mouse.down(); | ||
} | ||
|
||
// Waits for the ripple effect to be added | ||
await page.waitForSelector('.ion-activated'); | ||
|
||
const elHandle = await el.elementHandle(); | ||
const classes = await elHandle?.evaluate((el) => el.classList.value); | ||
expect(classes).toMatch('ion-activated'); | ||
}); | ||
|
||
test('should add .ion-activated when the button is pressed', async ({ page }) => { | ||
await verifyRippleEffect(page, '#ripple-with-button ion-button'); | ||
}); | ||
}); | ||
}); | ||
|
||
const verifyRippleEffect = async (page: IonicPage, selector: string) => { | ||
await page.goto(`/src/components/ripple-effect/test/basic?ionic:_testing=false&ionic:mode=md`); | ||
|
||
const el = page.locator(selector); | ||
|
||
await el.scrollIntoViewIfNeeded(); | ||
|
||
const boundingBox = await el.boundingBox(); | ||
|
||
if (boundingBox) { | ||
await page.mouse.move(boundingBox.x + boundingBox.width / 2, boundingBox.y + boundingBox.height / 2); | ||
await page.mouse.down(); | ||
} | ||
|
||
// Waits for the ripple effect to be added | ||
await page.waitForSelector(`${selector}.ion-activated`); | ||
|
||
const elHandle = await el.elementHandle(); | ||
const classes = await elHandle?.evaluate((el) => el.classList.value); | ||
expect(classes).toMatch('ion-activated'); | ||
}; |
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
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.
If I check the button demo on https://ionicframework.com/docs, the button receives
ion-activated
for a brief moment on click, even with the busted ripple effect. Does the test fail with the broken state? 🤔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.
Are you possibly being served from a cache? I don't see the class added to the button element when clicking and holding on the button in the docs examples. Chrome also doesn't indicate that the
class
attribute was modified during mouse down.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.
Happens in incognito, screencast: https://user-images.githubusercontent.com/90629384/163048183-3adafc01-3551-43a5-b6e9-962630f7df91.mp4 The class is on there as long as I have the mouse button held down.
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.
Strange that doesn't happen on Mac 🤔 https://user-images.githubusercontent.com/13732623/163049314-6e795818-897e-464b-ba0c-ba589f0bd4fe.mp4
Anyways, I confirmed that with the changes on
main
, the test suite fails. With the changes in this branch, the test suite passes.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.
Cool, that's what's important 👍