Commit 02318d36 authored by AFOC-1709091830\echou's avatar AFOC-1709091830\echou

add test case

parent 9310e0f0
......@@ -7,6 +7,7 @@
/dist/src/dev.js
/dist/src/dev.js.map
/dist/examples
/dist/__tests__
tsconfig.json
tslint.json
webpack.config.js
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PullToRefresh spec App shows PullToRefresh 1`] = `
<div
style={
Object {
"WebkitOverflowScrolling": "touch",
"backgroundColor": "white",
"height": "auto",
"overflow": "hidden",
"position": "relative",
"zIndex": 1,
}
}
>
<div
style={
Object {
"left": 0,
"overflow": "hidden",
"position": "absolute",
"right": 0,
"top": 0,
}
}
>
<div>
Pull Down
</div>
</div>
<div
style={
Object {
"WebkitOverflowScrolling": "touch",
"backgroundColor": "white",
"height": "auto",
"overflow": "hidden",
"position": "relative",
"zIndex": 1,
}
}
>
<div>
Test
</div>
</div>
</div>
`;
/*tslint:disable no-implicit-dependencies*/
import * as React from "react";
import * as renderer from "react-test-renderer";
import {PullDownContent} from "../../src";
describe("PullDownContent spec", () => {
it("App shows PullDownContent", () => {
const element = renderer
.create((
<PullDownContent
background={"#CCC"}
height="200px"
/>
))
.toJSON();
expect(element).toMatchSnapshot();
});
});
/*tslint:disable no-implicit-dependencies*/
import * as React from "react";
import * as renderer from "react-test-renderer";
import {PullToRefresh} from "../../src/";
describe("PullToRefresh spec", () => {
it("App shows PullToRefresh", () => {
const element = renderer
.create((
<PullToRefresh
onRefresh={null}
pullDownContent={<div>Pull Down</div>}
releaseContent={<div>Release to refresh</div>}
refreshContent={<div>Refreshing</div>}
pullDownThreshold={200}
>
<div>Test</div>
</PullToRefresh>
))
.toJSON();
expect(element).toMatchSnapshot();
});
});
/*tslint:disable no-implicit-dependencies*/
import * as React from "react";
import * as renderer from "react-test-renderer";
import {RefreshContent} from "../../src";
describe("RefreshContent spec", () => {
it("App shows RefreshContent", () => {
const element = renderer
.create((
<RefreshContent
background={"#CCC"}
height="200px"
/>
))
.toJSON();
expect(element).toMatchSnapshot();
});
});
/*tslint:disable no-implicit-dependencies*/
import * as React from "react";
import * as renderer from "react-test-renderer";
import {ReleaseContent} from "../../src";
describe("ReleaseContent spec", () => {
it("App shows ReleaseContent", () => {
const element = renderer
.create((
<ReleaseContent
background={"#CCC"}
height="200px"
/>
))
.toJSON();
expect(element).toMatchSnapshot();
});
});
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PullDownContent spec App shows PullDownContent 1`] = `
<div
className="sc-bwzfXH kHYjaZ"
height="200px"
>
<div
className="sc-htpNat GucRt"
/>
<span>
Pull down to refresh
</span>
</div>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`PullToRefresh spec App shows PullToRefresh 1`] = `
<div
style={
Object {
"WebkitOverflowScrolling": "touch",
"backgroundColor": "white",
"height": "auto",
"overflow": "hidden",
"position": "relative",
"zIndex": 1,
}
}
>
<div
style={
Object {
"left": 0,
"overflow": "hidden",
"position": "absolute",
"right": 0,
"top": 0,
}
}
>
<div>
Pull Down
</div>
</div>
<div
style={
Object {
"WebkitOverflowScrolling": "touch",
"backgroundColor": "white",
"height": "auto",
"overflow": "hidden",
"position": "relative",
"zIndex": 1,
}
}
>
<div>
Test
</div>
</div>
</div>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`RefreshContent spec App shows RefreshContent 1`] = `
<div
className="sc-bdVaJa bkDdBU"
height="200px"
>
<div
className="sk-fading-circle"
>
<div
className="sk-circle1 sk-circle"
/>
<div
className="sk-circle2 sk-circle"
/>
<div
className="sk-circle3 sk-circle"
/>
<div
className="sk-circle4 sk-circle"
/>
<div
className="sk-circle5 sk-circle"
/>
<div
className="sk-circle6 sk-circle"
/>
<div
className="sk-circle7 sk-circle"
/>
<div
className="sk-circle8 sk-circle"
/>
<div
className="sk-circle9 sk-circle"
/>
<div
className="sk-circle10 sk-circle"
/>
<div
className="sk-circle11 sk-circle"
/>
<div
className="sk-circle12 sk-circle"
/>
</div>
</div>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ReleaseContent spec App shows ReleaseContent 1`] = `
<div
className="sc-bxivhb hxSCts"
height="200px"
>
<div
className="sc-ifAKCX jLYZjZ"
/>
<span>
Release to refresh
</span>
</div>
`;
{
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx)$",
"coverageReporters": [
"html",
"json",
"text"
],
"collectCoverageFrom": [
"src/**/*.tsx",
"src/**/*.ts"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
}
......@@ -6,10 +6,10 @@
"typings": "./dist/src/index.d.ts",
"scripts": {
"dev": "webpack-dev-server",
"lint": "tslint -c tslint.json src/*",
"lint": "tslint --project .",
"clean": "rimraf dist",
"tsc": "npm run clean && tsc -p .",
"test": "npm run lint",
"test": "rimraf dist && npm run lint && jest --config=jestconfig.json",
"prepublish": "npm run tsc && npm test"
},
"repository": {
......@@ -34,13 +34,18 @@
},
"devDependencies": {
"@types/core-decorators": "^0.10.32",
"@types/jest": "^22.0.0",
"@types/react": "^16.0.31",
"@types/react-dom": "^16.0.3",
"@types/react-test-renderer": "^16.0.0",
"awesome-typescript-loader": "^3.4.1",
"jest": "^22.0.4",
"path": "^0.12.7",
"react-hot-loader": "^3.1.3",
"react-test-renderer": "^16.2.0",
"rimraf": "^2.6.2",
"source-map-loader": "^0.2.3",
"ts-jest": "^22.0.0",
"tslint": "^5.8.0",
"tslint-react": "^3.2.0",
"typescript": "^2.6.2",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment