mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
👽 Angular 14 rebase 👽 (#7769)
* fix after rebase * new release strategy for ng next Signed-off-by: eromano <eugenioromano16@gmail.com> * peer dep Signed-off-by: eromano <eugenioromano16@gmail.com> * Angular 14 fix unit test and storybook Signed-off-by: eromano <eugenioromano16@gmail.com> fix after rebase Signed-off-by: eromano <eugenioromano16@gmail.com> update pkg.json Signed-off-by: eromano <eugenioromano16@gmail.com> missing dep Signed-off-by: eromano <eugenioromano16@gmail.com> Fix mistake and missing code Dream....build only affected libs Add utility run commands * Use nx command to run affected tests * Fix nx test core fix content tests Run unit with watch false core test fixes reduce test warnings Fix process cloud unit Fix adf unit test Fix lint process cloud Disable lint next line Use right core path Fix insights unit fix linting insights Fix process-services unit fix the extensions test report fix test warnings Fix content unit Fix bunch of content unit * Produce an adf alpha of 14 * hopefully fixing the content * Push back the npm publish * Remove flaky unit * Fix linting * Make the branch as root * Get rid of angualar13 * Remove the travis depth * Fixing version for npm * Enabling cache for unit and build * Fix scss for core and paths Copy i18 and asset by using ng-packager Export the theming alias and fix path Use ng-package to copy assets process-services-cloud Use ng-package to copy assets process-services Use ng-package to copy assets content-services Use ng-package to copy assets insights * feat: fix api secondary entry point * fix storybook rebase * Move dist under dist/libs from lib/dist * Fix the webstyle * Use only necessary nrwl deps and improve lint * Fix unit for libs * Convert lint.sh to targets - improve performance * Use latest of angular * Align alfresco-js-api Signed-off-by: eromano <eugenioromano16@gmail.com> Co-authored-by: eromano <eugenioromano16@gmail.com> Co-authored-by: Mikolaj Serwicki <mikolaj.serwicki@hyland.com> Co-authored-by: Tomasz <tomasz.gnyp@hyland.com>
This commit is contained in:
@@ -141,10 +141,9 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
component.currentFolderId = 'fake-starting-folder';
|
||||
});
|
||||
|
||||
it('should trigger siteChange event on init with parent site Title of start folder', (done) => {
|
||||
component.siteChange.subscribe((siteTitle: string) => {
|
||||
it('should trigger siteChange event on init with parent site Title of start folder', async () => {
|
||||
await component.siteChange.subscribe((siteTitle: string) => {
|
||||
expect(siteTitle).toBe('fake-site');
|
||||
done();
|
||||
});
|
||||
|
||||
component.ngOnInit();
|
||||
@@ -152,19 +151,17 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
expect(component.startSiteGuid).toBe('fake-site');
|
||||
});
|
||||
|
||||
it('should trigger siteChange event when a site is selected in sites-dropdown', (done) => {
|
||||
it('should trigger siteChange event when a site is selected in sites-dropdown', async () => {
|
||||
const fakeSiteEntry = new SiteEntry({ entry: { title: 'fake-new-site', guid: 'fake-new-site' } });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
component.siteChange.subscribe((siteTitle: string) => {
|
||||
expect(siteTitle).toBe('fake-new-site');
|
||||
done();
|
||||
});
|
||||
|
||||
const sitesDropdown = fixture.debugElement.query(By.directive(DropdownSitesComponent));
|
||||
sitesDropdown.componentInstance.selectedSite({ value: fakeSiteEntry });
|
||||
await component.siteChange.subscribe((siteTitle: string) => {
|
||||
expect(siteTitle).toBe('fake-new-site');
|
||||
});
|
||||
|
||||
const sitesDropdown = fixture.debugElement.query(By.directive(DropdownSitesComponent));
|
||||
sitesDropdown.componentInstance.selectedSite({ value: fakeSiteEntry });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -194,12 +191,11 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
expect(component.documentList.sortingMode).toBe('server');
|
||||
});
|
||||
|
||||
it('should trigger the select event when selection has been made', (done) => {
|
||||
it('should trigger the select event when selection has been made', async () => {
|
||||
const expectedNode = { id: 'fakeid' } as Node;
|
||||
component.select.subscribe((nodes) => {
|
||||
await component.select.subscribe((nodes) => {
|
||||
expect(nodes.length).toBe(1);
|
||||
expect(nodes[0]).toBe(expectedNode);
|
||||
done();
|
||||
});
|
||||
|
||||
component.chosenNode = [expectedNode];
|
||||
@@ -288,16 +284,14 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show the breadcrumb for the currentFolderId by default', (done) => {
|
||||
it('should show the breadcrumb for the currentFolderId by default', async () => {
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
const breadcrumb = fixture.debugElement.query(By.directive(DropdownBreadcrumbComponent));
|
||||
expect(breadcrumb).not.toBeNull();
|
||||
expect(breadcrumb.componentInstance.folderNode).toEqual(undefined);
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
const breadcrumb = fixture.debugElement.query(By.directive(DropdownBreadcrumbComponent));
|
||||
expect(breadcrumb).not.toBeNull();
|
||||
expect(breadcrumb.componentInstance.folderNode).toEqual(undefined);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should not show the breadcrumb if search was performed as last action', async () => {
|
||||
@@ -367,37 +361,31 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
expect(breadcrumb.componentInstance.folderNode).toEqual(undefined);
|
||||
});
|
||||
|
||||
it('should keep breadcrumb folderNode unchanged if breadcrumbTransform is NOT defined', (done) => {
|
||||
it('should keep breadcrumb folderNode unchanged if breadcrumbTransform is NOT defined', async () => {
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
expect(component.breadcrumbTransform).toBeNull();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.breadcrumbTransform).toBeNull();
|
||||
|
||||
const breadcrumb = fixture.debugElement.query(By.directive(DropdownBreadcrumbComponent));
|
||||
expect(breadcrumb.componentInstance.folderNode).toEqual(undefined);
|
||||
done();
|
||||
});
|
||||
const breadcrumb = fixture.debugElement.query(By.directive(DropdownBreadcrumbComponent));
|
||||
expect(breadcrumb.componentInstance.folderNode).toEqual(undefined);
|
||||
});
|
||||
|
||||
it('should make changes to breadcrumb folderNode if breadcrumbTransform is defined', (done) => {
|
||||
it('should make changes to breadcrumb folderNode if breadcrumbTransform is defined', async () => {
|
||||
const transformedFolderNode = {
|
||||
id: 'trans-node',
|
||||
name: 'trans-node-name',
|
||||
path: { elements: [{ id: 'testId', name: 'testName' }] }
|
||||
};
|
||||
component.breadcrumbTransform = (() => transformedFolderNode);
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.breadcrumbTransform).not.toBeNull();
|
||||
expect(component.breadcrumbTransform).not.toBeNull();
|
||||
|
||||
const breadcrumb = fixture.debugElement.query(By.directive(DropdownBreadcrumbComponent));
|
||||
expect(breadcrumb.componentInstance.route[0].name).toBe('testName');
|
||||
expect(breadcrumb.componentInstance.route[0].id).toBe('testId');
|
||||
done();
|
||||
});
|
||||
const breadcrumb = fixture.debugElement.query(By.directive(DropdownBreadcrumbComponent));
|
||||
expect(breadcrumb.componentInstance.route[0].name).toBe('testName');
|
||||
expect(breadcrumb.componentInstance.route[0].id).toBe('testId');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -830,9 +818,10 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
expect(component.getSelectedCount()).toBe(0);
|
||||
});
|
||||
|
||||
it('should not render component input if `showNodeCounter` is false', () => {
|
||||
it('should not render component input if `showNodeCounter` is false', async () => {
|
||||
component.showNodeCounter = false;
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
expect(fixture.debugElement.nativeElement.querySelector('adf-node-counter')).toBe(null);
|
||||
});
|
||||
});
|
||||
|
@@ -40,7 +40,7 @@ import {
|
||||
DataSorting,
|
||||
ShowHeaderMode
|
||||
} from '@alfresco/adf-core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { UntypedFormControl } from '@angular/forms';
|
||||
import { Node, NodePaging, Pagination, SiteEntry, SitePaging, NodeEntry, QueryBody, RequestScope } from '@alfresco/js-api';
|
||||
import { DocumentListComponent } from '../document-list/components/document-list.component';
|
||||
import { RowFilter } from '../document-list/data/row-filter.model';
|
||||
@@ -264,7 +264,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
||||
|
||||
infiniteScroll: boolean = false;
|
||||
debounceSearch: number = 200;
|
||||
searchInput: FormControl = new FormControl();
|
||||
searchInput: UntypedFormControl = new UntypedFormControl();
|
||||
|
||||
target: PaginatedComponent;
|
||||
preselectedNodes: NodeEntry[] = [];
|
||||
|
@@ -47,7 +47,8 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
imageResolver: () => 'piccolo',
|
||||
currentFolderId: 'cat-girl-nuku-nuku',
|
||||
selectionMode: 'multiple',
|
||||
showLocalUploadButton: true
|
||||
showLocalUploadButton: true,
|
||||
restrictRootToCurrentFolderId: true
|
||||
};
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
@@ -74,15 +75,17 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
|
||||
const documentListService = TestBed.inject(DocumentListService);
|
||||
const sitesService: SitesService = TestBed.inject(SitesService);
|
||||
|
||||
dialog = TestBed.inject(MatDialogRef);
|
||||
uploadService = TestBed.inject(UploadService);
|
||||
|
||||
spyOn(documentListService, 'getFolder').and.callThrough();
|
||||
spyOn(documentListService, 'getFolderNode').and.callThrough();
|
||||
spyOn(documentListService, 'getFolder');
|
||||
spyOn(documentListService, 'getFolderNode');
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
||||
|
||||
fixture = TestBed.createComponent(ContentNodeSelectorComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
const contentService = TestBed.inject(ContentService);
|
||||
spyOn(contentService, 'hasAllowableOperations').and.returnValue(true);
|
||||
|
||||
|
Reference in New Issue
Block a user