From d07353d02e95e542b7075ab4d9fbf595d4f2ba07 Mon Sep 17 00:00:00 2001 From: Siklos Date: Thu, 11 Aug 2022 14:36:25 +0200 Subject: [PATCH] Fix regression + fix tests --- .../ElementsSidebar/ElementsSidebar.test.tsx | 16 ++++++++-------- src/Components/Properties/Properties.test.tsx | 18 +++++++++--------- src/Components/Properties/Properties.tsx | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Components/ElementsSidebar/ElementsSidebar.test.tsx b/src/Components/ElementsSidebar/ElementsSidebar.test.tsx index 927e70c..fac312b 100644 --- a/src/Components/ElementsSidebar/ElementsSidebar.test.tsx +++ b/src/Components/ElementsSidebar/ElementsSidebar.test.tsx @@ -72,12 +72,12 @@ describe.concurrent('Elements sidebar', () => { expect(screen.queryByText('y')).toBeDefined(); expect(screen.queryByText('width')).toBeDefined(); expect(screen.queryByText('height')).toBeDefined(); - const propertyId = container.querySelector('#property-id'); - const propertyParentId = container.querySelector('#property-parentId'); - const propertyX = container.querySelector('#property-x'); - const propertyY = container.querySelector('#property-y'); - const propertyWidth = container.querySelector('#property-width'); - const propertyHeight = container.querySelector('#property-height'); + const propertyId = container.querySelector('#id'); + const propertyParentId = container.querySelector('#parentId'); + const propertyX = container.querySelector('#x'); + const propertyY = container.querySelector('#y'); + const propertyWidth = container.querySelector('#width'); + const propertyHeight = container.querySelector('#height'); expect((propertyId as HTMLInputElement).value).toBe(MainContainer.properties.id.toString()); expect(propertyParentId).toBeDefined(); expect((propertyParentId as HTMLInputElement).value).toBe(''); @@ -216,8 +216,8 @@ describe.concurrent('Elements sidebar', () => { expect(screen.getByText(/main/i)); const child1 = screen.getByText(/child-1/i); expect(child1); - const propertyId = container.querySelector('#property-id'); - const propertyParentId = container.querySelector('#property-parentId'); + const propertyId = container.querySelector('#id'); + const propertyParentId = container.querySelector('#parentId'); expect((propertyId as HTMLInputElement).value).toBe(MainContainer.properties.id.toString()); expect((propertyParentId as HTMLInputElement).value).toBe(''); diff --git a/src/Components/Properties/Properties.test.tsx b/src/Components/Properties/Properties.test.tsx index 55fa718..2afc364 100644 --- a/src/Components/Properties/Properties.test.tsx +++ b/src/Components/Properties/Properties.test.tsx @@ -17,7 +17,7 @@ describe.concurrent('Properties', () => { expect(screen.queryByText('y')).toBeNull(); }); - it('Some properties', () => { + it('Some properties, change values with dynamic input', () => { const prop = { id: 'stuff', parentId: 'parentId', @@ -41,10 +41,10 @@ describe.concurrent('Properties', () => { expect(screen.queryByText('x')).toBeDefined(); expect(screen.queryByText('y')).toBeDefined(); - let propertyId = container.querySelector('#property-id'); - let propertyParentId = container.querySelector('#property-parentId'); - let propertyX = container.querySelector('#property-x'); - let propertyY = container.querySelector('#property-y'); + let propertyId = container.querySelector('#id'); + let propertyParentId = container.querySelector('#parentId'); + let propertyX = container.querySelector('#x'); + let propertyY = container.querySelector('#y'); expect(propertyId).toBeDefined(); expect((propertyId as HTMLInputElement).value).toBe('stuff'); expect(propertyParentId).toBeDefined(); @@ -70,10 +70,10 @@ describe.concurrent('Properties', () => { onSubmit={() => {}} />); - propertyId = container.querySelector('#property-id'); - propertyParentId = container.querySelector('#property-parentId'); - propertyX = container.querySelector('#property-x'); - propertyY = container.querySelector('#property-y'); + propertyId = container.querySelector('#id'); + propertyParentId = container.querySelector('#parentId'); + propertyX = container.querySelector('#x'); + propertyY = container.querySelector('#y'); expect(propertyId).toBeDefined(); expect((propertyId as HTMLInputElement).value).toBe('stuffed'); expect(propertyParentId).toBeDefined(); diff --git a/src/Components/Properties/Properties.tsx b/src/Components/Properties/Properties.tsx index 39a6411..7477542 100644 --- a/src/Components/Properties/Properties.tsx +++ b/src/Components/Properties/Properties.tsx @@ -10,7 +10,7 @@ interface IPropertiesProps { } export const Properties: React.FC = (props: IPropertiesProps) => { - const [isDynamicInput, setIsDynamicInput] = useState(false); + const [isDynamicInput, setIsDynamicInput] = useState(true); if (props.properties === undefined) { return
;