Skip to content

Commit

Permalink
Prettify + Add tests for #2515
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Nov 9, 2023
1 parent 1aa1f0d commit 2ac367a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export function OriginalString({
const markedTerm = target.dataset['match'];
if (markedTerm) {
setPopupTerms(
terms.terms?.filter((t) => t.text.toLowerCase() === markedTerm) ?? [],
terms.terms?.filter((t) => t.text.toLowerCase() === markedTerm) ??
[],
);
}
}
Expand Down Expand Up @@ -115,9 +116,7 @@ function InnerOriginalString({

return (
<p className='original' onClick={onClick}>
<Highlight terms={terms}>
{source}
</Highlight>
<Highlight terms={terms}>{source}</Highlight>
</p>
);
}
2 changes: 2 additions & 0 deletions translate/src/modules/placeable/components/Highlight.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ describe('specific marker', () => {
['10 % complete', '10'],
['There were % d cows'],
['There were %(number) 3d cows'],
['Verified by %@', '%@'],
['Update login %1$@ for %2$@?', '%1$@', '%2$@'],
// Qt
['Hello, %1', '%1'],
['Hello, %99', '%99'],
Expand Down
1 change: 0 additions & 1 deletion translate/src/modules/placeable/components/Highlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export function Highlight({
});
}


for (const { l10nId, re } of [
{ l10nId: 'term-email', re: /(?:mailto:)?\w[\w.-]*@\w[\w.]*\w/g },
{ l10nId: 'term-number', re: /[-+]?\d+(?:[\u00A0.,]\d+)*\b/gu },
Expand Down

0 comments on commit 2ac367a

Please sign in to comment.