render single sound change in single suite

This commit is contained in:
Sorrel Bri 2019-11-29 15:47:27 -08:00
parent d4139ee575
commit 62b0bcde8b
2 changed files with 9 additions and 5 deletions

View file

@ -2,9 +2,13 @@ import React from 'react';
import './SoundChangeSuite.scss';
const SoundChangeSuite = props => {
let epochName = props.epoch ? Object.keys(props.epoch)[0] : 'Changes';
return (
<div className="SoundChangeSuite" data-testid="SoundChangeSuite">
<h4>{props.epoch ? Object.keys(props.epoch)[0] : 'Changes'}</h4>
<div className="SoundChangeSuite" data-testid={`${epochName}_SoundChangeSuite`}>
<h4>{epochName}</h4>
<form className="SoundChangeSuite__form" data-testid={`${epochName}_SoundChangeSuite_changes`}>
<textarea name="changes" id="" cols="30" rows="10" value={props.epoch ? props.epoch[epochName][0] : ''} onChange={e=>e.target.value}></textarea>
</form>
</div>
);
}

View file

@ -15,11 +15,11 @@ it('renders SoundChangeSuite without crashing', () => {
describe('SoundChangeSuite', () => {
it('renders the correct subtitle', () => {
const { getByTestId } = render(<SoundChangeSuite epoch={{'Epoch Name': ['sound change rule']}}/>);
expect(getByTestId('SoundChangeSuite')).toHaveTextContent('Epoch Name');
expect(getByTestId('Epoch Name_SoundChangeSuite')).toHaveTextContent('Epoch Name');
});
it('renders a suite of soundchanges', () => {
const { getByTestId } = render(<SoundChangeSuite />);
const { getByTestId } = render(<SoundChangeSuite epoch={{'Epoch Name': ['sound>change/environment']}}/>);
expect(getByTestId('Epoch Name_SoundChangeSuite_changes')).toHaveFormValues({changes: 'sound>change/environment'})
})
});