Skip to content

Commit

Permalink
fix: update link and test
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaofei0320 committed Nov 12, 2020
1 parent 36cbd43 commit bf4db91
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 103 deletions.
2 changes: 1 addition & 1 deletion examples/docs/en-US/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Basic text link

```html
<div>
<el-link href="https://element.eleme.io" target="_blank">default</el-link>
<el-link href="https://element3.gitee.io" target="_blank">default</el-link>
<el-link type="primary">primary</el-link>
<el-link type="success">success</el-link>
<el-link type="warning">warning</el-link>
Expand Down
2 changes: 1 addition & 1 deletion examples/docs/es/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Texto con hipervinculo básico

```html
<div>
<el-link href="https://element.eleme.io" target="_blank">default</el-link>
<el-link href="https://element3.gitee.io" target="_blank">default</el-link>
<el-link type="primary">primary</el-link>
<el-link type="success">success</el-link>
<el-link type="warning">warning</el-link>
Expand Down
2 changes: 1 addition & 1 deletion examples/docs/fr-FR/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Lien texte basique.

```html
<div>
<el-link href="https://element.eleme.io" target="_blank">défaut</el-link>
<el-link href="https://element3.gitee.io" target="_blank">défaut</el-link>
<el-link type="primary">primaire</el-link>
<el-link type="success">succès</el-link>
<el-link type="warning">avertissement</el-link>
Expand Down
2 changes: 1 addition & 1 deletion examples/docs/zh-CN/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:::demo
```html
<div>
<el-link href="https://element.eleme.io" target="_blank">默认链接</el-link>
<el-link href="https://element3.gitee.io" target="_blank">默认链接</el-link>
<el-link type="primary">主要链接</el-link>
<el-link type="success">成功链接</el-link>
<el-link type="warning">警告链接</el-link>
Expand Down
4 changes: 2 additions & 2 deletions packages/link/__tests__/Link.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ describe('Link', () => {
it('href', () => {
const wrapper = mount(Link, {
props: {
href: 'https://element.eleme.io/'
href: 'https://element3.gitee.io/'
}
})

expect(wrapper.attributes('href')).toBe('https://element.eleme.io/')
expect(wrapper.attributes('href')).toBe('https://element3.gitee.io/')
})

it('should get target attr value', () => {
Expand Down
68 changes: 43 additions & 25 deletions test/unit/specs/link.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,61 +6,79 @@ describe('Link', () => {
afterEach(() => {
destroyVM(vm)
})

it('create', () => {
vm = createTest(Link, {
type: 'primary'
}, true)
vm = createTest(
Link,
{
type: 'primary'
},
true
)
let linkElm = vm.$el
expect(linkElm.classList.contains('el-link--primary')).to.be.true
})
it('icon', () => {
vm = createTest(Link, {
icon: 'el-icon-search'
}, true)
vm = createTest(
Link,
{
icon: 'el-icon-search'
},
true
)
let linkElm = vm.$el
expect(linkElm.querySelector('.el-icon-search')).to.be.ok
})
it('href', () => {
vm = createTest(Link, {
href: 'https://element.eleme.io/'
}, true)
vm = createTest(
Link,
{
href: 'https://element3.gitee.io/'
},
true
)
let linkElm = vm.$el
expect(linkElm.getAttribute('href')).to.be.equal('https://element.eleme.io/')
expect(linkElm.getAttribute('href')).to.be.equal(
'https://element3.gitee.io/'
)
})
it('target', () => {
vm = createVue(`
<el-link href="https://element.eleme.io" target="_blank">
<el-link href="https://element3.gitee.io" target="_blank">
default
</el-link>
`)
let linkElm = vm.$el
expect(linkElm.getAttribute('target')).to.be.equal('_blank')
})
it('disabled', () => {
vm = createTest(Link, {
disabled: true
}, true)
vm = createTest(
Link,
{
disabled: true
},
true
)
let linkElm = vm.$el
expect(linkElm.classList.contains('is-disabled')).to.be.true
})

it('click', async() => {
it('click', async () => {
let result
vm = createVue({
template: `
vm = createVue(
{
template: `
<el-link @click="handleClick"></el-link>
`,
methods: {
handleClick(evt) {
result = evt
methods: {
handleClick(evt) {
result = evt
}
}
}
}, true)
},
true
)
vm.$el.click()
await wait()
expect(result).to.exist
})

})

112 changes: 55 additions & 57 deletions types/element3.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PluginObject, App } from 'vue'
import {
ElementUIComponent,
ElementUIComponentSize,
ElementUIHorizontalAlignment
ElementUIComponent,
ElementUIComponentSize,
ElementUIHorizontalAlignment
} from './component'

export { ElAlert } from './alert'
Expand Down Expand Up @@ -32,6 +32,8 @@ export { ElRadio } from './radio'
export { ElRadioGroup } from './radio-group'
export { ElSlider } from './slider'
export { ElSwitch } from './switch'
export { ElLink } from './link'


import { ElCollapse } from './collapse'
import { ElCollapseItem } from './collapse-item'
Expand Down Expand Up @@ -74,7 +76,6 @@ import { ElTooltip } from './tooltip'
import { ElTransfer } from './transfer'
import { ElTree, TreeData } from './tree'
import { ElUpload } from './upload'
import { ElLink } from './link'
import { ElDivider } from './divider'
import { ElIcon } from './icon'
import { ElCalendar } from './calendar'
Expand All @@ -87,9 +88,9 @@ import { ElDrawer } from './drawer'
import { ElPopconfirm } from './popconfirm'

export interface InstallationOptions {
locale: any
i18n: any
size: string
locale: any
i18n: any
size: string
}

/** The version of element-ui */
Expand Down Expand Up @@ -124,148 +125,145 @@ export const MessageBox: ElMessageBox
export const Notification: ElNotification

/** Collapse Component */
export class Collapse extends ElCollapse {}
export class Collapse extends ElCollapse { }

/** Collapse Item Component */
export class CollapseItem extends ElCollapseItem {}
export class CollapseItem extends ElCollapseItem { }

/** Color Picker Component */
export class ColorPicker extends ElColorPicker {}
export class ColorPicker extends ElColorPicker { }

/** Container Component */
export class Container extends ElContainer {}
export class Container extends ElContainer { }

/** Date Picker Component */
export class DatePicker extends ElDatePicker {}
export class DatePicker extends ElDatePicker { }

/** Dialog Component */
export class Dialog extends ElDialog {}
export class Dialog extends ElDialog { }

/** Dropdown Component */
export class Dropdown extends ElDropdown {}
export class Dropdown extends ElDropdown { }

/** Dropdown Item Component */
export class DropdownItem extends ElDropdownItem {}
export class DropdownItem extends ElDropdownItem { }

/** Dropdown Menu Component */
export class DropdownMenu extends ElDropdownMenu {}
export class DropdownMenu extends ElDropdownMenu { }

/** Footer Component */
export class Footer extends ElFooter {}
export class Footer extends ElFooter { }

/** Form Component */
export class Form extends ElForm {}
export class Form extends ElForm { }

/** Form Item Component */
export class FormItem extends ElFormItem {}
export class FormItem extends ElFormItem { }

/** Header Component */
export class Header extends ElHeader {}
export class Header extends ElHeader { }

/** Main Component */
export class Main extends ElMain {}
export class Main extends ElMain { }

/** Menu that provides navigation for your website */
export class Menu extends ElMenu {}
export class Menu extends ElMenu { }

/** Menu Item Component */
export class MenuItem extends ElMenuItem {}
export class MenuItem extends ElMenuItem { }

/** Menu Item Group Component */
export class MenuItemGroup extends ElMenuItemGroup {}
export class MenuItemGroup extends ElMenuItemGroup { }

/** Dropdown Select Option Component */
export class Option extends ElOption {}
export class Option extends ElOption { }

/** Dropdown Select Option Group Component */
export class OptionGroup extends ElOptionGroup {}
export class OptionGroup extends ElOptionGroup { }

/** Popover Component */
export class Popover extends ElPopover {}
export class Popover extends ElPopover { }

/** Rate Component */
export class Rate extends ElRate {}
export class Rate extends ElRate { }

/** Slider Component */
export class Slider extends ElSlider {}
export class Slider extends ElSlider { }

/** Step Component */
export class Step extends ElStep {}
export class Step extends ElStep { }

/** Steps Component */
export class Steps extends ElSteps {}
export class Steps extends ElSteps { }

/** Submenu Component */
export class Submenu extends ElSubmenu {}
export class Submenu extends ElSubmenu { }

/** Table Component */
export class Table extends ElTable {}
export class Table extends ElTable { }

/** Table Column Component */
export class TableColumn extends ElTableColumn {}
export class TableColumn extends ElTableColumn { }

/** Tabs Component */
export class Tabs extends ElTabs {}
export class Tabs extends ElTabs { }

/** Tab Pane Component */
export class TabPane extends ElTabPane {}
export class TabPane extends ElTabPane { }

/** Tag Component */
export class Tag extends ElTag {}
export class Tag extends ElTag { }

/** Timeline Component */
export class Timeline extends ElTimeline {}
export class Timeline extends ElTimeline { }

/** Timeline Item Component */
export class TimelineItem extends ElTimelineItem {}
export class TimelineItem extends ElTimelineItem { }

/** TimePicker Component */
export class TimePicker extends ElTimePicker {}
export class TimePicker extends ElTimePicker { }

/** TimeSelect Component */
export class TimeSelect extends ElTimeSelect {}
export class TimeSelect extends ElTimeSelect { }

/** Tooltip Component */
export class Tooltip extends ElTooltip {}
export class Tooltip extends ElTooltip { }

/** Transfer Component */
export class Transfer extends ElTransfer {}
export class Transfer extends ElTransfer { }

/** Tree Component */
export class Tree<K = any, D = TreeData> extends ElTree<K, D> {}
export class Tree<K = any, D = TreeData> extends ElTree<K, D> { }

/** Upload Component */
export class Upload extends ElUpload {}
export class Upload extends ElUpload { }

/** Divider Component */
export class Divider extends ElDivider {}

/** Link Component */
export class Link extends ElLink {}
export class Divider extends ElDivider { }

/** Image Component */
export class Image extends ElImage {}
export class Image extends ElImage { }

/** Icon Component */
export class Icon extends ElIcon {}
export class Icon extends ElIcon { }

/** Calendar Component */
export class Calendar extends ElCalendar {}
export class Calendar extends ElCalendar { }

/** Backtop Component */
export class Backtop extends ElBacktop {}
export class Backtop extends ElBacktop { }

/** InfiniteScroll Directive */
export const InfiniteScroll: PluginObject<ElInfiniteScroll>

/** PageHeader Component */
export class PageHeader extends ElPageHeader {}
export class PageHeader extends ElPageHeader { }

/** Avatar Component */
export class Avatar extends ElAvatar {}
export class Avatar extends ElAvatar { }

/** Drawer Component */
export class Drawer extends ElDrawer {}
export class Drawer extends ElDrawer { }

/** Popconfirm Component */
export class Popconfirm extends ElPopconfirm {}
export class Popconfirm extends ElPopconfirm { }
Loading

0 comments on commit bf4db91

Please sign in to comment.