mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
Execute test when change exclude file (#5989)
* Execute test when change exclude file * Update protractor.excludes.json * Update nx.json * fix first call use all params document list
This commit is contained in:
parent
bba8ab1839
commit
7cfb95da9d
@ -123,6 +123,7 @@ describe('Version component permissions', () => {
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await apiService.getInstance().login(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
|
||||
await apiService.getInstance().core.sitesApi.deleteSite(site.entry.id, { permanent: true });
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
{
|
||||
"C277201": "Investigate after NG10",
|
||||
"C362240": "Include once ADF starts using ACS 7 , https://issues.alfresco.com/jira/browse/ADF-5182",
|
||||
"C362241": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182",
|
||||
"C362242": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182",
|
||||
|
@ -74,7 +74,8 @@ describe('DocumentList', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
eventMock = {
|
||||
preventDefault: function () {}
|
||||
preventDefault: function () {
|
||||
}
|
||||
};
|
||||
|
||||
fixture = TestBed.createComponent(DocumentListComponent);
|
||||
@ -1180,13 +1181,15 @@ describe('DocumentList', () => {
|
||||
documentList.onNodeDblClick(node);
|
||||
});
|
||||
|
||||
it('should load folder by ID on init', () => {
|
||||
it('should load folder by ID on init', async () => {
|
||||
spyOn(documentList, 'loadFolder').and.returnValue(Promise.resolve());
|
||||
|
||||
documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, '1d26e465-dea3-42f3-b415-faa8364b9692', true) });
|
||||
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(documentList.loadFolder).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@ -1442,13 +1445,13 @@ describe('DocumentList', () => {
|
||||
documentList.includeFields = ['test-include'];
|
||||
documentList.currentFolderId = 'fake-id';
|
||||
|
||||
fixture.detectChanges();
|
||||
documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, 'fake-id', true) });
|
||||
|
||||
expect(documentListService.getFolder).toHaveBeenCalledWith(null, {
|
||||
where: undefined,
|
||||
maxItems: 25,
|
||||
skipCount: 0,
|
||||
orderBy: ['isFolder DESC', 'name asc' ],
|
||||
orderBy: ['isFolder DESC', 'name asc'],
|
||||
rootFolderId: 'fake-id'
|
||||
}, ['test-include']);
|
||||
});
|
||||
@ -1458,13 +1461,13 @@ describe('DocumentList', () => {
|
||||
documentList.where = '(isFolder=true)';
|
||||
documentList.currentFolderId = 'fake-id';
|
||||
|
||||
fixture.detectChanges();
|
||||
documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, 'fake-id', true) });
|
||||
|
||||
expect(documentListService.getFolder).toHaveBeenCalledWith(null, {
|
||||
where: '(isFolder=true)',
|
||||
maxItems: 25,
|
||||
skipCount: 0,
|
||||
orderBy: ['isFolder DESC', 'name asc' ],
|
||||
orderBy: ['isFolder DESC', 'name asc'],
|
||||
rootFolderId: 'fake-id'
|
||||
}, ['test-include']);
|
||||
});
|
||||
@ -1472,15 +1475,15 @@ describe('DocumentList', () => {
|
||||
it('should add orderBy in the server request', () => {
|
||||
documentList.includeFields = ['test-include'];
|
||||
documentList.sorting = ['size', 'DESC'];
|
||||
documentList.currentFolderId = 'fake-id';
|
||||
documentList.where = null;
|
||||
documentList.currentFolderId = 'fake-id';
|
||||
|
||||
fixture.detectChanges();
|
||||
documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, 'fake-id', true) });
|
||||
|
||||
expect(documentListService.getFolder).toHaveBeenCalledWith(null, {
|
||||
maxItems: 25,
|
||||
skipCount: 0,
|
||||
where: undefined,
|
||||
where: null,
|
||||
orderBy: ['isFolder DESC', 'size DESC'],
|
||||
rootFolderId: 'fake-id'
|
||||
}, ['test-include']);
|
||||
@ -1494,15 +1497,23 @@ describe('DocumentList', () => {
|
||||
skipCount: 10
|
||||
});
|
||||
|
||||
expect(documentListService.getFolder).toHaveBeenCalledWith(null, Object({
|
||||
maxItems: 10,
|
||||
skipCount: 10,
|
||||
orderBy: ['name ASC'],
|
||||
rootFolderId: 'no-node',
|
||||
where: undefined
|
||||
}), undefined);
|
||||
|
||||
documentList.onNodeClick(folder);
|
||||
|
||||
expect(documentListService.getFolder).toHaveBeenCalledWith(null, {
|
||||
expect(documentListService.getFolder).toHaveBeenCalledWith(null, Object({
|
||||
maxItems: 25,
|
||||
skipCount: 0,
|
||||
orderBy: ['isFolder DESC', 'name asc' ],
|
||||
orderBy: ['name ASC'],
|
||||
rootFolderId: 'folder-id',
|
||||
where: undefined
|
||||
}, undefined);
|
||||
}), undefined);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -233,7 +233,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
this._rowFilter = rowFilter;
|
||||
if (this.data) {
|
||||
this.data.setFilter(this._rowFilter);
|
||||
if (this._currentFolderId) {
|
||||
if (this.currentFolderId) {
|
||||
this.reload();
|
||||
}
|
||||
}
|
||||
@ -255,31 +255,9 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
@Input()
|
||||
stickyHeader: boolean = false;
|
||||
|
||||
_currentFolderId: string = null;
|
||||
|
||||
/** The ID of the folder node to display or a reserved string alias for special sources */
|
||||
@Input()
|
||||
set currentFolderId(currentFolderId: string) {
|
||||
if (this._currentFolderId !== currentFolderId) {
|
||||
this._currentFolderId = currentFolderId;
|
||||
if (this.sorting) {
|
||||
const [key, direction] = this.sorting;
|
||||
this.orderBy = this.buildOrderByArray(key, direction);
|
||||
}
|
||||
if (this.data) {
|
||||
this.data.loadPage(null, false);
|
||||
this.resetNewFolderPagination();
|
||||
}
|
||||
|
||||
if (this._currentFolderId) {
|
||||
this.loadFolder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get currentFolderId(): string {
|
||||
return this._currentFolderId;
|
||||
}
|
||||
currentFolderId: string = null;
|
||||
|
||||
/** The Document list will show all the nodes contained in the NodePaging entity */
|
||||
@Input()
|
||||
@ -461,15 +439,15 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
|
||||
const columns = this.data.getColumns();
|
||||
if (!columns || columns.length === 0) {
|
||||
this.setupDefaultColumns(this._currentFolderId);
|
||||
this.setupDefaultColumns(this.currentFolderId);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
this.resetSelection();
|
||||
|
||||
if (changes.sorting && changes.sorting.currentValue) {
|
||||
const [key, direction] = changes.sorting.currentValue;
|
||||
if (this.sorting) {
|
||||
const [key, direction] = this.sorting;
|
||||
this.orderBy = this.buildOrderByArray(key, direction);
|
||||
}
|
||||
|
||||
@ -489,6 +467,19 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
}
|
||||
}
|
||||
|
||||
if (changes['currentFolderId']?.currentValue !== changes['currentFolderId']?.previousValue) {
|
||||
if (this.data) {
|
||||
this.data.loadPage(null, false);
|
||||
this.resetNewFolderPagination();
|
||||
}
|
||||
|
||||
if (changes['currentFolderId'].currentValue) {
|
||||
|
||||
this.loadFolder();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.data) {
|
||||
if (changes.node && changes.node.currentValue) {
|
||||
const merge = this._pagination ? this._pagination.merge : false;
|
||||
@ -597,15 +588,15 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
navigateTo(node: Node | string): boolean {
|
||||
if (typeof node === 'string') {
|
||||
this.resetNewFolderPagination();
|
||||
this._currentFolderId = node;
|
||||
this.currentFolderId = node;
|
||||
this.folderChange.emit(new NodeEntryEvent(<Node> {id: node}));
|
||||
this.reload();
|
||||
return true;
|
||||
} else {
|
||||
if (this.canNavigateFolder(node)) {
|
||||
this.resetNewFolderPagination();
|
||||
this._currentFolderId = this.getNodeFolderDestinationId(node);
|
||||
this.folderChange.emit(new NodeEntryEvent(<Node> {id: this._currentFolderId}));
|
||||
this.currentFolderId = this.getNodeFolderDestinationId(node);
|
||||
this.folderChange.emit(new NodeEntryEvent(<Node> {id: this.currentFolderId}));
|
||||
this.reload();
|
||||
return true;
|
||||
}
|
||||
@ -623,7 +614,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
}
|
||||
|
||||
updateCustomSourceData(nodeId: string): void {
|
||||
this._currentFolderId = nodeId;
|
||||
this.currentFolderId = nodeId;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -662,20 +653,19 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
}
|
||||
|
||||
loadFolder() {
|
||||
|
||||
if (!this._pagination.merge) {
|
||||
this.setLoadingState(true);
|
||||
}
|
||||
|
||||
if (!this.hasCustomLayout) {
|
||||
this.setupDefaultColumns(this._currentFolderId);
|
||||
this.setupDefaultColumns(this.currentFolderId);
|
||||
}
|
||||
|
||||
if (this.documentListService.isCustomSourceService(this._currentFolderId)) {
|
||||
this.updateCustomSourceData(this._currentFolderId);
|
||||
if (this.documentListService.isCustomSourceService(this.currentFolderId)) {
|
||||
this.updateCustomSourceData(this.currentFolderId);
|
||||
}
|
||||
|
||||
this.documentListService.loadFolderByNodeId(this._currentFolderId, this._pagination, this.includeFields, this.where, this.orderBy)
|
||||
this.documentListService.loadFolderByNodeId(this.currentFolderId, this._pagination, this.includeFields, this.where, this.orderBy)
|
||||
.subscribe((documentNode: DocumentLoaderNode) => {
|
||||
if (documentNode.currentNode) {
|
||||
this.folderNode = documentNode.currentNode.entry;
|
||||
|
6
nx.json
6
nx.json
@ -1,5 +1,5 @@
|
||||
{
|
||||
"npmScope": "my-company",
|
||||
"npmScope": "adf",
|
||||
"implicitDependencies": {
|
||||
"angular.json": "*",
|
||||
"package.json": "*",
|
||||
@ -7,9 +7,7 @@
|
||||
"tslint.json": "*",
|
||||
"nx.json": "*",
|
||||
".travis.yml": "*",
|
||||
"e2e/protractor.excludes.json": [
|
||||
"demoshell-e2e"
|
||||
]
|
||||
"e2e/protractor.excludes.json": "*"
|
||||
},
|
||||
"projects": {
|
||||
"demoshell": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user