Match-id-bf925df05da50203ca4baf87357f2a25d21ca829
This commit is contained in:
parent
ef6fd2888a
commit
8a9fdd01a6
|
@ -13,7 +13,7 @@ env:
|
||||||
resource:
|
resource:
|
||||||
type: docker
|
type: docker
|
||||||
image: kweecr04.his.huawei.com:80/ecr-build-arm-gzkunpeng/euleros_v2r7spc522_x64_opmt_cs5.0_sz:v5.0
|
image: kweecr04.his.huawei.com:80/ecr-build-arm-gzkunpeng/euleros_v2r7spc522_x64_opmt_cs5.0_sz:v5.0
|
||||||
class: 4U8G
|
class: 8U16G
|
||||||
mode: toolbox
|
mode: toolbox
|
||||||
cache:
|
cache:
|
||||||
- type: workspace
|
- type: workspace
|
||||||
|
|
|
@ -33,6 +33,17 @@ const noUnitCSS = [
|
||||||
'zoom',
|
'zoom',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const length = noUnitCSS.length;
|
||||||
|
for (let i = 0; i < length; i++) {
|
||||||
|
const cssKey = noUnitCSS[i];
|
||||||
|
const attributeKey = cssKey.charAt(0).toUpperCase() + cssKey.slice(1);
|
||||||
|
|
||||||
|
// css 兼容性前缀 webkit: chrome, mo: IE或者Edge, Moz: 火狐
|
||||||
|
noUnitCSS.push('Webkit' + attributeKey);
|
||||||
|
noUnitCSS.push('mo' + attributeKey);
|
||||||
|
noUnitCSS.push('Moz' + attributeKey);
|
||||||
|
}
|
||||||
|
|
||||||
function isNeedUnitCSS(styleName: string) {
|
function isNeedUnitCSS(styleName: string) {
|
||||||
return !(
|
return !(
|
||||||
noUnitCSS.includes(styleName) ||
|
noUnitCSS.includes(styleName) ||
|
||||||
|
@ -78,6 +89,7 @@ export function setStyles(dom, styles) {
|
||||||
if (name.indexOf('--') === 0) {
|
if (name.indexOf('--') === 0) {
|
||||||
style.setProperty(name, styleVal);
|
style.setProperty(name, styleVal);
|
||||||
} else {
|
} else {
|
||||||
|
// 使用这种赋值方式,浏览器可以将'WebkitLineClamp', 'backgroundColor'分别识别为'-webkit-line-clamp'和'backgroud-color'
|
||||||
style[name] = adjustStyleValue(name, styleVal);
|
style[name] = adjustStyleValue(name, styleVal);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -83,6 +83,12 @@ describe('Dom Attribute', () => {
|
||||||
expect(window.getComputedStyle(div).getPropertyValue('height')).toBe('20px');
|
expect(window.getComputedStyle(div).getPropertyValue('height')).toBe('20px');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('WebkitLineClamp和lineClamp样式不会把数字转换成字符串或者追加"px"', () => {
|
||||||
|
Horizon.render(<div id={'div'} style={{ WebkitLineClamp: 2 }} />, container);
|
||||||
|
// 浏览器可以将WebkitLineClamp识别为-webkit-line-clamp,测试框架不可以
|
||||||
|
expect(container.querySelector('div').style.WebkitLineClamp).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
it('空字符串做属性名', () => {
|
it('空字符串做属性名', () => {
|
||||||
const emptyStringProps = { '': '' };
|
const emptyStringProps = { '': '' };
|
||||||
expect(() => {
|
expect(() => {
|
||||||
|
|
Loading…
Reference in New Issue