Skip to content

Commit 2ae4de6

Browse files
committed
test: Update snapshots
1 parent 6b29255 commit 2ae4de6

File tree

7 files changed

+139
-10
lines changed

7 files changed

+139
-10
lines changed

snapshots/alipay/alipay.axml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

snapshots/alipay/alipay.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Component({
77
size: 18,
88
},
99
data: {
10+
colors: '',
1011
quot: '"',
1112
svgSize: 18,
1213
isStr: true,
@@ -16,6 +17,7 @@ Component({
1617
const color = this.props.color;
1718

1819
this.setData({
20+
colors: this.fixColor(color),
1921
isStr: typeof color === 'string',
2022
});
2123

@@ -31,6 +33,7 @@ Component({
3133

3234
if (color !== prevProps.color) {
3335
this.setData({
36+
colors: this.fixColor(color),
3437
isStr: typeof color === 'string',
3538
});
3639
}
@@ -41,4 +44,34 @@ Component({
4144
});
4245
}
4346
},
47+
methods: {
48+
fixColor: function() {
49+
var color = this.props.color;
50+
var hex2rgb = this.hex2rgb;
51+
52+
if (typeof color === 'string') {
53+
return color.indexOf('#') === 0 ? hex2rgb(color) : color;
54+
}
55+
56+
return color.map(function (item) {
57+
return item.indexOf('#') === 0 ? hex2rgb(item) : item;
58+
});
59+
},
60+
hex2rgb: function(hex) {
61+
var rgb = [];
62+
63+
hex = hex.substr(1);
64+
65+
if (hex.length === 3) {
66+
hex = hex.replace(/(.)/g, '$1$1');
67+
}
68+
69+
hex.replace(/../g, function(color) {
70+
rgb.push(parseInt(color, 0x10));
71+
return color;
72+
});
73+
74+
return 'rgb(' + rgb.join(',') + ')';
75+
}
76+
}
4477
});

snapshots/baidu/baidu.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Component({
1010
value: '',
1111
observer: function(color) {
1212
this.setData({
13+
colors: this.fixColor(color),
1314
isStr: typeof color === 'string',
1415
});
1516
}
@@ -25,8 +26,39 @@ Component({
2526
},
2627
},
2728
data: {
28-
quot: '"',
29+
colors: '',
2930
svgSize: 18,
31+
quot: '"',
3032
isStr: true,
3133
},
34+
methods: {
35+
fixColor: function() {
36+
var color = this.data.color;
37+
var hex2rgb = this.hex2rgb;
38+
39+
if (typeof color === 'string') {
40+
return color.indexOf('#') === 0 ? hex2rgb(color) : color;
41+
}
42+
43+
return color.map(function (item) {
44+
return item.indexOf('#') === 0 ? hex2rgb(item) : item;
45+
});
46+
},
47+
hex2rgb: function(hex) {
48+
var rgb = [];
49+
50+
hex = hex.substr(1);
51+
52+
if (hex.length === 3) {
53+
hex = hex.replace(/(.)/g, '$1$1');
54+
}
55+
56+
hex.replace(/../g, function(color) {
57+
rgb.push(parseInt(color, 0x10));
58+
return color;
59+
});
60+
61+
return 'rgb(' + rgb.join(',') + ')';
62+
}
63+
}
3264
});

snapshots/baidu/baidu.swan

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

snapshots/kuaishou/kuaishou.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Component({
99
type: null,
1010
observer: function(color) {
1111
this.setData({
12+
colors: this.fixColor(),
1213
isStr: typeof color === 'string',
1314
});
1415
}
@@ -24,8 +25,39 @@ Component({
2425
},
2526
},
2627
data: {
28+
colors: '',
2729
svgSize: 18,
2830
quot: '"',
2931
isStr: true,
3032
},
33+
methods: {
34+
fixColor: function() {
35+
var color = this.data.color;
36+
var hex2rgb = this.hex2rgb;
37+
38+
if (typeof color === 'string') {
39+
return color.indexOf('#') === 0 ? hex2rgb(color) : color;
40+
}
41+
42+
return color.map(function (item) {
43+
return item.indexOf('#') === 0 ? hex2rgb(item) : item;
44+
});
45+
},
46+
hex2rgb: function(hex) {
47+
var rgb = [];
48+
49+
hex = hex.substr(1);
50+
51+
if (hex.length === 3) {
52+
hex = hex.replace(/(.)/g, '$1$1');
53+
}
54+
55+
hex.replace(/../g, function(color) {
56+
rgb.push(parseInt(color, 0x10));
57+
return color;
58+
});
59+
60+
return 'rgb(' + rgb.join(',') + ')';
61+
}
62+
}
3163
});

snapshots/toutiao/toutiao.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Component({
1010
value: '',
1111
observer: function(color) {
1212
this.setData({
13+
colors: this.fixColor(),
1314
isStr: typeof color === 'string',
1415
});
1516
}
@@ -25,8 +26,39 @@ Component({
2526
},
2627
},
2728
data: {
29+
colors: '',
2830
svgSize: 18 / 750 * tt.getSystemInfoSync().windowWidth,
2931
quot: '"',
3032
isStr: true,
3133
},
34+
methods: {
35+
fixColor: function() {
36+
var color = this.data.color;
37+
var hex2rgb = this.hex2rgb;
38+
39+
if (typeof color === 'string') {
40+
return color.indexOf('#') === 0 ? hex2rgb(color) : color;
41+
}
42+
43+
return color.map(function (item) {
44+
return item.indexOf('#') === 0 ? hex2rgb(item) : item;
45+
});
46+
},
47+
hex2rgb: function(hex) {
48+
var rgb = [];
49+
50+
hex = hex.substr(1);
51+
52+
if (hex.length === 3) {
53+
hex = hex.replace(/(.)/g, '$1$1');
54+
}
55+
56+
hex.replace(/../g, function(color) {
57+
rgb.push(parseInt(color, 0x10));
58+
return color;
59+
});
60+
61+
return 'rgb(' + rgb.join(',') + ')';
62+
}
63+
}
3264
});

snapshots/toutiao/toutiao.ttml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)