Skip to content

Commit

Permalink
Fix unstable test in tableMoverTest (#2708)
Browse files Browse the repository at this point in the history
  • Loading branch information
JiuqingSong authored Jun 17, 2024
1 parent 2d95ac4 commit 81b29c0
Showing 1 changed file with 119 additions and 116 deletions.
235 changes: 119 additions & 116 deletions packages/roosterjs-content-model-plugins/test/tableEdit/tableMoverTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,119 +18,122 @@ describe('Table Mover Tests', () => {
let targetId = 'tableSelectionTestId';
let tableEdit: TableEditPlugin;
let node: HTMLDivElement;
const cmTable: ContentModelTable = {
blockType: 'Table',
rows: [
{
height: 20,
format: {},
cells: [
{
blockGroupType: 'TableCell',
blocks: [
{
blockType: 'Paragraph',
segments: [
{
segmentType: 'Text',
text: 'a1',
format: {},
},
],
format: {},
isImplicit: true,
},
],
format: {},
spanLeft: false,
spanAbove: false,
isHeader: false,
dataset: {},
},
{
blockGroupType: 'TableCell',
blocks: [
{
blockType: 'Paragraph',
segments: [
{
segmentType: 'Text',
text: 'z1',
format: {},
},
],
format: {},
},
],
format: {},
spanLeft: false,
spanAbove: false,
isHeader: false,
dataset: {},
},
],
},
{
height: 20,
format: {},
cells: [
{
blockGroupType: 'TableCell',
blocks: [
{
blockType: 'Paragraph',
segments: [
{
segmentType: 'Text',
text: 'a2',
format: {},
},
],
format: {},
isImplicit: true,
},
],
format: {},
spanLeft: false,
spanAbove: false,
isHeader: false,
dataset: {},
},
{
blockGroupType: 'TableCell',
blocks: [
{
blockType: 'Paragraph',
segments: [
{
segmentType: 'Text',
text: 'z2',
format: {},
},
{
segmentType: 'SelectionMarker',
isSelected: true,
format: {},
},
],
format: {},
},
],
format: {},
spanLeft: false,
spanAbove: false,
isHeader: false,
dataset: {},
},
],

function createCmTable(): ContentModelTable {
return {
blockType: 'Table',
rows: [
{
height: 20,
format: {},
cells: [
{
blockGroupType: 'TableCell',
blocks: [
{
blockType: 'Paragraph',
segments: [
{
segmentType: 'Text',
text: 'a1',
format: {},
},
],
format: {},
isImplicit: true,
},
],
format: {},
spanLeft: false,
spanAbove: false,
isHeader: false,
dataset: {},
},
{
blockGroupType: 'TableCell',
blocks: [
{
blockType: 'Paragraph',
segments: [
{
segmentType: 'Text',
text: 'z1',
format: {},
},
],
format: {},
},
],
format: {},
spanLeft: false,
spanAbove: false,
isHeader: false,
dataset: {},
},
],
},
{
height: 20,
format: {},
cells: [
{
blockGroupType: 'TableCell',
blocks: [
{
blockType: 'Paragraph',
segments: [
{
segmentType: 'Text',
text: 'a2',
format: {},
},
],
format: {},
isImplicit: true,
},
],
format: {},
spanLeft: false,
spanAbove: false,
isHeader: false,
dataset: {},
},
{
blockGroupType: 'TableCell',
blocks: [
{
blockType: 'Paragraph',
segments: [
{
segmentType: 'Text',
text: 'z2',
format: {},
},
{
segmentType: 'SelectionMarker',
isSelected: true,
format: {},
},
],
format: {},
},
],
format: {},
spanLeft: false,
spanAbove: false,
isHeader: false,
dataset: {},
},
],
},
],
format: {
id: `${targetId}`,
},
],
format: {
id: `${targetId}`,
},
widths: [10, 10],
dataset: {},
};
widths: [10, 10],
dataset: {},
};
}

beforeEach(() => {
document.body.innerHTML = '';
Expand All @@ -143,7 +146,7 @@ describe('Table Mover Tests', () => {
plugins: [tableEdit],
initialModel: {
blockGroupType: 'Document',
blocks: [{ ...cmTable }],
blocks: [createCmTable()],
format: {},
},
};
Expand Down Expand Up @@ -529,7 +532,7 @@ describe('Table Mover Tests', () => {
const divRect = document.createElement('div');

const initValue: TableMoverInitValue = {
cmTable: cmTable,
cmTable: createCmTable(),
initialSelection: null,
tableRect: divRect,
};
Expand Down Expand Up @@ -619,7 +622,7 @@ describe('Table Mover Tests', () => {
const divRect = document.createElement('div');

const initValue: TableMoverInitValue = {
cmTable: cmTable,
cmTable: createCmTable(),
initialSelection: null,
tableRect: divRect,
};
Expand Down Expand Up @@ -701,7 +704,7 @@ describe('Table Mover Tests', () => {
const divRect = document.createElement('div');

const initValue: TableMoverInitValue = {
cmTable: cmTable,
cmTable: createCmTable(),
initialSelection: null,
tableRect: divRect,
};
Expand Down

0 comments on commit 81b29c0

Please sign in to comment.