Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix4 - about control #855

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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