Merge f806c4c420 into 5a42eae90f
This commit is contained in:
commit
62d6127867
7 changed files with 1255 additions and 35 deletions
2
.babelrc
2
.babelrc
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"presets": ["env"],
|
"presets": ["env", "flow"],
|
||||||
"plugins": ["transform-react-jsx"]
|
"plugins": ["transform-react-jsx"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
.flowconfig
Normal file
9
.flowconfig
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
[ignore]
|
||||||
|
|
||||||
|
[include]
|
||||||
|
|
||||||
|
[libs]
|
||||||
|
|
||||||
|
[options]
|
||||||
|
|
||||||
|
[lints]
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -3,3 +3,5 @@
|
||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
/.vagrant
|
/.vagrant
|
||||||
|
lib/
|
||||||
|
testlib/
|
||||||
14
package.json
14
package.json
|
|
@ -7,23 +7,31 @@
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "LGPL-2.1",
|
"license": "LGPL-2.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack"
|
"build": "webpack",
|
||||||
|
"flow-tests": "babel tests/ -d testlib/",
|
||||||
|
"flow-src": "babel src/ -d lib/"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"babel-cli": "^6.24.1",
|
||||||
"babel-core": "^6.25.0",
|
"babel-core": "^6.25.0",
|
||||||
"babel-loader": "^7.0.0",
|
"babel-loader": "^7.0.0",
|
||||||
"babel-plugin-transform-react-jsx": "^6.24.1",
|
"babel-plugin-transform-react-jsx": "^6.24.1",
|
||||||
"babel-preset-env": "^1.5.2",
|
"babel-preset-env": "^1.5.2",
|
||||||
|
"babel-preset-flow": "^6.23.0",
|
||||||
"copy-webpack-plugin": "~3.0.1",
|
"copy-webpack-plugin": "~3.0.1",
|
||||||
|
"enzyme": "^2.9.1",
|
||||||
"eslint": "^3.0.0",
|
"eslint": "^3.0.0",
|
||||||
"eslint-loader": "~1.6.1",
|
"eslint-loader": "~1.6.1",
|
||||||
"eslint-plugin-react": "~6.9.0",
|
"eslint-plugin-react": "~6.9.0",
|
||||||
|
"flow-bin": "^0.49.1",
|
||||||
"jshint": "~2.9.1",
|
"jshint": "~2.9.1",
|
||||||
"jshint-loader": "~0.8.3",
|
"jshint-loader": "~0.8.3",
|
||||||
|
"react-test-renderer": "^15.6.1",
|
||||||
|
"tape": "^4.7.0",
|
||||||
"webpack": "^2.6.1"
|
"webpack": "^2.6.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^15.6.0",
|
"react": "^15.6.1",
|
||||||
"react-dom": "^15.6.0"
|
"react-dom": "^15.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
22
src/components/test-component.js
Normal file
22
src/components/test-component.js
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
|
||||||
|
function TestComponent(props) {
|
||||||
|
return (
|
||||||
|
<p>Hello {props.name}</p>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class TestApp extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className="testing">
|
||||||
|
This is just a test
|
||||||
|
<TestComponent name="Sean"/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
20
tests/concept.test.js
Normal file
20
tests/concept.test.js
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
// @flow
|
||||||
|
import React from 'react'
|
||||||
|
import { shallow, mount, ShallowWrapper } from 'enzyme';
|
||||||
|
|
||||||
|
import TestApp, { TestComponent } from "../lib/components/test-component";
|
||||||
|
|
||||||
|
|
||||||
|
var test = require('tape'); // assign the tape library to the variable "test"
|
||||||
|
|
||||||
|
test('should return -1 when the value is not present in Array', (t) => {
|
||||||
|
let testArray: Array<number> = [1, 2, 3];
|
||||||
|
t.equal(-1, testArray.indexOf(4)); // 4 is not present in this array so passes
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("should have 'Sean' in the TestComponent sub-component", (t) => {
|
||||||
|
const app: ShallowWrapper = shallow(<TestApp />);
|
||||||
|
t.equal(app.find("TestComponent").prop("name"), "Sean");
|
||||||
|
t.end();
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue