Add more tests

This commit is contained in:
Aakansha Doshi 2023-06-12 13:00:31 +05:30
parent 1784f5b31e
commit 9e6751c5fb
3 changed files with 294 additions and 239 deletions

View file

@ -243,12 +243,13 @@ const bindLinearElementToElement = (
type: endType,
}) as ExcalidrawBindableElement;
}
bindLinearElement(
excliadrawLinearElement,
endBoundElement as ExcalidrawBindableElement,
"end",
);
}
bindLinearElement(
excliadrawLinearElement,
endBoundElement as ExcalidrawBindableElement,
"end",
);
}
return {
linearElement: excliadrawLinearElement,
@ -301,10 +302,6 @@ export const convertToExcalidrawElements = (
return [];
}
elements.forEach((element) => {
if (!element) {
return;
}
let elementId = element.id || regenerateId(null);
// To make sure every element has a unique id
@ -381,12 +378,6 @@ export const convertToExcalidrawElements = (
excalidrawElements.push(linearElement);
excalidrawElements.push(startBoundElement);
excalidrawElements.push(endBoundElement);
if (startBoundElement && !elementWithid?.start?.id) {
excalidrawElements.push(startBoundElement);
}
if (endBoundElement && !elementWithid?.end?.id) {
excalidrawElements.push(endBoundElement);
}
} else if (elementWithid.type === "line") {
const width = elementWithid.width || DEFAULT_LINEAR_ELEMENT_PROPS.width;
const height =