Skip to content

Commit

Permalink
Merge pull request #151 from n7best/master
Browse files Browse the repository at this point in the history
fix test dependency, add babel polyfill notice to read me
  • Loading branch information
n7best committed Nov 16, 2016
2 parents bd3b50e + 168e837 commit b91ebd3
Show file tree
Hide file tree
Showing 47 changed files with 52 additions and 2,390 deletions.
7 changes: 6 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"presets": ['es2015', 'stage-2', 'react'],
"plugins": ['transform-class-properties', 'add-module-exports']
"plugins": ['transform-class-properties', 'add-module-exports'],
"env": {
"test": {
"plugins": [ "istanbul" ]
}
}
}
6 changes: 5 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@
},
"plugins": [
"react"
]
],
"globals": {
"it": true,
"describe": true,
}
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ node_modules
npm-debug.log
.DS_Store
publish.sh
.c9
.c9
pendingtest
.nyc_output
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ script:
- npm test
- npm run coverage
before_install:
npm install react
npm install --save react@15.4.0 react-dom@15.4.0
after_script:
npm install coveralls && cat ./coverage/lcov.info | coveralls
npm install coveralls && nyc report --reporter=text-lcov | coveralls
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ With [npm](http://npmjs.com/):
If React is not installed

```
npm install react weui@0.4.3 react-weui --save
npm install --save react@15.4.0 react-dom@15.4.0
npm install --save weui@0.4.3 react-weui
```

With React Installed
Expand All @@ -33,6 +34,8 @@ With React Installed
npm install weui@0.4.3 react-weui --save
```

Due to the browser compatibility issues, react-weui required [babel polyfill](https://babeljs.io/docs/usage/polyfill/) to work

## Example

We have several examples on the documentation. Here is the first one to get you started:
Expand Down
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"build:page": "npm run build:example && npm run build:doc",
"lint": "eslint 'src/**/*.@(js|jsx)'",
"pretest": "npm run lint",
"test": "mocha --compilers js:babel-core/register --recursive",
"test": "mocha --compilers js:babel-core/register --recursive -r ignore-styles -r jsdom-global/register",
"test:watch": "npm run test -- --watch",
"coverage": "npm run lint & istanbul cover _mocha -- --compilers js:babel-core/register --recursive",
"coverage": "npm run lint & nyc --require babel-core/register mocha -r ignore-styles -r jsdom-global/register && nyc report --reporter=lcov",
"c9startdoc": "webpack-dev-server --config webpack.config.doc.js --hot --inline --progress --colors --host $IP --port $PORT",
"c9start": "webpack-dev-server --hot --inline --progress --colors --host $IP --port $PORT"
},
Expand Down Expand Up @@ -48,6 +48,7 @@
"babel-eslint": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-istanbul": "^3.0.0",
"babel-plugin-transform-class-properties": "^6.18.0",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
Expand All @@ -57,7 +58,7 @@
"babel-standalone": "^6.18.2",
"codemirror": "^5.20.2",
"css-loader": "^0.23.0",
"enzyme": "^1.1.0",
"enzyme": "^2.6.0",
"eslint": "^1.10.3",
"eslint-plugin-react": "^3.11.3",
"extract-text-webpack-plugin": "^1.0.1",
Expand All @@ -66,20 +67,21 @@
"github-markdown-css": "^2.4.1",
"history": "^1.17.0",
"html-webpack-plugin": "^2.14.0",
"istanbul": "^0.4.1",
"jsdom": "^8.4.0",
"ignore-styles": "^5.0.1",
"jsdom": "9.8.3",
"jsdom-global": "2.1.0",
"json-loader": "^0.5.4",
"less": "^2.5.3",
"less-loader": "^2.2.1",
"mocha": "^2.3.4",
"nyc": "^9.0.1",
"open-browser-webpack-plugin": "0.0.1",
"postcss-loader": "^0.8.2",
"raw-loader": "^0.5.1",
"react-addons-css-transition-group": "^0.14.7",
"react-addons-test-utils": "^0.14.3",
"react-addons-css-transition-group": "^0.14.7 || ^15.0.0-0 || 15.x",
"react-addons-test-utils": "^0.14.3 || ^15.0.0-0 || 15.x",
"react-codemirror": "^0.2.6",
"react-docgen": "^2.12.1",
"react-dom": "^0.14.2",
"react-fontawesome": "^1.3.1",
"react-remarkable": "^1.1.1",
"react-router": "^1.0.2",
Expand All @@ -95,6 +97,7 @@
"weui": "^1.0.2"
},
"peerDependencies": {
"react": "^0.14.2 || ^15.0.1"
"react": "0.14.x || ^15.0.0-0 || 15.x",
"react-dom": "^0.14.x || ^15.0.0-0 || 15.x"
}
}
2 changes: 1 addition & 1 deletion src/components/msg/msg.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Msg extends Component {
[className]: className
})

let elFooter = footer;
let elFooter = footer ? footer : ()=>false;

if(!elFooter && (extraHref || extraText) ){
deprecationWarning('Msg extraHref/extraText', 'Msg footer')
Expand Down
91 changes: 0 additions & 91 deletions test/actionsheet.js

This file was deleted.

64 changes: 0 additions & 64 deletions test/article.js

This file was deleted.

34 changes: 19 additions & 15 deletions test/button.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* Created by jf on 15/12/9.
*/

"use strict";

import React from 'react';
import { shallow } from 'enzyme';
import assert from 'assert';
Expand All @@ -13,6 +7,16 @@ const {Button} = WeUI;

describe('<Button></Button>', () => {

describe(`<Button type="vcode"></Button>`, ()=> {
let wrapper = shallow(
<Button type="vcode">ok</Button>
);

it(`should have class with "weui-vcode-btn"`, ()=> {
assert(wrapper.hasClass('weui-vcode-btn'));
});
});

['primary', 'default', 'warn'].map((type)=> {
['normal', 'small'].map((size)=> {
[true, false].map((disabled)=> {
Expand Down Expand Up @@ -50,28 +54,28 @@ describe('<Button></Button>', () => {
}
});

it(`should have class with "weui_btn" & weui_btn_${type}`, ()=> {
assert(wrapper.hasClass('weui_btn'));
assert(wrapper.hasClass(`weui_btn_${type}`));
it(`should have class with "weui-btn" & weui-btn_${type}`, ()=> {
assert(wrapper.hasClass('weui-btn'));
assert(wrapper.hasClass(`weui-btn_${type}`));
});


it(`should have class with "weui_btn_mini" when size is 'small'`, ()=> {
it(`should have class with "weui-btn_mini" when size is 'small'`, ()=> {
if (size === 'small') {
assert(wrapper.hasClass('weui_btn_mini'));
assert(wrapper.hasClass('weui-btn_mini'));
}
else {
assert(!wrapper.hasClass('weui_btn_mini'));
assert(!wrapper.hasClass('weui-btn_mini'));
}
});

it(`should have class with "weui_btn_disabled" and "disabled" attribute when disabled is true`, ()=> {
it(`should have class with "weui-btn_disabled" and "disabled" attribute when disabled is true`, ()=> {
if (disabled) {
assert(wrapper.hasClass('weui_btn_disabled'));
assert(wrapper.hasClass('weui-btn_disabled'));
assert(wrapper.prop('disabled'))
}
else {
assert(!wrapper.hasClass('weui_btn_disabled'));
assert(!wrapper.hasClass('weui-btn_disabled'));
assert(!wrapper.prop('disabled'));
}
});
Expand Down
Loading

0 comments on commit b91ebd3

Please sign in to comment.