mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
feat(TypeConversion): allow converting list of string with quotes to ChoiceList (#397)
This commit is contained in:
@@ -447,7 +447,7 @@ describe('ChoiceList', function() {
|
||||
|
||||
it('should allow reasonable conversions between ChoiceList and other types', async function() {
|
||||
await gu.enterGridRows({rowNum: 1, col: 'A'},
|
||||
[['Hello'], ['World'], [' Foo,Bar;Baz!,']]);
|
||||
[['Hello'], ['World'], [' Foo,Bar;Baz!,"Qux, quux corge", "80\'s",']]);
|
||||
await testTextChoiceListConversions();
|
||||
});
|
||||
|
||||
@@ -468,17 +468,17 @@ describe('ChoiceList', function() {
|
||||
|
||||
// Check that choices got populated.
|
||||
await driver.find('.test-right-tab-field').click();
|
||||
assert.deepEqual(await getChoiceLabels(), ['Hello', 'World', 'Foo', 'Bar;Baz!']);
|
||||
assert.deepEqual(await getChoiceLabels(), ['Hello', 'World', 'Foo', 'Bar;Baz!', 'Qux, quux corge', '80\'s']);
|
||||
assert.deepEqual(
|
||||
await getChoiceColors(),
|
||||
[UNSET_FILL, UNSET_FILL, UNSET_FILL, UNSET_FILL]
|
||||
[UNSET_FILL, UNSET_FILL, UNSET_FILL, UNSET_FILL, UNSET_FILL, UNSET_FILL]
|
||||
);
|
||||
|
||||
// Check that the result contains the right tags.
|
||||
assert.deepEqual(await gu.getVisibleGridCells({rowNums: [1, 2, 3], cols: ['A']}), [
|
||||
'Hello',
|
||||
'World',
|
||||
'Foo\nBar;Baz!'
|
||||
'Foo\nBar;Baz!\nQux, quux corge\n80\'s'
|
||||
]);
|
||||
await gu.checkForErrors();
|
||||
|
||||
@@ -494,17 +494,21 @@ describe('ChoiceList', function() {
|
||||
[
|
||||
{fillColor: DEFAULT_FILL, textColor: DEFAULT_TEXT, ...VALID_CHOICE},
|
||||
{fillColor: DEFAULT_FILL, textColor: DEFAULT_TEXT, ...VALID_CHOICE},
|
||||
{fillColor: DEFAULT_FILL, textColor: DEFAULT_TEXT, ...VALID_CHOICE},
|
||||
{fillColor: DEFAULT_FILL, textColor: DEFAULT_TEXT, ...VALID_CHOICE},
|
||||
]
|
||||
);
|
||||
|
||||
// Open a cell to see the actual tags.
|
||||
await gu.getCell({rowNum: 3, col: 'A'}).click();
|
||||
await driver.sendKeys(Key.ENTER);
|
||||
assert.deepEqual(await getEditorTokens(), ['Foo', 'Bar;Baz!']);
|
||||
assert.deepEqual(await getEditorTokensIsInvalid(), [false, false]);
|
||||
assert.deepEqual(await getEditorTokens(), ['Foo', 'Bar;Baz!', 'Qux, quux corge', '80\'s']);
|
||||
assert.deepEqual(await getEditorTokensIsInvalid(), [ false, false, false, false ]);
|
||||
assert.deepEqual(
|
||||
await getEditorTokenStyles(),
|
||||
[
|
||||
{fillColor: DEFAULT_FILL, textColor: DEFAULT_TEXT, ...VALID_CHOICE},
|
||||
{fillColor: DEFAULT_FILL, textColor: DEFAULT_TEXT, ...VALID_CHOICE},
|
||||
{fillColor: DEFAULT_FILL, textColor: DEFAULT_TEXT, ...VALID_CHOICE},
|
||||
{fillColor: DEFAULT_FILL, textColor: DEFAULT_TEXT, ...VALID_CHOICE}
|
||||
]
|
||||
@@ -520,7 +524,7 @@ describe('ChoiceList', function() {
|
||||
assert.deepEqual(await gu.getVisibleGridCells({rowNums: [1, 2, 3], cols: ['A']}), [
|
||||
'Hello',
|
||||
'World',
|
||||
'Foo, Bar;Baz!, hooray'
|
||||
'Foo, Bar;Baz!, "Qux, quux corge", 80\'s, hooray'
|
||||
]);
|
||||
|
||||
// Undo the cell change and both conversions (back to ChoiceList, back to Text), and check
|
||||
@@ -529,7 +533,7 @@ describe('ChoiceList', function() {
|
||||
assert.deepEqual(await gu.getVisibleGridCells({rowNums: [1, 2, 3], cols: ['A']}), [
|
||||
'Hello',
|
||||
'World',
|
||||
' Foo,Bar;Baz!,', // That's the text originally entered into this Text cell.
|
||||
' Foo,Bar;Baz!,"Qux, quux corge", "80\'s",', // That's the text originally entered into this Text cell.
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user