Skip to content

Commit

Permalink
Merge branch 'master' into feature-2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 authored Jul 7, 2017
2 parents 25a6032 + 631ca1c commit b653a2c
Show file tree
Hide file tree
Showing 90 changed files with 837 additions and 370 deletions.
48 changes: 48 additions & 0 deletions .jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const libDir = process.env.LIB_DIR;

const transformIgnorePatterns = [
'/dist/',
'/node_modules/reqwest',
];

if (libDir !== 'es') {
transformIgnorePatterns.push('/node_modules/');
}

module.exports = {
setupFiles: [
'./tests/setup.js',
],
moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
'json',
'md',
],
modulePathIgnorePatterns: [
'/_site/',
],
testPathIgnorePatterns: [
'/node_modules/',
'dekko',
'node',
],
transform: {
'\\.tsx?$': './node_modules/typescript-babel-jest',
'\\.js$': './node_modules/babel-jest',
'\\.md$': './node_modules/antd-demo-jest',
},
testRegex: libDir === 'dist' ? 'demo\\.test\\.js$' : '.*\\.test\\.js$',
collectCoverageFrom: [
'components/**/*.{ts,tsx}',
'!components/*/style/index.tsx',
'!components/style/index.tsx',
'!components/*/locale/index.tsx',
],
transformIgnorePatterns,
snapshotSerializers: [
'enzyme-to-json/serializer',
],
};
21 changes: 21 additions & 0 deletions .jest.node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
setupFiles: [
'./tests/setup.js',
],
moduleFileExtensions: [
'ts',
'tsx',
'js',
'md',
],
transform: {
'\\.tsx?$': './node_modules/typescript-babel-jest',
'\\.js$': './node_modules/babel-jest',
'\\.md$': './node_modules/antd-demo-jest',
},
testRegex: 'demo\\.test\\.js$',
testEnvironment: 'node',
snapshotSerializers: [
'enzyme-to-json/serializer'
],
};
19 changes: 0 additions & 19 deletions .jest.node.json

This file was deleted.

