refactor: rename Offset.motifs to motifRefs
This commit is contained in:
@@ -631,11 +631,11 @@ const LM_FIXTURE = `00 bar '001P1L1M1'
|
||||
`;
|
||||
const lmOffset = buildModel(parseAstLog(LM_FIXTURE)).bars[0].voices['pi'].offsets[0];
|
||||
ok('line.motif: offset has 1 stem note', lmOffset.stemNotes.length === 1);
|
||||
ok('line.motif: offset.motifs has 2 entries', lmOffset.motifs.length === 2);
|
||||
ok('line.motif: first motif label', lmOffset.motifs[0].label === 'coct');
|
||||
ok('line.motif: second motif label', lmOffset.motifs[1].label === 'oct');
|
||||
ok('line.motif: second motif chord', lmOffset.motifs[1].chord === 'C2');
|
||||
ok('line.motif: first motif chord null', lmOffset.motifs[0].chord === null);
|
||||
ok('line.motif: offset.motifRefs has 2 entries', lmOffset.motifRefs.length === 2);
|
||||
ok('line.motif: first motifRef label', lmOffset.motifRefs[0].label === 'coct');
|
||||
ok('line.motif: second motifRef label', lmOffset.motifRefs[1].label === 'oct');
|
||||
ok('line.motif: second motifRef chord', lmOffset.motifRefs[1].chord === 'C2');
|
||||
ok('line.motif: first motifRef chord null', lmOffset.motifRefs[0].chord === null);
|
||||
|
||||
section('stem_note.write_to and chainText');
|
||||
const WT_FIXTURE = `00 bar '001P1L1M1'
|
||||
@@ -704,8 +704,8 @@ const voicesWithMotifs = model.bars.flatMap(b => Object.values(b.voices)).filter
|
||||
ok('fixture voices have motif objects', voicesWithMotifs.every(v => v.motifs.every(m => typeof m === 'object' && 'label' in m)));
|
||||
const offsetsWithStemNotes = model.bars.flatMap(b => Object.values(b.voices)).flatMap(v => v.offsets).filter(o => o.stemNotes.length > 0);
|
||||
ok('fixture offsets have stem note objects', offsetsWithStemNotes.every(o => o.stemNotes.every(sn => 'pitch' in sn && 'clauses' in sn)));
|
||||
const offsetsWithMotifInvocations = model.bars.flatMap(b => Object.values(b.voices)).flatMap(v => v.offsets).filter(o => o.motifs?.length > 0);
|
||||
ok('fixture offset motif invocations are objects', offsetsWithMotifInvocations.every(o => o.motifs.every(m => 'label' in m)));
|
||||
const offsetsWithMotifInvocations = model.bars.flatMap(b => Object.values(b.voices)).flatMap(v => v.offsets).filter(o => o.motifRefs?.length > 0);
|
||||
ok('fixture offset motif invocations are objects', offsetsWithMotifInvocations.every(o => o.motifRefs.every(m => 'label' in m)));
|
||||
const stemNotesWithChainText = offsetsWithStemNotes.flatMap(o => o.stemNotes).filter(sn => sn.chainText);
|
||||
ok('fixture stem notes with chain text have clauses', stemNotesWithChainText.every(sn => sn.clauses.length > 0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user