diff --git a/packages/components/src/Button/Button.tsx b/packages/components/src/Button/Button.tsx index 950d5a0a60..5c15f65ccf 100644 --- a/packages/components/src/Button/Button.tsx +++ b/packages/components/src/Button/Button.tsx @@ -11,6 +11,7 @@ export interface IBtnProps extends React.ButtonHTMLAttributes { small?: boolean large?: boolean showIconOnly?: boolean + iconColor?: string } type ToArray = [Type] extends [any] ? Type[] : never @@ -112,7 +113,7 @@ export const Button = (props: BtnProps) => { pointerEvents: 'none', }} > - + )} void + sx?: ThemeUIStyleObject } export const glyphs: IGlyphs = { @@ -115,7 +118,6 @@ const IconWrapper = styled.div` min-width: ${(props) => (props.size ? `${props.size}px` : '32px')}; min-height: ${(props) => (props.size ? `${props.size}px` : '32px')}; position: relative; - color: ${(props) => (props.color ? `${props.color}` : 'inherit')}; ${verticalAlign} ${space} @@ -153,7 +155,12 @@ export const Icon = (props: Props) => { } return ( - + ({ @@ -28,7 +31,9 @@ jest.mock('src/index', () => ({ jest.mock('src/stores/Research/research.store') -import ResearchArticle from './ResearchArticle' +const activeUser = FactoryUser({ + userRoles: ['beta-tester'], +}) describe('Research Article', () => { const mockResearchStore = { @@ -75,6 +80,36 @@ describe('Research Article', () => { expect(wrapper.getAllByText('another-example-username')).toHaveLength(1) }) + it('displays "Follow" button text if not subscribed', async () => { + // Arrange + ;(useResearchStore as jest.Mock).mockReturnValue({ + ...mockResearchStore, + }) + + // Act + const wrapper = getWrapper() + + // Assert + expect(wrapper.getAllByText('Follow').length).toBeGreaterThan(0) + }) + + it('displays "Following" button text if user is subscribed', async () => { + // Arrange + ;(useResearchStore as jest.Mock).mockReturnValue({ + ...mockResearchStore, + activeResearchItem: FactoryResearchItem({ + subscribers: [activeUser.userName], + }), + activeUser, + }) + + // Act + const wrapper = getWrapper() + + // Assert + expect(wrapper.getAllByText('Following').length).toBeGreaterThan(0) + }) + describe('Research Update', () => { it('displays contributors', async () => { // Arrange @@ -147,7 +182,11 @@ describe('Research Article', () => { const getWrapper = () => { return render( - + { let didInit = false const store = useResearchStore() const [viewCount, setViewCount] = useState() + const theme = useTheme() const incrementViewCount = async () => { const sessionStorageArray = retrieveSessionStorageArray('research') @@ -110,14 +110,19 @@ const ResearchDescription = ({ research, isEditable, ...props }: IProps) => {