mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-17 11:49:41 +08:00
Merge branch 'dev' into feat/cz_&_husky
This commit is contained in:
commit
689864b219
24
.github/workflows/yarn.js.yml
vendored
Normal file
24
.github/workflows/yarn.js.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- 'feat/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
- 'feat/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: borales/actions-yarn@v2.0.0
|
||||
with:
|
||||
cmd: install --frozen-lockfile
|
||||
- uses: borales/actions-yarn@v2.0.0
|
||||
with:
|
||||
cmd: test
|
@ -13,6 +13,20 @@ function webpack(config) {
|
||||
loader: require.resolve('vue-loader'),
|
||||
options: {},
|
||||
},
|
||||
{
|
||||
test: /\.stories\.ts$/,
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve('./export-loader')
|
||||
},
|
||||
{
|
||||
loader: require.resolve('ts-loader'),
|
||||
options: {
|
||||
transpileOnly: true,
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.(ts|tsx)$/,
|
||||
use: [
|
||||
|
10
.storybook/export-loader.js
Normal file
10
.storybook/export-loader.js
Normal file
@ -0,0 +1,10 @@
|
||||
module.exports = function (content, map, meta) {
|
||||
content = content.replace(
|
||||
/^export\s*{\s*default as (.+?)}(.+)/mg,`
|
||||
import _$1 $2
|
||||
export const $1 = () => _$1
|
||||
`.trim())
|
||||
this.callback(null, content, map, meta)
|
||||
return
|
||||
}
|
||||
|
@ -3,4 +3,5 @@ const path = require('path');
|
||||
module.exports = {
|
||||
stories: ['../packages/**/doc/*.stories.[tj]s'],
|
||||
presets: [path.resolve(__dirname, './custom-presets')],
|
||||
addons: ['@storybook/addon-storysource'],
|
||||
};
|
||||
|
@ -19,6 +19,7 @@
|
||||
"@babel/core": "^7.10.5",
|
||||
"@commitlint/cli": "^9.1.1",
|
||||
"@commitlint/config-conventional": "^9.1.1",
|
||||
"@storybook/addon-storysource": "^5.3.19",
|
||||
"@storybook/html": "^5.3.19",
|
||||
"@types/jest": "^26.0.7",
|
||||
"@vue/compiler-sfc": "^3.0.0-rc.1",
|
||||
@ -26,9 +27,9 @@
|
||||
"babel-preset-vue": "^2.0.2",
|
||||
"cz-conventional-changelog": "^3.2.0",
|
||||
"husky": "^4.2.5",
|
||||
"lint-staged": "^10.2.11",
|
||||
"jest": "^24.1.0",
|
||||
"lerna": "^3.22.1",
|
||||
"lint-staged": "^10.2.11",
|
||||
"ts-jest": "^26.1.3",
|
||||
"ts-loader": "^8.0.1",
|
||||
"typescript": "^3.9.7",
|
||||
|
@ -3,13 +3,35 @@ import Badge from '../src/index.vue'
|
||||
|
||||
const AXIOM = 'Rem is the best girl'
|
||||
|
||||
describe('Badge.vue', () => {
|
||||
test('render test', () => {
|
||||
const instance = mount(Badge, {
|
||||
slots: {
|
||||
default: AXIOM
|
||||
},
|
||||
describe('Badge', () => {
|
||||
test('has value', () => {
|
||||
const wrapper = mount(Badge, {
|
||||
props: {value: 80}
|
||||
})
|
||||
expect(instance.text()).toEqual(AXIOM)
|
||||
expect(wrapper.vm.content).toEqual(80)
|
||||
})
|
||||
|
||||
test('is fixed', () => {
|
||||
const wrapper = mount(Badge, {
|
||||
slots: {default: AXIOM}
|
||||
})
|
||||
expect(wrapper.find('.el-badge__content.is-fixed')).toBeDefined()
|
||||
})
|
||||
|
||||
test('is dot', () => {
|
||||
const wrapper = mount(Badge, {
|
||||
props: {isDot: true},
|
||||
slots: {default: AXIOM}
|
||||
})
|
||||
expect(wrapper.find('.el-badge__content.is-fixed')).toBeDefined()
|
||||
})
|
||||
|
||||
test('max', async () => {
|
||||
const wrapper = mount(Badge, {
|
||||
props: {max: 100, value: 200},
|
||||
})
|
||||
expect(wrapper.vm.content).toEqual('100+')
|
||||
await wrapper.setProps({value: 80})
|
||||
expect(wrapper.vm.content).toEqual(80)
|
||||
})
|
||||
})
|
||||
|
@ -1,7 +1,5 @@
|
||||
import Basic from './basic.vue'
|
||||
export { default as BasicUsage} from './basic.vue'
|
||||
|
||||
export default {
|
||||
title: "Badge",
|
||||
}
|
||||
|
||||
export const BasicUsage = () => Basic
|
||||
|
2
typings/vue-shim.d.ts
vendored
2
typings/vue-shim.d.ts
vendored
@ -1,7 +1,7 @@
|
||||
declare module '*.vue' {
|
||||
import { Component, ComponentPublicInstance } from 'vue'
|
||||
const _default: Component & {
|
||||
new (): ComponentPublicInstance
|
||||
new (): ComponentPublicInstance<any>
|
||||
}
|
||||
export default _default
|
||||
}
|
||||
|
40
yarn.lock
40
yarn.lock
@ -2169,6 +2169,25 @@
|
||||
estree-walker "^1.0.1"
|
||||
picomatch "^2.2.2"
|
||||
|
||||
"@storybook/addon-storysource@^5.3.19":
|
||||
version "5.3.19"
|
||||
resolved "https://registry.yarnpkg.com/@storybook/addon-storysource/-/addon-storysource-5.3.19.tgz#ae693e88db5d220cb256a9ef4a2366c300e8d88c"
|
||||
integrity sha512-W7mIAHuxYT+b1huaHCHLkBAh2MbeWmF8CxeBCFiOgZaYYQUTDEh018HJF8u2AqiWSouRhcfzhTnGxOo0hNRBgw==
|
||||
dependencies:
|
||||
"@storybook/addons" "5.3.19"
|
||||
"@storybook/components" "5.3.19"
|
||||
"@storybook/router" "5.3.19"
|
||||
"@storybook/source-loader" "5.3.19"
|
||||
"@storybook/theming" "5.3.19"
|
||||
core-js "^3.0.1"
|
||||
estraverse "^4.2.0"
|
||||
loader-utils "^1.2.3"
|
||||
prettier "^1.16.4"
|
||||
prop-types "^15.7.2"
|
||||
react-syntax-highlighter "^11.0.2"
|
||||
regenerator-runtime "^0.13.3"
|
||||
util-deprecate "^1.0.2"
|
||||
|
||||
"@storybook/addons@5.3.19":
|
||||
version "5.3.19"
|
||||
resolved "https://registry.npm.taobao.org/@storybook/addons/download/@storybook/addons-5.3.19.tgz?cache=0&sync_timestamp=1595435252424&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40storybook%2Faddons%2Fdownload%2F%40storybook%2Faddons-5.3.19.tgz#3a7010697afd6df9a41b8c8a7351d9a06ff490a4"
|
||||
@ -2417,6 +2436,22 @@
|
||||
qs "^6.6.0"
|
||||
util-deprecate "^1.0.2"
|
||||
|
||||
"@storybook/source-loader@5.3.19":
|
||||
version "5.3.19"
|
||||
resolved "https://registry.yarnpkg.com/@storybook/source-loader/-/source-loader-5.3.19.tgz#ff0a00731c24c61721d8b9d84152f8542913a3b7"
|
||||
integrity sha512-srSZRPgEOUse8nRVnlazweB2QGp63mPqM0uofg8zYARyaYSOzkC155ymdeiHsmiBTS3X3I0FQE4+KnwiH7iLtw==
|
||||
dependencies:
|
||||
"@storybook/addons" "5.3.19"
|
||||
"@storybook/client-logger" "5.3.19"
|
||||
"@storybook/csf" "0.0.1"
|
||||
core-js "^3.0.1"
|
||||
estraverse "^4.2.0"
|
||||
global "^4.3.2"
|
||||
loader-utils "^1.2.3"
|
||||
prettier "^1.16.4"
|
||||
prop-types "^15.7.2"
|
||||
regenerator-runtime "^0.13.3"
|
||||
|
||||
"@storybook/theming@5.3.19":
|
||||
version "5.3.19"
|
||||
resolved "https://registry.npm.taobao.org/@storybook/theming/download/@storybook/theming-5.3.19.tgz#177d9819bd64f7a1a6ea2f1920ffa5baf9a5f467"
|
||||
@ -10598,6 +10633,11 @@ prelude-ls@~1.1.2:
|
||||
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
|
||||
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
|
||||
|
||||
prettier@^1.16.4:
|
||||
version "1.19.1"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
|
||||
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
|
||||
|
||||
pretty-error@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.npm.taobao.org/pretty-error/download/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
|
||||
|
Loading…
Reference in New Issue
Block a user