Skip to content

Commit

Permalink
Run snapshots test againts demos
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Mar 7, 2017
1 parent c30036f commit b6c0a14
Show file tree
Hide file tree
Showing 191 changed files with 40,244 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": ["react-native"],
"plugins": [["import", { "libraryName": "antd-mobile", "libraryDirectory": "components" }]]
"plugins": [["import", { "libraryName": "antd-mobile", "libraryDirectory": "../../../../components" }]]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ my-release-key.keystore
yarn.lock
npm-debug.log*
!components/**/__tests__/*.js
coverage
33 changes: 33 additions & 0 deletions .jest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"preset": "react-native",
"setupFiles": [
"./tests/setup.js"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"md"
],
"moduleNameMapper": {
"\\.png": "<rootDir>/tests/imageStub.js"
},
"testPathIgnorePatterns": [
"/node_modules/",
"_site",
"site"
],
"transform": {
"\\.tsx?$": "./node_modules/typescript-babel-jest",
"\\.js$": "./node_modules/babel-jest",
"\\.md$": "./node_modules/antd-demo-jest/mobile"
},
"testRegex": ".*\\.test\\.js$",
"collectCoverageFrom": [
"components/**/*.{ts,tsx}",
"!components/*/style/index.tsx"
],
"testEnvironment": "jsdom"
}
31 changes: 31 additions & 0 deletions .jest.web.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"moduleFileExtensions": [
"web.tsx",
"web.js",
"ts",
"tsx",
"js",
"jsx",
"json",
"md"
],
"moduleNameMapper": {
"\\.svg$": "<rootDir>/tests/imageStub.js"
},
"testPathIgnorePatterns": [
"/node_modules/",
"_site",
"site"
],
"transform": {
"\\.tsx?$": "./node_modules/typescript-babel-jest",
"\\.js$": "./node_modules/babel-jest",
"\\.md$": "./node_modules/antd-demo-jest/mobile"
},
"testRegex": ".*\\.test\\.web\\.js$",
"collectCoverageFrom": [
"components/**/*.{ts,tsx}",
"!components/*/style/index.tsx"
],
"testEnvironment": "jsdom"
}
163 changes: 163 additions & 0 deletions components/accordion/__tests__/__snapshots__/demo.test.web.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders ./components/accordion/demo/accordion.md correctly 1`] = `
<div
style="margin-top:10px;margin-bottom:10px;"
>
<div
class="am-accordion my-accordion"
>
<div
class="am-accordion-item"
>
<div
aria-expanded="false"
class="am-accordion-header"
role="tab"
>
<i
class="arrow"
/>
标题一
</div>
</div>
<div
class="am-accordion-item pad"
>
<div
aria-expanded="false"
class="am-accordion-header"
role="tab"
>
<i
class="arrow"
/>
标题二
</div>
</div>
<div
class="am-accordion-item pad"
>
<div
aria-expanded="false"
class="am-accordion-header"
role="tab"
>
<i
class="arrow"
/>
标题三
</div>
</div>
</div>
</div>
`;

exports[`renders ./components/accordion/demo/basic.md correctly 1`] = `
<div
style="margin-top:10px;margin-bottom:10px;"
>
<div
class="am-accordion my-accordion"
>
<div
class="am-accordion-item am-accordion-item-active"
>
<div
aria-expanded="true"
class="am-accordion-header"
role="tab"
>
<i
class="arrow"
/>
标题一
</div>
<div
class="am-accordion-content am-accordion-content-active"
role="tabpanel"
>
<div
class="am-accordion-content-box"
>
<div
class="am-list my-list"
>
<div
class="am-list-body"
>
<div
class="am-list-item am-list-item-middle"
>
<div
class="am-list-line"
>
<div
class="am-list-content"
>
子内容一
</div>
</div>
</div>
<div
class="am-list-item am-list-item-middle"
>
<div
class="am-list-line"
>
<div
class="am-list-content"
>
子内容二
</div>
</div>
</div>
<div
class="am-list-item am-list-item-middle"
>
<div
class="am-list-line"
>
<div
class="am-list-content"
>
子内容三
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class="am-accordion-item pad"
>
<div
aria-expanded="false"
class="am-accordion-header"
role="tab"
>
<i
class="arrow"
/>
标题二
</div>
</div>
<div
class="am-accordion-item pad"
>
<div
aria-expanded="false"
class="am-accordion-header"
role="tab"
>
<i
class="arrow"
/>
标题三
</div>
</div>
</div>
</div>
`;
3 changes: 3 additions & 0 deletions components/accordion/__tests__/demo.test.web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { webDemoTest } from '../../../tests/shared/demoTest';

webDemoTest('accordion');
Loading

0 comments on commit b6c0a14

Please sign in to comment.