Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaroldi committed Oct 25, 2024
1 parent 09531d8 commit cd26c3c
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ describe('Content Model Auto Format Plugin Test', () => {
expect(model).toEqual(expectedResult);
}

xit('should call transformHyphen', () => {
it('should call transformHyphen', () => {
const event: EditorInputEvent = {
eventType: 'input',
rawEvent: { data: ' ', preventDefault: () => {}, inputType: 'insertText' } as any,
Expand All @@ -1092,7 +1092,13 @@ describe('Content Model Auto Format Plugin Test', () => {
segments: [
{
segmentType: 'Text',
text: 'test—test',
text: 'test—tes',
format: {},
isSelected: undefined,
},
{
segmentType: 'Text',
text: 't',
format: {},
isSelected: undefined,
},
Expand Down Expand Up @@ -1185,7 +1191,7 @@ describe('Content Model Auto Format Plugin Test', () => {

const segment: ContentModelText = {
segmentType: 'Text',
text: '1/2',
text: '1/2 ',
format: {},
};
const paragraph: ContentModelParagraph = {
Expand Down Expand Up @@ -1218,7 +1224,7 @@ describe('Content Model Auto Format Plugin Test', () => {
expect(model).toEqual(expectResult);
}

xit('should call transformFraction', () => {
it('should call transformFraction', () => {
const event: EditorInputEvent = {
eventType: 'input',
rawEvent: { data: ' ', preventDefault: () => {}, inputType: 'insertText' } as any,
Expand All @@ -1238,6 +1244,12 @@ describe('Content Model Auto Format Plugin Test', () => {
format: {},
isSelected: undefined,
},
{
segmentType: 'Text',
text: ' ',
format: {},
isSelected: undefined,
},
],
},
],
Expand All @@ -1249,7 +1261,7 @@ describe('Content Model Auto Format Plugin Test', () => {
);
});

it('should not call transformHyphen - disable options', () => {
it('should not call transformFraction - disable options', () => {
const event: EditorInputEvent = {
eventType: 'input',
rawEvent: { data: ' ', preventDefault: () => {}, inputType: 'insertText' } as any,
Expand All @@ -1262,7 +1274,7 @@ describe('Content Model Auto Format Plugin Test', () => {
{
blockType: 'Paragraph',
format: {},
segments: [{ segmentType: 'Text', text: '1/2', format: {} }],
segments: [{ segmentType: 'Text', text: '1/2 ', format: {} }],
},
],
},
Expand All @@ -1286,7 +1298,7 @@ describe('Content Model Auto Format Plugin Test', () => {

const segment: ContentModelText = {
segmentType: 'Text',
text: '1st',
text: '1st ',
format: {},
};
const paragraph: ContentModelParagraph = {
Expand Down Expand Up @@ -1319,7 +1331,7 @@ describe('Content Model Auto Format Plugin Test', () => {
expect(model).toEqual(expectResult);
}

xit('should call transformOrdinals', () => {
it('should call transformOrdinals', () => {
const event: EditorInputEvent = {
eventType: 'input',
rawEvent: { data: ' ', preventDefault: () => {}, inputType: 'insertText' } as any,
Expand All @@ -1345,6 +1357,12 @@ describe('Content Model Auto Format Plugin Test', () => {
format: { superOrSubScriptSequence: 'super' },
isSelected: undefined,
},
{
segmentType: 'Text',
text: ' ',
format: {},
isSelected: undefined,
},
],
},
],
Expand All @@ -1369,7 +1387,7 @@ describe('Content Model Auto Format Plugin Test', () => {
{
blockType: 'Paragraph',
format: {},
segments: [{ segmentType: 'Text', text: '1st', format: {} }],
segments: [{ segmentType: 'Text', text: '1st ', format: {} }],
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@ describe('createImageCropper', () => {
] as HTMLDivElement[];

expect(JSON.stringify(croppers)).toEqual(JSON.stringify(expectedCropper));

cropCenterDiv.remove();
cropOverlayTopLeftDiv.remove();
cropOverlayTopRightDiv.remove();
cropOverlayBottomLeftDiv.remove();
cropOverlayBottomRightDiv.remove();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ describe('ImageEditPlugin', () => {
} as any;
});

afterEach(() => {
editor = null!;
});

it('keyDown', () => {
const mockedImage = {
getAttribute: getAttributeSpy,
Expand Down Expand Up @@ -719,6 +723,7 @@ describe('ImageEditPlugin - applyFormatWithContentModel', () => {
plugin.dispose();
editor.dispose();
editor = null;
mockedImage.remove();
}

it('image to text', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ describe('createImageResizer', () => {
const result = createImageResizer(document);
const resizers = [...createCorners(), ...createSides()].filter(element => !!element);
expect(result).toEqual(resizers);

result.forEach((resizer, index) => {
resizer.remove();
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ describe('createImageRotator', () => {
const expectedRotator = div.firstElementChild! as HTMLDivElement;

expect(result).toEqual([expectedRotator]);
document.body.removeChild(div);
div.remove();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('createImageWrapper', () => {
rotators: [],
croppers: [],
});
document.body.removeChild(imageSpan);
imageSpan.remove();
});

it('rotate', () => {
Expand Down Expand Up @@ -124,7 +124,7 @@ describe('createImageWrapper', () => {
rotators: rotator,
croppers: [],
});
document.body.removeChild(imageSpan);
imageSpan.remove();
});

it('crop', () => {
Expand Down Expand Up @@ -179,7 +179,7 @@ describe('createImageWrapper', () => {
rotators: [],
croppers: cropper,
});
document.body.removeChild(imageSpan);
imageSpan.remove();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ describe('updateWrapper', () => {
expect(imageClone.style.height).toBe('13.3333px');
expect(imageClone.style.verticalAlign).toBe('bottom');
expect(imageClone.style.position).toBe('absolute');
image.remove();
});
});

0 comments on commit cd26c3c

Please sign in to comment.