hook lexicon into ProtoLang render
This commit is contained in:
parent
cabf342b4a
commit
7de78839b0
3 changed files with 10 additions and 6 deletions
|
@ -122,7 +122,7 @@ const PhonoChangeApplier = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="PhonoChangeApplier" data-testid="PhonoChangeApplier">
|
<div className="PhonoChangeApplier" data-testid="PhonoChangeApplier">
|
||||||
<ProtoLang lexicon={lexicon} setLexicon={setLexicon}/>
|
<ProtoLang lexicon={state.lexicon} dispatch={dispatch}/>
|
||||||
<Features phonemes={phonemes} setPhonemes={setPhonemes} features={features} setFeatures={setFeatures}/>
|
<Features phonemes={phonemes} setPhonemes={setPhonemes} features={features} setFeatures={setFeatures}/>
|
||||||
<Epochs epochs={epochs} setEpochs={setEpochs} errors={errors}/>
|
<Epochs epochs={epochs} setEpochs={setEpochs} errors={errors}/>
|
||||||
<Options options={options} setOptions={setOptions} runChanges={runChanges}/>
|
<Options options={options} setOptions={setOptions} runChanges={runChanges}/>
|
||||||
|
|
|
@ -9,8 +9,8 @@ const ProtoLang = (props) => {
|
||||||
<form data-testid="ProtoLang-Lexicon">
|
<form data-testid="ProtoLang-Lexicon">
|
||||||
<textarea
|
<textarea
|
||||||
name="lexicon"
|
name="lexicon"
|
||||||
value={props.lexicon ? props.lexicon.join("\n") : ''}
|
value={props.lexicon ? props.lexicon.map(lexeme => `${lexeme.lexeme} \t#${lexeme.epoch.name}`).join('\n'): ''}
|
||||||
onChange={e=>props.setLexicon(e.target.value.split(/\n/))}
|
onChange={e=>props.dispatch({action: 'SET_LEXION', value: e.target.value.split(/\n/)})}
|
||||||
>
|
>
|
||||||
</textarea>
|
</textarea>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
|
||||||
import ProtoLang from './ProtoLang';
|
import ProtoLang from './ProtoLang';
|
||||||
import renderer from 'react-test-renderer';
|
import renderer from 'react-test-renderer';
|
||||||
import { exportAllDeclaration } from '@babel/types';
|
import { exportAllDeclaration } from '@babel/types';
|
||||||
import {render} from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import extendExpect from '@testing-library/jest-dom/extend-expect'
|
import extendExpect from '@testing-library/jest-dom/extend-expect'
|
||||||
|
|
||||||
it('renders ProtoLang without crashing', () => {
|
it('renders ProtoLang without crashing', () => {
|
||||||
|
@ -21,7 +21,11 @@ describe('ProtoLang', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders lexicon from state', () => {
|
it('renders lexicon from state', () => {
|
||||||
const { getByTestId } = render(<ProtoLang lexicon={['one']}/>);
|
const { getByTestId } = render(<ProtoLang lexicon={[{ lexeme:'one', epoch:{name: 'epoch-one', changes: []} }]}/>);
|
||||||
expect(getByTestId('ProtoLang-Lexicon')).toHaveFormValues({lexicon: 'one'});
|
expect(getByTestId('ProtoLang-Lexicon')).toHaveFormValues({lexicon: 'one #epoch-one'});
|
||||||
|
})
|
||||||
|
|
||||||
|
it('', () => {
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
Loading…
Reference in a new issue