From 7eba2c366cdaa26b2bb7cb797c97ca3ccde702eb Mon Sep 17 00:00:00 2001 From: Vasily Strelyaev Date: Fri, 2 Aug 2024 17:41:24 +0300 Subject: [PATCH] chore: add test for SelectBox regression (re: T1238637) (#27846) --- .../integration/integration.test.tsx | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 packages/devextreme-react/src/core/__tests__/integration/integration.test.tsx diff --git a/packages/devextreme-react/src/core/__tests__/integration/integration.test.tsx b/packages/devextreme-react/src/core/__tests__/integration/integration.test.tsx new file mode 100644 index 000000000000..3bead0c2bcda --- /dev/null +++ b/packages/devextreme-react/src/core/__tests__/integration/integration.test.tsx @@ -0,0 +1,48 @@ +import * as testingLib from '@testing-library/react'; +import * as React from 'react'; + +import { useState, useEffect } from 'react'; +import SelectBox from '../../../select-box'; +import TextBox from '../../../text-box'; + +jest.useFakeTimers(); + +describe('selectbox', () => { + afterEach(() => { + jest.clearAllMocks(); + testingLib.cleanup(); + }); + + it('renders selectbox in strict mode when data source is specified dynamically without errors', () => { + const Field = (data: any) => { + return (); + } + + const list = [{ ID: 1, Name: 'Item 1' }]; + + const SelectBoxWithDynamicDataSource = () => { + const [items, setItems] = useState([{}]); + + useEffect(() => { + setItems(list); + }, []); + + return ( + + ); + }; + + const renderSelectBox = () => testingLib.render( + + + + ); + + expect(renderSelectBox).not.toThrow(); + }); +}); \ No newline at end of file