Skip to content

Commit

Permalink
add about control (#855)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegMoshkovich committed Nov 14, 2023
1 parent fdbe781 commit 87eb10e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Components/About/AboutControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {ControlButton} from '../Buttons'
import PrivacyControl from './PrivacyControl'
import LogoB from '../../assets/LogoB.svg'
import {Helmet} from 'react-helmet-async'
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'
import PkgJson from '../../../package.json'

/**
* Button to toggle About panel on and off
Expand All @@ -31,11 +31,11 @@ export default function AboutControl() {

return (
<ControlButton
title='About'
title={`Bldrs: ${PkgJson.version}`}
isDialogDisplayed={isDialogDisplayed}
setIsDialogDisplayed={setIsDialogDisplayedLocal}
icon={
<InfoOutlinedIcon className='icon-share' color='secondary'/>
<LogoB/>
}
dialog={
<AboutDialog
Expand Down
6 changes: 4 additions & 2 deletions src/Components/About/AboutControl.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ import React from 'react'
import {render, fireEvent, waitFor} from '@testing-library/react'
import {MockComponent} from '../../__mocks__/MockComponent'
import AboutControl from './AboutControl'
import PkgJson from '../../../package.json'


const bldrsVersionString = `Bldrs: ${PkgJson.version}`
describe('About control tests', () => {
test('renders the AboutControl button', () => {
const {getByTitle} = render(<MockComponent><AboutControl/></MockComponent>)
const aboutControl = getByTitle('About')
const aboutControl = getByTitle(bldrsVersionString)
expect(aboutControl).toBeInTheDocument()
})

test('renders AboutDialog when control is pressed', () => {
const {getByTitle, getByText} = render(<MockComponent><AboutControl/></MockComponent>)
const aboutControl = getByTitle('About')
const aboutControl = getByTitle(bldrsVersionString)
fireEvent.click(aboutControl)
const dialogTitle = getByText('Build every thing together')
expect(dialogTitle).toBeInTheDocument()
Expand Down

0 comments on commit 87eb10e

Please sign in to comment.