Skip to content

Commit

Permalink
test: add clear border info test case
Browse files Browse the repository at this point in the history
  • Loading branch information
gazedreamily committed Oct 11, 2022
1 parent c91dd2c commit 1336e81
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions packages/core/test/toolbar/clear-format.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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);
});
});

0 comments on commit 1336e81

Please sign in to comment.