mirror of
https://github.com/vxcontrol/ncform.git
synced 2026-07-19 18:23:32 -04:00
fix(ncform-theme-elementui): fixed select bugs
This commit is contained in:
+1
-1
@@ -411,7 +411,7 @@ context('input', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it.only('autocomplete', () => {
|
||||
it('autocomplete', () => {
|
||||
cy.server();
|
||||
cy.route({
|
||||
method: 'GET',
|
||||
|
||||
+71
-1
@@ -363,6 +363,25 @@ context('select', () => {
|
||||
};
|
||||
}).as('list');
|
||||
|
||||
cy.route(() => {
|
||||
return {
|
||||
method: 'GET',
|
||||
url: '/list1**',
|
||||
response: {
|
||||
data: [
|
||||
{
|
||||
value: '1',
|
||||
label: 'daniel'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: 'sarah'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
}).as('list1');
|
||||
|
||||
let formSchema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -403,6 +422,22 @@ context('select', () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// filter > select > clear > select
|
||||
name3: {
|
||||
type: 'string',
|
||||
ui: {
|
||||
widget: 'select',
|
||||
widgetConfig: {
|
||||
filterable: true,
|
||||
filterLocal: false,
|
||||
enumSourceRemote: {
|
||||
remoteUrl: '/list1',
|
||||
itemTemplate: '<span>{{item.id}} : {{item.name}}</span>',
|
||||
resField: 'data'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -458,6 +493,41 @@ context('select', () => {
|
||||
expect(xhr.url.search('status=1&keyword=d')).to.be.greaterThan(0);
|
||||
expect(callCount).to.be.equal(3);
|
||||
});
|
||||
|
||||
cy.get('@body')
|
||||
.find('li:contains("daniel"):visible')
|
||||
.click()
|
||||
cy.get('input')
|
||||
.eq(0)
|
||||
.should('have.value', 'daniel');
|
||||
});
|
||||
|
||||
cy.get('label')
|
||||
.contains('name3')
|
||||
.parent()
|
||||
.within(() => {
|
||||
cy.wait('@list1');
|
||||
cy.get('input')
|
||||
.eq(0)
|
||||
.click();
|
||||
|
||||
cy.get('@body')
|
||||
.find('li:contains("daniel"):visible:last')
|
||||
.click()
|
||||
cy.get('input')
|
||||
.eq(0)
|
||||
.should('have.value', 'daniel');
|
||||
|
||||
cy.get('input')
|
||||
.eq(0)
|
||||
.click().clear();
|
||||
|
||||
cy.get('@body')
|
||||
.find('li:contains("sarah"):visible:last')
|
||||
.click()
|
||||
cy.get('input')
|
||||
.eq(0)
|
||||
.should('have.value', 'sarah');
|
||||
});
|
||||
|
||||
// common.submitForm();
|
||||
@@ -542,7 +612,7 @@ context('select', () => {
|
||||
.find('li:contains("sarah")')
|
||||
.find(':not(:hidden)')
|
||||
.click();
|
||||
cy.get('input')
|
||||
cy.get('input')
|
||||
.eq(0)
|
||||
.should('have.value', 'sarah');
|
||||
|
||||
|
||||
@@ -416,7 +416,7 @@ export default {
|
||||
// 下面是远程数据源的处理
|
||||
const options = {
|
||||
url: autoCpl.enumSourceRemote.remoteUrl,
|
||||
params: _get(this.mergeConfig, "autocomplete.enumSourceRemote.otherParams", {})
|
||||
params: _cloneDeep(_get(this.mergeConfig, "autocomplete.enumSourceRemote.otherParams", {}))
|
||||
};
|
||||
if (autoCpl.enumSourceRemote.paramName)
|
||||
options.params[autoCpl.enumSourceRemote.paramName] = queryString;
|
||||
|
||||
@@ -108,9 +108,10 @@ export default {
|
||||
|
||||
const options = {
|
||||
url: this.mergeConfig.enumSourceRemote.remoteUrl,
|
||||
params: _get(this.mergeConfig, "enumSourceRemote.otherParams", {})
|
||||
params: _cloneDeep(_get(this.mergeConfig, "enumSourceRemote.otherParams", {}))
|
||||
};
|
||||
options.params[this.mergeConfig.enumSourceRemote.paramName] = query;
|
||||
if (this.mergeConfig.enumSourceRemote.paramName)
|
||||
options.params[this.mergeConfig.enumSourceRemote.paramName] = query;
|
||||
this.$http(options).then(res => {
|
||||
this.$data.options = this.mergeConfig.enumSourceRemote.resField
|
||||
? _get(res.data, this.mergeConfig.enumSourceRemote.resField)
|
||||
|
||||
Reference in New Issue
Block a user