10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ script:
npm run lint
elif [ "$TEST_TYPE" = dist ]; then
npm run dist && \
node ./tests/dekko/dist.test.js
node ./tests/dekko/dist.test.js && \
LIB_DIR=dist npm test -- --coverage -w 2
elif [ "$TEST_TYPE" = compile ]; then
npm run dist && \
npm run compile && \
node ./tests/dekko/lib.test.js
node ./tests/dekko/lib.test.js && \
LIB_DIR=es npm test -- --coverage -w 2 && \
LIB_DIR=lib npm test -- --coverage -w 2
elif [ "$TEST_TYPE" = test:dom ]; then
npm run dist && \
npm test -- --coverage -w 2 && \
bash <(curl -s https://codecov.io/bash)
elif [ "$TEST_TYPE" = test:node ]; then
npm test -- --config .jest.node.json -w 2
npm run test-node -- -w 2
fi
12 changes: 4 additions & 8 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@ If you want to read change logs before `2.0.0`, please visit [GitHub](https://gi

---

## Next

- Increase click area of Table's sort and filter icon.[#6528](https://github.com/ant-design/ant-design/pull/6528)

## 2.11.2

`2017-06-25`

- Dropdown.Button now support getPopupContainer function.[#6527](https://github.com/ant-design/ant-design/pull/6527)
- Dropdown.Button now support `getPopupContainer` function. [#6527](https://github.com/ant-design/ant-design/pull/6527)
- Fix disabled dropdown submenu style error. [#6548](https://github.com/ant-design/ant-design/issues/6548)
- Fix background color error of Calendar. [#aaf2a](https://github.com/ant-design/ant-design/commit/aaf2a508bef96f81faf556036649b2a2fe5b635b)
- Fix background color error of Calendar. [aaf2a50](https://github.com/ant-design/ant-design/commit/aaf2a508bef96f81faf556036649b2a2fe5b635b)
- Select of Calendar now take place in header. [#6479](https://github.com/ant-design/ant-design/pull/6479)
- Fix horia horizontal scroll error of Input and Textarea. [#6577](https://github.com/ant-design/ant-design/issues/6577)
- Improve document of `disabled` attribute of Checkbox and Radio. [#6597](https://github.com/ant-design/ant-design/pull/6597)
- Increase click area of Table's sort and filter icon.[#6528](https://github.com/ant-design/ant-design/pull/6528)
- Add `event:Event` parameter of Table.props.onRowClick. [#e2a99f5](https://github.com/ant-design/ant-design/commit/e2a99f53f7a27bd7de4adf99d0e1ee755b537c72)
- Increase click area of Table's sort and filter icon. [#6528](https://github.com/ant-design/ant-design/pull/6528)
- Add `event:Event` parameter of Table.props.onRowClick. [e2a99f5](https://github.com/ant-design/ant-design/commit/e2a99f53f7a27bd7de4adf99d0e1ee755b537c72)

## 2.11.1

Expand Down
8 changes: 4 additions & 4 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ timeline: true

`2017-06-25`

- Dropdown.Button 现在也支持 getPopupContainer 方法[#6527](https://github.com/ant-design/ant-design/pull/6527)
- 修复 Dropdown 子菜单 disabled 时的样式错误问题。 [#6548](https://github.com/ant-design/ant-design/issues/6548)
- 修复 Calendar 的背景颜色问题。 [#aaf2a](https://github.com/ant-design/ant-design/commit/aaf2a508bef96f81faf556036649b2a2fe5b635b)
- 修复 Dropdown.Button 不支持 `getPopupContainer` 方法的问题[#6527](https://github.com/ant-design/ant-design/pull/6527)
- 修复 Dropdown 子菜单 disabled 时的样式错误问题。[#6548](https://github.com/ant-design/ant-design/issues/6548)
- 修复 Calendar 的背景颜色问题。 [aaf2a50](https://github.com/ant-design/ant-design/commit/aaf2a508bef96f81faf556036649b2a2fe5b635b)
- Calender 的下拉菜单现在在 header 中显示。[#6479](https://github.com/ant-design/ant-design/pull/6479)
- 修复 Input 和 Textarea 横向滚动的问题。[#6577](https://github.com/ant-design/ant-design/issues/6577)
- 补充了 Checkbox 和 Radio 的 `disabled` 属性文档。[#6597](https://github.com/ant-design/ant-design/pull/6597)
- 增大了 Table 的排序和过滤图标的可点击区域。[#6528](https://github.com/ant-design/ant-design/pull/6528)
- 为 Table.props.onRowClick 函数增加了 event: Event 参数。[#e2a99f5](https://github.com/ant-design/ant-design/commit/e2a99f53f7a27bd7de4adf99d0e1ee755b537c72)
- 为 Table.props.onRowClick 函数增加了 event: Event 参数。[e2a99f5](https://github.com/ant-design/ant-design/commit/e2a99f53f7a27bd7de4adf99d0e1ee755b537c72)

## 2.11.1

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ See [i18n](http://ant.design/docs/react/i18n).
- [Home page](http://ant.design/)
- [UI library](http://ant.design/docs/react/introduce)
- [Change Log](CHANGELOG.en-US.md)
- [Offcial Scaffold Tool](https://github.com/dvajs/dva-cli/)
- [Official Scaffold Tool](https://github.com/dvajs/dva-cli/)
- [Development Tool](http://ant-tool.github.io/)
- [Scaffold Market](http://scaffold.ant.design)
- [rc-components](http://react-component.github.io/)
Expand Down
12 changes: 8 additions & 4 deletions components/_util/getLocale.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import assign from 'object-assign';

export function getComponentLocale(props, context, componentName, getDefaultLocale) {
let locale: any = {};
if (context && context.antLocale && context.antLocale[componentName]) {
Expand All @@ -11,8 +9,14 @@ export function getComponentLocale(props, context, componentName, getDefaultLoca
locale = defaultLocale.default || defaultLocale;
}

const result = assign({}, locale, props.locale);
result.lang = assign({}, locale.lang, props.locale.lang);
const result = {
...locale,
...props.locale,
};
result.lang = {
...locale.lang,
...props.locale.lang,
};
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion components/avatar/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Avatars can be used to represent people or object, which supports image, antd-Ic

| Property | Description | Type | Default |
|----------- |--------------------------------------------------------- | ---------- |-------|
| type | to set the shape of avatar | Enum{ 'circle', 'square' } | `circle` |
| shape | to set the shape of avatar | Enum{ 'circle', 'square' } | `circle` |
| size | to set the size of avatar | Enum{ 'large', 'small', 'default' } | `default` |
| src | the address of a image avatar | string | - |
| icon | the icon type of a icon avatar, see `Icon` Component | string | - |
18 changes: 18 additions & 0 deletions components/back-top/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { mount } from 'enzyme';
import BackTop from '..';

const delay = timeout => new Promise(resolve => setTimeout(resolve, timeout));

describe('BackTop', () => {
it('should scroll to top after click it', async () => {
const wrapper = mount(<BackTop visibilityHeight={-1} />);
document.documentElement.scrollTop = 400;
// trigger scroll manually
wrapper.node.handleScroll();
await delay(500);
wrapper.find('.ant-back-top').simulate('click');
await delay(500);
expect(Math.round(document.documentElement.scrollTop)).toBe(0);
});
});
24 changes: 15 additions & 9 deletions components/badge/ScrollNumber.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { createElement, Component } from 'react';
import assign from 'object-assign';
import omit from 'omit.js';
import classNames from 'classnames';

function getNumberArray(num) {
return num ?
Expand Down Expand Up @@ -119,24 +119,30 @@ export default class ScrollNumber extends Component<ScrollNumberProps, any> {
}

render() {
const { prefixCls, className, style, component = 'sup' } = this.props;
// fix https://fb.me/react-unknown-prop
const props = assign({}, omit(this.props, [
const restProps = omit(this.props, [
'count',
'onAnimated',
'component',
'prefixCls',
]), {
className: `${this.props.prefixCls} ${this.props.className}`,
});
]);
const newProps = {
...restProps,
className: classNames({
[`${prefixCls}`]: !!prefixCls,
[`${className}`]: !!className,
}),
};
// allow specify the border
// mock border-color by box-shadow for compatible with old usage:
// <Badge count={4} style={{ backgroundColor: '#fff', color: '#999', borderColor: '#d9d9d9' }} />
if (props.style && props.style.borderColor) {
props.style.boxShadow = `0 0 0 1px ${props.style.borderColor} inset`;
if (style && style.borderColor) {
newProps.style.boxShadow = `0 0 0 1px ${style.borderColor} inset`;
}
return createElement(
(this.props.component || 'sup') as any,
props,
component as any,
newProps,
this.renderNumberElement(),
);
}
Expand Down
14 changes: 14 additions & 0 deletions components/card/Grid.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import classNames from 'classnames';

export interface CardGridProps {
prefixCls?: string;
style?: React.CSSProperties;
className?: string;
}

export default (props: CardGridProps) => {
const { prefixCls = 'ant-card', className, ...others } = props;
const classString = classNames(`${prefixCls}-grid`, className);
return <div {...others} className={classString} />;
};
65 changes: 64 additions & 1 deletion components/card/__tests__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,70 @@ exports[`renders ./components/card/demo/border-less.md correctly 1`] = `
</div>
`;

exports[`renders ./components/card/demo/grid.md correctly 1`] = `
exports[`renders ./components/card/demo/grid-card.md correctly 1`] = `
<div
class="ant-card ant-card-bordered ant-card-no-hovering"
>
<div
class="ant-card-head"
>
<h3
class="ant-card-head-title"
>
卡片标题
</h3>
</div>
<div
class="ant-card-body"
style="padding:0;"
>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
卡片内容
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
卡片内容
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
卡片内容
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
卡片内容
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
卡片内容
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
卡片内容
</div>
<div
class="ant-card-grid"
style="width:25%;text-align:center;"
>
卡片内容
</div>
</div>
</div>
`;

exports[`renders ./components/card/demo/in-column.md correctly 1`] = `
<div
style="background:#ECECEC;padding:30px;"
>
Expand Down
35 changes: 35 additions & 0 deletions components/card/demo/grid-card.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
order: 6
title:
zh-CN: 网格型内嵌卡片
en-US: Grid card
---

## zh-CN

一种常见的卡片内容区隔模式。

## en-US

Grid style card content.

````jsx
import { Card } from 'antd';

const gridStyle = {
width: '25%',
textAlign: 'center',
};

ReactDOM.render(
<Card title="卡片标题" noHovering bodyStyle={{ padding: 0 }}>
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
<Card.Grid style={gridStyle}>卡片内容</Card.Grid>
</Card>
, mountNode);
````
Loading

0 comments on commit b653a2c

Please sign in to comment.