|  | @@ -534,7 +534,7 @@ describe("restore", () => {
 | 
	
		
			
				|  |  |  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  describe("repairing bindings", () => {
 | 
	
		
			
				|  |  | -  it("should repair container boundElements", () => {
 | 
	
		
			
				|  |  | +  it("should repair container boundElements when repair is true", () => {
 | 
	
		
			
				|  |  |      const container = API.createElement({
 | 
	
		
			
				|  |  |        type: "rectangle",
 | 
	
		
			
				|  |  |        boundElements: [],
 | 
	
	
		
			
				|  | @@ -546,9 +546,26 @@ describe("repairing bindings", () => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      expect(container.boundElements).toEqual([]);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    const restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  | +    let restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  | +      [container, boundElement],
 | 
	
		
			
				|  |  | +      null,
 | 
	
		
			
				|  |  | +    );
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    expect(restoredElements).toEqual([
 | 
	
		
			
				|  |  | +      expect.objectContaining({
 | 
	
		
			
				|  |  | +        id: container.id,
 | 
	
		
			
				|  |  | +        boundElements: [],
 | 
	
		
			
				|  |  | +      }),
 | 
	
		
			
				|  |  | +      expect.objectContaining({
 | 
	
		
			
				|  |  | +        id: boundElement.id,
 | 
	
		
			
				|  |  | +        containerId: container.id,
 | 
	
		
			
				|  |  | +      }),
 | 
	
		
			
				|  |  | +    ]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  |        [container, boundElement],
 | 
	
		
			
				|  |  |        null,
 | 
	
		
			
				|  |  | +      { repairBindings: true },
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      expect(restoredElements).toEqual([
 | 
	
	
		
			
				|  | @@ -563,7 +580,7 @@ describe("repairing bindings", () => {
 | 
	
		
			
				|  |  |      ]);
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  it("should repair containerId of boundElements", () => {
 | 
	
		
			
				|  |  | +  it("should repair containerId of boundElements when repair is true", () => {
 | 
	
		
			
				|  |  |      const boundElement = API.createElement({
 | 
	
		
			
				|  |  |        type: "text",
 | 
	
		
			
				|  |  |        containerId: null,
 | 
	
	
		
			
				|  | @@ -573,9 +590,26 @@ describe("repairing bindings", () => {
 | 
	
		
			
				|  |  |        boundElements: [{ type: boundElement.type, id: boundElement.id }],
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    const restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  | +    let restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  | +      [container, boundElement],
 | 
	
		
			
				|  |  | +      null,
 | 
	
		
			
				|  |  | +    );
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    expect(restoredElements).toEqual([
 | 
	
		
			
				|  |  | +      expect.objectContaining({
 | 
	
		
			
				|  |  | +        id: container.id,
 | 
	
		
			
				|  |  | +        boundElements: [{ type: boundElement.type, id: boundElement.id }],
 | 
	
		
			
				|  |  | +      }),
 | 
	
		
			
				|  |  | +      expect.objectContaining({
 | 
	
		
			
				|  |  | +        id: boundElement.id,
 | 
	
		
			
				|  |  | +        containerId: null,
 | 
	
		
			
				|  |  | +      }),
 | 
	
		
			
				|  |  | +    ]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  |        [container, boundElement],
 | 
	
		
			
				|  |  |        null,
 | 
	
		
			
				|  |  | +      { repairBindings: true },
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      expect(restoredElements).toEqual([
 | 
	
	
		
			
				|  | @@ -620,7 +654,7 @@ describe("repairing bindings", () => {
 | 
	
		
			
				|  |  |      ]);
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  it("should remove bindings of deleted elements from boundElements", () => {
 | 
	
		
			
				|  |  | +  it("should remove bindings of deleted elements from boundElements when repair is true", () => {
 | 
	
		
			
				|  |  |      const container = API.createElement({
 | 
	
		
			
				|  |  |        type: "rectangle",
 | 
	
		
			
				|  |  |        boundElements: [],
 | 
	
	
		
			
				|  | @@ -642,6 +676,8 @@ describe("repairing bindings", () => {
 | 
	
		
			
				|  |  |        type: invisibleBoundElement.type,
 | 
	
		
			
				|  |  |        id: invisibleBoundElement.id,
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  | +    expect(container.boundElements).toEqual([]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      const nonExistentBinding = { type: "text", id: "non-existent" };
 | 
	
		
			
				|  |  |      // @ts-ignore
 | 
	
		
			
				|  |  |      container.boundElements = [
 | 
	
	
		
			
				|  | @@ -650,15 +686,26 @@ describe("repairing bindings", () => {
 | 
	
		
			
				|  |  |        nonExistentBinding,
 | 
	
		
			
				|  |  |      ];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    expect(container.boundElements).toEqual([
 | 
	
		
			
				|  |  | -      obsoleteBinding,
 | 
	
		
			
				|  |  | -      invisibleBinding,
 | 
	
		
			
				|  |  | -      nonExistentBinding,
 | 
	
		
			
				|  |  | +    let restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  | +      [container, invisibleBoundElement, boundElement],
 | 
	
		
			
				|  |  | +      null,
 | 
	
		
			
				|  |  | +    );
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    expect(restoredElements).toEqual([
 | 
	
		
			
				|  |  | +      expect.objectContaining({
 | 
	
		
			
				|  |  | +        id: container.id,
 | 
	
		
			
				|  |  | +        boundElements: [obsoleteBinding, invisibleBinding, nonExistentBinding],
 | 
	
		
			
				|  |  | +      }),
 | 
	
		
			
				|  |  | +      expect.objectContaining({
 | 
	
		
			
				|  |  | +        id: boundElement.id,
 | 
	
		
			
				|  |  | +        containerId: container.id,
 | 
	
		
			
				|  |  | +      }),
 | 
	
		
			
				|  |  |      ]);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    const restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  | +    restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  |        [container, invisibleBoundElement, boundElement],
 | 
	
		
			
				|  |  |        null,
 | 
	
		
			
				|  |  | +      { repairBindings: true },
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      expect(restoredElements).toEqual([
 | 
	
	
		
			
				|  | @@ -673,7 +720,7 @@ describe("repairing bindings", () => {
 | 
	
		
			
				|  |  |      ]);
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  it("should remove containerId if container not exists", () => {
 | 
	
		
			
				|  |  | +  it("should remove containerId if container not exists when repair is true", () => {
 | 
	
		
			
				|  |  |      const boundElement = API.createElement({
 | 
	
		
			
				|  |  |        type: "text",
 | 
	
		
			
				|  |  |        containerId: "non-existent",
 | 
	
	
		
			
				|  | @@ -684,9 +731,26 @@ describe("repairing bindings", () => {
 | 
	
		
			
				|  |  |        isDeleted: true,
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    const restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  | +    let restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  | +      [boundElement, boundElementDeleted],
 | 
	
		
			
				|  |  | +      null,
 | 
	
		
			
				|  |  | +    );
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    expect(restoredElements).toEqual([
 | 
	
		
			
				|  |  | +      expect.objectContaining({
 | 
	
		
			
				|  |  | +        id: boundElement.id,
 | 
	
		
			
				|  |  | +        containerId: "non-existent",
 | 
	
		
			
				|  |  | +      }),
 | 
	
		
			
				|  |  | +      expect.objectContaining({
 | 
	
		
			
				|  |  | +        id: boundElementDeleted.id,
 | 
	
		
			
				|  |  | +        containerId: "non-existent",
 | 
	
		
			
				|  |  | +      }),
 | 
	
		
			
				|  |  | +    ]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    restoredElements = restore.restoreElements(
 | 
	
		
			
				|  |  |        [boundElement, boundElementDeleted],
 | 
	
		
			
				|  |  |        null,
 | 
	
		
			
				|  |  | +      { repairBindings: true },
 | 
	
		
			
				|  |  |      );
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      expect(restoredElements).toEqual([
 |