From ff5ba6a7646c7ea36943464706f01a7d7d91a556 Mon Sep 17 00:00:00 2001
From: chouchouji <70570907+chouchouji@users.noreply.github.com>
Date: Wed, 24 Jul 2024 13:39:19 +0800
Subject: [PATCH] test(components): [badge] complete test cases (#17628)
---
.../components/badge/__tests__/badge.test.tsx | 39 +++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/packages/components/badge/__tests__/badge.test.tsx b/packages/components/badge/__tests__/badge.test.tsx
index b6ff99c425..e2aab4fb74 100644
--- a/packages/components/badge/__tests__/badge.test.tsx
+++ b/packages/components/badge/__tests__/badge.test.tsx
@@ -94,4 +94,43 @@ describe('Badge', () => {
await nextTick()
expect(wrapper.find('.el-badge__content').text()).toEqual('-1+')
})
+
+ test('color', () => {
+ const badgeValue = ref(20)
+ const wrapper = mount(() => )
+ expect(wrapper.find('.el-badge__content').attributes('style')).toContain(
+ 'background-color: blue'
+ )
+ })
+
+ test('badgeStyle', () => {
+ const badgeValue = ref(20)
+ const wrapper = mount(() => (
+
+ ))
+ expect(wrapper.find('.el-badge__content').attributes('style')).toContain(
+ 'background: blue'
+ )
+ })
+
+ test('badgeClass', () => {
+ const badgeValue = ref(20)
+ const wrapper = mount(() => (
+
+ ))
+ expect(wrapper.find('.test-badge-class').exists()).toBe(true)
+ })
+
+ test('offset', () => {
+ const badgeValue = ref(20)
+ const wrapper = mount(() => (
+
+ ))
+ expect(wrapper.find('.el-badge__content').attributes('style')).toContain(
+ 'margin-right: -10px'
+ )
+ expect(wrapper.find('.el-badge__content').attributes('style')).toContain(
+ 'margin-top: 10px'
+ )
+ })
})