From fde767ef14ceaed191447c536d6b4423b41ca540 Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 28 Feb 2024 15:47:26 +0200 Subject: [PATCH] fix new eslint issues --- .../x-data-grid-pro/src/tests/columns.DataGridPro.test.tsx | 5 +++++ .../x-data-grid-pro/src/tests/treeData.DataGridPro.test.tsx | 1 + packages/x-data-grid/src/tests/export.DataGrid.test.tsx | 1 + .../src/DesktopDatePicker/tests/DesktopDatePicker.test.tsx | 2 ++ .../StaticDatePicker/tests/StaticDatePickerKeyboard.test.tsx | 1 + .../src/useLicenseVerifier/useLicenseVerifier.test.tsx | 1 + packages/x-license/src/verifyLicense/verifyLicense.test.ts | 1 + packages/x-tree-view/src/TreeItem/TreeItem.test.tsx | 3 +++ test/e2e/index.test.ts | 3 +++ 9 files changed, 18 insertions(+) diff --git a/packages/x-data-grid-pro/src/tests/columns.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/columns.DataGridPro.test.tsx index 6643b4e5abeb..e40f2d135202 100644 --- a/packages/x-data-grid-pro/src/tests/columns.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/columns.DataGridPro.test.tsx @@ -481,15 +481,19 @@ describe(' - Columns', () => { it('.columns works', async () => { await autosize({ columns: [columns[0].field] }, [50, 100]); }); + it('.includeHeaders works', async () => { await autosize({ includeHeaders: true }, [213, 235]); }); + it('.includeOutliers works', async () => { await autosize({ includeOutliers: true }, [50, 144]); }); + it('.outliersFactor works', async () => { await autosize({ outliersFactor: 40 }, [50, 144]); }); + it('.expand works', async () => { await autosize({ expand: true }, [134, 148]); }); @@ -498,6 +502,7 @@ describe(' - Columns', () => { describe('column pipe processing', () => { type GridPrivateApiContextRef = ReturnType; + it('should not loose column width when re-applying pipe processing', () => { let privateApi: GridPrivateApiContextRef; function Footer() { diff --git a/packages/x-data-grid-pro/src/tests/treeData.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/treeData.DataGridPro.test.tsx index 259c2f7a4409..c6b60ed1fd4f 100644 --- a/packages/x-data-grid-pro/src/tests/treeData.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/treeData.DataGridPro.test.tsx @@ -442,6 +442,7 @@ describe(' - Tree data', () => { /> ); } + it('should respect the pageSize for the top level rows when toggling children expansion', () => { render(); expect(getColumnValues(1)).to.deep.equal(['A', 'B']); diff --git a/packages/x-data-grid/src/tests/export.DataGrid.test.tsx b/packages/x-data-grid/src/tests/export.DataGrid.test.tsx index 2503e8829d54..16626ae166a8 100644 --- a/packages/x-data-grid/src/tests/export.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/export.DataGrid.test.tsx @@ -27,6 +27,7 @@ describe(' - Export', () => { }); let spyCreateObjectURL: SinonSpy; + beforeEach(() => { spyCreateObjectURL = spy(global.URL, 'createObjectURL'); }); diff --git a/packages/x-date-pickers/src/DesktopDatePicker/tests/DesktopDatePicker.test.tsx b/packages/x-date-pickers/src/DesktopDatePicker/tests/DesktopDatePicker.test.tsx index 7c64c8832c42..d30fac087720 100644 --- a/packages/x-date-pickers/src/DesktopDatePicker/tests/DesktopDatePicker.test.tsx +++ b/packages/x-date-pickers/src/DesktopDatePicker/tests/DesktopDatePicker.test.tsx @@ -160,10 +160,12 @@ describe('', () => { let originalScrollX: number; let originalScrollY: number; + beforeEach(() => { originalScrollX = window.screenX; originalScrollY = window.scrollY; }); + afterEach(() => { window.scrollTo(originalScrollX, originalScrollY); }); diff --git a/packages/x-date-pickers/src/StaticDatePicker/tests/StaticDatePickerKeyboard.test.tsx b/packages/x-date-pickers/src/StaticDatePicker/tests/StaticDatePickerKeyboard.test.tsx index 9b46e2fc2821..d4d71dc9c534 100644 --- a/packages/x-date-pickers/src/StaticDatePicker/tests/StaticDatePickerKeyboard.test.tsx +++ b/packages/x-date-pickers/src/StaticDatePicker/tests/StaticDatePickerKeyboard.test.tsx @@ -126,6 +126,7 @@ describe(' - Keyboard interactions', () => { }); }); }); + describe('MonthCalendar keyboard navigation', () => { [ { key: 'ArrowLeft', expectFocusedMonth: 'Jul' }, diff --git a/packages/x-license/src/useLicenseVerifier/useLicenseVerifier.test.tsx b/packages/x-license/src/useLicenseVerifier/useLicenseVerifier.test.tsx index 9aaa3bfc713b..9d576314bd10 100644 --- a/packages/x-license/src/useLicenseVerifier/useLicenseVerifier.test.tsx +++ b/packages/x-license/src/useLicenseVerifier/useLicenseVerifier.test.tsx @@ -28,6 +28,7 @@ describe('useLicenseVerifier', function test() { const { render } = createRenderer(); let env: any; + beforeEach(() => { env = process.env.NODE_ENV; // Avoid Karma "Invalid left-hand side in assignment" SyntaxError diff --git a/packages/x-license/src/verifyLicense/verifyLicense.test.ts b/packages/x-license/src/verifyLicense/verifyLicense.test.ts index e610daffeeb0..7f916614ab14 100644 --- a/packages/x-license/src/verifyLicense/verifyLicense.test.ts +++ b/packages/x-license/src/verifyLicense/verifyLicense.test.ts @@ -9,6 +9,7 @@ const RELEASE_INFO = generateReleaseInfo(releaseDate); describe('License: verifyLicense', () => { let env: any; + beforeEach(() => { env = process.env.NODE_ENV; process.env.NODE_ENV = 'test'; diff --git a/packages/x-tree-view/src/TreeItem/TreeItem.test.tsx b/packages/x-tree-view/src/TreeItem/TreeItem.test.tsx index 11f216686b7b..b26404d0565b 100644 --- a/packages/x-tree-view/src/TreeItem/TreeItem.test.tsx +++ b/packages/x-tree-view/src/TreeItem/TreeItem.test.tsx @@ -184,6 +184,7 @@ describe('', () => { expect(getByTestId('2')).not.to.have.attribute('aria-expanded'); }); + it('should treat multiple empty conditional arrays as empty', () => { const { getByTestId } = render( @@ -202,6 +203,7 @@ describe('', () => { expect(getByTestId('2')).not.to.have.attribute('aria-expanded'); }); + it('should treat one conditional empty and one conditional with results as expandable', () => { const { getByTestId } = render( @@ -218,6 +220,7 @@ describe('', () => { expect(getByTestId('2')).to.have.attribute('aria-expanded', 'true'); }); + it('should handle edge case of nested array of array', () => { const { getByTestId } = render( diff --git a/test/e2e/index.test.ts b/test/e2e/index.test.ts index 01bc01a24ec8..5dcb5ac457c1 100644 --- a/test/e2e/index.test.ts +++ b/test/e2e/index.test.ts @@ -589,6 +589,7 @@ async function initializeEnvironment( expect(await input.inputValue()).to.equal('02/11/2022'); }); }); + describe('', () => { it('should allow selecting a value', async () => { await renderFixture('DatePicker/BasicMobileDatePicker'); @@ -606,6 +607,7 @@ async function initializeEnvironment( }); }); }); + describe('', () => { it('should allow selecting a value', async () => { await renderFixture('DatePicker/BasicDesktopDateTimePicker'); @@ -695,6 +697,7 @@ async function initializeEnvironment( }); }); }); + describe('', () => { it('should allow selecting a range value', async () => { // firefox in CI is not happy with this test