mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-612] Support for Form Outcome Visibility Conditions (#5934)
This commit is contained in:
@@ -23,11 +23,30 @@ describe('FormOutcomeModel', () => {
|
||||
it('should setup with json config', () => {
|
||||
const json = {
|
||||
id: '<id>',
|
||||
name: '<name>'
|
||||
name: '<name>',
|
||||
visibilityCondition: {
|
||||
leftType: 'field',
|
||||
leftValue: 'TextOne',
|
||||
operator: '==',
|
||||
rightValue: 'showTab',
|
||||
rightType: 'value',
|
||||
nextConditionOperator: '',
|
||||
nextCondition: null
|
||||
}
|
||||
};
|
||||
const model = new FormOutcomeModel(null, json);
|
||||
expect(model.id).toBe(json.id);
|
||||
expect(model.name).toBe(json.name);
|
||||
expect(model.visibilityCondition).toBeDefined();
|
||||
});
|
||||
|
||||
it('should not setup with null json config', () => {
|
||||
const model = new FormOutcomeModel(null, null);
|
||||
expect(model.id).toBeUndefined();
|
||||
expect(model.name).toBeUndefined();
|
||||
expect(model.isVisible).toBeDefined();
|
||||
expect(model.isVisible).toBe(true);
|
||||
expect(model.visibilityCondition).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should store the form reference', () => {
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
import { FormWidgetModel } from './form-widget.model';
|
||||
import { FormModel } from './form.model';
|
||||
import { WidgetVisibilityModel } from './../../../models/widget-visibility.model';
|
||||
|
||||
export class FormOutcomeModel extends FormWidgetModel {
|
||||
|
||||
@@ -28,6 +29,8 @@ export class FormOutcomeModel extends FormWidgetModel {
|
||||
|
||||
isSystem: boolean = false;
|
||||
isSelected: boolean = false;
|
||||
isVisible: boolean = true;
|
||||
visibilityCondition: WidgetVisibilityModel;
|
||||
|
||||
constructor(form: FormModel, json?: any) {
|
||||
super(form, json);
|
||||
@@ -35,6 +38,7 @@ export class FormOutcomeModel extends FormWidgetModel {
|
||||
if (json) {
|
||||
this.isSystem = json.isSystem ? true : false;
|
||||
this.isSelected = form && json.name === form.selectedOutcome ? true : false;
|
||||
this.visibilityCondition = new WidgetVisibilityModel(json.visibilityCondition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ describe('TabModel', () => {
|
||||
expect(model.isVisible).toBe(true);
|
||||
});
|
||||
|
||||
it('should not setup with json config', () => {
|
||||
it('should not setup with null json config', () => {
|
||||
const model = new TabModel(null, null);
|
||||
expect(model.id).toBeUndefined();
|
||||
expect(model.title).toBeUndefined();
|
||||
|
Reference in New Issue
Block a user