Skip to content

Commit e3b51ac

Browse files
committed
test: improve test for disable props
1 parent edf1732 commit e3b51ac

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

core/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
<a href="./README-zh.md">简体中文</a>
33
</p>
44

5-
<div align="center" markdown="1">
5+
<div align="left" markdown="1">
66
<sup>Using <a href="https://wangchujiang.com/#/app" target="_blank">my app</a> is also a way to <a href="https://wangchujiang.com/#/sponsor" target="_blank">support</a> me:</sup>
77
<br>
8+
<a target="_blank" href="https://apps.apple.com/app/6757317079" title="Screen Test for macOS"><img alt="Screen Test" height="52" width="52" src="https://wangchujiang.com/appicon/screen-test.png"></a>
89
<a target="_blank" href="https://apps.apple.com/app/Deskmark/6755948110" title="Deskmark for macOS"><img alt="Deskmark" height="52" width="52" src="https://wangchujiang.com/appicon/deskmark.png"></a>
910
<a target="_blank" href="https://apps.apple.com/app/Keyzer/6500434773" title="Keyzer for macOS"><img alt="Keyzer" height="52" width="52" src="https://wangchujiang.com/appicon/keyzer.png"></a>
1011
<a target="_blank" href="https://github.com/jaywcjlove/vidwall-hub" title="Vidwall Hub for macOS"><img alt="Vidwall Hub" height="52" width="52" src="https://wangchujiang.com/appicon/vidwall-hub.png"></a>

test/index.test.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,17 @@ test('lineBar props', () => {
3636

3737
test('disable props', () => {
3838
render(
39-
<Split disable data-testid="split">
39+
<Split disable visible={true} data-testid="split">
4040
<div> Header </div>
4141
<div> Header </div>
4242
</Split>,
4343
);
4444
const element = screen.getByTestId('split');
4545
expect(element.className).toEqual('w-split w-split-horizontal');
46-
expect((element.childNodes[1] as any).className).toEqual('w-split-bar w-split-large-bar disable');
46+
47+
// 使用querySelector查找分割条,而不是依赖childNodes索引
48+
const splitBar = element.querySelector('.w-split-bar');
49+
expect(splitBar?.className).toEqual('w-split-bar w-split-large-bar disable');
4750
expect(element.childNodes.length).toEqual(3);
4851
expect(element).toBeInTheDocument();
4952
});

0 commit comments

Comments
 (0)