Skip to content

Commit

Permalink
ntp: remove bullet from update-notification notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Nov 28, 2024
1 parent d220474 commit a32fbac
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@ export function WithNotes({ notes, version }) {
<div id={id} class={styles.detailsContent}>
<ul class={styles.list}>
{notes.map((note, index) => {
return <li key={note + index}>{note}</li>;
/**
* Note: Doing this here as a very specific 'view' concern
* Note: using the `if` + `.slice` to avoid regex
* Note: `.slice` is safe on `•` because it is a single Unicode character
* and is represented by a single UTF-16 code unit.
*/
let trimmed = note.trim();
if (trimmed.startsWith('•')) {
trimmed = trimmed.slice(1).trim();
}
return <li key={note + index}>{trimmed}</li>;
})}
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ test.describe('newtab update notifications', () => {

await page.getByText("Browser Updated to version 1.91. See what's new in this release.").waitFor();
await page.getByRole('link', { name: "what's new" }).click();
await page.getByText('Bug fixes and improvements').waitFor();
// this test was updated to add 'exact: true' which would fail if the bullet was not stripped
await page.getByText('Bug fixes and improvements', { exact: true }).waitFor();
await page.getByText('Optimized performance for faster load times', { exact: true }).waitFor();
await page.getByRole('button', { name: 'Dismiss' }).click();
await ntp.mocks.waitForCallCount({ method: 'updateNotification_dismiss', count: 1 });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export const updateNotificationExamples = {
},
populated: {
content: {
notes: ['Bug fixes and improvements'],
// prettier-ignore
notes: [
'• Bug fixes and improvements',
'Optimized performance for faster load times'
],
version: '1.91',
},
},
Expand Down

0 comments on commit a32fbac

Please sign in to comment.