Fixed jasmine test cases.

This commit is contained in:
Pradip Parkale 2021-09-15 11:42:23 +05:30 committed by Akshay Joshi
parent 460c66ab3f
commit 89d40d38d9
3 changed files with 16 additions and 17 deletions

View File

@ -4,30 +4,18 @@ import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import { emptyValidator, isEmptyString } from '../../../../../../../../static/js/validators';
export class PartitionKeysSchema extends BaseUISchema {
constructor(columns=[], getOperatorClass, getCollations) {
constructor(columns=[]) {
super({
key_type: 'column',
});
this.columns = columns;
this.columnsReloadBasis = false;
this.getOperatorClass = getOperatorClass;
this.getCollations = getCollations;
this.op_class_types = [];
}
changeColumnOptions(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() {
let obj = this;
return [{
@ -81,7 +69,7 @@ export class PartitionKeysSchema extends BaseUISchema {
},{
id: 'collationame', label: gettext('Collation'), cell: 'select',
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) {
if(state.key_type == 'expression') {
return false;
@ -100,8 +88,7 @@ export class PartitionKeysSchema extends BaseUISchema {
return true;
},
disabled: ()=>{return !(obj.isNew()); },
options: obj._top.getOperatorClass(), mode: ['create', 'properties', 'edit'],
optionsLoaded: (options)=>{obj.setOpClassTypes(options);},
options: obj.top.getOperatorClass(), mode: ['create', 'properties', 'edit'],
}];
}

View File

@ -46,6 +46,9 @@ describe('PartitionTableSchema', ()=>{
}
}
});
schemaObj.top = schemaObj;
schemaObj.top.getCollations = ()=>Promise.resolve({});
schemaObj.top.getOperatorClass = ()=>Promise.resolve({});
});
afterAll(() => {

View File

@ -29,6 +29,8 @@ class SchemaInColl extends BaseUISchema {
this.collSchema = schemaObj;
this.columns = columns;
}
getCollations() {}
getOperatorClass() {}
get baseFields() {
return [{
@ -52,7 +54,12 @@ describe('PartitionKeysSchema', ()=>{
mount = createMount();
spyOn(nodeAjax, 'getNodeAjaxOptions').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(() => {
@ -164,6 +171,8 @@ describe('PartitionsSchema', ()=>{
spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([]));
schemaObj = new PartitionsSchema();
schemaObj.top = schemaObj;
schemaObj.top.getCollations = ()=>Promise.resolve({});
schemaObj.top.getOperatorClass = ()=>Promise.resolve({});
});
afterAll(() => {