Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ export const containerSizeFormatParser: FormatParser<SizeFormat> = (format, elem
if (element.tagName == 'DIV' || element.tagName == 'P') {
delete format.width;
delete format.height;
delete format.maxHeight;
delete format.maxWidth;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,67 @@ describe('containerSizeFormatParser', () => {

expect(format).toEqual({});
});

it('DIV with maxWidth', () => {
const div = document.createElement('div');
const format: SizeFormat = {
maxWidth: '100px',
};

containerSizeFormatParser(format, div, null!, {});

expect(format).toEqual({});
});

it('DIV with maxHeight', () => {
const div = document.createElement('div');
const format: SizeFormat = {
maxHeight: '100px',
};

containerSizeFormatParser(format, div, null!, {});

expect(format).toEqual({});
});

it('DIV with all size properties', () => {
const div = document.createElement('div');
const format: SizeFormat = {
width: '10px',
height: '10px',
maxWidth: '100px',
maxHeight: '100px',
};

containerSizeFormatParser(format, div, null!, {});

expect(format).toEqual({});
});

it('P with maxWidth and maxHeight', () => {
const p = document.createElement('p');
const format: SizeFormat = {
maxWidth: '200px',
maxHeight: '50px',
};

containerSizeFormatParser(format, p, null!, {});

expect(format).toEqual({});
});

it('SPAN with maxWidth and maxHeight', () => {
const span = document.createElement('span');
const format: SizeFormat = {
maxWidth: '200px',
maxHeight: '50px',
};

containerSizeFormatParser(format, span, null!, {});

expect(format).toEqual({
maxWidth: '200px',
maxHeight: '50px',
});
});
});
Loading