From 2aa90a4fa8dced1e63f7072dee70a43889cd3388 Mon Sep 17 00:00:00 2001
From: JeremyWuuuuu <591449570@qq.com>
Date: Wed, 5 Aug 2020 14:43:25 +0800
Subject: [PATCH] address PR comments
---
packages/link/__tests__/link.spec.ts | 21 +++++++++++++--------
packages/link/src/index.vue | 12 ++++++------
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/packages/link/__tests__/link.spec.ts b/packages/link/__tests__/link.spec.ts
index 5117b413d2..4b17654d67 100644
--- a/packages/link/__tests__/link.spec.ts
+++ b/packages/link/__tests__/link.spec.ts
@@ -13,29 +13,23 @@ describe('Link.vue', () => {
expect(wrapper.text()).toEqual(AXIOM)
})
- test('it should handle click event when href were given and is not disabled', async () => {
- const href = 'https://target.com'
+ test('it should handle click event when link is not disabled', async () => {
const wrapper = mount(Link, {
slots: {
default: AXIOM,
},
- props: {
- href,
- },
})
await wrapper.find('.el-link').trigger('click')
expect(wrapper.emitted('click')).toHaveLength(1)
})
- test('it should disable click when it\'s disabled', async () => {
- const href = 'https://target.com'
+ test('it should disable click when link is disabled', async () => {
const wrapper = mount(Link, {
slots: {
default: AXIOM,
},
props: {
- href,
disabled: true,
},
})
@@ -45,5 +39,16 @@ describe('Link.vue', () => {
})
+ test('icon slots', () => {
+ const linkName = 'test link'
+ const wrapper = mount(Link, {
+ slots: {
+ default: linkName,
+ icon: AXIOM,
+ },
+ })
+ expect(wrapper.text()).toContain(linkName)
+ expect(wrapper.text()).toContain(AXIOM)
+ })
})
diff --git a/packages/link/src/index.vue b/packages/link/src/index.vue
index bd4a572fcc..632f033824 100644
--- a/packages/link/src/index.vue
+++ b/packages/link/src/index.vue
@@ -16,19 +16,19 @@
-
-
-
+