mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(client): Improve navigation search bar clarity (#59140)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
@@ -778,13 +778,12 @@
|
|||||||
"search": {
|
"search": {
|
||||||
"label": "Search",
|
"label": "Search",
|
||||||
"placeholder": {
|
"placeholder": {
|
||||||
"default": "Search our tutorials",
|
"default": "Search our news articles, tutorials, and books",
|
||||||
"numbered": "Search {{ roundedTotalRecords }}+ tutorials"
|
"numbered": "Search {{ roundedTotalRecords }}+ news articles, tutorials, and books"
|
||||||
},
|
},
|
||||||
"see-results": "See all results for {{searchQuery}}",
|
"see-results": "See all results for {{searchQuery}}",
|
||||||
"no-tutorials": "No tutorials found",
|
|
||||||
"try": "Looking for something? Try the search bar on this page.",
|
"try": "Looking for something? Try the search bar on this page.",
|
||||||
"no-results": "We could not find anything relating to <0>{{query}}</0>",
|
"no-results": "No results found",
|
||||||
"result-list": "Search results"
|
"result-list": "Search results"
|
||||||
},
|
},
|
||||||
"misc": {
|
"misc": {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const SearchBarFooter = ({
|
|||||||
onMouseLeave
|
onMouseLeave
|
||||||
}: SearchBarFooterProps) => {
|
}: SearchBarFooterProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const title = t('search.no-tutorials');
|
const title = t('search.no-results');
|
||||||
|
|
||||||
if (!query) {
|
if (!query) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ describe('Search bar placeholder tests:', () => {
|
|||||||
if (clientLocale === 'english') {
|
if (clientLocale === 'english') {
|
||||||
describe('Placeholder strings', () => {
|
describe('Placeholder strings', () => {
|
||||||
test('When the total number of hits is less than 100 the expected placeholder is generated', async () => {
|
test('When the total number of hits is less than 100 the expected placeholder is generated', async () => {
|
||||||
const expected = 'Search our tutorials';
|
const expected = 'Search our news articles, tutorials, and books';
|
||||||
const placeholderText = await generateSearchPlaceholder({
|
const placeholderText = await generateSearchPlaceholder({
|
||||||
mockRecordsNum: 99,
|
mockRecordsNum: 99,
|
||||||
locale: 'english'
|
locale: 'english'
|
||||||
@@ -156,7 +156,7 @@ describe('Search bar placeholder tests:', () => {
|
|||||||
mockRecordsNum: 100,
|
mockRecordsNum: 100,
|
||||||
locale: 'english'
|
locale: 'english'
|
||||||
});
|
});
|
||||||
const expected = 'Search 100+ tutorials';
|
const expected = 'Search 100+ news articles, tutorials, and books';
|
||||||
|
|
||||||
expect(placeholderText).toEqual(expected);
|
expect(placeholderText).toEqual(expected);
|
||||||
});
|
});
|
||||||
@@ -166,7 +166,7 @@ describe('Search bar placeholder tests:', () => {
|
|||||||
mockRecordsNum: 11000,
|
mockRecordsNum: 11000,
|
||||||
locale: 'english'
|
locale: 'english'
|
||||||
});
|
});
|
||||||
const expected = 'Search 11,000+ tutorials';
|
const expected = 'Search 11,000+ news articles, tutorials, and books';
|
||||||
|
|
||||||
expect(placeholderText).toEqual(expected);
|
expect(placeholderText).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ test.describe('Search bar', () => {
|
|||||||
const resultList = page.getByRole('list', { name: 'Search results' });
|
const resultList = page.getByRole('list', { name: 'Search results' });
|
||||||
await expect(resultList.getByRole('listitem')).toHaveCount(1);
|
await expect(resultList.getByRole('listitem')).toHaveCount(1);
|
||||||
await expect(resultList.getByRole('listitem')).toHaveText(
|
await expect(resultList.getByRole('listitem')).toHaveText(
|
||||||
'No tutorials found'
|
'No results found'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user