-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for field aliases via config spreadsheet in related…
… table grid fields
- Loading branch information
Showing
10 changed files
with
109 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { transformFields } from './config'; | ||
|
||
describe('transformFields', () => { | ||
it('handles a list of plain fields without aliases', () => { | ||
const config = 'one, two,three'; | ||
|
||
expect(transformFields(config)).toEqual(['one', 'two', 'three']); | ||
}); | ||
|
||
it('handles a list of fields with aliases', () => { | ||
const config = 'one (1), two (2),three (3)'; | ||
|
||
expect(transformFields(config)).toEqual([ | ||
{ | ||
name: 'one', | ||
alias: '1', | ||
}, | ||
{ | ||
name: 'two', | ||
alias: '2', | ||
}, | ||
{ | ||
name: 'three', | ||
alias: '3', | ||
}, | ||
]); | ||
}); | ||
|
||
it('handles nested parentheses in aliases', () => { | ||
const config = 'one (1), two (2),three (3 (three))'; | ||
|
||
expect(transformFields(config)).toEqual([ | ||
{ | ||
name: 'one', | ||
alias: '1', | ||
}, | ||
{ | ||
name: 'two', | ||
alias: '2', | ||
}, | ||
{ | ||
name: 'three', | ||
alias: '3 (three)', | ||
}, | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters