Skip to content

Commit e3d1202

Browse files
committed
[FIX] spreadsheet: adapt test to new pivot parameter
See odoo/o-spreadsheet#6414 Task: 4793572
1 parent 269b724 commit e3d1202

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

addons/spreadsheet/static/tests/pivots/model/pivot_plugin.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ test("Can change display type of a measure", async function () {
20632063
});
20642064
// prettier-ignore
20652065
expect(getFormattedValueGrid(model, "A1:D5")).toEqual({
2066-
A1: "(#1) Partner Pivot", B1: "xphone", C1: "xpad", D1: "Total",
2066+
A1: "Partner Pivot", B1: "xphone", C1: "xpad", D1: "Total",
20672067
A2: "", B2: "Probability", C2: "Probability", D2: "Probability",
20682068
A3: "No", B3: "", C3: "15.00", D3: "15.00",
20692069
A4: "Yes", B4: "10.00", C4: "106.00", D4: "116.00",
@@ -2076,7 +2076,7 @@ test("Can change display type of a measure", async function () {
20762076

20772077
// prettier-ignore
20782078
expect(getFormattedValueGrid(model, "A1:D5")).toEqual({
2079-
A1: "(#1) Partner Pivot", B1: "xphone", C1: "xpad", D1: "Total",
2079+
A1: "Partner Pivot", B1: "xphone", C1: "xpad", D1: "Total",
20802080
A2: "", B2: "Probability", C2: "Probability", D2: "Probability",
20812081
A3: "No", B3: "0.00%", C3: "11.45%", D3: "11.45%",
20822082
A4: "Yes", B4: "7.63%", C4: "80.92%", D4: "88.55%",
@@ -2092,7 +2092,7 @@ test("Can change display type of a measure", async function () {
20922092

20932093
// prettier-ignore
20942094
expect(getFormattedValueGrid(model, "A1:D5")).toEqual({
2095-
A1: "(#1) Partner Pivot", B1: "xphone", C1: "xpad", D1: "Total",
2095+
A1: "Partner Pivot", B1: "xphone", C1: "xpad", D1: "Total",
20962096
A2: "", B2: "Probability", C2: "Probability", D2: "Probability",
20972097
A3: "No", B3: "", C3: "100.00%", D3: "100.00%",
20982098
A4: "Yes", B4: "", C4: "706.67%", D4: "773.33%",

addons/spreadsheet/static/tests/pivots/model/pivot_table_function.test.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test("full PIVOT() values", async function () {
3535
setCellContent(model, "A1", `=PIVOT("1")`, "42");
3636
// prettier-ignore
3737
expect(getEvaluatedGrid(model, "A1:D7", "42")).toEqual([
38-
["(#1) Partner Pivot", "xphone", "xpad", "Total"],
38+
["Partner Pivot", "xphone", "xpad", "Total"],
3939
["", "Probability", "Probability", "Probability"],
4040
[1, "", 11, 11],
4141
[2, "", 15, 15],
@@ -63,7 +63,7 @@ test("PIVOT(row_count=1)", async function () {
6363
setCellContent(model, "A1", `=PIVOT("1", 1)`, "42");
6464
// prettier-ignore
6565
expect(getEvaluatedGrid(model, "A1:D4", "42")).toEqual([
66-
["(#1) Partner Pivot", "xphone", "xpad", "Total"],
66+
["Partner Pivot", "xphone", "xpad", "Total"],
6767
["", "Probability", "Probability", "Probability"],
6868
[1, "", 11, 11],
6969
[null, null, null, null],
@@ -74,7 +74,7 @@ test("PIVOT(row_count=0)", async function () {
7474
setCellContent(model, "A1", `=PIVOT("1", 0)`, "42");
7575
// prettier-ignore
7676
expect(getEvaluatedGrid(model, "A1:D3", "42")).toEqual([
77-
["(#1) Partner Pivot", "xphone", "xpad", "Total"],
77+
["Partner Pivot", "xphone", "xpad", "Total"],
7878
["", "Probability", "Probability", "Probability"],
7979
[null, null, null, null],
8080
]);
@@ -89,7 +89,7 @@ test("PIVOT(negative row_count)", async function () {
8989
});
9090

9191
test("PIVOT(include_column_titles=FALSE)", async function () {
92-
setCellContent(model, "A1", `=PIVOT("1",,,FALSE)`, "42");
92+
setCellContent(model, "A1", `=PIVOT("1",,,FALSE,,FALSE)`, "42");
9393
// prettier-ignore
9494
expect(getEvaluatedGrid(model, "A1:D5", "42")).toEqual([
9595
[1, "", 11, 11],
@@ -111,7 +111,7 @@ test("PIVOT(include_total=FALSE) with no groupbys applied", async function () {
111111
setCellContent(model, "A1", `=PIVOT("1",,FALSE)`, "42");
112112
// prettier-ignore
113113
expect(getEvaluatedGrid(model, "A1:B3", "42")).toEqual([
114-
["(#1) Partner Pivot", "Total"],
114+
["Partner Pivot", "Total"],
115115
["", "Probability"],
116116
["Total", 131],
117117
]);
@@ -129,7 +129,7 @@ test("PIVOT(include_total=FALSE) with multiple measures and no groupbys applied"
129129
setCellContent(model, "A1", `=PIVOT("1",,FALSE)`, "42");
130130
// prettier-ignore
131131
expect(getEvaluatedGrid(model, "A1:C3", "42")).toEqual([
132-
["(#1) Partner Pivot", "Total", ""],
132+
["Partner Pivot", "Total", ""],
133133
["", "Probability", "Foo"],
134134
["Total", 131, 32],
135135
]);
@@ -147,7 +147,7 @@ test("PIVOT(include_total=FALSE) with only row groupby applied", async function
147147
setCellContent(model, "A1", `=PIVOT("1",,FALSE)`, "42");
148148
// prettier-ignore
149149
expect(getEvaluatedGrid(model, "A1:C7", "42")).toEqual([
150-
["(#1) Partner Pivot", "Total", null],
150+
["Partner Pivot", "Total", null],
151151
["", "Probability", null],
152152
[1, 11, null],
153153
[2, 15, null],
@@ -177,7 +177,7 @@ test("sorted PIVOT(include_total=FALSE) with only row groupby applied", async fu
177177
setCellContent(model, "A1", `=PIVOT("1",,FALSE)`, "42");
178178
// prettier-ignore
179179
expect(getEvaluatedGrid(model, "A1:C7", "42")).toEqual([
180-
["(#1) Partner Pivot", "Total", null],
180+
["Partner Pivot", "Total", null],
181181
["", "Probability", null],
182182
[17, 95, null],
183183
[2, 15, null],
@@ -200,7 +200,7 @@ test("PIVOT(include_total=FALSE) with multiple measures and only row groupby app
200200
setCellContent(model, "A1", `=PIVOT("1",,FALSE)`, "42");
201201
// prettier-ignore
202202
expect(getEvaluatedGrid(model, "A1:D5", "42")).toEqual([
203-
["(#1) Partner Pivot", "Total", "", null],
203+
["Partner Pivot", "Total", "", null],
204204
["", "Probability", "Foo", null],
205205
["xphone", 10, 12, null],
206206
["xpad", 121, 20, null],
@@ -220,15 +220,15 @@ test("PIVOT(include_total=FALSE) with only col groupby applied", async function
220220
setCellContent(model, "A1", `=PIVOT("1",,FALSE)`, "42");
221221
// prettier-ignore
222222
expect(getEvaluatedGrid(model, "A1:D4", "42")).toEqual([
223-
["(#1) Partner Pivot", "xphone", "xpad", null],
223+
["Partner Pivot", "xphone", "xpad", null],
224224
["", "Probability", "Probability", null],
225225
["Total", 10, 121, null],
226226
[null, null, null, null],
227227
]);
228228
});
229229

230230
test("PIVOT(include_total=FALSE, include_column_titles=FALSE)", async function () {
231-
setCellContent(model, "A1", `=PIVOT("1",,FALSE,FALSE)`, "42");
231+
setCellContent(model, "A1", `=PIVOT("1",,FALSE,FALSE,,FALSE)`, "42");
232232
// prettier-ignore
233233
expect(getEvaluatedGrid(model, "A1:D5", "42")).toEqual([
234234
[1, "", 11, null],
@@ -240,7 +240,7 @@ test("PIVOT(include_total=FALSE, include_column_titles=FALSE)", async function (
240240
});
241241

242242
test("PIVOT(row_count=1, include_total=FALSE, include_column_titles=FALSE)", async function () {
243-
setCellContent(model, "A1", `=PIVOT("1",1,FALSE,FALSE)`, "42");
243+
setCellContent(model, "A1", `=PIVOT("1",1,FALSE,FALSE,,FALSE)`, "42");
244244
// prettier-ignore
245245
expect(getEvaluatedGrid(model, "A1:D2", "42")).toEqual([
246246
[1, "", 11, null],
@@ -249,18 +249,18 @@ test("PIVOT(row_count=1, include_total=FALSE, include_column_titles=FALSE)", asy
249249
});
250250

251251
test("PIVOT(row_count=0, include_total=FALSE, include_column_titles=FALSE)", async function () {
252-
setCellContent(model, "A1", `=PIVOT("1",0,FALSE,FALSE)`, "42");
252+
setCellContent(model, "A1", `=PIVOT("1",0,FALSE,FALSE,,FALSE)`, "42");
253253
// prettier-ignore
254254
expect(getEvaluatedGrid(model, "A1:D1", "42")).toEqual([
255-
["(#1) Partner Pivot", null, null, null],
255+
["Partner Pivot", null, null, null],
256256
]);
257257
});
258258

259259
test("PIVOT(row_count=0, include_total=TRUE, include_column_titles=FALSE)", async function () {
260-
setCellContent(model, "A1", `=PIVOT("1",0,TRUE,FALSE)`, "42");
260+
setCellContent(model, "A1", `=PIVOT("1",0,TRUE,FALSE,,FALSE)`, "42");
261261
// prettier-ignore
262262
expect(getEvaluatedGrid(model, "A1:D1", "42")).toEqual([
263-
["(#1) Partner Pivot", null, null, null],
263+
["Partner Pivot", null, null, null],
264264
]);
265265
});
266266

@@ -278,7 +278,7 @@ test("PIVOT with multiple row groups", async function () {
278278
// values in the first sheet from the individual pivot functions
279279
// prettier-ignore
280280
expect(getEvaluatedGrid(model, "A1:D11", firstSheetId)).toEqual([
281-
["(#1) Partner Pivot", "xphone", "xpad", "Total"],
281+
["Partner Pivot", "xphone", "xpad", "Total"],
282282
["", "Probability", "Probability", "Probability"],
283283
[1, "", 11, 11],
284284
[2, "", 11, 11],
@@ -295,7 +295,7 @@ test("PIVOT with multiple row groups", async function () {
295295
// values from the PIVOT function
296296
// prettier-ignore
297297
expect(getEvaluatedGrid(model, "A1:D11", "42")).toEqual([
298-
["(#1) Partner Pivot", "xphone", "xpad", "Total"],
298+
["Partner Pivot", "xphone", "xpad", "Total"],
299299
["", "Probability", "Probability", "Probability"],
300300
[1, "", 11, 11],
301301
[2, "", 11, 11],
@@ -311,7 +311,7 @@ test("PIVOT with multiple row groups", async function () {
311311
// values from the PIVOT function without any group totals
312312
// prettier-ignore
313313
expect(getEvaluatedGrid(model, "A1:D11", "42")).toEqual([
314-
["(#1) Partner Pivot", "xphone", "xpad", null],
314+
["Partner Pivot", "xphone", "xpad", null],
315315
["", "Probability", "Probability", null],
316316
[1, "", "", null], // group header but without total values
317317
[2, "", 11, null],
@@ -330,7 +330,7 @@ test("edit pivot groups", async function () {
330330
const originalGrid = getEvaluatedGrid(model, "A1:D7", "42");
331331
// prettier-ignore
332332
expect(originalGrid).toEqual([
333-
["(#1) Partner Pivot", "xphone", "xpad", "Total"],
333+
["Partner Pivot", "xphone", "xpad", "Total"],
334334
["", "Probability", "Probability", "Probability"],
335335
[1, "", 11, 11],
336336
[2, "", 15, 15],
@@ -350,7 +350,7 @@ test("edit pivot groups", async function () {
350350
await animationFrame();
351351
// prettier-ignore
352352
expect(getEvaluatedGrid(model, "A1:B3", "42")).toEqual([
353-
["(#1) Partner Pivot", "Total"],
353+
["Partner Pivot", "Total"],
354354
["", "Probability"],
355355
["Total", 131],
356356
]);
@@ -362,12 +362,12 @@ test("edit pivot groups", async function () {
362362
test("Renaming the pivot reevaluates the PIVOT function", async function () {
363363
const pivotId = model.getters.getPivotIds()[0];
364364
setCellContent(model, "A1", `=PIVOT("1")`, "42");
365-
expect(getEvaluatedCell(model, "A1", "42").value).toBe("(#1) Partner Pivot");
365+
expect(getEvaluatedCell(model, "A1", "42").value).toBe("Partner Pivot");
366366
model.dispatch("RENAME_PIVOT", {
367367
pivotId,
368368
name: "New Name",
369369
});
370-
expect(getEvaluatedCell(model, "A1", "42").value).toBe("(#1) New Name");
370+
expect(getEvaluatedCell(model, "A1", "42").value).toBe("New Name");
371371
});
372372

373373
test("can hide a measure", async function () {
@@ -381,7 +381,7 @@ test("can hide a measure", async function () {
381381
setCellContent(model, "A10", '=PIVOT("1")');
382382
// prettier-ignore
383383
expect(getEvaluatedGrid(model, "A10:C12")).toEqual([
384-
["(#1) Partner Pivot", "Total", "",],
384+
["Partner Pivot", "Total", "",],
385385
["", "Probability", "Foo"],
386386
["Total", 131, 32],
387387
]);
@@ -393,7 +393,7 @@ test("can hide a measure", async function () {
393393
await animationFrame();
394394
// prettier-ignore
395395
expect(getEvaluatedGrid(model, "A10:C12")).toEqual([
396-
["(#1) Partner Pivot", "Total", null],
396+
["Partner Pivot", "Total", null],
397397
["", "Foo", null],
398398
["Total", 32, null],
399399
]);

addons/spreadsheet/static/tests/pivots/pivot_see_records.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ test("Can see records on PIVOT cells", async function () {
264264

265265
// same but without the column headers
266266
// set the function in A3 such as the data cells matches the ones in the first sheet
267-
setCellContent(model, "A3", `=PIVOT("1",,,FALSE)`, "42");
267+
setCellContent(model, "A3", `=PIVOT("1",,,FALSE,,FALSE)`, "42");
268268
await checkCells(data_cells);
269269
});
270270

addons/spreadsheet/static/tests/public_spreadsheet/freeze.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ test("spilled pivot table", async function () {
297297
const data = await freezeOdooData(model);
298298
const sheet = data.sheets[0];
299299
const cells = sheet.cells;
300-
expect(cells.A10).toBe("(#1) Partner Pivot");
300+
expect(cells.A10).toBe("Partner Pivot");
301301
expect(cells.A11).toBe("");
302302
expect(cells.A12).toBe("Total");
303303
expect(cells.B10).toBe("Total");

0 commit comments

Comments
 (0)