Skip to content

Commit

Permalink
test: add basic test for all comps
Browse files Browse the repository at this point in the history
  • Loading branch information
07akioni committed Feb 17, 2021
1 parent 25f72e3 commit 6a70895
Show file tree
Hide file tree
Showing 137 changed files with 543 additions and 1,188 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ module.exports = {
// The glob patterns Jest uses to detect test files
testMatch: [
// '<rootDir>/src/**/__tests__/**/*.[jt]s',
'<rootDir>/src/**/*.(spec|test).ts'
'<rootDir>/src/**/*.(spec|test).(ts|tsx)'
],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@
"tinycolor2": "^1.4.2",
"typescript": "^4.1.3",
"vite": "^2.0.0",
"vue-jest": "^5.0.0-alpha.7",
"vue-router": "^4.0.0-rc.1"
"vue-jest": "^5.0.0-alpha.7"
},
"dependencies": {
"@css-render/plugin-bem": "^0.12.0",
Expand All @@ -128,7 +127,8 @@
"vfonts": "^0.0.1",
"vooks": "0.0.8",
"vue": "^3.0.5",
"vueuc": "^0.1.2"
"vueuc": "^0.1.2",
"vue-router": "^4.0.3"
},
"husky": {
"hooks": {
Expand Down
2 changes: 1 addition & 1 deletion src/_mixins/use-hljs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export default function useHljs (
warn('code', 'hljs is not set.')
}
return computed(() => {
return props.hljs || NConfigProvider?.mergedHljs || vm.$naive.hljs
return props.hljs || NConfigProvider?.mergedHljs || vm?.$naive?.hljs
})
}
19 changes: 0 additions & 19 deletions src/auto-complete/tests/AutoComplete.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/auto-complete/tests/AutoComplete.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NAutoComplete } from '../index'

describe('n-auto-complete', () => {
it('should work with import on demand', () => {
mount(NAutoComplete)
})
})
19 changes: 0 additions & 19 deletions src/avatar/tests/Avatar.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/avatar/tests/Avatar.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NAvatar } from '../index'

describe('n-avatar', () => {
it('should work with import on demand', () => {
mount(NAvatar)
})
})
19 changes: 0 additions & 19 deletions src/back-top/tests/BackTop.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/back-top/tests/BackTop.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NBackTop } from '../index'

describe('n-back-top', () => {
it('should work with import on demand', () => {
mount(NBackTop)
})
})
19 changes: 0 additions & 19 deletions src/badge/tests/Badge.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/badge/tests/Badge.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NBadge } from '../index'

describe('n-badge', () => {
it('should work with import on demand', () => {
mount(NBadge)
})
})
19 changes: 0 additions & 19 deletions src/breadcrumb/tests/Breadcrumb.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/breadcrumb/tests/Breadcrumb.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NBreadcrumb } from '../index'

describe('n-breadcrumb', () => {
it('should work with import on demand', () => {
mount(NBreadcrumb)
})
})
19 changes: 0 additions & 19 deletions src/card/tests/Card.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/card/tests/Card.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NCard } from '../index'

describe('n-card', () => {
it('should work with import on demand', () => {
mount(NCard)
})
})
2 changes: 1 addition & 1 deletion src/cascader/src/Cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default defineComponent({
},
options: {
type: Array as PropType<BaseOption[]>,
default: []
default: () => []
},
value: [String, Number, Array] as PropType<Value | null>,
defaultValue: {
Expand Down
19 changes: 0 additions & 19 deletions src/checkbox/tests/Checkbox.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/checkbox/tests/Checkbox.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NCheckbox } from '../index'

describe('n-checkbox', () => {
it('should work with import on demand', () => {
mount(NCheckbox)
})
})
19 changes: 0 additions & 19 deletions src/code/tests/Code.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/code/tests/Code.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NCode } from '../index'

describe('n-code', () => {
it('should work with import on demand', () => {
mount(NCode)
})
})
19 changes: 0 additions & 19 deletions src/collapse/tests/Collapse.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/collapse/tests/Collapse.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NCollapse } from '../index'

describe('n-collapse', () => {
it('should work with import on demand', () => {
mount(NCollapse)
})
})
19 changes: 0 additions & 19 deletions src/config-consumer/tests/ConfigConsumer.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/config-consumer/tests/ConfigConsumer.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NConfigConsumer } from '../index'

describe('n-config-consumer', () => {
it('should work with import on demand', () => {
mount(NConfigConsumer)
})
})
19 changes: 0 additions & 19 deletions src/config-provider/tests/ConfigProvider.spec.js

This file was deleted.

8 changes: 8 additions & 0 deletions src/config-provider/tests/ConfigProvider.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { mount } from '@vue/test-utils'
import { NConfigProvider } from '../index'

describe('n-config-provider', () => {
it('should work with import on demand', () => {
mount(NConfigProvider)
})
})
2 changes: 1 addition & 1 deletion src/data-table/demos/enUS/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ custom-filter-menu
| bordered | `boolean` | `true` | |
| bottom-bordered | `boolean` | `true` | |
| checked-row-keys | `Array<string \| number>` | `undefined` | The keys of checked rows. |
| columns | `Array<Column>` | required | Columns to display. |
| columns | `Array<Column>` | `[]` | Columns to display. |
| data | `Array<Object>` | `[]` | Data to display. |
| default-checked-row-keys | `Array<string \| number>` | `[]` | |
| loading | `boolean` | `false` | |
Expand Down
2 changes: 1 addition & 1 deletion src/data-table/demos/zhCN/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ custom-filter-menu
| bordered | `boolean` | `true` | |
| bottom-bordered | `boolean` | `true` | |
| checked-row-keys | `Array<string \| number>` | `undefined` | 被选中的列的 key |
| columns | `Array<Column>` | | 需要展示的列**必需** |
| columns | `Array<Column>` | `[]` | 需要展示的列 |
| data | `Array<Object>` | `[]` | 需要展示的数据 |
| default-checked-row-keys | `Array<string \| number>` | `[]` | |
| loading | `boolean` | `false` | |
Expand Down
2 changes: 1 addition & 1 deletion src/data-table/src/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const dataTableProps = {
maxHeight: Number,
columns: {
type: Array as PropType<Array<TableColumnInfo | SelectionColInfo>>,
required: true
default: () => []
},
data: {
type: Array as PropType<TableNode[]>,
Expand Down
Loading

0 comments on commit 6a70895

Please sign in to comment.