From 1336e810057dcde9f4da80bda010a848cfbb0a0d Mon Sep 17 00:00:00 2001 From: gaze Date: Tue, 11 Oct 2022 19:53:52 +0800 Subject: [PATCH] test: add clear border info test case --- .../core/test/toolbar/clear-format.test.js | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/packages/core/test/toolbar/clear-format.test.js b/packages/core/test/toolbar/clear-format.test.js index 375a29b0..e7bbbd77 100644 --- a/packages/core/test/toolbar/clear-format.test.js +++ b/packages/core/test/toolbar/clear-format.test.js @@ -28,8 +28,64 @@ describe("clear format", () => { }, ], ], + config: { + borderInfo: [ + { + rangeType: "range", + borderType: "border-all", + style: "3", + color: "#0000ff", + range: [ + { + row: [0, 3], + column: [0, 2], + }, + ], + }, + { + rangeType: "range", + borderType: "border-inside", + style: "3", + color: "#0000ff", + range: [ + { + row: [7, 8], + column: [8, 9], + }, + ], + }, + ], + }, }, ], + config: { + borderInfo: [ + { + rangeType: "range", + borderType: "border-all", + style: "3", + color: "#0000ff", + range: [ + { + row: [0, 3], + column: [0, 2], + }, + ], + }, + { + rangeType: "range", + borderType: "border-inside", + style: "3", + color: "#0000ff", + range: [ + { + row: [7, 8], + column: [8, 9], + }, + ], + }, + ], + }, }); test("clear format", async () => { @@ -45,4 +101,43 @@ describe("clear format", () => { }; expect(getFlowdata(ctx)[0][0]).toEqual(expectedCell); }); + + test("clear border info", async () => { + const ctx = getContext(); + const expectedBorderInfo = [ + { + rangeType: "range", + borderType: "border-all", + style: "3", + color: "#0000ff", + range: [ + { + row: [0, 3], + column: [0, 2], + }, + ], + }, + { + rangeType: "range", + borderType: "border-inside", + style: "3", + color: "#0000ff", + range: [ + { + row: [7, 8], + column: [8, 9], + }, + ], + }, + { + rangeType: "range", + borderType: "border-none", + color: "#000000", + style: "1", + range: [{ row: [0, 0], column: [0, 0], row_focus: 0, column_focus: 0 }], + }, + ]; + handleClearFormat(ctx); + expect(ctx.luckysheetfile[0].config.borderInfo).toEqual(expectedBorderInfo); + }); });