mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
ACS-8198 remove f prefix
This commit is contained in:
committed by
Darya Blavanovich
parent
b9ee276b97
commit
5b599d90f5
@@ -17,10 +17,19 @@
|
|||||||
|
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { DialogComponent } from './dialog.component';
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { DIALOG_COMPONENT_DATA, DialogComponent } from './dialog.component';
|
||||||
import { DialogData } from './dialog-data.interface';
|
import { DialogData } from './dialog-data.interface';
|
||||||
import { DialogSize } from './dialog.model';
|
import { DialogSize } from './dialog.model';
|
||||||
import { CoreTestingModule } from '../../testing';
|
import { CoreTestingModule } from '../../testing';
|
||||||
|
import { Component, DebugElement, inject } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'adf-dummy-component'
|
||||||
|
})
|
||||||
|
class DummyComponent {
|
||||||
|
data = inject(DIALOG_COMPONENT_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
describe('DialogComponent', () => {
|
describe('DialogComponent', () => {
|
||||||
let component: DialogComponent;
|
let component: DialogComponent;
|
||||||
@@ -43,11 +52,13 @@ describe('DialogComponent', () => {
|
|||||||
const setupBeforeEach = (dialogOptions: DialogData = data) => {
|
const setupBeforeEach = (dialogOptions: DialogData = data) => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CoreTestingModule],
|
imports: [CoreTestingModule],
|
||||||
|
declarations: [DummyComponent],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: MAT_DIALOG_DATA, useValue: dialogOptions },
|
{ provide: MAT_DIALOG_DATA, useValue: dialogOptions },
|
||||||
{ provide: MatDialogRef, useValue: dialogRef }
|
{ provide: MatDialogRef, useValue: dialogRef }
|
||||||
]
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
|
||||||
dialogRef.close.calls.reset();
|
dialogRef.close.calls.reset();
|
||||||
fixture = TestBed.createComponent(DialogComponent);
|
fixture = TestBed.createComponent(DialogComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
@@ -254,4 +265,24 @@ describe('DialogComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('when contentComponent with contentData was passed', () => {
|
||||||
|
const mockData = 'Injected Data';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
setupBeforeEach({
|
||||||
|
...data,
|
||||||
|
contentComponent: DummyComponent,
|
||||||
|
componentData: mockData
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should generate component with injectoted data', () => {
|
||||||
|
const debugElement: DebugElement = fixture.debugElement.query(By.directive(DummyComponent));
|
||||||
|
const dummyComponentInstance = debugElement.componentInstance;
|
||||||
|
|
||||||
|
expect(dummyComponentInstance).toBeTruthy();
|
||||||
|
expect(dummyComponentInstance.data).toEqual(mockData);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user