From ef2d3b2c891f625de4a0b435953af87bae8589c0 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Fri, 1 Mar 2024 09:21:31 +0400 Subject: [PATCH] Up tests --- .../view/ComponentDataVariableView.ts | 1 + test/specs/dataSources/index.ts | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/dom_components/view/ComponentDataVariableView.ts b/src/dom_components/view/ComponentDataVariableView.ts index 8c5503790..0528d4e01 100644 --- a/src/dom_components/view/ComponentDataVariableView.ts +++ b/src/dom_components/view/ComponentDataVariableView.ts @@ -24,6 +24,7 @@ export default class ComponentDataVariableView extends ComponentView { expect(cmpVar.getEl()?.innerHTML).toBe('Name1'); }); - test.todo('component is properly updating on its property changes'); + test('component is properly updating on its default value change', () => { + const cmpVar = addDataVariable(); + cmpVar.set({ value: 'none' }); + expect(cmpVar.getEl()?.innerHTML).toBe('none'); + }); + + test('component is properly updating on its path change', () => { + const ds = addDataSource(); + const cmpVar = addDataVariable(); + const el = cmpVar.getEl()!; + cmpVar.set({ path: 'ds1.id2.name' }); + expect(el.innerHTML).toBe('Name2'); + cmpVar.set({ path: 'ds1[id3]name' }); + expect(el.innerHTML).toBe('Name3'); + + ds.getRecord('id3')?.set({ name: 'Name3-UP' }); + expect(el.innerHTML).toBe('Name3-UP'); + }); describe('DataSource changes', () => { test('component is properly updating on data source add', () => {