From 615dd3dd673bec24dfc78025e5e9c12b02d075b7 Mon Sep 17 00:00:00 2001 From: lijinke666 Date: Tue, 31 Oct 2023 17:05:39 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=20react=20=E5=BF=AB?= =?UTF-8?q?=E7=85=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/s2-react/__tests__/setup.js | 12 -- .../__snapshots__/pagination-spec.tsx.snap | 160 ++++++++++++++++++ .../src/components/tooltip/custom-tooltip.tsx | 2 +- 3 files changed, 161 insertions(+), 13 deletions(-) diff --git a/packages/s2-react/__tests__/setup.js b/packages/s2-react/__tests__/setup.js index 59b30afea7..632c26d1e4 100644 --- a/packages/s2-react/__tests__/setup.js +++ b/packages/s2-react/__tests__/setup.js @@ -1,17 +1,5 @@ /* eslint-disable no-console */ -import React from 'react'; -import ReactDOM from 'react-dom'; -import { version as antdVersion } from 'antd'; - -console.log(`================== [S2 REACT TEST ENV] ====================`); -console.table({ - react: React.version, - 'react-dom': ReactDOM.version, - antd: antdVersion, -}); -console.log(`====================================================`); - ['time', 'info', 'warn'].forEach((type) => { jest.spyOn(console, type).mockImplementation(() => {}); }); diff --git a/packages/s2-react/__tests__/spreadsheet/__snapshots__/pagination-spec.tsx.snap b/packages/s2-react/__tests__/spreadsheet/__snapshots__/pagination-spec.tsx.snap index 6a8ab9c72e..01575eeeb4 100644 --- a/packages/s2-react/__tests__/spreadsheet/__snapshots__/pagination-spec.tsx.snap +++ b/packages/s2-react/__tests__/spreadsheet/__snapshots__/pagination-spec.tsx.snap @@ -120,6 +120,166 @@ exports[`Pagination Tests should receive antd component extra prop `; exports[`Pagination Tests should render locale text for { locale: 'en_US', page: '1 / page', count: 'Total2' } 1`] = ` +
+
    +
  • + +
  • +
  • + + 1 + +
  • +
  • + +
  • +
  • +
    +
    + + + + + 1 / page + +
    + +
    +
  • +
+ + Total + - + +
+`; + +exports[`Pagination Tests should render locale text for { locale: 'en_US', page: '1 / page', count: 'Total2' } 2`] = `
diff --git a/packages/s2-react/src/components/tooltip/custom-tooltip.tsx b/packages/s2-react/src/components/tooltip/custom-tooltip.tsx index 66ae3db7d6..bd272b00b4 100644 --- a/packages/s2-react/src/components/tooltip/custom-tooltip.tsx +++ b/packages/s2-react/src/components/tooltip/custom-tooltip.tsx @@ -28,7 +28,7 @@ export class CustomTooltip extends BaseTooltip< > { root: Root; - isLegacyReactVersion = !createRoot || !startsWith(version, '18'); + isLegacyReactVersion = !startsWith(version, '18'); constructor(spreadsheet: SpreadSheet) { super(spreadsheet);