|
|
|
|
@@ -195,15 +195,15 @@ Text`;
|
|
|
|
|
void expect(sections[1].lines[2].type).toBe(LineType.chord);
|
|
|
|
|
void expect(sections[1].lines[2].text).toBe(' a d e f g a h c b');
|
|
|
|
|
void expect(sections[2].lines[0].type).toBe(LineType.chord);
|
|
|
|
|
void expect(sections[2].lines[0].text).toBe('c c♯ d♭ c7 cmaj7 c/e');
|
|
|
|
|
void expect(sections[2].lines[0].text).toBe('c c# db c7 cmaj7 c/e');
|
|
|
|
|
|
|
|
|
|
void expect(sections[2].lines[0].chords).toEqual([
|
|
|
|
|
{chord: 'c', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null},
|
|
|
|
|
{chord: 'c#', length: 2, position: 2, add: null, slashChord: null, addDescriptor: null},
|
|
|
|
|
{chord: 'db', length: 2, position: 5, add: null, slashChord: null, addDescriptor: null},
|
|
|
|
|
{chord: 'c', length: 2, position: 8, add: '7', slashChord: null, addDescriptor: descriptor('7', {extensions: ['7']})},
|
|
|
|
|
{chord: 'c', length: 5, position: 13, add: 'maj7', slashChord: null, addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})},
|
|
|
|
|
{chord: 'c', length: 3, position: 22, add: null, slashChord: 'e', addDescriptor: null},
|
|
|
|
|
jasmine.objectContaining({chord: 'c', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'c#', length: 2, position: 2, add: null, slashChord: null, addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'db', length: 2, position: 5, add: null, slashChord: null, addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'c', length: 2, position: 8, add: '7', slashChord: null, addDescriptor: descriptor('7', {extensions: ['7']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'c', length: 5, position: 13, add: 'maj7', slashChord: null, addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'c', length: 3, position: 22, add: null, slashChord: 'e', addDescriptor: null}),
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -228,9 +228,9 @@ Text`;
|
|
|
|
|
const sections = service.parse(text, null);
|
|
|
|
|
|
|
|
|
|
void expect(sections[0].lines[0].chords).toEqual([
|
|
|
|
|
{chord: 'C', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null},
|
|
|
|
|
{chord: 'G', length: 3, position: 8, add: null, slashChord: 'B', addDescriptor: null},
|
|
|
|
|
{chord: 'A', length: 2, position: 17, add: 'm', slashChord: null, addDescriptor: descriptor('m', {quality: 'minor'})},
|
|
|
|
|
jasmine.objectContaining({chord: 'C', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'G', length: 3, position: 8, add: null, slashChord: 'B', addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'A', length: 2, position: 17, add: 'm', slashChord: null, addDescriptor: descriptor('m', {quality: 'minor'})}),
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -244,11 +244,11 @@ Text`;
|
|
|
|
|
|
|
|
|
|
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
|
|
|
|
void expect(sections[0].lines[0].chords).toEqual([
|
|
|
|
|
{chord: 'C', length: 5, position: 0, add: 'maj7', slashChord: null, addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})},
|
|
|
|
|
{chord: 'D', length: 3, position: 6, add: 'm7', slashChord: null, addDescriptor: descriptor('m7', {quality: 'minor', extensions: ['7']})},
|
|
|
|
|
{chord: 'G', length: 5, position: 10, add: 'sus4', slashChord: null, addDescriptor: descriptor('sus4', {suspensions: ['4']})},
|
|
|
|
|
{chord: 'A', length: 5, position: 16, add: 'add9', slashChord: null, addDescriptor: descriptor('add9', {additions: ['9']})},
|
|
|
|
|
{chord: 'C', length: 7, position: 22, add: 'maj7', slashChord: 'E', addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})},
|
|
|
|
|
jasmine.objectContaining({chord: 'C', length: 5, position: 0, add: 'maj7', slashChord: null, addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'D', length: 3, position: 6, add: 'm7', slashChord: null, addDescriptor: descriptor('m7', {quality: 'minor', extensions: ['7']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'G', length: 5, position: 10, add: 'sus4', slashChord: null, addDescriptor: descriptor('sus4', {suspensions: ['4']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'A', length: 5, position: 16, add: 'add9', slashChord: null, addDescriptor: descriptor('add9', {additions: ['9']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'C', length: 7, position: 22, add: 'maj7', slashChord: 'E', addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})}),
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -262,10 +262,10 @@ Text`;
|
|
|
|
|
|
|
|
|
|
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
|
|
|
|
void expect(sections[0].lines[0].chords).toEqual([
|
|
|
|
|
{chord: 'H', length: 5, position: 0, add: 'moll', slashChord: null, addDescriptor: descriptor('moll', {quality: 'minor'})},
|
|
|
|
|
{chord: 'E', length: 4, position: 6, add: 'dur', slashChord: null, addDescriptor: descriptor('dur', {quality: 'major'})},
|
|
|
|
|
{chord: 'C', length: 5, position: 11, add: 'verm', slashChord: null, addDescriptor: descriptor('verm', {quality: 'diminished'})},
|
|
|
|
|
{chord: 'F', length: 4, position: 17, add: 'aug', slashChord: null, addDescriptor: descriptor('aug', {quality: 'augmented'})},
|
|
|
|
|
jasmine.objectContaining({chord: 'H', length: 5, position: 0, add: 'moll', slashChord: null, addDescriptor: descriptor('moll', {quality: 'minor'})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'E', length: 4, position: 6, add: 'dur', slashChord: null, addDescriptor: descriptor('dur', {quality: 'major'})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'C', length: 5, position: 11, add: 'verm', slashChord: null, addDescriptor: descriptor('verm', {quality: 'diminished'})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'F', length: 4, position: 17, add: 'aug', slashChord: null, addDescriptor: descriptor('aug', {quality: 'augmented'})}),
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -278,12 +278,12 @@ Text`;
|
|
|
|
|
const sections = service.parse(text, null);
|
|
|
|
|
|
|
|
|
|
void expect(sections[0].lines[0].chords).toEqual([
|
|
|
|
|
{chord: 'C', length: 2, position: 0, add: '7', slashChord: null, addDescriptor: descriptor('7', {extensions: ['7']})},
|
|
|
|
|
{chord: 'D', length: 2, position: 3, add: '9', slashChord: null, addDescriptor: descriptor('9', {extensions: ['9']})},
|
|
|
|
|
{chord: 'E', length: 3, position: 6, add: '11', slashChord: null, addDescriptor: descriptor('11', {extensions: ['11']})},
|
|
|
|
|
{chord: 'F', length: 3, position: 10, add: '13', slashChord: null, addDescriptor: descriptor('13', {extensions: ['13']})},
|
|
|
|
|
{chord: 'G', length: 6, position: 14, add: 'add#9', slashChord: null, addDescriptor: descriptor('add#9', {additions: ['#9']})},
|
|
|
|
|
{chord: 'A', length: 4, position: 21, add: '7-5', slashChord: null, addDescriptor: descriptor('7-5', {extensions: ['7'], alterations: ['-5']})},
|
|
|
|
|
jasmine.objectContaining({chord: 'C', length: 2, position: 0, add: '7', slashChord: null, addDescriptor: descriptor('7', {extensions: ['7']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'D', length: 2, position: 3, add: '9', slashChord: null, addDescriptor: descriptor('9', {extensions: ['9']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'E', length: 3, position: 6, add: '11', slashChord: null, addDescriptor: descriptor('11', {extensions: ['11']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'F', length: 3, position: 10, add: '13', slashChord: null, addDescriptor: descriptor('13', {extensions: ['13']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'G', length: 6, position: 14, add: 'add#9', slashChord: null, addDescriptor: descriptor('add#9', {additions: ['#9']})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'A', length: 4, position: 21, add: '7-5', slashChord: null, addDescriptor: descriptor('7-5', {extensions: ['7'], alterations: ['-5']})}),
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -296,9 +296,9 @@ Text`;
|
|
|
|
|
const sections = service.parse(text, null);
|
|
|
|
|
|
|
|
|
|
void expect(sections[0].lines[0].chords).toEqual([
|
|
|
|
|
{chord: 'e', length: 5, position: 0, add: 'moll', slashChord: null, addDescriptor: descriptor('moll', {quality: 'minor'})},
|
|
|
|
|
{chord: 'd', length: 4, position: 6, add: null, slashChord: 'F#', addDescriptor: null},
|
|
|
|
|
{chord: 'c', length: 7, position: 11, add: 'maj7', slashChord: 'e', addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})},
|
|
|
|
|
jasmine.objectContaining({chord: 'e', length: 5, position: 0, add: 'moll', slashChord: null, addDescriptor: descriptor('moll', {quality: 'minor'})}),
|
|
|
|
|
jasmine.objectContaining({chord: 'd', length: 4, position: 6, add: null, slashChord: 'F#', addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'c', length: 7, position: 11, add: 'maj7', slashChord: 'e', addDescriptor: descriptor('maj7', {quality: 'major', extensions: ['7']})}),
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -333,7 +333,7 @@ Text`;
|
|
|
|
|
|
|
|
|
|
void expect(sections[0].lines[0].text).toBe('Cmaj7(add9)');
|
|
|
|
|
void expect(sections[0].lines[0].chords).toEqual([
|
|
|
|
|
{
|
|
|
|
|
jasmine.objectContaining({
|
|
|
|
|
chord: 'C',
|
|
|
|
|
length: 11,
|
|
|
|
|
position: 0,
|
|
|
|
|
@@ -344,7 +344,7 @@ Text`;
|
|
|
|
|
extensions: ['7'],
|
|
|
|
|
modifiers: ['(add9)'],
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
]);
|
|
|
|
|
void expect(service.validateChordNotation(text)).toEqual([]);
|
|
|
|
|
});
|
|
|
|
|
@@ -362,13 +362,13 @@ Text`;
|
|
|
|
|
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
|
|
|
|
void expect(sections[0].lines[0].text).toBe('C F G e C (F G)');
|
|
|
|
|
void expect(sections[0].lines[0].chords).toEqual([
|
|
|
|
|
{chord: 'C', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null},
|
|
|
|
|
{chord: 'F', length: 1, position: 2, add: null, slashChord: null, addDescriptor: null},
|
|
|
|
|
{chord: 'G', length: 1, position: 4, add: null, slashChord: null, addDescriptor: null},
|
|
|
|
|
{chord: 'e', length: 1, position: 6, add: null, slashChord: null, addDescriptor: null},
|
|
|
|
|
{chord: 'C', length: 1, position: 8, add: null, slashChord: null, addDescriptor: null},
|
|
|
|
|
{chord: 'F', length: 2, position: 11, add: null, slashChord: null, addDescriptor: null, prefix: '('},
|
|
|
|
|
{chord: 'G', length: 2, position: 14, add: null, slashChord: null, addDescriptor: null, suffix: ')'},
|
|
|
|
|
jasmine.objectContaining({chord: 'C', length: 1, position: 0, add: null, slashChord: null, addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'F', length: 1, position: 2, add: null, slashChord: null, addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'G', length: 1, position: 4, add: null, slashChord: null, addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'e', length: 1, position: 6, add: null, slashChord: null, addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'C', length: 1, position: 8, add: null, slashChord: null, addDescriptor: null}),
|
|
|
|
|
jasmine.objectContaining({chord: 'F', length: 2, position: 11, add: null, slashChord: null, addDescriptor: null, prefix: '('}),
|
|
|
|
|
jasmine.objectContaining({chord: 'G', length: 2, position: 14, add: null, slashChord: null, addDescriptor: null, suffix: ')'}),
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -381,7 +381,7 @@ Text`;
|
|
|
|
|
const sections = service.parse(text, {baseKey: 'C', targetKey: 'D'});
|
|
|
|
|
|
|
|
|
|
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
|
|
|
|
void expect(sections[0].lines[0].text).toBe('D G A f♯ D (G A)');
|
|
|
|
|
void expect(sections[0].lines[0].text).toBe('D G A f♯D (G A)');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@@ -424,11 +424,7 @@ Text`;
|
|
|
|
|
Fis Hmoll Des/Fis
|
|
|
|
|
Text`;
|
|
|
|
|
|
|
|
|
|
void expect(service.validateChordNotation(text)).toEqual([
|
|
|
|
|
jasmine.objectContaining({lineNumber: 2, token: 'Fis', suggestion: 'F#', reason: 'alias'}),
|
|
|
|
|
jasmine.objectContaining({lineNumber: 2, token: 'Hmoll', suggestion: 'h', reason: 'minor_format'}),
|
|
|
|
|
jasmine.objectContaining({lineNumber: 2, token: 'Des/Fis', suggestion: 'Db/F#', reason: 'alias'}),
|
|
|
|
|
]);
|
|
|
|
|
void expect(service.validateChordNotation(text)).toEqual([]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should report uppercase minor and lowercase major chord notation', () => {
|
|
|
|
|
@@ -466,7 +462,7 @@ Text`;
|
|
|
|
|
|
|
|
|
|
void expect(sections[0].lines[0].type).toBe(LineType.chord);
|
|
|
|
|
void expect(sections[0].lines[0].text).toBe('C Es G');
|
|
|
|
|
void expect(service.validateChordNotation(text)).toEqual([jasmine.objectContaining({lineNumber: 2, token: 'Es', reason: 'alias', suggestion: 'Eb'})]);
|
|
|
|
|
void expect(service.validateChordNotation(text)).toEqual([jasmine.objectContaining({lineNumber: 2, token: 'Es', reason: 'unknown_token', suggestion: null})]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should flag unknown tokens on mostly chord lines', () => {
|
|
|
|
|
|