Skip to content

Commit

Permalink
fix(NoticeBar): the default value of prefix-icon attribute is changed…
Browse files Browse the repository at this point in the history
… to true
  • Loading branch information
anlyyao committed Jul 5, 2023
1 parent 34286e6 commit b10185e
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 156 deletions.
156 changes: 26 additions & 130 deletions src/notice-bar/__test__/__snapshots__/demo.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ exports[`NoticeBar > NoticeBar baseVue demo works fine 1`] = `
class="t-notice-bar t-notice-bar--info"
>
<!-- prefixIcon -->
<div
class="t-notice-bar__prefix-icon"
>
<!---->
</div>
<!--v-if-->
<!-- content -->
<div
class="t-notice-bar__content-wrap"
Expand All @@ -19,11 +15,7 @@ exports[`NoticeBar > NoticeBar baseVue demo works fine 1`] = `
style=""
>
这是一条普通的通知信息
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -69,11 +61,7 @@ exports[`NoticeBar > NoticeBar customVue demo works fine 1`] = `
style=""
>
提示文字描述提示文字描述提示文字描述
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -285,11 +273,7 @@ exports[`NoticeBar > NoticeBar eventVue demo works fine 1`] = `
style=""
>
这是一条普通的通知信息
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -346,11 +330,7 @@ exports[`NoticeBar > NoticeBar iconDemoVue demo works fine 1`] = `
style=""
>
提示文字描述提示文字描述提示文字描述
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -397,11 +377,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
class="t-notice-bar t-notice-bar--info"
>
<!-- prefixIcon -->
<div
class="t-notice-bar__prefix-icon"
>
<!---->
</div>
<!--v-if-->
<!-- content -->
<div
class="t-notice-bar__content-wrap"
Expand All @@ -411,11 +387,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
这是一条普通的通知信息
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -471,11 +443,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
提示文字描述提示文字描述提示文字描述
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -531,11 +499,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
这是一条普通的通知信息
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -683,11 +647,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
这是一条普通的通知信息
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -767,11 +727,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
提示文字描述提示文字描述提示文字描述
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -945,11 +901,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
默认状态公告栏默认状态公告栏
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -985,11 +937,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
成功状态公告栏成功状态公告栏
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1025,11 +973,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
警示状态公告栏警示状态公告栏
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1065,11 +1009,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
错误状态公告栏错误状态公告栏
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1105,11 +1045,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
class="t-notice-bar t-notice-bar--info notice-bar-demo-block"
>
<!-- prefixIcon -->
<div
class="t-notice-bar__prefix-icon"
>
<!---->
</div>
<!--v-if-->
<!-- content -->
<div
class="t-notice-bar__content-wrap"
Expand All @@ -1119,11 +1055,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
提示文字描述提示文字描述提示文字描述提示文字描述文
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1159,11 +1091,7 @@ exports[`NoticeBar > NoticeBar mobileVue demo works fine 1`] = `
style=""
>
提示文字描述提示文字描述提示文字描述提示文字描述文
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1298,11 +1226,7 @@ exports[`NoticeBar > NoticeBar scrollingVue demo works fine 1`] = `
class="t-notice-bar t-notice-bar--info notice-bar-demo-block"
>
<!-- prefixIcon -->
<div
class="t-notice-bar__prefix-icon"
>
<!---->
</div>
<!--v-if-->
<!-- content -->
<div
class="t-notice-bar__content-wrap"
Expand All @@ -1312,11 +1236,7 @@ exports[`NoticeBar > NoticeBar scrollingVue demo works fine 1`] = `
style=""
>
提示文字描述提示文字描述提示文字描述提示文字描述文
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1352,11 +1272,7 @@ exports[`NoticeBar > NoticeBar scrollingVue demo works fine 1`] = `
style=""
>
提示文字描述提示文字描述提示文字描述提示文字描述文
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1510,11 +1426,7 @@ exports[`NoticeBar > NoticeBar suffixIconVue demo works fine 1`] = `
style=""
>
这是一条普通的通知信息
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1575,11 +1487,7 @@ exports[`NoticeBar > NoticeBar themeVue demo works fine 1`] = `
style=""
>
默认状态公告栏默认状态公告栏
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1615,11 +1523,7 @@ exports[`NoticeBar > NoticeBar themeVue demo works fine 1`] = `
style=""
>
成功状态公告栏成功状态公告栏
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1655,11 +1559,7 @@ exports[`NoticeBar > NoticeBar themeVue demo works fine 1`] = `
style=""
>
警示状态公告栏警示状态公告栏
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down Expand Up @@ -1695,11 +1595,7 @@ exports[`NoticeBar > NoticeBar themeVue demo works fine 1`] = `
style=""
>
错误状态公告栏错误状态公告栏
<span
class="t-notice-bar__operation"
>
<!---->
</span>
<!--v-if-->
</div>
</div>
<!-- suffixIcon -->
Expand Down
2 changes: 1 addition & 1 deletion src/notice-bar/__test__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe('NoticeBar', async () => {
triggerName = name;
});
const wrapper = mount(
<NoticeBar visible prefix-icon="pre" content="test" extra="extra" suffix-icon="suffix" onClick={fn} />,
<NoticeBar visible prefix-icon="pre" content="test" extra="extra" suffix-icon="suffix" operation="operation" onClick={fn} />,
);
await wrapper.find('.t-notice-bar__prefix-icon').trigger('click');
expect(triggerName).toBe('prefix-icon');
Expand Down
1 change: 0 additions & 1 deletion src/notice-bar/demos/event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { h } from 'vue';
import { CloseIcon, ChevronRightIcon } from 'tdesign-icons-vue-next';
import { Toast } from 'tdesign-mobile-vue';
const iconFunc = () => h(CloseIcon);
const arrowRight = () => h(ChevronRightIcon);
const handleClick = (context: string) => {
Toast(`click:${context}`);
Expand Down
1 change: 0 additions & 1 deletion src/notice-bar/demos/scrolling.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ import { SoundIcon } from 'tdesign-icons-vue-next';
const content = ref<string>('提示文字描述提示文字描述提示文字描述提示文字描述文');
const content1 = ref(['君不见', '高堂明镜悲白发', '朝如青丝暮成雪', '人生得意须尽欢', '莫使金樽空对月']);
const visible = ref<boolean>(true);
</script>
2 changes: 1 addition & 1 deletion src/notice-bar/notice-bar.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ content | String / Array / Slot / Function | - | Typescript:`string \| string[
direction | String | horizontal | options:horizontal/vertical | N
marquee | Boolean / Object | false | Typescript:`boolean \| DrawMarquee` `interface DrawMarquee { speed?: number; loop?: number; delay?: number }`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/notice-bar/type.ts) | N
operation | String / Slot / Function | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
prefixIcon | Boolean / Slot / Function | - | Typescript:`Boolean \ | TNode \| Function`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
prefixIcon | Boolean / Slot / Function | true | Typescript:`Boolean \ | TNode `[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
suffixIcon | Slot / Function | - | Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
theme | String | info | options:info/success/warning/error | N
visible | Boolean | false | `v-model` and `v-model:visible` is supported | N
Expand Down
2 changes: 1 addition & 1 deletion src/notice-bar/notice-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ content | String / Array / Slot / Function | - | 文本内容。TS 类型:`str
direction | String | horizontal | 滚动方向。可选项:horizontal/vertical | N
marquee | Boolean / Object | false | 跑马灯效果。speed 指速度控制;loop 指循环播放次数,值为 -1 表示循环播放,值为 0 表示不循环播放;delay 表示延迟多久开始播放。TS 类型:`boolean \| DrawMarquee` `interface DrawMarquee { speed?: number; loop?: number; delay?: number }`[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/notice-bar/type.ts) | N
operation | String / Slot / Function | - | 右侧额外信息。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
prefixIcon | Boolean / Slot / Function | - | 前缀图标。 值为 false 表示不显示前缀图标。TS 类型:`Boolean \ | TNode \ | Function`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
prefixIcon | Boolean / Slot / Function | true | 用于自定义g公告栏前面的图标,优先级大于 theme 设定的图标。值为 false 则不显示图标,值为 true 显示 theme 设定图标。TS 类型:`Boolean \ | TNode `[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
suffixIcon | Slot / Function | - | 后缀图标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N
theme | String | info | 内置主题。可选项:info/success/warning/error | N
visible | Boolean | false | 显示/隐藏。支持语法糖 `v-model``v-model:visible` | N
Expand Down
Loading

0 comments on commit b10185e

Please sign in to comment.