Commit 5d925ed6 authored by baiyaaaaa's avatar baiyaaaaa Committed by FuryBean

Test/component/form (#687)

Form: add test
parent 14495f61
......@@ -792,8 +792,8 @@
|---------- |-------------- |---------- |-------------------------------- |-------- |
| model | 表单数据对象 | object | — | — |
| rules | 表单验证规则 | object | — | — |
| type | 表单类型 | string | stacked, inline, horizontal | horizontal |
| label-align | 表单域标签的水平对齐位置 | string | right,left | right |
| inline | 行内表单模式 | boolean | — | false |
| label-position | 表单域标签的位置 | string | right/left/top | right |
| label-width | 表单域标签的宽度,所有的 form-item 都会继承 form 组件的 labelWidth 的值 | string | — | — |
| label-suffix | 表单域标签的后缀 | string | — | — |
......
......@@ -85,7 +85,6 @@
methods: {
validate(trigger, cb) {
var rules = this.getFilteredRule(trigger);
if (!rules || rules.length === 0) {
cb && cb();
return true;
......
......@@ -15,7 +15,6 @@
props: {
model: Object,
rules: Object,
type: String,
labelPosition: String,
labelWidth: String,
labelSuffix: {
......@@ -35,6 +34,7 @@
this.fields[field.prop] = field;
this.fieldLength++;
});
/* istanbul ignore next */
this.$on('el.form.removeField', (field) => {
delete this.fields[field.prop];
this.fieldLength--;
......
......@@ -4,7 +4,7 @@ describe('Dropdown', () => {
it('create', done => {
const vm = createVue({
template: `
<el-dropdown>
<el-dropdown ref="dropdown">
<span class="el-dropdown-link">
下拉菜单<i class="el-icon-caret-bottom el-icon-right"></i>
</span>
......@@ -18,19 +18,19 @@ describe('Dropdown', () => {
</el-dropdown>
`
}, true);
let dropdownElm = vm.$el;
let dropdown = vm.$refs.dropdown;
let dropdownElm = dropdown.$el;
let triggerElm = dropdownElm.children[0];
triggerEvent(triggerElm, 'mouseenter');
setTimeout(_ => {
var dropdownMenu = document.querySelector('.dropdown-test-creat');
expect(dropdownMenu.style.display).to.not.ok;
expect(dropdown.visible).to.be.true;
triggerEvent(triggerElm, 'mouseleave');
setTimeout(_ => {
expect(dropdownMenu.style.display).to.be.equal('none');
expect(dropdown.visible).to.not.true;
done();
}, 600);
}, 300);
}, 400);
});
it('menu click', done => {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment