From 9095bce3e81292e80ecea7d568dcdd3cee13f7ef Mon Sep 17 00:00:00 2001 From: Dvergar <1528484+Dvergar@users.noreply.github.com> Date: Thu, 22 Dec 2022 13:07:45 +0100 Subject: [PATCH] [Fix] Add layoutType for listChanged stream --- src/tests/controllers/SubscriberContoller.test.ts | 7 +++++-- types/LayoutTypes.ts | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tests/controllers/SubscriberContoller.test.ts b/src/tests/controllers/SubscriberContoller.test.ts index c17fbde6..d75b8315 100644 --- a/src/tests/controllers/SubscriberContoller.test.ts +++ b/src/tests/controllers/SubscriberContoller.test.ts @@ -1,4 +1,4 @@ -import { SDK } from '../../index'; +import { LayoutType, SDK } from '../../index'; import { SubscriberController } from '../../controllers/SubscriberController'; import mockConfig from '../__mocks__/config'; import { mockFrameAnimation } from '../__mocks__/animations'; @@ -93,8 +93,11 @@ describe('Subscriber methods', () => { mockedSubscribers.onSelectedLayoutIdChanged('new id'); expect(mockedSDK.config.onSelectedLayoutIdChanged).toHaveBeenCalledWith('new id'); - mockedSubscribers.onLayoutsChanged(JSON.stringify([])); + mockedSubscribers.onLayoutsChanged('[{"layoutId":"0","layoutName":"Rectangle","layoutType":"top","parentLayoutId":null,"childLayouts":["2"]}]'); expect(mockedSDK.config.onLayoutsChanged).toHaveBeenCalledTimes(15); + expect(mockedSDK.config.onVariableListChanged).toHaveBeenCalledWith([{ layoutId: "0", layoutName: "Rectangle", layoutType: LayoutType.top, parentLayoutId: null, childLayouts: ["2"] }] + ); + mockedSubscribers.onConnectorStateChanged(JSON.stringify({ id: 'id', type: ConnectorEventType.loaded })); expect(mockedSDK.config.onLayoutsChanged).toHaveBeenCalledTimes(16); diff --git a/types/LayoutTypes.ts b/types/LayoutTypes.ts index 9410ed4d..d0f9b74a 100644 --- a/types/LayoutTypes.ts +++ b/types/LayoutTypes.ts @@ -50,6 +50,7 @@ export type Layout = { export type LayoutListItemType = { layoutId: string; layoutName: string; + layoutType: LayoutType; parentLayoutId?: string; childLayouts: string[]; };