Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve the console warnings #1611

Merged
merged 2 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/cell/__test__/__virtualHostSnapshot__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ exports[`Cell Cell base demo works fine 1`] = `
/>
<t-cell
arrow="{{true}}"
bordered="{{false}}"
hover="{{true}}"
leftIcon="lock-on"
title="单行标题"
Expand Down Expand Up @@ -119,6 +120,7 @@ exports[`Cell Cell multiple demo works fine 1`] = `
</t-cell>
<t-cell
align="top"
bordered="{{false}}"
description="一段很长很长的内容文字"
hover="{{true}}"
image="https://tdesign.gtimg.com/miniprogram/images/cell1.png"
Expand Down
2 changes: 1 addition & 1 deletion src/cell/cell.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<view
style="{{_._style([style, customStyle])}}"
class="class {{prefix}}-class {{classPrefix}} {{ hover ? classPrefix + '--hover' : ''}} {{ !bordered ? classPrefix + '--borderless' : ''}} {{classPrefix}}--{{align}}"
class="class {{prefix}}-class {{classPrefix}} {{ hover ? classPrefix + '--hover' : ''}} {{ !bordered || isLastChild ? classPrefix + '--borderless' : ''}} {{classPrefix}}--{{align}}"
hover-class="{{classPrefix}}--hover-class"
hover-stay-time="70"
bind:tap="onClick"
Expand Down
3 changes: 2 additions & 1 deletion src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ export const styles = function (styleObj) {
.join('; ');
};

