Skip to content

Commit e4a6369

Browse files
authored
refactor(milestone): [milestone] refactor the milestone theme. (#2233)
* refactor(milestone): 重构milestone主题 * refactor(milestone): 修复新规范主题下的测试用例报错
1 parent 4e1b135 commit e4a6369

File tree

9 files changed

+237
-266
lines changed

9 files changed

+237
-266
lines changed

examples/sites/demos/pc/app/milestone/basic-usage.spec.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,33 @@ test('基本用法', async ({ page }) => {
2525
const iconStyles = [
2626
{
2727
'background-color': 'rgb(255, 255, 255)',
28-
'color': 'rgb(94, 124, 224)',
29-
'box-shadow': 'rgba(94, 124, 224, 0.4) 0px 0px 0px 4px'
28+
'color': 'rgb(25, 25, 25)',
29+
'box-shadow': 'none'
3030
},
3131
{
3232
'background-color': 'rgb(255, 255, 255)',
33-
'color': 'rgb(94, 124, 224)',
34-
'box-shadow': 'rgba(94, 124, 224, 0.4) 0px 0px 0px 4px'
33+
'color': 'rgb(25, 25, 25)',
34+
'box-shadow': 'none'
3535
},
3636
{
3737
'background-color': 'rgb(158, 197, 145)',
3838
'color': 'rgb(255, 255, 255)',
39-
'box-shadow': 'rgba(158, 197, 145, 0.4) 0px 0px 0px 4px'
39+
'box-shadow': 'none'
4040
},
4141
{
42-
'background-color': 'rgb(217, 217, 217)',
43-
'color': 'rgb(255, 255, 255)',
44-
'box-shadow': 'rgba(217, 217, 217, 0.4) 0px 0px 0px 4px'
42+
'background-color': 'rgb(255, 255, 255)',
43+
'color': 'rgb(217, 217, 217)',
44+
'box-shadow': 'none'
4545
},
4646
{
47-
'background-color': 'rgb(151, 167, 219)',
48-
'color': 'rgb(255, 255, 255)',
49-
'box-shadow': 'rgba(151, 167, 219, 0.4) 0px 0px 0px 4px'
47+
'background-color': 'rgb(255, 255, 255)',
48+
'color': 'rgb(151, 167, 219)',
49+
'box-shadow': 'none'
5050
},
5151
{
52-
'background-color': 'rgb(250, 173, 20)',
53-
'color': 'rgb(255, 255, 255)',
54-
'box-shadow': 'rgba(250, 173, 20, 0.4) 0px 0px 0px 4px'
52+
'background-color': 'rgb(255, 255, 255)',
53+
'color': 'rgb(250, 173, 20)',
54+
'box-shadow': 'none'
5555
}
5656
]
5757
const titles = ['completed 状态', 'completed 状态', 'doing 状态', 'cancel 状态', 'back 状态', 'end 状态']
@@ -64,13 +64,13 @@ test('基本用法', async ({ page }) => {
6464
await expect(nodeTitles).toHaveCount(nodeCount)
6565
await expect(nodeDates).toHaveCount(nodeCount)
6666
const { width: totalWidth, height: totalHeight } = await milestone.boundingBox()
67-
const nodeWidth = Math.floor(totalWidth / nodeCount)
67+
const nodeWidth = Math.floor(totalWidth / nodeCount / 2)
6868
const nodeHeight = totalHeight - 38
6969
for (let i = 0; i < nodeCount; i++) {
7070
const { width, height } = await nodes.nth(i).boundingBox()
7171
await expect(width).toBeGreaterThanOrEqual(nodeWidth)
7272
await expect(height).toEqual(nodeHeight)
73-
await expect(nodeLines.nth(i)).toHaveCSS('height', '4px')
73+
await expect(nodeLines.nth(i)).toHaveCSS('height', '1px')
7474
await expect(nodeIcons.nth(i)).toHaveClass(iconClasss[i])
7575
await expect(nodeTitles.nth(i)).toHaveText(titles[i])
7676
await expect(nodeDates.nth(i)).toHaveText(/2018-9/)
@@ -83,13 +83,13 @@ test('基本用法', async ({ page }) => {
8383
await expect(lineWidth).toBeGreaterThanOrEqual(0)
8484
}
8585
if (i < 2) {
86-
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '12px')
86+
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '24px')
8787
} else {
8888
await expect(nodeIcons.nth(i)).toHaveText(String(i - 1))
8989
}
9090
if (i < 4) {
91-
await expect(flags.nth(i)).toHaveCSS('width', '58px')
92-
await expect(flags.nth(i)).toHaveCSS('padding', '0px 4px')
91+
await expect(flags.nth(i)).toHaveCSS('width', '96px')
92+
await expect(flags.nth(i)).toHaveCSS('padding', '4px')
9393
await expect(flags.nth(i)).toHaveText(flagContents[i])
9494
await expect(flagLines.nth(i)).toHaveCSS('width', '1px')
9595
await expect(flagLines.nth(i)).toHaveCSS('height', '30px')

examples/sites/demos/pc/app/milestone/custom-icon-slot.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ test('自定义节点图标', async ({ page }) => {
1010
await expect(nodeIcons).toHaveCount(nodeCount)
1111
for (let i = 0; i < nodeCount; i++) {
1212
await expect(nodeIcons.nth(i).locator('svg')).toHaveClass(/custom/)
13-
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '12px')
13+
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '24px')
1414
}
1515
})

examples/sites/demos/pc/app/milestone/flag-before.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ test('旗子数据来源', async ({ page }) => {
1212
const flagAfterContents = [//, /test7使vui/, /test8/, /test6/]
1313
const flagBeforeContents = [/test1/, //, /test7使vui/, /test8/]
1414
const button = page.getByRole('button').filter({ hasText: '设置flag-before值为true' })
15-
const flagAfterLineColors = ['rgb(245, 34, 45)', 'rgb(245, 34, 45)', 'rgb(126, 211, 33)', 'rgb(94, 124, 224)']
16-
const flagBeforeLineColors = ['rgb(94, 124, 224)', 'rgb(245, 34, 45)', 'rgb(245, 34, 45)', 'rgb(126, 211, 33)']
15+
const flagAfterLineColors = ['rgb(245, 34, 45)', 'rgb(245, 34, 45)', 'rgb(126, 211, 33)', 'rgb(25, 25, 25)']
16+
const flagBeforeLineColors = ['rgb(25, 25, 25)', 'rgb(245, 34, 45)', 'rgb(245, 34, 45)', 'rgb(126, 211, 33)']
1717

1818
for (let i = 0; i < flagCount; i++) {
1919
const { x, y, width, height } = await flags.nth(i).boundingBox()
@@ -26,7 +26,7 @@ test('旗子数据来源', async ({ page }) => {
2626

2727
await expect(x).toBeGreaterThanOrEqual(nodeX)
2828
await expect(lineY - lineHeight).toBeGreaterThanOrEqual(y)
29-
await expect(width).toEqual(58)
29+
await expect(width).toEqual(96)
3030
await expect(height).toBeGreaterThanOrEqual(34)
3131
await expect(flags.nth(i)).toHaveText(flagAfterContents[i])
3232
await expect(flagLines.nth(i)).toHaveCSS('width', '1px')
@@ -48,7 +48,7 @@ test('旗子数据来源', async ({ page }) => {
4848

4949
await expect(x).toBeGreaterThanOrEqual(nodeX, 2)
5050
await expect(lineY - lineHeight).toBeGreaterThanOrEqual(y)
51-
await expect(width).toEqual(58)
51+
await expect(width).toEqual(96)
5252
await expect(height).toBeGreaterThanOrEqual(34)
5353
await expect(flags.nth(i)).toHaveText(flagBeforeContents[i])
5454
await expect(flagLines.nth(i)).toHaveCSS('width', '1px')

examples/sites/demos/pc/app/milestone/show-number.spec.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,33 @@ test('序号显示', async ({ page }) => {
2323
const iconStyles = [
2424
{
2525
'background-color': 'rgb(255, 255, 255)',
26-
'color': 'rgb(94, 124, 224)',
27-
'box-shadow': 'rgba(94, 124, 224, 0.4) 0px 0px 0px 4px'
26+
'color': 'rgb(25, 25, 25)',
27+
'box-shadow': 'none'
2828
},
2929
{
3030
'background-color': 'rgb(255, 255, 255)',
31-
'color': 'rgb(94, 124, 224)',
32-
'box-shadow': 'rgba(94, 124, 224, 0.4) 0px 0px 0px 4px'
31+
'color': 'rgb(25, 25, 25)',
32+
'box-shadow': 'none'
3333
},
3434
{
3535
'background-color': 'rgb(126, 211, 33)',
3636
'color': 'rgb(255, 255, 255)',
37-
'box-shadow': 'rgba(126, 211, 33, 0.4) 0px 0px 0px 4px'
37+
'box-shadow': 'none'
3838
},
3939
{
40-
'background-color': 'rgb(217, 217, 217)',
41-
'color': 'rgb(255, 255, 255)',
42-
'box-shadow': 'rgba(217, 217, 217, 0.4) 0px 0px 0px 4px'
40+
'background-color': 'rgb(255, 255, 255)',
41+
'color': 'rgb(217, 217, 217)',
42+
'box-shadow': 'none'
4343
},
4444
{
45-
'background-color': 'rgb(245, 34, 45)',
46-
'color': 'rgb(255, 255, 255)',
47-
'box-shadow': 'rgba(245, 34, 45, 0.4) 0px 0px 0px 4px'
45+
'background-color': 'rgb(255, 255, 255)',
46+
'color': 'rgb(245, 34, 45)',
47+
'box-shadow': 'none'
4848
},
4949
{
50-
'background-color': 'rgb(250, 173, 20)',
51-
'color': 'rgb(255, 255, 255)',
52-
'box-shadow': 'rgba(250, 173, 20, 0.4) 0px 0px 0px 4px'
50+
'background-color': 'rgb(255, 255, 255)',
51+
'color': 'rgb(250, 173, 20)',
52+
'box-shadow': 'none'
5353
}
5454
]
5555
const titles = [
@@ -67,13 +67,13 @@ test('序号显示', async ({ page }) => {
6767
await expect(nodeTitles).toHaveCount(nodeCount)
6868
await expect(nodeDates).toHaveCount(nodeCount)
6969
const { width: totalWidth } = await milestone.boundingBox()
70-
const nodeWidth = Math.floor(totalWidth / nodeCount)
70+
const nodeWidth = Math.floor(totalWidth / nodeCount / 2)
7171

7272
for (let i = 0; i < nodeCount; i++) {
7373
const { width, height } = await nodes.nth(i).boundingBox()
7474
await expect(width).toBeGreaterThanOrEqual(nodeWidth)
7575
await expect(height).toBeGreaterThan(84)
76-
await expect(nodeLines.nth(i)).toHaveCSS('height', '4px')
76+
await expect(nodeLines.nth(i)).toHaveCSS('height', '1px')
7777
await expect(nodeIcons.nth(i)).toHaveClass(iconClasss[i])
7878
await expect(nodeTitles.nth(i)).toHaveText(titles[i])
7979
await expect(nodeDates.nth(i)).toHaveText(/2018-9/)
@@ -86,7 +86,7 @@ test('序号显示', async ({ page }) => {
8686
await expect(lineWidth).toBeGreaterThanOrEqual(0)
8787
}
8888
if (i < 2) {
89-
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '12px')
89+
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '24px')
9090
} else {
9191
await expect(nodeIcons.nth(i)).toHaveText(String(i + 1))
9292
}
@@ -100,7 +100,7 @@ test('序号显示', async ({ page }) => {
100100

101101
for (let i = 0; i < nodeCount; i++) {
102102
if (i < 2) {
103-
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '12px')
103+
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '24px')
104104
} else {
105105
await expect(nodeIcons.nth(i)).toHaveText('')
106106
}

examples/sites/demos/pc/app/milestone/solid-style.spec.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,33 @@ test('实心显示', async ({ page }) => {
2323
const iconStyles = [
2424
{
2525
'background-color': 'rgb(255, 255, 255)',
26-
'color': 'rgb(94, 124, 224)',
27-
'box-shadow': 'rgba(94, 124, 224, 0.4) 0px 0px 0px 4px'
26+
'color': 'rgb(25, 25, 25)',
27+
'box-shadow': 'none'
2828
},
2929
{
3030
'background-color': 'rgb(255, 255, 255)',
31-
'color': 'rgb(94, 124, 224)',
32-
'box-shadow': 'rgba(94, 124, 224, 0.4) 0px 0px 0px 4px'
31+
'color': 'rgb(25, 25, 25)',
32+
'box-shadow': 'none'
3333
},
3434
{
3535
'background-color': 'rgb(126, 211, 33)',
3636
'color': 'rgb(255, 255, 255)',
37-
'box-shadow': 'rgba(126, 211, 33, 0.4) 0px 0px 0px 4px'
37+
'box-shadow': 'none'
3838
},
3939
{
40-
'background-color': 'rgb(217, 217, 217)',
41-
'color': 'rgb(255, 255, 255)',
42-
'box-shadow': 'rgba(217, 217, 217, 0.4) 0px 0px 0px 4px'
40+
'background-color': 'rgb(255, 255, 255)',
41+
'color': 'rgb(217, 217, 217)',
42+
'box-shadow': 'none'
4343
},
4444
{
45-
'background-color': 'rgb(245, 34, 45)',
46-
'color': 'rgb(255, 255, 255)',
47-
'box-shadow': 'rgba(245, 34, 45, 0.4) 0px 0px 0px 4px'
45+
'background-color': 'rgb(255, 255, 255)',
46+
'color': 'rgb(245, 34, 45)',
47+
'box-shadow': 'none'
4848
},
4949
{
50-
'background-color': 'rgb(250, 173, 20)',
51-
'color': 'rgb(255, 255, 255)',
52-
'box-shadow': 'rgba(250, 173, 20, 0.4) 0px 0px 0px 4px'
50+
'background-color': 'rgb(255, 255, 255)',
51+
'color': 'rgb(250, 173, 20)',
52+
'box-shadow': 'none'
5353
}
5454
]
5555
const titles = [
@@ -67,12 +67,12 @@ test('实心显示', async ({ page }) => {
6767
await expect(nodeTitles).toHaveCount(nodeCount)
6868
await expect(nodeDates).toHaveCount(nodeCount)
6969
const { width: totalWidth } = await milestone.boundingBox()
70-
const nodeWidth = Math.floor(totalWidth / nodeCount)
70+
const nodeWidth = Math.floor(totalWidth / nodeCount / 2)
7171
for (let i = 0; i < nodeCount; i++) {
7272
const { width, height } = await nodes.nth(i).boundingBox()
7373
await expect(width).toBeGreaterThanOrEqual(nodeWidth)
7474
await expect(height).toBeGreaterThan(84)
75-
await expect(nodeLines.nth(i)).toHaveCSS('height', '4px')
75+
await expect(nodeLines.nth(i)).toHaveCSS('height', '1px')
7676
await expect(nodeIcons.nth(i)).toHaveClass(iconClasss[i])
7777
await expect(nodeTitles.nth(i)).toHaveText(titles[i])
7878
await expect(nodeDates.nth(i)).toHaveText(/2018-9/)
@@ -85,7 +85,7 @@ test('实心显示', async ({ page }) => {
8585
await expect(lineWidth).toBeGreaterThanOrEqual(0)
8686
}
8787
if (i < 2) {
88-
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '12px')
88+
await expect(nodeIcons.nth(i).locator('svg')).toHaveCSS('font-size', '24px')
8989
} else {
9090
await expect(nodeIcons.nth(i)).toHaveText(String(i - 1))
9191
}
@@ -98,6 +98,6 @@ test('实心显示', async ({ page }) => {
9898
await button.click()
9999

100100
for (let i = 0; i < 2; i++) {
101-
await expect(nodeIcons.nth(i)).toHaveCSS('background-color', 'rgb(94, 124, 224)')
101+
await expect(nodeIcons.nth(i)).toHaveCSS('background-color', 'rgb(25, 25, 25)')
102102
}
103103
})
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const tinyMilestoneAuroraTheme = {
2-
'ti-milestone-icon-color': '#1890ff'
2+
'tv-Milestone-icon-color': '#1890ff'
33
}

0 commit comments

Comments
 (0)