Add tests for autocomplete without accents

This commit is contained in:
Ronan Amicel 2022-08-17 18:15:32 +02:00
parent 2a05d04e35
commit 0249b3d31b
3 changed files with 41 additions and 0 deletions

View File

@ -301,6 +301,23 @@ describe('ChoiceList', function() {
await gu.waitForServer(); await gu.waitForServer();
assert.equal(await driver.find('.cell_editor').isPresent(), false); assert.equal(await driver.find('.cell_editor').isPresent(), false);
assert.equal(await gu.getCell({rowNum: 1, col: 'B'}).getText(), 'Blue\nGreen\nBlack'); assert.equal(await gu.getCell({rowNum: 1, col: 'B'}).getText(), 'Blue\nGreen\nBlack');
// Starting to type names without accents should match the actual choices
await gu.addColumn("Accents");
await api.applyUserActions(docId, [
['ModifyColumn', 'Table1', 'Accents', {
type: 'ChoiceList',
widgetOptions: JSON.stringify({
choices: ['Adélaïde', 'Adèle', 'Agnès', 'Amélie'],
})
}],
]);
await gu.getCell({rowNum: 1, col: 'Accents'}).click();
await driver.sendKeys('Ade', Key.ENTER);
await driver.sendKeys('Agne', Key.ENTER);
await driver.sendKeys('Ame', Key.ENTER);
assert.deepEqual(await getEditorTokens(), ['Adélaïde', 'Agnès', 'Amélie']);
}); });
it('should be visible in formulas', async () => { it('should be visible in formulas', async () => {

View File

@ -413,6 +413,18 @@ describe('ReferenceColumns', function() {
['Dark Slate Blue', 'Dark Slate Gray', 'Slate Blue', 'Medium Slate Blue']); ['Dark Slate Blue', 'Dark Slate Gray', 'Slate Blue', 'Medium Slate Blue']);
await driver.sendKeys(Key.ESCAPE); await driver.sendKeys(Key.ESCAPE);
// Starting to type Añil with the accent
await driver.sendKeys('añ');
assert.deepEqual(await getACOptions(2),
['Añil', 'Alice Blue']);
await driver.sendKeys(Key.ESCAPE);
// Starting to type Añil without the accent should work too
await driver.sendKeys('an');
assert.deepEqual(await getACOptions(2),
['Añil', 'Alice Blue']);
await driver.sendKeys(Key.ESCAPE);
await driver.sendKeys('blac'); await driver.sendKeys('blac');
assert.deepEqual(await getACOptions(6), assert.deepEqual(await getACOptions(6),
['Black', 'Blanched Almond', 'Blue', 'Blue Violet', 'Alice Blue', 'Cadet Blue']); ['Black', 'Blanched Almond', 'Blue', 'Blue Violet', 'Alice Blue', 'Cadet Blue']);

View File

@ -709,6 +709,18 @@ describe('ReferenceList', function() {
['Dark Slate Blue', 'Dark Slate Gray', 'Slate Blue', 'Medium Slate Blue']); ['Dark Slate Blue', 'Dark Slate Gray', 'Slate Blue', 'Medium Slate Blue']);
await driver.sendKeys(Key.ESCAPE); await driver.sendKeys(Key.ESCAPE);
// Starting to type Añil with the accent
await driver.sendKeys('añ');
assert.deepEqual(await getACOptions(2),
['Añil', 'Alice Blue']);
await driver.sendKeys(Key.ESCAPE);
// Starting to type Añil without the accent should work too
await driver.sendKeys('an');
assert.deepEqual(await getACOptions(2),
['Añil', 'Alice Blue']);
await driver.sendKeys(Key.ESCAPE);
await driver.sendKeys('blac'); await driver.sendKeys('blac');
assert.deepEqual(await getACOptions(6), assert.deepEqual(await getACOptions(6),
['Black', 'Blanched Almond', 'Blue', 'Blue Violet', 'Alice Blue', 'Cadet Blue']); ['Black', 'Blanched Almond', 'Blue', 'Blue Violet', 'Alice Blue', 'Cadet Blue']);