Skip to content

Commit 258cd42

Browse files
committed
[FIX] auto_complete: search pivot value with quotes
In the demo sheet, When typing =PIVOT.VALUE(1,"Expected Revenue","Stage", "Ne), we are not getting any suggestions. The reason is the double quotes, which is not part of the value fuzzy search key and hence the value is filtered out. closes #5558 Task: 4061068 Signed-off-by: Rémi Rahir (rar) <[email protected]>
1 parent b694f2c commit 258cd42

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/registries/auto_completes/pivot_auto_complete.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ autoCompleteProviders.add("pivot_group_values", {
291291
text,
292292
description: usedLabel,
293293
htmlContent: [{ value: text, color }],
294-
fuzzySearchKey: value + usedLabel,
294+
fuzzySearchKey: text + usedLabel,
295295
};
296296
});
297297
},

tests/composer/auto_complete/pivot_auto_complete_store.test.ts

+22-2
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,13 @@ describe("spreadsheet pivot auto complete", () => {
300300
expect(autoComplete?.proposals).toEqual([
301301
{
302302
description: "",
303-
fuzzySearchKey: "New",
303+
fuzzySearchKey: '"New"',
304304
htmlContent: [{ color: "#00a82d", value: '"New"' }],
305305
text: '"New"',
306306
},
307307
{
308308
description: "",
309-
fuzzySearchKey: "Won",
309+
fuzzySearchKey: '"Won"',
310310
htmlContent: [{ color: "#00a82d", value: '"Won"' }],
311311
text: '"Won"',
312312
},
@@ -316,6 +316,26 @@ describe("spreadsheet pivot auto complete", () => {
316316
expect(composer.autocompleteProvider).toBeUndefined();
317317
});
318318

319+
test.each(['"Ne', "Ne"])("PIVOT.VALUE search text field for group value", async (searchTerm) => {
320+
const model = createModelWithPivot("A1:I5");
321+
updatePivot(model, "1", {
322+
columns: [],
323+
rows: [{ fieldName: "Stage" }],
324+
measures: [{ id: "Expected Revenue:sum", fieldName: "Expected Revenue", aggregator: "sum" }],
325+
});
326+
const { store: composer } = makeStoreWithModel(model, CellComposerStore);
327+
composer.startEdition(`=PIVOT.VALUE(1,"Expected Revenue","Stage",${searchTerm}`);
328+
const autoComplete = composer.autocompleteProvider;
329+
expect(autoComplete?.proposals).toEqual([
330+
{
331+
description: "",
332+
fuzzySearchKey: '"New"',
333+
htmlContent: [{ color: "#00a82d", value: '"New"' }],
334+
text: '"New"',
335+
},
336+
]);
337+
});
338+
319339
test("PIVOT.VALUE autocomplete date month_number field for group value", async () => {
320340
const model = createModelWithPivot("A1:I5");
321341
updatePivot(model, "1", {

0 commit comments

Comments
 (0)