Skip to content

Commit 97a5cff

Browse files
authored
fix(blockheader): change some review comment and different font-size (#481)
* fix(blockheader): change some review comment and different font-size * fix(copy): change copy demo
1 parent d05ecbe commit 97a5cff

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

src/blockHeader/__tests__/blockHeader.test.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,19 @@ describe('test BlockHeader render', () => {
7979
expect(getByText('说明文字')).toHaveClass('title__description');
8080
expect(getByText('Icon')).toBeTruthy();
8181
});
82-
test('should render BlockHeader background success', () => {
82+
test('should render BlockHeader background false success', () => {
8383
const props = { title: '测试1', background: false };
8484
const { container } = render(<BlockHeader {...props} />);
8585
const wrap = container.firstChild;
86-
expect(wrap!.firstChild).not.toHaveClass(`background`);
86+
expect(wrap!.firstChild).not.toHaveClass(`dtc-block-header__title--background`);
8787
});
88-
test('should render BlockHeader className when isSmall is small', () => {
88+
test('should render BlockHeader className when size is small', () => {
8989
const { container, getByText } = render(<BlockHeader {...props2} />);
9090
const wrap = container.firstChild!;
9191
expect(wrap).toHaveClass(`${prefixCls} test__className`);
92+
expect(wrap.firstChild).toHaveClass(
93+
`dtc-block-header__title dtc-block-header__title--small dtc-block-header__title--background`
94+
);
9295
expect(getByText('标题2')).toHaveClass('title__text');
9396
expect(getByText('说明文字')).toHaveClass('title__description');
9497
expect(getByText('Icon')).toBeTruthy();
@@ -97,16 +100,17 @@ describe('test BlockHeader render', () => {
97100
test('should render BlockHeader tooltip success', () => {
98101
const { container } = render(<BlockHeader {...props3} />);
99102
const wrap = container.firstChild!;
100-
const afterTitleWrap = wrap.firstChild!.firstChild!.lastChild;
101-
expect(afterTitleWrap!.firstChild).toHaveClass('anticon-question-circle');
103+
const tooltipWrap = wrap.firstChild!.firstChild!.lastChild;
104+
expect(tooltipWrap!.firstChild).toHaveClass('anticon-question-circle');
102105
});
103106

104-
test('should render BlockHeader tooltip and desc success', () => {
107+
test('should render BlockHeader description success', () => {
105108
const { container } = render(<BlockHeader {...props4} />);
106109
const wrap = container.firstChild!;
107-
const afterTitleWrap = wrap.firstChild!.firstChild!.lastChild;
108-
expect(afterTitleWrap).toHaveTextContent('说明文字');
110+
const description = wrap.firstChild!.firstChild!.lastChild;
111+
expect(description).toHaveTextContent('说明文字');
109112
});
113+
110114
test('should render BlockHeader correct dom length', () => {
111115
const { container } = render(<BlockHeader title="分类级别" addonBefore="" />);
112116
const titleBoxWrap = container.firstChild!.firstChild!.firstChild;
@@ -118,6 +122,7 @@ describe('test BlockHeader render', () => {
118122
const titleBoxWrap1 = container1.firstChild!.firstChild!.firstChild;
119123
expect(titleBoxWrap1!.childNodes.length).toEqual(3);
120124
});
125+
121126
test('should render BlockHeader correct margin-bottom', () => {
122127
const { container: noStyle } = render(<BlockHeader title="分类级别" addonBefore="" />);
123128
expect(noStyle.querySelector('.dtc-block-header')).not.toHaveAttribute('style');

src/blockHeader/demos/basic.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export default () => {
4444
size={size}
4545
title="分类标题"
4646
background={showBackground}
47-
tooltip={tooltip && '这里展示问号提示'}
48-
description={description && '提示说明文字'}
47+
tooltip={tooltip ? '这里展示问号提示' : ''}
48+
description={description ? '提示说明文字' : ''}
4949
/>
5050
</div>
5151
);

src/blockHeader/style.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@ $card_prefix: "dtc-block-header";
77
align-items: center;
88
justify-content: space-between;
99
&--large {
10-
.#{$card_prefix}-title-box {
10+
.title__box {
1111
line-height: 24px;
12-
.#{$card_prefix}-title {
12+
.title__text {
1313
font-size: 16px;
1414
}
1515
}
1616
}
1717
&--middle {
18-
.#{$card_prefix}-title-box {
18+
.title__box {
1919
line-height: 22px;
20-
.#{$card_prefix}-title {
20+
.title__text {
2121
font-size: 14px;
2222
}
2323
}
2424
}
2525
&--small {
26-
.#{$card_prefix}-title-box {
26+
.title__box {
2727
line-height: 20px;
28-
.#{$card_prefix}-title {
28+
.title__text {
2929
font-size: 12px;
3030
}
3131
}

src/copy/demos/basic.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export default () => {
1919
<p>{text}</p>
2020
</div>
2121
<div>
22-
<BlockHeader title={`使用 ()=>React.ReactNode`} background={false} size="small" />
23-
<Copy text={text} tooltip={() => `使用 ()=>React.ReactNode,复制该文本`} />
22+
<BlockHeader title={`使用 () => React.ReactNode`} background={false} size="small" />
23+
<Copy text={text} tooltip={() => `使用 () => React.ReactNode,复制该文本`} />
2424
<p>{text}</p>
2525
</div>
2626
</Space>

0 commit comments

Comments
 (0)