Skip to content

Commit 0e96c1e

Browse files
author
刘欢
committed
test: test showSearch
1 parent f015c60 commit 0e96c1e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/Select.spec.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,5 +835,21 @@ describe('TreeSelect.basic', () => {
835835

836836
expect(options).toHaveLength(4);
837837
});
838+
it.only.each([
839+
// [description, props, shouldExist]
840+
['showSearch=false ', { showSearch: false }, false],
841+
['showSearch=undefined ', {}, false],
842+
['showSearch=true', { showSearch: true }, true],
843+
])('%s', (_, props: { showSearch?: boolean; mode?: 'tags' }, shouldExist) => {
844+
const { container } = render(
845+
<TreeSelect open treeDefaultExpandAll treeData={treeData} {...props} />,
846+
);
847+
const inputNode = container.querySelector('input');
848+
if (shouldExist) {
849+
expect(inputNode).not.toHaveAttribute('readonly');
850+
} else {
851+
expect(inputNode).toHaveAttribute('readonly');
852+
}
853+
});
838854
});
839855
});

0 commit comments

Comments
 (0)