mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
AAE-29971 Buttons for dynamic component (#10539)
* [AAE-29971] buttons for dynamic component * [AAE-29971] added unit tests for projected content
This commit is contained in:
parent
af3ca02347
commit
18ff34c6c8
@ -1 +1,8 @@
|
||||
<div #container></div>
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
<div #container></div>
|
||||
</mat-card-content>
|
||||
<mat-card-actions align="end">
|
||||
<ng-content select="[buttons]"></ng-content>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
@ -16,12 +16,11 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TaskScreenCloudComponent } from './screen-cloud.component';
|
||||
import { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ScreenRenderingService } from '../../../services/public-api';
|
||||
import { Component } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ScreenRenderingService } from '../../../services/public-api';
|
||||
import { TaskScreenCloudComponent } from './screen-cloud.component';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-test-component',
|
||||
@ -31,15 +30,27 @@ import { By } from '@angular/platform-browser';
|
||||
})
|
||||
class TestComponent {}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-test-actions-component',
|
||||
template: `<adf-cloud-task-screen [taskId]="'1'" [appName]="'app-name-test'" [screenId]="'test'">
|
||||
<div buttons class="adf-cloud-test-buttons">
|
||||
<button>Test</button>
|
||||
</div>
|
||||
</adf-cloud-task-screen> `,
|
||||
imports: [CommonModule, TaskScreenCloudComponent],
|
||||
standalone: true
|
||||
})
|
||||
class TestWrapperComponent {}
|
||||
|
||||
describe('TaskScreenCloudComponent', () => {
|
||||
let fixture: ComponentFixture<TaskScreenCloudComponent>;
|
||||
let fixture: ComponentFixture<TestWrapperComponent>;
|
||||
let screenRenderingService: ScreenRenderingService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TaskScreenCloudComponent, TestComponent]
|
||||
imports: [TaskScreenCloudComponent, TestComponent, TestWrapperComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TaskScreenCloudComponent);
|
||||
fixture = TestBed.createComponent(TestWrapperComponent);
|
||||
screenRenderingService = TestBed.inject(ScreenRenderingService);
|
||||
screenRenderingService.register({ ['test']: () => TestComponent });
|
||||
fixture.componentRef.setInput('screenId', 'test');
|
||||
@ -50,4 +61,9 @@ describe('TaskScreenCloudComponent', () => {
|
||||
const dynamicComponent = fixture.debugElement.query(By.css('.adf-cloud-test-container'));
|
||||
expect(dynamicComponent).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should project content into component', async () => {
|
||||
const projectedContent = fixture.debugElement.query(By.css('.adf-cloud-test-buttons'));
|
||||
expect(projectedContent).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
@ -18,12 +18,13 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, ComponentRef, inject, Input, OnInit, ViewChild, ViewContainerRef } from '@angular/core';
|
||||
import { ScreenRenderingService } from '../../../services/public-api';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-task-screen',
|
||||
standalone: true,
|
||||
imports: [CommonModule],
|
||||
template: '<div #container></div>'
|
||||
imports: [CommonModule, MatCardModule],
|
||||
templateUrl: './screen-cloud.component.html'
|
||||
})
|
||||
export class TaskScreenCloudComponent implements OnInit {
|
||||
/** Task id to fetch corresponding form and values. */
|
||||
|
@ -26,10 +26,13 @@
|
||||
|
||||
<ng-container *ngSwitchCase="taskTypeEnum.Screen">
|
||||
<adf-cloud-task-screen
|
||||
[taskId]="taskId"
|
||||
[appName]="appName"
|
||||
[screenId]="screenId"
|
||||
/>
|
||||
[taskId]="taskId"
|
||||
>
|
||||
<ng-template [ngTemplateOutlet]="taskFormCloudButtons" buttons>
|
||||
</ng-template>
|
||||
</adf-cloud-task-screen>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngSwitchCase="taskTypeEnum.None">
|
||||
|
Loading…
x
Reference in New Issue
Block a user