render list of results from results hook
This commit is contained in:
parent
caa8da5ded
commit
20601af746
3 changed files with 8 additions and 3 deletions
|
@ -14,6 +14,7 @@ const PhonoChangeApplier = () => {
|
||||||
);
|
);
|
||||||
const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ feature]>[- feature]/_#']}]);
|
const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ feature]>[- feature]/_#']}]);
|
||||||
const [ options, setOptions ] = useState({output: 'default', save: false})
|
const [ options, setOptions ] = useState({output: 'default', save: false})
|
||||||
|
const [ results, setResults ] = useState([])
|
||||||
|
|
||||||
const runChanges = e => {
|
const runChanges = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -26,7 +27,7 @@ const PhonoChangeApplier = () => {
|
||||||
<Features phonemes={phonemes} setPhonemes={setPhonemes}/>
|
<Features phonemes={phonemes} setPhonemes={setPhonemes}/>
|
||||||
<Epochs epochs={epochs} setEpochs={setEpochs}/>
|
<Epochs epochs={epochs} setEpochs={setEpochs}/>
|
||||||
<Options options={options} setOptions={setOptions} runChanges={runChanges}/>
|
<Options options={options} setOptions={setOptions} runChanges={runChanges}/>
|
||||||
<Output />
|
<Output results={results} setResults={setResults}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,10 @@ const Output = props => {
|
||||||
return (
|
return (
|
||||||
<div className="Output" data-testid="Output">
|
<div className="Output" data-testid="Output">
|
||||||
<h3>Results of Run</h3>
|
<h3>Results of Run</h3>
|
||||||
|
|
||||||
|
<div data-testid="Output-lexicon">
|
||||||
|
{props.results ? props.results.map((lexicalItem, i) => <p key={`output-lexical-item-${i}`}>{lexicalItem}</p>) : <></>}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@ describe('Output', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders output lexicon list from output hook', () => {
|
it('renders output lexicon list from output hook', () => {
|
||||||
const { getByTestId } = render(<Output />);
|
const { getByTestId } = render(<Output results={['word', 'lex', 'word']}/>);
|
||||||
// expect(getByTestId('Output-list'));
|
expect(getByTestId('Output-lexicon')).toContainHTML('<p>word</p><p>lex</p><p>word</p>');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
Loading…
Reference in a new issue