diff --git a/package.json b/package.json index ee0a6c2e5890..c38fa179fc8b 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "eslint-plugin-import": "^2.29.1", "eslint-plugin-jsdoc": "^48.0.6", "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-mocha": "^10.2.0", + "eslint-plugin-mocha": "^10.3.0", "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", 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 diff --git a/yarn.lock b/yarn.lock index f80f786be1cb..7f6c925f8acf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6840,10 +6840,10 @@ eslint-plugin-jsx-a11y@^6.8.0: object.entries "^1.1.7" object.fromentries "^2.0.7" -eslint-plugin-mocha@^10.2.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-mocha/-/eslint-plugin-mocha-10.2.0.tgz#15b05ce5be4b332bb0d76826ec1c5ebf67102ad6" - integrity sha512-ZhdxzSZnd1P9LqDPF0DBcFLpRIGdh1zkF2JHnQklKQOvrQtT73kdP5K9V2mzvbLR+cCAO9OI48NXK/Ax9/ciCQ== +eslint-plugin-mocha@^10.3.0: + version "10.3.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-mocha/-/eslint-plugin-mocha-10.3.0.tgz#a1cd40737c230f4dc7477a3bef3bbaad7f8d8282" + integrity sha512-IWzbg2K6B1Q7h37Ih4zMyW+nhmw1JvUlHlbCUUUu6PfOOAUGCB0gxmvv7/U+TQQ6e8yHUv+q7KMdIIum4bx+PA== dependencies: eslint-utils "^3.0.0" rambda "^7.4.0"