Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jinli.lyy committed Jan 31, 2019
2 parents 625b2d7 + 888a8eb commit 7a0740d
Show file tree
Hide file tree
Showing 16 changed files with 130 additions and 93 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

<a name="1.12.3"></a>
## [1.12.3](https://github.com/alibaba-fusion/next/compare/1.12.2...1.12.3) (2019-01-28)


### Bug Fixes

* **Pagination:** locale text error ([406c198](https://github.com/alibaba-fusion/next/commit/406c198))
* **Tab:** extra is covered by other elements ([c3d913f](https://github.com/alibaba-fusion/next/commit/c3d913f))
* **Tab:** inproperly focus when using with field ([0d3bd2c](https://github.com/alibaba-fusion/next/commit/0d3bd2c))




<a name="1.12.2"></a>
## [1.12.2](https://github.com/alibaba-fusion/next/compare/1.12.1...1.12.2) (2019-01-28)

Expand Down
6 changes: 4 additions & 2 deletions LATESTLOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Latest Log

## [1.12.2](https://github.com/alibaba-fusion/next/compare/1.12.1...1.12.2) (2019-01-28)
## [1.12.3](https://github.com/alibaba-fusion/next/compare/1.12.2...1.12.3) (2019-01-28)


### Bug Fixes

* **Util:** DO NOT process any non-string type value ([2a3280f](https://github.com/alibaba-fusion/next/commit/2a3280f))
* **Pagination:** locale text error ([406c198](https://github.com/alibaba-fusion/next/commit/406c198))
* **Tab:** extra is covered by other elements ([c3d913f](https://github.com/alibaba-fusion/next/commit/c3d913f))
* **Tab:** inproperly focus when using with field ([0d3bd2c](https://github.com/alibaba-fusion/next/commit/0d3bd2c))


36 changes: 26 additions & 10 deletions docs/icon/demo/size.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

- order: 2

ICON的尺寸包括:`xxs``xs``small``medium``large``xl``xxl``xxxl`
ICON的尺寸包括:`xxs``xs``small``medium``large``xl``xxl``xxxl`, `inherit`

:::lang=en-us
# Size

- order: 2

ICON's sizes include:`xxs``xs``small``medium``large``xl``xxl``xxxl`
ICON's sizes include:`xxs``xs``small``medium``large``xl``xxl``xxxl`, `inherit`

:::
---
Expand All @@ -18,15 +18,31 @@ ICON's sizes include:`xxs`,`xs`,`small`,`medium`,`large`,`xl`,`xxl`
import { Icon } from '@alifd/next';

const sizes = ['xxs', 'xs', 'small', 'medium', 'large', 'xl', 'xxl', 'xxxl'];

const inherit = 'inherit';
ReactDOM.render((
<ul className="icon-sizes">
{sizes.map((size, index) => (
<li key={index}>
<Icon type="smile" size={size} />
<span>{size}</span>
</li>))}
</ul>
<div>
<ul className="icon-sizes">
{sizes.map((size, index) => (
<li key={index}>
<Icon type="smile" size={size} />
<span>{size}</span>
</li>))}
</ul>

<span>{inherit}</span>
<h4>
Shall I compare thee to a summer's day? <Icon type="smile" size={inherit} /> <Icon type="set" size={inherit} />
</h4>
<h3>
Thou art more lovely and more temperate. <Icon type="smile" size={inherit} /> <Icon type="set" size={inherit} />
</h3>
<h2>
Rough winds do shake the darling buds of May, <Icon type="smile" size={inherit} /> <Icon type="set" size={inherit} />
</h2>
<h1>
And summer's lease hath all too short a date. <Icon type="smile" size={inherit} /> <Icon type="set" size={inherit} />
</h1>
</div>
), mountNode);

````
Expand Down
2 changes: 1 addition & 1 deletion docs/icon/index.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@

| Param | Descripiton | Type | Default Value |
| ---- | ---------------------------------------------------- | -------- | ------------ |
| size | To set the icon size<br><br>**option**:<br>'xxs', 'xs', 'small', 'medium', 'large', 'xl', 'xxl', 'xxxl' | Enum | 'medium' |
| size | To set the icon size<br><br>**option**:<br>'xxs', 'xs', 'small', 'medium', 'large', 'xl', 'xxl', 'xxxl', 'inherit' | Enum | 'medium' |
| type | Specify which icon to display | String | - |
8 changes: 4 additions & 4 deletions docs/icon/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

### Icon

| 参数 | 说明 | 类型 | 默认值 |
| ---- | -------------------------------------------------------------------------------------- | ------ | -------- |
| size | 指定图标大小<br><br>**可选值**:<br>'xxs', 'xs', 'small', 'medium', 'large', 'xl', 'xxl', 'xxxl' | Enum | 'medium' |
| type | 指定显示哪种图标 | String | - |
| 参数 | 说明 | 类型 | 默认值 |
| ---- | ------------------------------------------------------------------------------------------------- | ------ | -------- |
| size | 指定图标大小<br><br>**可选值**:<br>'xxs', 'xs', 'small', 'medium', 'large', 'xl', 'xxl', 'xxxl', 'inherit' | Enum | 'medium' |
| type | 指定显示哪种图标 | String | - |
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var next = require('./lib/index.js');

next.version = '1.12.2';
next.version = '1.12.3';

module.exports = next;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alifd/next",
"version": "1.12.2",
"version": "1.12.3",
"description": "A configurable component library for web built on React.",
"keywords": [
"fusion",
Expand Down
26 changes: 12 additions & 14 deletions src/checkbox/checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,21 @@ class Checkbox extends UIState {
super(props);

let checked, indeterminate;
if (context.__group__) {
indeterminate = false;
checked = isChecked(context.selectedValue, props.value);
} else {
if ('checked' in props) {
checked = props.checked;
} else {
checked = props.defaultChecked;
}

if ('indeterminate' in props) {
indeterminate = props.indeterminate;
} else {
indeterminate = props.defaultIndeterminate;
}
if ('checked' in props) {
checked = props.checked;
} else {
checked = props.defaultChecked;
}

if ('indeterminate' in props) {
indeterminate = props.indeterminate;
} else {
indeterminate = props.defaultIndeterminate;
}
if (context.__group__) {
checked = isChecked(context.selectedValue, props.value);
}
this.state = {
checked,
indeterminate
Expand Down
44 changes: 23 additions & 21 deletions src/core/util/_mixin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -416,27 +416,29 @@
}

// Chrome不支持小于12px的字体,故采用缩放的方式缩小字体
@if ($size < 12) {
@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {
@if ($transform) {
transform: scale($size / $icon-s) $transform;
} @else {
transform: scale($size / $icon-s);
}
@if ($marginLeft) {
margin-left: $marginLeft - ($icon-s - $size) / 2;
} @else {
margin-left: -($icon-s - $size) / 2;
}
@if ($marginRight) {
margin-right: $marginRight - ($icon-s - $size) / 2;
} @else {
margin-right: -($icon-s - $size) / 2;
}

&:before {
width: $icon-s;
font-size: $icon-s;
@if (type-of($size) == 'number') {
@if ($size < 12) {
@media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {
@if ($transform) {
transform: scale($size / $icon-s) $transform;
} @else {
transform: scale($size / $icon-s);
}
@if ($marginLeft) {
margin-left: $marginLeft - ($icon-s - $size) / 2;
} @else {
margin-left: -($icon-s - $size) / 2;
}
@if ($marginRight) {
margin-right: $marginRight - ($icon-s - $size) / 2;
} @else {
margin-right: -($icon-s - $size) / 2;
}

&:before {
width: $icon-s;
font-size: $icon-s;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/icon/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Icon extends Component {
/**
* 指定图标大小
*/
size: PropTypes.oneOf(['xxs', 'xs', 'small', 'medium', 'large', 'xl', 'xxl', 'xxxl']),
size: PropTypes.oneOf(['xxs', 'xs', 'small', 'medium', 'large', 'xl', 'xxl', 'xxxl', 'inherit']),
className: PropTypes.string
};

Expand Down
4 changes: 4 additions & 0 deletions src/icon/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,8 @@
&xxxl {
@include icon-size($icon-xxxl);
}

&inherit {
@include icon-size(inherit);
}
}
1 change: 0 additions & 1 deletion src/progress/view/progress-circle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export default class Circle extends Component {
<div
className={wrapCls}
dir={rtl ? 'rtl' : undefined}
tabIndex="0"
role="progressbar"
aria-valuenow={percent}
aria-valuemin="0"
Expand Down
1 change: 0 additions & 1 deletion src/progress/view/progress-line.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default class Line extends React.PureComponent {
return (
<div
dir={rtl ? 'rtl' : undefined}
tabIndex="0"
role="progressbar"
aria-valuenow={percent}
aria-valuemin="0"
Expand Down
11 changes: 11 additions & 0 deletions test/checkbox/group-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,15 @@ describe('Checkbox.Group', () => {
assert.deepEqual(wrapper.dive().state().value, [1]);
});
});

describe('should respect children\'s indeternimate state', () => {
it('should support value === 0', () => {

const wrapper1 = mount(<CheckboxGroup ><Checkbox defaultIndeterminate={true} >1</Checkbox></CheckboxGroup>);
const wrapper2 = mount(<CheckboxGroup ><Checkbox indeterminate={true} >1</Checkbox></CheckboxGroup>);

assert(wrapper1.find('.indeterminate').length === 1);
assert(wrapper2.find('.indeterminate').length === 1);
});
});
});
29 changes: 29 additions & 0 deletions test/progress/a11y-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import Progress from '../../src/progress/index';
import '../../src/progress/style.js';
import a11y from '../util/a11y';

Enzyme.configure({ adapter: new Adapter() });

/* eslint-disable no-undef, react/jsx-filename-extension */
describe('Progress A11y', () => {
let wrapper;

afterEach(() => {
if (wrapper) {
wrapper.unmount();
wrapper = null;
}
a11y.afterEach();
});

it('should not have any violations for Line Progress', (done) => {
wrapper = a11y.test(<Progress percent={30} />, done, { incomplete: true });
});

it('should not have any violations for Circle Progress', (done) => {
wrapper = a11y.test(<Progress shape="circle" percent={30} />, done, { incomplete: true });
});
});
36 changes: 0 additions & 36 deletions test/progress/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import React from 'react';
import Enzyme, { mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import assert from 'power-assert';
import Axe from 'axe-core';
import Progress from '../../src/progress/index';
import '../../src/progress/style.js';

Enzyme.configure({ adapter: new Adapter() });

Expand Down Expand Up @@ -65,23 +63,6 @@ describe('Line', () => {
assert(wrapper.find('.next-progress-line-overlay-finishing').length === 1);
});
});

describe('a11y', () => {
it('should not have any violations', (done) => {
const div = document.createElement('div');
document.body.appendChild(div);
mount(<Progress percent={30} />, { attachTo: div });

Axe.run('.next-progress-line', {}, function(error, results) {
if (error) {
return error;
}

assert(results.violations.length === 0);
done();
});
});
});
});

describe('Circle', () => {
Expand Down Expand Up @@ -130,23 +111,6 @@ describe('Circle', () => {
assert(wrapper.find('.next-progress-circle-overlay-finishing').length === 1);
});
});

describe('a11y', () => {
it('should not have any violations', (done) => {
const div = document.createElement('div');
document.body.appendChild(div);
mount(<Progress shape="circle" percent={30} />, { attachTo: div });

Axe.run('.next-progress-circle', {}, function(error, results) {
if (error) {
return error;
}

assert(results.violations.length === 0);
done();
});
});
});
});


0 comments on commit 7a0740d

Please sign in to comment.