Commit 32bdb193 authored by benjaminParisel's avatar benjaminParisel Committed by jeromecambon

defect(switch): disabled switch button in popup when properties not display (#2715)

Covers [UID-95](https://bonitasoft.atlassian.net/browse/UID-95)
parent a23f3d8a
......@@ -29,6 +29,7 @@
// Get dictionary to give it on webComponent
let dictionaryValues = Object.values(dictionary);
this.dictionary = this._attachDictionary(dictionaryValues[0]);
this.propertiesIsDisplay = false;
}
......@@ -85,9 +86,11 @@
this.selectedWidget = '';
return;
}
let selectedWidget = this.widgetsToDisplay.filter(w => w.name.toLowerCase() === this.selectedWidget.toLowerCase());
if (selectedWidget.length > 0) {
this.propertiesTo = this.getWidget(selectedWidget[0].id);
this.propertiesIsDisplay = true;
}
}
......
......@@ -66,6 +66,7 @@
<div class="modal-footer">
<button type="button"
class="btn btn-primary"
ng-disabled="!ctrl.propertiesIsDisplay"
ng-click="ctrl.applyConfig()"
translate>Switch
</button>
......
......@@ -198,11 +198,19 @@ describe('switchComponentPopupController', function () {
});
it('should display clear button when a widget is selected', function () {
controller.selectedWidget = 'pbInput';
controller.selectedWidget = 'Input';
expect(controller.isClearButtonVisible()).toBeTruthy();
controller.clearValue();
expect(controller.isClearButtonVisible()).toBeFalsy();
});
it('should disabled switch button in popup when user never click on show properties button', function () {
controller.selectedWidget = 'autocomplete';
expect(controller.propertiesIsDisplay).toBeFalsy();
controller.showProperties();
expect(controller.propertiesIsDisplay).toBeTruthy();
});
});
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