Skip to content

Commit

Permalink
Merge bc5acce into 87252c6
Browse files Browse the repository at this point in the history
  • Loading branch information
no-chris committed Feb 11, 2023
2 parents 87252c6 + bc5acce commit 6a7e4e2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/chord-mark/src/renderer/components/renderSong.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ export default function renderSong(

function shouldRepeatLines(line) {
const shouldSkipAutoRepeatChordLine =
line.isFromAutoRepeatChords && !autoRepeatChords;
!autoRepeatChords &&
(line.isFromAutoRepeatChords ||
(line.type === lineTypes.CHORD && line.isFromSectionCopy));

const shouldSkipSectionMultiplyLine =
line.isFromSectionMultiply && !expandSectionMultiply;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,48 @@ verseLine`;
expect(toText(rendered)).toBe(expected);
});

test('should not repeat chords when autoRepeatChords === false', () => {
const input = `#v
A B
verseLine
#v
#v`;
const expected = `Verse 1
|A |B |
verseLine
Verse 2
verseLine
Verse 3
verseLine`;
const rendered = renderSongText(input, {
expandSectionCopy: true,
autoRepeatChords: false,
});
expect(toText(rendered)).toBe(expected);
});

test('should not repeat chords when autoRepeatChords === false, even if the section contains only chords', () => {
const input = `#v
A B
C D
#v
#v`;
const expected = `Verse 1
|A |B |
|C |D |
Verse 2
Verse 3`;
const rendered = renderSongText(input, {
expandSectionCopy: true,
autoRepeatChords: false,
});
expect(toText(rendered)).toBe(expected);
});

test('should only repeat section label when expandSectionCopy === false', () => {
const input = `#v
A B
Expand Down

0 comments on commit 6a7e4e2

Please sign in to comment.