[AAE-8086] Propagate form events (#7572)

* [AAE-8086] Propagate events

* [AAE-8086] Add form rules manager to the form renderer

* [AAE-8086] Extensibility improvements

* [AAE-8086] Fix wrong import

* [AAE-8087] Add form actions

* [AAE-8086] Initialize form rules manager on form renderer component changes

* [AAE-8087] Fix form actions

* [AAE-8087] Fix unit tests for field visibility

* trigger travis
This commit is contained in:
Pablo Martinez Garcia
2022-04-14 11:59:12 +02:00
committed by GitHub
parent 48c3fac018
commit a02a8a4ad9
18 changed files with 464 additions and 34 deletions

View File

@@ -158,12 +158,12 @@ describe('FormComponent UI and visibility', () => {
fixture.detectChanges();
const firstEl = fixture.debugElement.query(By.css('#field-country-container'));
expect(firstEl.nativeElement.hidden).toBeTruthy();
expect(firstEl.nativeElement.style.visibility).toBe('hidden');
const secondEl = fixture.debugElement.query(By.css('#name'));
expect(secondEl).not.toBeNull();
expect(secondEl).toBeDefined();
expect(fixture.nativeElement.querySelector('#field-name-container').hidden).toBeFalsy();
expect(fixture.nativeElement.querySelector('#field-name-container').style.visibility).not.toBe('hidden');
});
it('should hide the field based on the previous one', () => {
@@ -177,10 +177,10 @@ describe('FormComponent UI and visibility', () => {
const firstEl = fixture.debugElement.query(By.css('#name'));
expect(firstEl).not.toBeNull();
expect(firstEl).toBeDefined();
expect(fixture.nativeElement.querySelector('#field-name-container').hidden).toBeFalsy();
expect(fixture.nativeElement.querySelector('#field-name-container').style.visibility).not.toBe('hidden');
const secondEl = fixture.debugElement.query(By.css('#field-country-container'));
expect(secondEl.nativeElement.hidden).toBeTruthy();
expect(secondEl.nativeElement.style.visibility).toBe('hidden');
});
it('should show the hidden field when the visibility condition change to true', () => {
@@ -192,10 +192,10 @@ describe('FormComponent UI and visibility', () => {
fixture.detectChanges();
let firstEl = fixture.debugElement.query(By.css('#field-country-container'));
expect(firstEl.nativeElement.hidden).toBeTruthy();
expect(firstEl.nativeElement.style.visibility).toBe('hidden');
const secondEl = fixture.debugElement.query(By.css('#field-name-container'));
expect(secondEl.nativeElement.hidden).toBeFalsy();
expect(secondEl.nativeElement.style.visibility).not.toBe('hidden');
const inputElement = fixture.nativeElement.querySelector('#name');
inputElement.value = 'italy';
@@ -203,7 +203,7 @@ describe('FormComponent UI and visibility', () => {
fixture.detectChanges();
firstEl = fixture.debugElement.query(By.css('#field-country-container'));
expect(firstEl.nativeElement.hidden).toBeFalsy();
expect(firstEl.nativeElement.style.visibility).not.toBe('hidden');
});
});

View File

@@ -513,9 +513,9 @@ describe('TaskFormComponent', () => {
fixture.detectChanges();
await fixture.whenStable();
const inputThreeContainer = fixture.nativeElement.querySelector('#field-text3-container');
expect(inputThreeContainer.hidden).toBe(true);
expect(inputThreeContainer.style.visibility).toBe('hidden');
const completeOutcomeButton: HTMLButtonElement = fixture.nativeElement.querySelector('#adf-form-complete');
expect(completeOutcomeButton.hidden).toBe(false);
expect(completeOutcomeButton.style.visibility).not.toBe('hidden');
completeOutcomeButton.click();
fixture.detectChanges();
});