mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
AAE-40102 Fix (#11363)
This commit is contained in:
@@ -65,6 +65,24 @@ describe('ButtonWidgetComponent', () => {
|
|||||||
expect(await button.isDisabled()).toBe(true);
|
expect(await button.isDisabled()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should disable button when the field reference remains the same but the readOnly property changes', async () => {
|
||||||
|
const sameFieldRef = { ...mockField, readOnly: false };
|
||||||
|
|
||||||
|
fixture.componentRef.setInput('field', sameFieldRef);
|
||||||
|
|
||||||
|
const button = await getButton();
|
||||||
|
const disabledBeforeChange = await button.isDisabled();
|
||||||
|
|
||||||
|
sameFieldRef.readOnly = true;
|
||||||
|
|
||||||
|
fixture.componentRef.setInput('field', sameFieldRef);
|
||||||
|
|
||||||
|
const disabledAfterChange = await button.isDisabled();
|
||||||
|
|
||||||
|
expect(disabledBeforeChange).toBe(false);
|
||||||
|
expect(disabledAfterChange).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('should attach className to the widget host element', () => {
|
it('should attach className to the widget host element', () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
/* eslint-disable @angular-eslint/component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
|
import { Component, ViewEncapsulation } from '@angular/core';
|
||||||
import { WidgetComponent } from '../widget.component';
|
import { WidgetComponent } from '../widget.component';
|
||||||
import { FormService } from '../../../services/form.service';
|
import { FormService } from '../../../services/form.service';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
@@ -32,7 +32,6 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|||||||
'[class]': 'hostClasses'
|
'[class]': 'hostClasses'
|
||||||
},
|
},
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
imports: [TranslatePipe, MatButtonModule, MatTooltipModule]
|
imports: [TranslatePipe, MatButtonModule, MatTooltipModule]
|
||||||
})
|
})
|
||||||
export class ButtonWidgetComponent extends WidgetComponent {
|
export class ButtonWidgetComponent extends WidgetComponent {
|
||||||
|
|||||||
Reference in New Issue
Block a user