Skip to content

Commit 182810f

Browse files
qinwenchengkagol
authored andcommitted
test(time-select): 增加对placeholder的测试
1 parent 8d04191 commit 182810f

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,10 @@ describe('TimeSelect', () => {
336336
expect(isAllDisabled(listItems, 0, 3 * 2 - 1)).toBeTruthy();
337337

338338
// 等于 03:00 的时间可以被点击
339+
expect(listItems[0].classList).not.toContain('disabled');
339340
await listItems[3 * 2].dispatchEvent(new Event('click'));
340341
listItems = document.querySelectorAll(selectItemCls);
341342
expect(listItems[0].classList).toContain('active');
342-
expect(listItems[0].classList).not.toContain('disabled');
343343
expect(input.element.value).toBe('03:00');
344344

345345
// 所有大于等于 03:00 小于等于 18:30 的时间可以被点击
@@ -375,5 +375,29 @@ describe('TimeSelect', () => {
375375
wrapper.unmount();
376376
});
377377

378-
it.todo('props placeholder work well.');
378+
it('time-select placeholder work', async () => {
379+
const wrapper = mount({
380+
components: { DTimeSelect },
381+
template: `<d-time-select v-model="modelValue" placeholder="测试placeholder是否正常渲染"></d-time-select>`,
382+
setup() {
383+
const modelValue = ref('');
384+
return {
385+
modelValue,
386+
};
387+
},
388+
});
389+
390+
const container = wrapper.find(baseClass);
391+
const dropdown = wrapper.find(dropdownCls);
392+
const input = wrapper.find<HTMLInputElement>(selectInputCls);
393+
expect(input.attributes().placeholder).toBe('测试placeholder是否正常渲染');
394+
395+
await wrapper.setProps({
396+
placeholder: 'placeholder',
397+
});
398+
await nextTick();
399+
400+
expect(input.attributes().placeholder).toBe('placeholder');
401+
402+
});
379403
});

0 commit comments

Comments
 (0)