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 @@
-
-
-
+