export const getAnimationFrame = function (cb: Function) {
export const getAnimationFrame = function (context: any, cb: Function) {
return wx
.createSelectorQuery()
.in(context)
.selectViewport()
.boundingClientRect()
.exec(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/image-viewer/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ exports[`image-viewer :base 1`] = `
<wx-image
ariaHidden="{{true}}"
ariaLabel=""
class="t-class t-image t-image--shape-square"
class="class t-class t-image t-image--shape-square"
hidden="{{true}}"
id="image"
lazyLoad="{{true}}"
Expand Down Expand Up @@ -125,7 +125,7 @@ exports[`image-viewer :base 2`] = `
<wx-image
ariaHidden="{{true}}"
ariaLabel=""
class="t-class t-image t-image--shape-square"
class="class t-class t-image t-image--shape-square"
hidden="{{true}}"
id="image"
lazyLoad="{{true}}"
Expand Down Expand Up @@ -195,7 +195,7 @@ exports[`image-viewer :base 3`] = `
<wx-image
ariaHidden="{{true}}"
ariaLabel=""
class="t-class t-image t-image--shape-square"
class="class t-class t-image t-image--shape-square"
hidden="{{true}}"
id="image"
lazyLoad="{{true}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ exports[`image-viewer :base 1`] = `
<wx-image
ariaHidden="{{true}}"
ariaLabel=""
class="t-class t-image t-image--shape-square"
class="class t-class t-image t-image--shape-square"
hidden="{{true}}"
id="image"
lazyLoad="{{true}}"
Expand Down Expand Up @@ -125,7 +125,7 @@ exports[`image-viewer :base 2`] = `
<wx-image
ariaHidden="{{true}}"
ariaLabel=""
class="t-class t-image t-image--shape-square"
class="class t-class t-image t-image--shape-square"
hidden="{{true}}"
id="image"
lazyLoad="{{true}}"
Expand Down Expand Up @@ -195,7 +195,7 @@ exports[`image-viewer :base 3`] = `
<wx-image
ariaHidden="{{true}}"
ariaLabel=""
class="t-class t-image t-image--shape-square"
class="class t-class t-image t-image--shape-square"
hidden="{{true}}"
id="image"
lazyLoad="{{true}}"
Expand Down
6 changes: 3 additions & 3 deletions src/image/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`image :base 1`] = `
<t-image>
<wx-view
ariaHidden="{{false}}"
class="t-class t-image t-image__mask t-image--failed t-image--shape-square"
class="class t-class t-image t-image__mask t-image--failed t-image--shape-square"
style=""
>
<wx-view
Expand All @@ -31,7 +31,7 @@ exports[`image :base 1`] = `
<wx-image
ariaHidden="{{true}}"
ariaLabel=""
class="t-class t-image t-image--shape-square"
class="class t-class t-image t-image--shape-square"
hidden="{{true}}"
id="image"
lazyLoad="{{false}}"
Expand All @@ -56,7 +56,7 @@ exports[`image :success 1`] = `
<wx-image
ariaHidden="{{false}}"
ariaLabel=""
class="t-class t-image t-image--shape-square"
class="class t-class t-image t-image--shape-square"
hidden="{{false}}"
id="image"
lazyLoad="{{false}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ exports[`Image Image status demo works fine 1`] = `
<t-image
height="72"
id="loading-img-custom"
loading=""
loading="slot"
shape="round"
width="72"
>
Expand Down Expand Up @@ -191,7 +191,7 @@ exports[`Image Image status demo works fine 1`] = `
失败自定义提示
</wx-view>
<t-image
error=""
error="slot"
height="72"
shape="round"
src=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`image :base 1`] = `
<t-image>
<wx-view
ariaHidden="{{false}}"
class="t-class t-image t-image__mask t-image--failed t-image--shape-square"
class="class t-class t-image t-image__mask t-image--failed t-image--shape-square"
style=""
>
<wx-view
Expand All @@ -31,7 +31,7 @@ exports[`image :base 1`] = `
<wx-image
ariaHidden="{{true}}"
ariaLabel=""
class="t-class t-image t-image--shape-square"
class="class t-class t-image t-image--shape-square"
hidden="{{true}}"
id="image"
lazyLoad="{{false}}"
Expand All @@ -56,7 +56,7 @@ exports[`image :success 1`] = `
<wx-image
ariaHidden="{{false}}"
ariaLabel=""
class="t-class t-image t-image--shape-square"
class="class t-class t-image t-image--shape-square"
hidden="{{false}}"
id="image"
lazyLoad="{{false}}"
Expand Down
4 changes: 2 additions & 2 deletions src/image/image.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<view
wx:elif="{{isFailed}}"
style="{{_._style([innerStyle, style, customStyle])}}"
class="{{prefix}}-class {{classPrefix}} {{classPrefix}}__mask {{classPrefix}}--failed {{classPrefix}}--shape-{{shape}}"
class="class {{prefix}}-class {{classPrefix}} {{classPrefix}}__mask {{classPrefix}}--failed {{classPrefix}}--shape-{{shape}}"
aria-hidden="{{ariaHidden}}"
>
<view wx:if="{{error === 'default'}}" style="font-size: 44rpx" class="{{prefix}}-class-load">
Expand All @@ -38,7 +38,7 @@
<image
id="image"
hidden="{{isLoading || isFailed}}"
class="{{prefix}}-class {{classPrefix}} {{classPrefix}}--shape-{{shape}}"
class="class {{prefix}}-class {{classPrefix}} {{classPrefix}}--shape-{{shape}}"
src="{{src}}"
style="{{_._style([innerStyle, style, customStyle])}}"
mode="{{mode}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ exports[`Input Input special demo works fine 1`] = `
suffix="元"
tClassTips="tips"
tips=""
type="number"
bind:change="onPriceInput"
/>
<t-input
Expand Down
52 changes: 30 additions & 22 deletions src/input/__test__/__virtualHostSnapshot__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@ exports[`input props : clearable && label && suffix 1`] = `
style=""
>
<wx-view
class="t-input__icon--prefix"
/>
<wx-view
ariaHidden="{{true}}"
class="t-input__label"
class="t-input__wrap--prefix"
>
<wx-text
class="t-class-label"
<wx-view
class="t-input__icon--prefix"
/>
<wx-view
ariaHidden="{{true}}"
class="t-input__label"
>
tdesign
</wx-text>
<wx-text
class="t-class-label"
>
tdesign
</wx-text>
</wx-view>
</wx-view>
<wx-view
class="t-input__wrap"
Expand All @@ -35,7 +39,7 @@ exports[`input props : clearable && label && suffix 1`] = `
ariaRole="textbox"
ariaRoledescription="tdesign"
autoFocus="{{false}}"
class="t-input__control t-input__control--left t-class-input"
class="t-input__control t-input--left t-class-input"
confirmHold="{{false}}"
confirmType="done"
cursor="{{0}}"
Expand Down Expand Up @@ -133,22 +137,26 @@ exports[`input slots : label 1`] = `
style=""
>
<wx-view
class="t-input__icon--prefix"
/>
<wx-view
ariaHidden="{{true}}"
class="t-input__label"
class="t-input__wrap--prefix"
>
<wx-text
slot="label"
<wx-view
class="t-input__icon--prefix"
/>
<wx-view
ariaHidden="{{true}}"
class="t-input__label"
>
标签文字
<wx-text
style="color: #e34d59"
slot="label"
>
*
标签文字
<wx-text
style="color: #e34d59"
>
*
</wx-text>
</wx-text>
</wx-text>
</wx-view>
</wx-view>
<wx-view
class="t-input__wrap"
Expand All @@ -163,7 +171,7 @@ exports[`input slots : label 1`] = `
ariaRole="textbox"
ariaRoledescription=""
autoFocus="{{false}}"
class="t-input__control t-input__control--left t-class-input"
class="t-input__control t-input--left t-class-input"
confirmHold="{{false}}"
confirmType="done"
cursor="{{0}}"
Expand Down
2 changes: 1 addition & 1 deletion src/link/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ size | String | medium | 尺寸。可选项:small/medium/large。TS 类型:`
status | String | normal | 组件状态。可选项:normal/active/disabled | N
suffix-icon | String / Object / Slot | - | 前置图标 | N
theme | String | default | 组件风格,依次为默认色、品牌色、危险色、警告色、成功色。可选项:default/primary/danger/warning/success | N
underline | Boolean | - 是否显示链接下划线 | N
underline | Boolean | - | 是否显示链接下划线 | N

### Link Events

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ exports[`Navbar Navbar img demo works fine 1`] = `
<img>
<t-navbar>
<wx-view
class="custom-left"
slot="left"
>
<t-image
Expand Down
3 changes: 3 additions & 0 deletions src/notice-bar/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ exports[`NoticeBar NoticeBar event demo works fine 1`] = `
这是一条普通的通知信息
</wx-view>
<t-link
class="extra"
content="详情"
navigatorProps="{{
Object {
Expand All @@ -82,6 +83,7 @@ exports[`NoticeBar NoticeBar event demo works fine 1`] = `
}}"
slot="extra"
theme="primary"
underline="{{true}}"
/>
</t-notice-bar>
<t-notice-bar
Expand All @@ -97,6 +99,7 @@ exports[`NoticeBar NoticeBar iconDemo demo works fine 1`] = `
<iconDemo>
<t-notice-bar
content="提示文字描述提示文字描述提示文字描述"
prefixIcon="{{false}}"
visible="{{true}}"
>
<wx-view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ exports[`NoticeBar NoticeBar event demo works fine 1`] = `
这是一条普通的通知信息
</wx-view>
<t-link
class="extra"
content="详情"
navigatorProps="{{
Object {
Expand All @@ -82,6 +83,7 @@ exports[`NoticeBar NoticeBar event demo works fine 1`] = `
}}"
slot="extra"
theme="primary"
underline="{{true}}"
/>
</t-notice-bar>
<t-notice-bar
Expand All @@ -97,6 +99,7 @@ exports[`NoticeBar NoticeBar iconDemo demo works fine 1`] = `
<iconDemo>
<t-notice-bar
content="提示文字描述提示文字描述提示文字描述"
prefixIcon="{{false}}"
visible="{{true}}"
>
<wx-view
Expand Down Expand Up @@ -153,6 +156,17 @@ exports[`NoticeBar NoticeBar scrolling demo works fine 1`] = `
</scrolling>
`;

exports[`NoticeBar NoticeBar suffixIcon demo works fine 1`] = `
<suffixIcon>
<t-notice-bar
content="这是一条普通的通知信息"
suffixIcon="close"
visible="{{true}}"
bind:click="click"
/>
</suffixIcon>
`;

exports[`NoticeBar NoticeBar theme demo works fine 1`] = `
<theme>
<t-notice-bar
Expand Down
2 changes: 1 addition & 1 deletion src/notice-bar/__test__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const mockGetAnimationFrame = jest.spyOn(Util, 'getAnimationFrame');
const mockGetRect = jest.spyOn(Util, 'getRect');

// 设置每次调用函数的值
mockGetAnimationFrame.mockImplementation((cb) => {
mockGetAnimationFrame.mockImplementation((context, cb) => {
return cb();
});

Expand Down
2 changes: 1 addition & 1 deletion src/notice-bar/_example/event/index.wxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<t-notice-bar visible="{{visible}}" suffixIcon="chevron-right" bind:click="click">
<view slot="content"> 这是一条普通的通知信息 </view>
<t-link slot="extra" content="详情" theme="primary" navigator-props="{{navigatorProps}}" />
<t-link slot="extra" class="extra" content="详情" theme="primary" underline navigator-props="{{navigatorProps}}" />
</t-notice-bar>

<t-notice-bar
Expand Down
6 changes: 5 additions & 1 deletion src/notice-bar/_example/event/index.wxss
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@

.extra {
height: 100%;
display: flex;
align-items: center;
}
2 changes: 1 addition & 1 deletion src/notice-bar/_example/iconDemo/index.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<t-notice-bar visible="{{visible}}" content="提示文字描述提示文字描述提示文字描述">
<t-notice-bar visible="{{visible}}" prefixIcon="{{false}}" content="提示文字描述提示文字描述提示文字描述">
<view slot="prefix-icon">
<t-icon name="error-circle-filled"></t-icon>
</view>
Expand Down
Loading