All files / roosterjs-content-model-dom/lib/formatHandlers/common borderBoxFormatHandler.ts

100% Statements 5/5
87.5% Branches 7/8
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19            1x   327x 29x       479x 52x        
import type { BorderBoxFormat } from 'roosterjs-content-model-types';
import type { FormatHandler } from '../FormatHandler';
 
/**
 * @internal
 */
export const borderBoxFormatHandler: FormatHandler<BorderBoxFormat> = {
    parse: (format, element) => {
        if (element.style?.boxSizing == 'border-box') {
            format.useBorderBox = true;
        }
    },
    apply: (format, element) => {
        if (format.useBorderBox) {
            element.style.boxSizing = 'border-box';
        }
    },
};