diff --git a/libs/plugin-types/index.d.ts b/libs/plugin-types/index.d.ts index b0757cf..1784c94 100644 --- a/libs/plugin-types/index.d.ts +++ b/libs/plugin-types/index.d.ts @@ -1441,6 +1441,12 @@ export interface PenpotShapeBase extends PenpotPluginData { */ component(): PenpotLibraryComponent | null; + /* + * If the current shape is a component it will remove the component information and leave the + * shape as a "basic shape" + */ + detach(): void; + /** * Resizes the shape to the specified width and height. * @param width The new width of the shape. diff --git a/libs/plugins-runtime/src/lib/api/plugin-api.spec.ts b/libs/plugins-runtime/src/lib/api/plugin-api.spec.ts index 9120011..4d5d3c2 100644 --- a/libs/plugins-runtime/src/lib/api/plugin-api.spec.ts +++ b/libs/plugins-runtime/src/lib/api/plugin-api.spec.ts @@ -120,12 +120,14 @@ describe('Plugin api', () => { const id = api.on('pagechange', callback); expect(mockContext.addListener).toHaveBeenCalled(); - expect(mockContext.addListener.mock.calls[0][0]).toBe('pagechange'); - expect(mockContext.addListener.mock.calls[0][1]).toBe(callback); + expect((mockContext.addListener.mock as any).lastCall[0]).toBe( + 'pagechange' + ); + expect((mockContext.addListener.mock as any).lastCall[1]).toBe(callback); api.off(id); expect(mockContext.removeListener).toHaveBeenCalled(); - expect(mockContext.removeListener.mock.calls[0][0]).toBe(id); + expect((mockContext.removeListener.mock as any).lastCall[0]).toBe(id); }); });