Skip to content

Commit b8671ce

Browse files
kagolhxj9102chenxi24Zz-ZzzZhuangxiaojie02
authored
release v1.5.0 (#1523)
* feat: release v1.4.0 * fix(search): fix props max-length * test(search): improve test case * refactor: Refactor code and component structure * fix: fix file name error * test(icon): improve icon test case * fix(tabs): fix content of tab has not changed when add a tab * refactor(popover): refactor popover test * test(form-item): add form-item test * fix(modal): 修复弹窗组件信息提示图标的颜色 * chore: release v1.4.1 * fix(collapse): 修复折叠面板禁用时图标颜色 * fix(time-picker): fix test case not pass * test(textarea、dropdown): improve test case * feat: documents support importing vue files * chore: solve eslint error * chore: update version to 1.5.0 * fix: fix build failed: ERR_REQUIRE_ESM Co-authored-by: hxj9102 <[email protected]> Co-authored-by: chenxi24 <[email protected]> Co-authored-by: Zz-ZzzZ <[email protected]> Co-authored-by: huangxiaojie02 <[email protected]> Co-authored-by: 刘元博 <[email protected]> Co-authored-by: gxuud <[email protected]>
1 parent ad667ff commit b8671ce

File tree

27 files changed

+1258
-263
lines changed

27 files changed

+1258
-263
lines changed

.eslintrc.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
root: true,
3-
parser: '@typescript-eslint/parser',
3+
parser: 'vue-eslint-parser',
44
parserOptions: {
55
sourceType: 'module',
66
ecmaVersion: 6,
@@ -110,4 +110,13 @@ module.exports = {
110110
'@typescript-eslint/member-ordering': 'off',
111111
'array-callback-return': 'off',
112112
},
113+
"overrides": [
114+
{
115+
"files": [
116+
"*.ts",
117+
"*.tsx"
118+
],
119+
"parser": "@typescript-eslint/parser"
120+
}
121+
]
113122
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@commitlint/cli": "^11.0.0",
1515
"@ls-lint/ls-lint": "^1.10.0",
1616
"@types/lodash": "^4.14.182",
17+
"@types/node": "^16.11.6",
1718
"all-contributors-cli": "^6.20.0",
1819
"better-scripts": "^0.1.1",
1920
"esbuild-register": "^2.6.0",

packages/devui-vue/devui/collapse/src/collapse.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
&.#{$devui-prefix}-collapse__item--disabled {
3434
color: $devui-disabled-text;
3535
cursor: not-allowed;
36+
37+
& > .#{$devui-prefix}-collapse__open-icon svg path {
38+
fill: currentColor !important;
39+
}
3640
}
3741

