diff --git a/src/course-unit/course-xblock/CourseXBlock.jsx b/src/course-unit/course-xblock/CourseXBlock.jsx index 9a5972fd7c..be8bdb2415 100644 --- a/src/course-unit/course-xblock/CourseXBlock.jsx +++ b/src/course-unit/course-xblock/CourseXBlock.jsx @@ -165,7 +165,7 @@ const CourseXBlock = memo(({ { isContentTaxonomyTagsCountLoaded && contentTaxonomyTagsCount > 0 - &&
+ &&
} render( + + , + , +); + describe('', () => { it('should render the component', () => { - render(); + renderComponent({ count: 17 }); expect(screen.getByText('17')).toBeInTheDocument(); }); it('should render the component with zero', () => { - render(); + renderComponent({ count: 0 }); expect(screen.getByText('0')).toBeInTheDocument(); }); it('should render a button with onClick', () => { - render( {}} />); + renderComponent({ count: 17, onClick: () => {} }); expect(screen.getByRole('button', { name: /17/i, })); diff --git a/src/generic/tag-count/index.jsx b/src/generic/tag-count/index.jsx index bb6dada9d7..5827072812 100644 --- a/src/generic/tag-count/index.jsx +++ b/src/generic/tag-count/index.jsx @@ -1,9 +1,16 @@ import PropTypes from 'prop-types'; -import { Icon, Button } from '@openedx/paragon'; +import { + Icon, Button, OverlayTrigger, Tooltip, +} from '@openedx/paragon'; import { Tag } from '@openedx/paragon/icons'; +import { useIntl } from '@edx/frontend-platform/i18n'; import classNames from 'classnames'; +import messages from './messages'; + const TagCount = ({ count, onClick }) => { + const intl = useIntl(); + const renderContent = () => ( <> @@ -17,9 +24,19 @@ const TagCount = ({ count, onClick }) => { } > { onClick ? ( - + + {intl.formatMessage(messages.tooltipText)} + + )} + > + + + ) : renderContent()} diff --git a/src/generic/tag-count/messages.js b/src/generic/tag-count/messages.js new file mode 100644 index 0000000000..fcdf61504b --- /dev/null +++ b/src/generic/tag-count/messages.js @@ -0,0 +1,10 @@ +import { defineMessages } from '@edx/frontend-platform/i18n'; + +const messages = defineMessages({ + tooltipText: { + id: 'course-authoring.generic.tag-count.tooltip.text', + defaultMessage: 'Manage tags', + }, +}); + +export default messages;