Browse Source

test: migrate part of Tree-Select tests (#37190)

pull/37194/head
lijianan 2 years ago
committed by GitHub
parent
commit
7f49d221a0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      components/tree-select/__tests__/__snapshots__/demo.test.ts.snap
  2. 1
      components/tree-select/__tests__/__snapshots__/index.test.tsx.snap
  3. 0
      components/tree-select/__tests__/demo.test.ts
  4. 15
      components/tree-select/__tests__/index.test.tsx

0
components/tree-select/__tests__/__snapshots__/demo.test.js.snap → components/tree-select/__tests__/__snapshots__/demo.test.ts.snap

1
components/tree-select/__tests__/__snapshots__/index.test.js.snap → 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"
>
 
</span>
</div>
</div>

0
components/tree-select/__tests__/demo.test.js → components/tree-select/__tests__/demo.test.ts

15
components/tree-select/__tests__/index.test.js → 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(
<TreeSelect
showSearch
clearIcon={<span>clear</span>}
@ -32,22 +32,23 @@ describe('TreeSelect', () => {
</TreeSelect>,
);
expect(wrapper.render()).toMatchSnapshot();
expect(container.firstChild).toMatchSnapshot();
});
it('should `treeIcon` work', () => {
const wrapper = mount(
const { container } = render(
<TreeSelect treeIcon open>
<TreeNode value="parent 1" title="parent 1" icon={<span>Bamboo</span>} />
</TreeSelect>,
);
expect(wrapper.render()).toMatchSnapshot();
expect(container.firstChild).toMatchSnapshot();
});
});
it('should support notFoundContent', () => {
const wrapper = mount(<TreeSelect treeIcon open notFoundContent="notFoundContent" />);
expect(wrapper.text()).toBe('notFoundContent');
const content = 'notFoundContent';
const { container } = render(<TreeSelect treeIcon open notFoundContent={content} />);
expect(container.querySelector('.ant-select-empty')?.innerHTML).toBe(content);
});
});
Loading…
Cancel
Save