Skip to content

Commit

Permalink
refactor: remove segmentId and line etc in action type
Browse files Browse the repository at this point in the history
  • Loading branch information
Jocs committed Oct 29, 2024
1 parent bc65876 commit f92e87b
Show file tree
Hide file tree
Showing 28 changed files with 49 additions and 403 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ describe('Test action iterator', () => {
}],
},
len: 5,
line: 0,
}, {
t: TextXActionType.DELETE,
len: 5,
line: 0,
}]);

expect(iterator.hasNext()).toBe(true);
Expand Down Expand Up @@ -81,7 +79,6 @@ describe('Test action iterator', () => {
customDecorations: [],
},
len: 2,
line: 0,
});

expect(iterator.peekType()).toBe(TextXActionType.INSERT);
Expand All @@ -103,7 +100,6 @@ describe('Test action iterator', () => {
}],
},
len: 3,
line: 0,
});

expect(iterator.peekType()).toBe(TextXActionType.DELETE);
Expand All @@ -113,7 +109,6 @@ describe('Test action iterator', () => {
expect(action).toEqual({
t: TextXActionType.DELETE,
len: 5,
line: 0,
});

expect(iterator.hasNext()).toBe(false);
Expand Down Expand Up @@ -141,7 +136,6 @@ describe('Test action iterator', () => {
}, {
t: TextXActionType.DELETE,
len: 5,
line: 0,
}]);

expect(iterator.rest()).toEqual([{
Expand All @@ -150,7 +144,6 @@ describe('Test action iterator', () => {
}, {
t: TextXActionType.DELETE,
len: 5,
line: 0,
}]);

iterator.next(3);
Expand All @@ -161,7 +154,6 @@ describe('Test action iterator', () => {
}, {
t: TextXActionType.DELETE,
len: 5,
line: 0,
}]);
});
});
36 changes: 0 additions & 36 deletions packages/core/src/docs/data-model/text-x/__tests__/apply.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ describe('apply method', () => {
{
t: TextXActionType.INSERT,
len: 1,
line: 0,
body: {
dataStream: 'h',
},
Expand All @@ -107,7 +106,6 @@ describe('apply method', () => {
},
],
},
segmentId: '',
},
];

Expand Down Expand Up @@ -136,13 +134,11 @@ describe('apply method', () => {
const actionsA: TextXAction[] = [
{
t: TextXActionType.RETAIN,
segmentId: '',
len: 1,
},
{
t: TextXActionType.INSERT,
len: 1,
line: 0,
body: {
dataStream: 'h',
textRuns: [
Expand Down Expand Up @@ -173,7 +169,6 @@ describe('apply method', () => {
},
],
},
segmentId: '',
},
];

Expand Down Expand Up @@ -201,13 +196,11 @@ describe('apply method', () => {
const actionsA: TextXAction[] = [
{
t: TextXActionType.RETAIN,
segmentId: '',
len: 1,
},
{
t: TextXActionType.INSERT,
len: 1,
line: 0,
body: {
dataStream: 'h',
textRuns: [
Expand Down Expand Up @@ -238,7 +231,6 @@ describe('apply method', () => {
},
],
},
segmentId: '',
},
];

Expand Down Expand Up @@ -267,11 +259,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
body: {
dataStream: '',
paragraphs: [{
Expand All @@ -288,11 +278,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
body: {
dataStream: '',
paragraphs: [{
Expand Down Expand Up @@ -330,11 +318,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
Expand All @@ -352,11 +338,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
Expand Down Expand Up @@ -395,11 +379,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
Expand All @@ -422,11 +404,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
coverType: UpdateDocsAttributeType.REPLACE,
body: {
dataStream: '',
Expand Down Expand Up @@ -470,11 +450,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
}, {
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
body: {
dataStream: '',
textRuns: [{
Expand All @@ -490,7 +468,6 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 2,
segmentId: '',
body: {
dataStream: '',
textRuns: [{
Expand Down Expand Up @@ -531,12 +508,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 1,
segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 1,
segmentId: '',
line: 0,
body: {
dataStream: '\r',
paragraphs: [{
Expand All @@ -553,12 +527,9 @@ describe('apply method', () => {
{
t: TextXActionType.RETAIN,
len: 2,
segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 1,
segmentId: '',
line: 0,
body: {
dataStream: 'X',
textRuns: [{
Expand Down Expand Up @@ -605,30 +576,23 @@ describe('apply method', () => {
{
t: TextXActionType.DELETE,
len: 2,
segmentId: '',
line: 0,
},
];

const actionsB: TextXAction[] = [
{
t: TextXActionType.RETAIN,
len: 2,
segmentId: '',
}, {
t: TextXActionType.INSERT,
len: 1,
segmentId: '',
line: 0,
body: {
dataStream: '1',
},
},
{
t: TextXActionType.INSERT,
len: 1,
segmentId: '',
line: 0,
body: {
dataStream: '1',
},
Expand Down
Loading

0 comments on commit f92e87b

Please sign in to comment.