Skip to content

Commit

Permalink
FIX: Words have incorrect number of lines
Browse files Browse the repository at this point in the history
  • Loading branch information
dwhieb committed Mar 17, 2024
1 parent 2797395 commit 685e57e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/words/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function createWords(words, options) {

for (const word of words) {


const glosses = createGlosses(word.gloss, options)
const literal = createLiteral(word.literal, options)
const morphemes = createMorphemes(word.analysis, options)
Expand Down
1 change: 1 addition & 0 deletions src/words/transcription.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default function createTranscription(data, { targetLang }) {

for (const ortho in data) {
const txn = data[ortho]
if (!txn) continue
html += `<span class=w data-ortho='${ ortho }' ${ lang }>${ addEmphasis(txn) }</span>`
}

Expand Down
17 changes: 16 additions & 1 deletion test/words.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ describe(`words`, function() {

describe(`word transcription`, function() {

it(`has the correct number of lines`, async function() {

const scription = `
ninakupenda
ni-na-ku-pend-a
1SG.SUBJ-PRES-2SG.OBJ-love-IND
I love you`

const { dom } = await parse(scription)
const word = findElementByClass(dom, `word`)

expect(word.childNodes).to.have.length(2)

})

it(`renders in multiple orthographies`, async function() {

const scription = `
Expand Down Expand Up @@ -282,7 +297,7 @@ describe(`words`, function() {
I love you
`

const { dom } = await parse(scription, { glosses: true })
const { dom, html } = await parse(scription, { glosses: true })
const glosses = findElements(dom, el => getTagName(el) === `abbr`)
const [person, num] = glosses

Expand Down

0 comments on commit 685e57e

Please sign in to comment.