Skip to content

Commit 7384ad3

Browse files
committed
test: form form-page gallery
1 parent 78e4c7c commit 7384ad3

File tree

15 files changed

+1426
-29
lines changed

15 files changed

+1426
-29
lines changed

src/cells/__test__/__snapshots__/cells.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ exports[`cells & cell basic cells & cell 1`] = `
4848
class="cell2"
4949
>
5050
<wx-view
51-
class="weui-cell "
51+
class="weui-cell weui-cell_wxss"
5252
hoverClass=""
5353
bind:tap="navigateTo"
5454
>

src/checkbox/__test__/__snapshots__/checkbox.test.js.snap

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,24 @@ exports[`checkbox-group & checkbox basic checkbox 1`] = `
1919
bind:tap="checkedChange"
2020
>
2121
<wx-view
22-
class="weui-cell weui-check__label ^weui-cell_checkbox "
22+
class="weui-cell weui-check__label ^weui-cell_radio "
2323
hoverClass=""
2424
bind:tap="navigateTo"
2525
>
2626
<wx-view
27-
class="weui-cell__hd "
27+
class="weui-cell__bd "
28+
>
29+
<wx-view>
30+
cell standard
31+
</wx-view>
32+
</wx-view>
33+
<wx-view
34+
class="weui-cell__ft "
2835
>
2936
<wx-view
30-
slot="icon"
37+
slot="footer"
3138
>
32-
<wx-checkbox
39+
<wx-radio
3340
checked=""
3441
class="weui-check"
3542
color=""
@@ -41,13 +48,6 @@ exports[`checkbox-group & checkbox basic checkbox 1`] = `
4148
/>
4249
</wx-view>
4350
</wx-view>
44-
<wx-view
45-
class="weui-cell__bd "
46-
>
47-
<wx-view>
48-
cell standard
49-
</wx-view>
50-
</wx-view>
5151
</wx-view>
5252
</mp-cell>
5353
</mp-checkbox>
@@ -58,17 +58,24 @@ exports[`checkbox-group & checkbox basic checkbox 1`] = `
5858
bind:tap="checkedChange"
5959
>
6060
<wx-view
61-
class="weui-cell weui-check__label ^weui-cell_checkbox "
61+
class="weui-cell weui-check__label weui-cell_wxss ^weui-cell_radio "
6262
hoverClass=""
6363
bind:tap="navigateTo"
6464
>
6565
<wx-view
66-
class="weui-cell__hd "
66+
class="weui-cell__bd "
67+
>
68+
<wx-view>
69+
cell standard
70+
</wx-view>
71+
</wx-view>
72+
<wx-view
73+
class="weui-cell__ft "
6774
>
6875
<wx-view
69-
slot="icon"
76+
slot="footer"
7077
>
71-
<wx-checkbox
78+
<wx-radio
7279
checked=""
7380
class="weui-check"
7481
color=""
@@ -80,13 +87,6 @@ exports[`checkbox-group & checkbox basic checkbox 1`] = `
8087
/>
8188
</wx-view>
8289
</wx-view>
83-
<wx-view
84-
class="weui-cell__bd "
85-
>
86-
<wx-view>
87-
cell standard
88-
</wx-view>
89-
</wx-view>
9090
</wx-view>
9191
</mp-cell>
9292
</mp-checkbox>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`form-page basic 1`] = `
4+
<main>
5+
<wx-view
6+
class="weui-form"
7+
>
8+
<wx-view
9+
class="weui-form__text-area"
10+
>
11+
<wx-view
12+
class="weui-form__title"
13+
>
14+
表单结构
15+
</wx-view>
16+
</wx-view>
17+
<wx-view
18+
class="weui-form__control-area"
19+
>
20+
阅读并同意
21+
<wx-navigator>
22+
《相关条款》
23+
</wx-navigator>
24+
</wx-view>
25+
<wx-view
26+
class="weui-form__tips-area"
27+
/>
28+
<wx-view
29+
class="weui-form__opr-area"
30+
>
31+
<wx-view
32+
slot="button"
33+
>
34+
<wx-button
35+
class="weui-btn"
36+
type="primary"
37+
bind:tap="submitForm"
38+
>
39+
确定
40+
</wx-button>
41+
</wx-view>
42+
</wx-view>
43+
<wx-view
44+
class="weui-form__tips-area"
45+
/>
46+
<wx-view
47+
class="weui-form__extra-area"
48+
>
49+
<wx-view
50+
class="weui-footer"
51+
/>
52+
</wx-view>
53+
</wx-view>
54+
</main>
55+
`;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import path from 'path'
2+
import simulate from 'miniprogram-simulate'
3+
4+
describe('form-page', () => {
5+
const formPage = simulate.load(path.resolve(__dirname, '../form-page'))
6+
7+
const id = simulate.load({
8+
compiler: 'official',
9+
rootPath: __dirname,
10+
template: `
11+
<mp-form-page title="表单结构" subtitle="展示表单页面的信息结构样式, 分别由头部区域/控件区域/提示区域/操作区域和底部信息区域组成。">
12+
阅读并同意<navigator>《相关条款》</navigator>
13+
<view slot="button">
14+
<button class="weui-btn" type="primary" bindtap="submitForm">确定</button>
15+
</view>
16+
</mp-form-page>
17+
`,
18+
usingComponents: {
19+
'mp-form-page': formPage
20+
}
21+
})
22+
23+
test('basic', async () => {
24+
const comp = simulate.render(id)
25+
comp.attach(document.createElement('parent-wrapper'))
26+
await simulate.sleep(0)
27+
expect(comp.toJSON()).toMatchSnapshot()
28+
})
29+
})

0 commit comments

Comments
 (0)