[ADF-2297] App-list - The component shows "No Apps found" until all the apps are loaded (#2945)

* [ADF-2297] When loading the process workspace landing page after login, there is a message "No Apps found" displayed until all the apps are loaded

* Added a template in app-list component to show apps loading status.

* [ADF-2297] When loading the process workspace landing page after login, there is a message "No Apps found" displayed until all the apps are loaded

* Added a template in app-list component to show apps loading status.

* [ADF-2297] When loading the process workspace landing page after login, there is a message "No Apps found" displayed until all the apps are loaded

* Added a template in app-list component to show apps loading status.

* [ADF-2297] When loading the process workspace landing page after login, there is a message "No Apps found" displayed until all the apps are loaded

* Added a template in app-list component to show apps loading status.

* added a way to pass custom no-apps template to adf-apps

* [ADF-2297] When loading the process workspace landing page after login, there is a message "No Apps found" displayed until all the apps are loaded

* Added a template in app-list component to show apps loading status.

* added a way to pass custom no-apps template to adf-apps
This commit is contained in:
madhukar23
2018-02-20 15:55:53 +05:30
committed by Eugenio Romano
parent de575fd47b
commit 5955cc567d
6 changed files with 125 additions and 8 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { DebugElement } from '@angular/core';
import { DebugElement, Component } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { AppsProcessService, CoreModule } from '@alfresco/adf-core';
@@ -70,6 +70,19 @@ describe('AppsListComponent', () => {
expect(getAppsSpy).toHaveBeenCalled();
});
it('loading should be false by default', () => {
expect(component.loading).toBeFalsy();
});
it('should show the loading spinner when the apps are loading', async(() => {
component.loading = true;
fixture.detectChanges();
fixture.whenStable().then(() => {
let loadingSpinner = fixture.nativeElement.querySelector('mat-spinner');
expect(loadingSpinner).toBeDefined();
});
}));
it('should show the apps filtered by defaultAppId', () => {
component.filtersAppId = [{defaultAppId: 'fake-app-1'}];
fixture.detectChanges();
@@ -239,3 +252,45 @@ describe('AppsListComponent', () => {
});
});
@Component({
template: `
<adf-apps>
<adf-empty-list>
<div adf-empty-list-header class="adf-empty-list-header">No Apps</div>
</adf-empty-list>
</adf-apps>
`
})
class CustomEmptyAppListTemplateComponent {
}
describe('Custom CustomEmptyAppListTemplateComponent', () => {
let fixture: ComponentFixture<CustomEmptyAppListTemplateComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppsListComponent,
CustomEmptyAppListTemplateComponent
],
imports: [
MaterialModule
]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CustomEmptyAppListTemplateComponent);
fixture.detectChanges();
});
it('should render the custom no-apps template', async(() => {
fixture.whenStable().then(() => {
fixture.detectChanges();
let title: any = fixture.debugElement.queryAll(By.css('[adf-empty-list-header]'));
expect(title.length).toBe(1);
expect(title[0].nativeElement.innerText).toBe('No Apps');
});
}));
});