Skip to content

Commit

Permalink
Allow directionless arpeggios
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredjj3 committed Jan 19, 2024
1 parent 4bacd39 commit 55647c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/musicxml/notations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export class Notations {
return this.element.all('arpeggiate').length > 0;
}

/** Returns the direction of the arppegio when appregiated and null otherwise. */
getArpeggioDirection(): VerticalDirection {
return this.element.first('arpeggiate')?.attr('direction').enum(VERTICAL_DIRECTIONS) ?? 'up';
/** Returns the direction of the arppegio. Defaults to null. */
getArpeggioDirection(): VerticalDirection | null {
return this.element.first('arpeggiate')?.attr('direction').enum(VERTICAL_DIRECTIONS) ?? null;
}

/** Whether the notations has at least one tuplet. */
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/musicxml/notations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ describe(Notations, () => {
expect(notations.getArpeggioDirection()).toBe(direction);
});

it(`defaults 'up' when the arpeggio direction is invalid`, () => {
it(`defaults to null when the arpeggio direction is invalid`, () => {
const node = xml.notations({ arpeggiate: xml.arpeggiate({ direction: 'foo' }) });
const notations = new Notations(node);
expect(notations.getArpeggioDirection()).toBe('up');
expect(notations.getArpeggioDirection()).toBeNull();
});

it(`defaults 'up' when the arpeggio direction is missing`, () => {
it(`defaults to null when the arpeggio direction is missing`, () => {
const node = xml.notations();
const notations = new Notations(node);
expect(notations.getArpeggioDirection()).toBe('up');
expect(notations.getArpeggioDirection()).toBeNull();
});
});

Expand Down

0 comments on commit 55647c9

Please sign in to comment.