Skip to content

Commit

Permalink
✅ test: 优化测试
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Apr 28, 2021
1 parent 6a009d9 commit bb67f27
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 331 deletions.
325 changes: 0 additions & 325 deletions packages/user-panel/tests/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -323,331 +323,6 @@ exports[`UserPanel 获取验证码 1`] = `
</div>
`;

exports[`UserPanel 错误状态 1`] = `
<div>
<div>
<form
class="ant-form ant-form-vertical"
>
<input
style="display: none;"
type="text"
/>
<div
class="ant-tabs ant-tabs-top ant-tabs-card"
>
<div
class="ant-tabs-nav"
role="tablist"
>
<div
class="ant-tabs-nav-wrap"
>
<div
class="ant-tabs-nav-list"
style="transform: translate(0px, 0px);"
>
<div
class="ant-tabs-tab ant-tabs-tab-active"
>
<div
aria-controls="rc-tabs-test-panel-account"
aria-selected="true"
class="ant-tabs-tab-btn"
id="rc-tabs-test-tab-account"
role="tab"
tabindex="0"
>
账户密码登录
</div>
</div>
<div
class="ant-tabs-tab"
>
<div
aria-controls="rc-tabs-test-panel-mobile"
aria-selected="false"
class="ant-tabs-tab-btn"
id="rc-tabs-test-tab-mobile"
role="tab"
tabindex="0"
>
手机号登录
</div>
</div>
<div
class="ant-tabs-ink-bar ant-tabs-ink-bar-animated"
/>
</div>
</div>
<div
class="ant-tabs-nav-operations ant-tabs-nav-operations-hidden"
>
<button
aria-controls="rc-tabs-test-more-popup"
aria-expanded="false"
aria-haspopup="listbox"
aria-hidden="true"
class="ant-tabs-nav-more"
id="rc-tabs-test-more"
style="visibility: hidden; order: 1;"
tabindex="-1"
type="button"
>
<span
aria-label="ellipsis"
class="anticon anticon-ellipsis"
role="img"
>
<svg
aria-hidden="true"
data-icon="ellipsis"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"
/>
</svg>
</span>
</button>
</div>
</div>
<div
class="ant-tabs-content-holder"
>
<div
class="ant-tabs-content ant-tabs-content-top"
>
<div
aria-hidden="false"
aria-labelledby="rc-tabs-test-tab-account"
class="ant-tabs-tabpane ant-tabs-tabpane-active"
id="rc-tabs-test-panel-account"
role="tabpanel"
tabindex="0"
/>
<div
aria-hidden="true"
aria-labelledby="rc-tabs-test-tab-mobile"
class="ant-tabs-tabpane"
id="rc-tabs-test-panel-mobile"
role="tabpanel"
style="display: none;"
tabindex="-1"
/>
</div>
</div>
</div>
<div
class="ant-row ant-form-item ant-form-item-is-validating"
>
<div
class="ant-col ant-form-item-control"
>
<div
class="ant-form-item-control-input"
>
<div
class="ant-form-item-control-input-content"
>
<span
class="ant-input-affix-wrapper ant-input-affix-wrapper-lg"
>
<span
class="ant-input-prefix"
>
<span
aria-label="user"
class="anticon anticon-user"
role="img"
>
<svg
aria-hidden="true"
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"
/>
</svg>
</span>
</span>
<input
class="ant-input ant-input-lg"
id="userName"
placeholder="用户名"
type="text"
value=""
/>
<span
class="ant-input-suffix"
>
<span
aria-label="close-circle"
class="anticon anticon-close-circle ant-input-clear-icon-hidden ant-input-clear-icon"
role="button"
tabindex="-1"
>
<svg
aria-hidden="true"
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 01-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"
/>
</svg>
</span>
</span>
</span>
</div>
</div>
</div>
</div>
<div
class="ant-row ant-form-item ant-form-item-is-validating"
>
<div
class="ant-col ant-form-item-control"
>
<div
class="ant-form-item-control-input"
>
<div
class="ant-form-item-control-input-content"
>
<span
class="ant-input-affix-wrapper ant-input-affix-wrapper-lg ant-input-password ant-input-password-large"
>
<span
class="ant-input-prefix"
>
<span
aria-label="lock"
class="anticon anticon-lock"
role="img"
>
<svg
aria-hidden="true"
data-icon="lock"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304z"
fill="#1890ff"
/>
<path
d="M232 840h560V536H232v304zm280-226a48.01 48.01 0 0128 87v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 0128-87z"
fill="#e6f7ff"
/>
<path
d="M484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"
fill="#1890ff"
/>
</svg>
</span>
</span>
<input
action="click"
class="ant-input ant-input-lg"
id="password"
placeholder="密码"
type="password"
value=""
/>
<span
class="ant-input-suffix"
>
<span
aria-label="eye-invisible"
class="anticon anticon-eye-invisible ant-input-password-icon"
role="img"
tabindex="-1"
>
<svg
aria-hidden="true"
data-icon="eye-invisible"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"
/>
<path
d="M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"
/>
</svg>
</span>
</span>
</span>
</div>
</div>
</div>
</div>
<div
style="margin-bottom: 24px;"
>
<label
class="ant-checkbox-wrapper ant-checkbox-wrapper-checked"
>
<span
class="ant-checkbox ant-checkbox-checked"
>
<input
checked=""
class="ant-checkbox-input"
id="autoLogin"
type="checkbox"
value=""
/>
<span
class="ant-checkbox-inner"
/>
</span>
<span>
自动登录
</span>
</label>
<a
style="float: right;"
>
忘记密码 ?
</a>
</div>
<button
ant-click-animating-without-extra-node="false"
class="ant-btn ant-btn-primary ant-btn-lg"
style="width: 100%;"
type="button"
>
<span>
提 交
</span>
</button>
</form>
</div>
</div>
`;

exports[`UserPanel 默认状态 1`] = `
<div>
<div>
Expand Down
6 changes: 0 additions & 6 deletions packages/user-panel/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ describe('UserPanel', () => {
const { container } = render(<UserPanel />);
expect(container).toMatchSnapshot();
});
it('错误状态', async () => {
const { container, findByText } = render(<UserPanel />);
const btn = await findByText('提 交');
await fireEvent.click(btn);
expect(container).toMatchSnapshot();
});

it('获取验证码', async () => {
const { container, findByText } = render(<UserPanel />);
Expand Down

0 comments on commit bb67f27

Please sign in to comment.