mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-10 15:36:06 -06:00
Fixed jasmine test cases.
This commit is contained in:
parent
460c66ab3f
commit
89d40d38d9
@ -4,30 +4,18 @@ import BaseUISchema from 'sources/SchemaView/base_schema.ui';
|
|||||||
import { emptyValidator, isEmptyString } from '../../../../../../../../static/js/validators';
|
import { emptyValidator, isEmptyString } from '../../../../../../../../static/js/validators';
|
||||||
|
|
||||||
export class PartitionKeysSchema extends BaseUISchema {
|
export class PartitionKeysSchema extends BaseUISchema {
|
||||||
constructor(columns=[], getOperatorClass, getCollations) {
|
constructor(columns=[]) {
|
||||||
super({
|
super({
|
||||||
key_type: 'column',
|
key_type: 'column',
|
||||||
});
|
});
|
||||||
this.columns = columns;
|
this.columns = columns;
|
||||||
this.columnsReloadBasis = false;
|
this.columnsReloadBasis = false;
|
||||||
this.getOperatorClass = getOperatorClass;
|
|
||||||
this.getCollations = getCollations;
|
|
||||||
this.op_class_types = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeColumnOptions(columns) {
|
changeColumnOptions(columns) {
|
||||||
this.columns = columns;
|
this.columns = columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
setOpClassTypes(options) {
|
|
||||||
|
|
||||||
if(!options || (_.isArray(options) && options.length == 0))
|
|
||||||
return this.op_class_types;
|
|
||||||
|
|
||||||
if(this.op_class_types.length == 0)
|
|
||||||
this.op_class_types = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
get baseFields() {
|
get baseFields() {
|
||||||
let obj = this;
|
let obj = this;
|
||||||
return [{
|
return [{
|
||||||
@ -81,7 +69,7 @@ export class PartitionKeysSchema extends BaseUISchema {
|
|||||||
},{
|
},{
|
||||||
id: 'collationame', label: gettext('Collation'), cell: 'select',
|
id: 'collationame', label: gettext('Collation'), cell: 'select',
|
||||||
type: 'select', group: gettext('partition'), deps:['key_type'],
|
type: 'select', group: gettext('partition'), deps:['key_type'],
|
||||||
options: obj._top.getCollations(), mode: ['create', 'properties', 'edit'],
|
options: obj.top.getCollations(), mode: ['create', 'properties', 'edit'],
|
||||||
editable: function(state) {
|
editable: function(state) {
|
||||||
if(state.key_type == 'expression') {
|
if(state.key_type == 'expression') {
|
||||||
return false;
|
return false;
|
||||||
@ -100,8 +88,7 @@ export class PartitionKeysSchema extends BaseUISchema {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
disabled: ()=>{return !(obj.isNew()); },
|
disabled: ()=>{return !(obj.isNew()); },
|
||||||
options: obj._top.getOperatorClass(), mode: ['create', 'properties', 'edit'],
|
options: obj.top.getOperatorClass(), mode: ['create', 'properties', 'edit'],
|
||||||
optionsLoaded: (options)=>{obj.setOpClassTypes(options);},
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,9 @@ describe('PartitionTableSchema', ()=>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
schemaObj.top = schemaObj;
|
||||||
|
schemaObj.top.getCollations = ()=>Promise.resolve({});
|
||||||
|
schemaObj.top.getOperatorClass = ()=>Promise.resolve({});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
@ -29,6 +29,8 @@ class SchemaInColl extends BaseUISchema {
|
|||||||
this.collSchema = schemaObj;
|
this.collSchema = schemaObj;
|
||||||
this.columns = columns;
|
this.columns = columns;
|
||||||
}
|
}
|
||||||
|
getCollations() {}
|
||||||
|
getOperatorClass() {}
|
||||||
|
|
||||||
get baseFields() {
|
get baseFields() {
|
||||||
return [{
|
return [{
|
||||||
@ -52,7 +54,12 @@ describe('PartitionKeysSchema', ()=>{
|
|||||||
mount = createMount();
|
mount = createMount();
|
||||||
spyOn(nodeAjax, 'getNodeAjaxOptions').and.returnValue(Promise.resolve([]));
|
spyOn(nodeAjax, 'getNodeAjaxOptions').and.returnValue(Promise.resolve([]));
|
||||||
spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([]));
|
spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([]));
|
||||||
schemaObj = new SchemaInColl(new PartitionKeysSchema());
|
let partitionObj = new PartitionKeysSchema();
|
||||||
|
partitionObj.top = {
|
||||||
|
getCollations : ()=>{},
|
||||||
|
getOperatorClass : ()=>{},
|
||||||
|
};
|
||||||
|
schemaObj = new SchemaInColl(partitionObj);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
@ -164,6 +171,8 @@ describe('PartitionsSchema', ()=>{
|
|||||||
spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([]));
|
spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([]));
|
||||||
schemaObj = new PartitionsSchema();
|
schemaObj = new PartitionsSchema();
|
||||||
schemaObj.top = schemaObj;
|
schemaObj.top = schemaObj;
|
||||||
|
schemaObj.top.getCollations = ()=>Promise.resolve({});
|
||||||
|
schemaObj.top.getOperatorClass = ()=>Promise.resolve({});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user