Files Office: Dismiss nudge when clicking on the anchor
For self dismiss nudges clicking on the anchor is the same as clicking on the nudge itself. Bug: b:276387552 Change-Id: Ie6f6370bc4db04604277dda4641c47c8170ca975 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4535898 Commit-Queue: Ben Reich <benreich@chromium.org> Auto-Submit: Luciano Pacheco <lucmult@chromium.org> Commit-Queue: Luciano Pacheco <lucmult@chromium.org> Reviewed-by: Ben Reich <benreich@chromium.org> Cr-Commit-Position: refs/heads/main@{#1144572}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
4da27019e3
commit
cd1a8a5ecc
ui/file_manager/file_manager/containers
@ -201,6 +201,8 @@ export class NudgeContainer {
|
||||
// Self dismissable nudge only dismisses if the user clicks on the nudge.
|
||||
this.nudge_.addEventListener(
|
||||
'pointerdown', () => this.closeNudge(this.currentNudgeType_), config);
|
||||
anchor.addEventListener(
|
||||
'pointerdown', () => this.closeNudge(this.currentNudgeType_), config);
|
||||
const dismissOnKeyDown = info.dismissOnKeyDown;
|
||||
if (dismissOnKeyDown) {
|
||||
document.addEventListener('keydown', (event: KeyboardEvent) => {
|
||||
|
@ -243,6 +243,26 @@ export async function testNudgeDismissButton(done: () => void) {
|
||||
done();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the nudge is dismissed by clicking on the anchor.
|
||||
*/
|
||||
export async function testNudgeDismissAnchor(done: () => void) {
|
||||
nudgeInfo[NudgeType.TEST_NUDGE].selfDismiss = true;
|
||||
await createAndShowTestNudge();
|
||||
|
||||
// Click and wait it to dismiss.
|
||||
const anchor = nudgeInfo[NudgeType.TEST_NUDGE].anchor();
|
||||
anchor!.dispatchEvent(new PointerEvent('pointerdown'));
|
||||
|
||||
// Reposition to hidden.
|
||||
await waitUntilRepositionsUninitialised();
|
||||
assertTrue(
|
||||
await nudgeContainer!.checkSeen(NudgeType.TEST_NUDGE),
|
||||
'check nudge has been seen');
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the nudge using the dismissOnKeyDown().
|
||||
*/
|
||||
|
Reference in New Issue
Block a user