From 7f49d221a04fc08fd33d07b025dcf807501722e7 Mon Sep 17 00:00:00 2001
From: lijianan <574980606@qq.com>
Date: Tue, 23 Aug 2022 11:57:50 +0800
Subject: [PATCH] test: migrate part of Tree-Select tests (#37190)
---
.../{demo.test.js.snap => demo.test.ts.snap} | 0
.../{index.test.js.snap => index.test.tsx.snap} | 1 -
.../__tests__/{demo.test.js => demo.test.ts} | 0
.../__tests__/{index.test.js => index.test.tsx} | 15 ++++++++-------
4 files changed, 8 insertions(+), 8 deletions(-)
rename components/tree-select/__tests__/__snapshots__/{demo.test.js.snap => demo.test.ts.snap} (100%)
rename components/tree-select/__tests__/__snapshots__/{index.test.js.snap => index.test.tsx.snap} (99%)
rename components/tree-select/__tests__/{demo.test.js => demo.test.ts} (100%)
rename components/tree-select/__tests__/{index.test.js => index.test.tsx} (75%)
diff --git a/components/tree-select/__tests__/__snapshots__/demo.test.js.snap b/components/tree-select/__tests__/__snapshots__/demo.test.ts.snap
similarity index 100%
rename from components/tree-select/__tests__/__snapshots__/demo.test.js.snap
rename to components/tree-select/__tests__/__snapshots__/demo.test.ts.snap
diff --git a/components/tree-select/__tests__/__snapshots__/index.test.js.snap b/components/tree-select/__tests__/__snapshots__/index.test.tsx.snap
similarity index 99%
rename from components/tree-select/__tests__/__snapshots__/index.test.js.snap
rename to components/tree-select/__tests__/__snapshots__/index.test.tsx.snap
index 739f2f3885..5c053f200b 100644
--- a/components/tree-select/__tests__/__snapshots__/index.test.js.snap
+++ b/components/tree-select/__tests__/__snapshots__/index.test.tsx.snap
@@ -231,7 +231,6 @@ exports[`TreeSelect TreeSelect Custom Icons should support customized icons 1`]
aria-hidden="true"
class="ant-select-selection-search-mirror"
>
-
diff --git a/components/tree-select/__tests__/demo.test.js b/components/tree-select/__tests__/demo.test.ts
similarity index 100%
rename from components/tree-select/__tests__/demo.test.js
rename to components/tree-select/__tests__/demo.test.ts
diff --git a/components/tree-select/__tests__/index.test.js b/components/tree-select/__tests__/index.test.tsx
similarity index 75%
rename from components/tree-select/__tests__/index.test.js
rename to components/tree-select/__tests__/index.test.tsx
index de3417fe05..c6f82cbc8d 100644
--- a/components/tree-select/__tests__/index.test.js
+++ b/components/tree-select/__tests__/index.test.tsx
@@ -1,5 +1,5 @@
-import { mount } from 'enzyme';
import React from 'react';
+import { render } from '../../../tests/utils';
import TreeSelect, { TreeNode } from '..';
import focusTest from '../../../tests/shared/focusTest';
import mountTest from '../../../tests/shared/mountTest';
@@ -12,7 +12,7 @@ describe('TreeSelect', () => {
describe('TreeSelect Custom Icons', () => {
it('should support customized icons', () => {
- const wrapper = mount(
+ const { container } = render(
clear}
@@ -32,22 +32,23 @@ describe('TreeSelect', () => {
,
);
- expect(wrapper.render()).toMatchSnapshot();
+ expect(container.firstChild).toMatchSnapshot();
});
it('should `treeIcon` work', () => {
- const wrapper = mount(
+ const { container } = render(
Bamboo} />
,
);
- expect(wrapper.render()).toMatchSnapshot();
+ expect(container.firstChild).toMatchSnapshot();
});
});
it('should support notFoundContent', () => {
- const wrapper = mount();
- expect(wrapper.text()).toBe('notFoundContent');
+ const content = 'notFoundContent';
+ const { container } = render();
+ expect(container.querySelector('.ant-select-empty')?.innerHTML).toBe(content);
});
});