diff --git a/src/components/Features.js b/src/components/Features.js index 637ffc5..5c6d661 100644 --- a/src/components/Features.js +++ b/src/components/Features.js @@ -29,39 +29,6 @@ const parsePhonesFromFeatureObject = featureObject => { } const featureMap = getFeatureMap(featureObject); - console.log(featureMap) - const featureMapJSX = getFeatureMapJSX(featureMap); - return featureMapJSX; -} - -const parseFeaturesFromPhonemeObject = phonesObject => { - - const getFeatureMap = (phonesObject) => { - return Object.keys(phonesObject).reduce((featureObject, phoneName) => { - let phone = phonesObject[phoneName]; - Object.keys(phone.features).forEach(feature => { - if (!featureObject[feature]) featureObject[feature] = {plus: [], minus: []} - if (phone.features[feature]) featureObject[feature].plus.push(phone.grapheme) - else featureObject[feature].minus.push(phone.grapheme) - }); - return featureObject; - }, {}) - } - - const getFeatureMapJSX = (featureMap) => { - return Object.keys(featureMap).map(feature => { - const plusPhones = featureMap[feature].plus.join('|'); - const minusPhones = featureMap[feature].minus.join('|'); - return ( -
  • - {`[+ ${feature}] = ${plusPhones}`} - {`[- ${feature}] = ${minusPhones}`} -
  • - ) - }); - } - - const featureMap = getFeatureMap(phonesObject); const featureMapJSX = getFeatureMapJSX(featureMap); return featureMapJSX; } diff --git a/src/components/Features.test.js b/src/components/Features.test.js index 0ae997a..d1b2e31 100644 --- a/src/components/Features.test.js +++ b/src/components/Features.test.js @@ -20,11 +20,16 @@ describe('Features', () => { }); it('renders features from phonemes hook', () => { - const { getByTestId } = render(); + const nPhone = {n:{ + grapheme: 'n', + features: { nasal: true, occlusive: true, vowel: false } }} + const { getByTestId } = render(); expect(getByTestId('Features-list')) .toContainHTML('');