3842
&:not(.#{$devui-prefix}-collapse__item--disabled) {

packages/devui-vue/devui/dropdown/__tests__/dropdown.spec.tsx

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
import { mount } from '@vue/test-utils';
22
import { nextTick, ref } from 'vue';
3-
import Dropdown from '../src/dropdown';
3+
import { Dropdown, DropdownMenu } from '../';
44
import { useNamespace } from '../../shared/hooks/use-namespace';
55

66
const buttonClass = useNamespace('button', true).b();
77
const flexibleOverlayClass = useNamespace('flexible-overlay', true).b();
8+
const dropdownNs = useNamespace('dropdown', true);
89

910
describe('d-dropdown', () => {
11+
beforeEach(() => {
12+
const dropdownMenus = document.querySelectorAll(flexibleOverlayClass);
13+
[...dropdownMenus].forEach(dropdownMenu => {
14+
dropdownMenu && dropdownMenu.parentNode?.removeChild(dropdownMenu);
15+
});
16+
});
17+
1018
it('should render correctly', async () => {
1119
const wrapper = mount({
1220
setup() {
@@ -180,7 +188,64 @@ describe('d-dropdown', () => {
180188
wrapper.unmount();
181189
});
182190

183-
it.todo('multi dropdown should work well.');
191+
it('multi dropdown should work well.', async () => {
192+
const wrapper = mount({
193+
setup() {
194+
return () => (
195+
<Dropdown>
196+
{{
197+
default: () => <d-button>Click Me</d-button>,
198+
menu: () => (
199+
<ul class="list-menu">
200+
<li class="menu-item">Item 1</li>
201+
<Dropdown>
202+
{{
203+
default: () => <li class="menu-item">Item 2</li>,
204+
menu: () => (
205+
<ul class="sub-list-menu">
206+
<li class="sub-menu-item">Item 2-1</li>
207+
<li class="sub-menu-item">Item 2-2</li>
208+
<li class="sub-menu-item">Item 2-3</li>
209+
</ul>
210+
),
211+
}}
212+
</Dropdown>
213+
</ul>
214+
),
215+
}}
216+
</Dropdown>
217+
);
218+
},
219+
});
220+
await nextTick();
221+
const btn = wrapper.find(buttonClass);
222+
await btn.trigger('click');
223+
expect(document.querySelectorAll(dropdownNs.e('menu-wrap')).length).toBe(1);
224+
await document.querySelector(dropdownNs.e('menu-wrap'))?.querySelectorAll('.menu-item')[1]?.click();
225+
expect(document.querySelectorAll(dropdownNs.e('menu-wrap')).length).toBe(2);
226+
wrapper.unmount();
227+
});
184228

185-
it.todo('d-dropdown-item should work well.');
229+
it('d-dropdown-item should work well.', async () => {
230+
const isOpen = ref(false);
231+
const wrapper = mount({
232+
setup () {
233+
return () => (
234+
<DropdownMenu v-model={isOpen.value}>
235+
<ul class="list-menu">
236+
<li class="menu-item">Item 1</li>
237+
<li class="menu-item">Item 2</li>
238+
<li class="menu-item">Item 3</li>
239+
<li class="menu-item">Item 4</li>
240+
</ul>
241+
</DropdownMenu>
242+
);
243+
},
244+
});
245+
expect(document.querySelector(dropdownNs.e('menu-wrap'))).toBeFalsy();
246+
isOpen.value = true;
247+
await nextTick();
248+
expect(document.querySelector(dropdownNs.e('menu-wrap'))).toBeTruthy();
249+
wrapper.unmount();
250+
});
186251
});

packages/devui-vue/devui/editable-select/src/components/dropdown/dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { EditableSelectContext, Option as O, SELECT_KEY } from '../../editable-s
44
import Option from '../option/option';
55
import Loading from '../../../../loading/src/loading-directive';
66
import { useNamespace } from '../../../../shared/hooks/use-namespace';
7-
import { debounce } from 'lodash-es';
7+
import { debounce } from 'lodash';
88

99
export default defineComponent({
1010
name: 'DEditableSelectDropdown',

packages/devui-vue/devui/editable-select/src/composables/use-input-event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { computed, Ref, SetupContext } from 'vue';
2-
import { debounce, isFunction } from 'lodash-es';
2+
import { debounce, isFunction } from 'lodash';
33
import { EditableSelectProps } from '../editable-select-types';
44
import { States } from './use-select';
55

packages/devui-vue/devui/editable-select/src/composables/use-select.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { computed, ComputedRef, getCurrentInstance, nextTick, onMounted, reactive, ref, Ref, SetupContext, watch } from 'vue';
22
import { EditableSelectProps, Option, Options } from '../editable-select-types';
33
import { createI18nTranslate } from '../../../locale/create';
4-
import { isNil } from 'lodash-es';
4+
import { isNil } from 'lodash';
55

66
export interface UseSelectStatesReturnType {
77
hoveringIndex: number;

packages/devui-vue/devui/textarea/__tests__/textarea.spec.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { mount } from '@vue/test-utils';
22
import { ref, nextTick } from 'vue';
33
import DTextarea from '../src/textarea';
4+
import { useNamespace } from '../../shared/hooks/use-namespace';
5+
6+
const ns = useNamespace('textarea', true);
47

58
describe('textarea test', () => {
69
it('d-textarea render work', async () => {
@@ -128,5 +131,26 @@ describe('textarea test', () => {
128131

129132
it.todo('props resize work well.');
130133

131-
it.todo('props show-count work well.');
134+
it('props show-count work well.', async () => {
135+
const value = ref('');
136+
const wrapper = mount({
137+
components: { DTextarea },
138+
template: `
139+
<d-textarea v-model="value" show-count />
140+
`,
141+
setup () {
142+
return {
143+
value,
144+
};
145+
},
146+
});
147+
expect(wrapper.find(ns.e('show-count')).text()).toBe('0');
148+
value.value = '12345678';
149+
await nextTick();
150+
expect(wrapper.find(ns.e('show-count')).text()).toBe('8');
151+
await wrapper.setProps({
152+
maxlength: 20,
153+
});
154+
expect(wrapper.find(ns.e('show-count')).text()).toBe('8 / 20');
155+
});
132156
});

packages/devui-vue/devui/time-picker/__tests__/time-picker.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ describe('time-picker test', () => {
172172
};
173173
slotDemo.value.chooseTime(timeObj);
174174
};
175+
let date = new Date();
175176
// 插槽内方法 -- 选择当前时间
176177
const chooseNowFun = () => {
177-
const date = new Date();
178178
const hour = date.getHours() > 9 ? date.getHours() : '0' + date.getHours();
179179
const minute = date.getMinutes() > 9 ? date.getMinutes() : '0' + date.getMinutes();
180180
const second = date.getSeconds() > 9 ? date.getSeconds() : '0' + date.getSeconds();
@@ -210,6 +210,7 @@ describe('time-picker test', () => {
210210
await timeInput.trigger('focus');
211211
const slotBottomNow = document.querySelector('.slot-bottom-now');
212212
const slotBottomOne = document.querySelector('.slot-bottom-one');
213+
date = new Date();
213214
await slotBottomNow?.dispatchEvent(new Event('click'));
214215
expect(timeInput.element.value).toBe(chooseNowFun());
215216

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
const options = { cssPreprocessor: 'scss' };
2+
import { blockPlugin } from '../plugins/block-plugin';
3+
import { renderPlugin, codePlugin } from 'vitepress-theme-demoblock';
4+
15
const markdown = {
26
config: (md) => {
3-
const { demoBlockPlugin } = require('vitepress-theme-demoblock')
4-
md.use(demoBlockPlugin, {
5-
cssPreprocessor: 'scss'
6-
})
7+
md.use((curMd) => {
8+
curMd.use(blockPlugin, options);
9+
curMd.use(codePlugin, options);
10+
curMd.use(renderPlugin, options);
11+
});
712
}
813
}
9-
export default markdown
14+
export default markdown;

0 commit comments

Comments
 (0)