Skip to content

Commit

Permalink
[M110] [FilesTrash] Fix text for nudge label on first trash
Browse files Browse the repository at this point in the history
The CL:4093977 updated the loadTimeData strings for ChromeOS to move
location, this has caused the initialisation of the loadTimeData to come
after the NudgeContainer so when the TRASH_NUDGE_LABEL is retrieved on
initialisation, it is not present. This updates the text to instead be
retrieved on first usage of the nudge not on initialisation.

Before: http://screen/8oWyA6SthnhwYHz
After: http://screen/9AYdLiAmvqVdHSs

(cherry picked from commit 80d3740)

Fixed: b:264804875
Test: CQ
Change-Id: I83bcf82c4fcd46f73047a05d8e851e33d769f919
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4144341
Commit-Queue: Wenbo Jie <wenbojie@chromium.org>
Reviewed-by: Wenbo Jie <wenbojie@chromium.org>
Commit-Queue: Ben Reich <benreich@chromium.org>
Auto-Submit: Ben Reich <benreich@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1090185}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4152930
Cr-Commit-Position: refs/branch-heads/5481@{#208}
Cr-Branched-From: 130f3e4-refs/heads/main@{#1084008}
  • Loading branch information
ben-reich authored and Chromium LUCI CQ committed Jan 11, 2023
1 parent edb7368 commit 0c6a1ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ui/file_manager/file_manager/containers/nudge_container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class NudgeContainer {
'blur', (_: Event) => this.closeNudge(this.currentNudgeType_), config);

this.nudge_.anchor = anchor;
this.nudge_.content = info.content;
this.nudge_.content = info.content();
this.nudge_.direction = info.direction;

this.nudge_.show();
Expand Down Expand Up @@ -317,7 +317,7 @@ interface NudgeInfo {
anchor: () => HTMLElement | null;

// The string contents of the nudge.
content: string;
content: () => string;

// The direction that nudge appears relative to the anchor. For more
// explanation on the various `NudgeDirection`'s look in `xf_nudge.ts` file.
Expand All @@ -335,15 +335,15 @@ interface NudgeInfo {
export const nudgeInfo: {[type in NudgeType]: NudgeInfo} = {
[NudgeType['TEST_NUDGE']]: {
anchor: () => document.querySelector<HTMLDivElement>('div#test'),
content: 'Test content',
content: () => 'Test content',
direction: NudgeDirection.BOTTOM_ENDWARD,
expiryDate: new Date(2999, 1, 1),
},
// A nudge that is shown when an item is first sent to the trash.
[NudgeType['TRASH_NUDGE']]: {
anchor: () =>
document.querySelector<HTMLSpanElement>('span[root-type-icon="trash"]'),
content: str('TRASH_NUDGE_LABEL'),
content: () => str('TRASH_NUDGE_LABEL'),
direction: NudgeDirection.BOTTOM_ENDWARD,
// Expire this after 4 releases (expires when M112 hits Stable).
expiryDate: new Date(2023, 4, 6),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export async function testAriaDescribedByElementIsAdded() {

assertNotEquals(describedByElement, null);
assertEquals(
describedByElement!.innerText, nudgeInfo[NudgeType.TEST_NUDGE].content);
describedByElement!.innerText, nudgeInfo[NudgeType.TEST_NUDGE].content());
}

/**
Expand Down

0 comments on commit 0c6a1ff

Please sign in to comment.