mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* ivy compatible core unit tests * ivy compatible content tests * ivy compatible process tests * ivy compatible process cloud tests * ivy compatible insights tests * fix content test * fix content test
108 lines
4.6 KiB
TypeScript
108 lines
4.6 KiB
TypeScript
/*!
|
|
* @license
|
|
* Copyright 2019 Alfresco Software, Ltd.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
import { CoreTestingModule } from '../../testing/core.testing.module';
|
|
import { setupTestBed } from '../../testing/setup-test-bed';
|
|
import { AboutApplicationModulesComponent } from './about-application-modules.component';
|
|
import { mockDependencies, mockPlugins } from '../about.mock';
|
|
import { TranslateModule } from '@ngx-translate/core';
|
|
|
|
describe('AboutApplicationModulesComponent', () => {
|
|
let fixture: ComponentFixture<AboutApplicationModulesComponent>;
|
|
let component: AboutApplicationModulesComponent;
|
|
|
|
setupTestBed({
|
|
imports: [
|
|
TranslateModule.forRoot(),
|
|
CoreTestingModule
|
|
]
|
|
});
|
|
|
|
beforeEach(() => {
|
|
fixture = TestBed.createComponent(AboutApplicationModulesComponent);
|
|
component = fixture.componentInstance;
|
|
component.dependencies = mockDependencies;
|
|
fixture.detectChanges();
|
|
});
|
|
|
|
afterEach(() => {
|
|
fixture.destroy();
|
|
});
|
|
|
|
it('Should display title', () => {
|
|
const titleElement = fixture.nativeElement.querySelector('[data-automation-id="adf-about-modules-title"]');
|
|
expect(titleElement.innerText).toEqual('ABOUT.PACKAGES.TITLE');
|
|
});
|
|
|
|
it('should display dependencies', async() => {
|
|
fixture.detectChanges();
|
|
await fixture.whenStable();
|
|
const dataTable = fixture.nativeElement.querySelector('.adf-datatable');
|
|
|
|
const depOne = fixture.nativeElement.querySelector('[data-automation-id="text_@alfresco/mock-core"]');
|
|
const depTwo = fixture.nativeElement.querySelector('[data-automation-id="text_@alfresco/mock-services"]');
|
|
const depVersionOne = fixture.nativeElement.querySelector('[data-automation-id="text_3.7.0"]');
|
|
const depVersionTwo = fixture.nativeElement.querySelector('[data-automation-id="text_2.0.0"]');
|
|
|
|
expect(dataTable).not.toBeNull();
|
|
|
|
expect(depOne.innerText).toEqual('@alfresco/mock-core');
|
|
expect(depTwo.innerText).toEqual('@alfresco/mock-services');
|
|
|
|
expect(depVersionOne.innerText).toEqual('3.7.0');
|
|
expect(depVersionTwo.innerText).toEqual('2.0.0');
|
|
});
|
|
|
|
it('should display extensions', async() => {
|
|
component.extensions = mockPlugins;
|
|
fixture.detectChanges();
|
|
await fixture.whenStable();
|
|
const dataTable = fixture.nativeElement.querySelector('.mat-table');
|
|
const nameColumn = fixture.nativeElement.querySelector('.mat-column--name');
|
|
const versionColumn = fixture.nativeElement.querySelector('.mat-column--version');
|
|
const licenseColumn = fixture.nativeElement.querySelector('.mat-column--license');
|
|
const nameRows = fixture.nativeElement.querySelector('.mat-row .mat-column--name');
|
|
const versionRows = fixture.nativeElement.querySelector('.mat-row .mat-column--version');
|
|
const licenseRows = fixture.nativeElement.querySelector('.mat-row .mat-column--license');
|
|
|
|
expect(dataTable).not.toBeNull();
|
|
|
|
expect(versionColumn.innerText).toEqual('ABOUT.EXTENSIONS.TABLE_HEADERS.VERSION');
|
|
expect(nameColumn.innerText).toEqual('ABOUT.EXTENSIONS.TABLE_HEADERS.NAME');
|
|
expect(licenseColumn.innerText).toEqual('ABOUT.EXTENSIONS.TABLE_HEADERS.LICENSE');
|
|
|
|
expect(nameRows.innerText).toEqual('plugin1');
|
|
expect(versionRows.innerText).toEqual('1.0.0');
|
|
expect(licenseRows.innerText).toEqual('MockLicense-2.0');
|
|
});
|
|
|
|
it('should not display extensions if showExtensions set to false ', async() => {
|
|
component.extensions = mockPlugins;
|
|
component.showExtensions = false;
|
|
fixture.detectChanges();
|
|
await fixture.whenStable();
|
|
const dataTable = fixture.nativeElement.querySelector('.mat-table');
|
|
const nameColumn = fixture.nativeElement.querySelector('.mat-column--name');
|
|
const nameRows = fixture.nativeElement.querySelector('.mat-row .mat-column--name');
|
|
|
|
expect(dataTable).toBeNull();
|
|
expect(nameColumn).toBeNull();
|
|
expect(nameRows).toBeNull();
|
|
});
|
|
});
|