-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Displays the `temporary_location` field according to the exhibitions/courses and temporary location cascade on the document detailed view of the public interface. * Displays the `temporary_location` field on the item detailed view of the professional interface. * Closes rero/rero-ils#2038. Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
- Loading branch information
1 parent
2eaeaa0
commit a286d30
Showing
9 changed files
with
168 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
projects/admin/src/app/pipe/item-in-collection.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 2021 RERO | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { RecordModule, RecordService } from '@rero/ng-core'; | ||
import { of } from 'rxjs'; | ||
import { ItemInCollectionPipe } from './item-in-collection.pipe'; | ||
|
||
describe('ItemInCollectionPipe', () => { | ||
let pipe: ItemInCollectionPipe; | ||
|
||
const emptyRecords = { | ||
aggregations: {}, | ||
hits: { | ||
total: { | ||
relation: 'eq', | ||
value: 0 | ||
}, | ||
hits: [] | ||
}, | ||
links: {} | ||
}; | ||
|
||
const records = [{ pid: '1'}]; | ||
|
||
const withRecords = { | ||
aggregations: {}, | ||
hits: { | ||
total: { | ||
relation: 'eq', | ||
value: 1 | ||
}, | ||
hits: records | ||
}, | ||
links: {} | ||
}; | ||
|
||
const recordServiceSpy = jasmine.createSpyObj('RecordService', ['getRecords', 'totalHits']); | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
RecordModule, | ||
TranslateModule.forRoot() | ||
], | ||
providers: [ | ||
ItemInCollectionPipe, | ||
{ provide: RecordService, useValue: recordServiceSpy } | ||
] | ||
}); | ||
pipe = TestBed.inject(ItemInCollectionPipe); | ||
}); | ||
|
||
it('create an instance', () => { | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
|
||
it('should return a null value if no result', () => { | ||
recordServiceSpy.getRecords.and.returnValue(of(emptyRecords)); | ||
recordServiceSpy.totalHits.and.returnValue(0); | ||
pipe.transform('1').subscribe((result: any) => expect(result).toBeNull()); | ||
}); | ||
|
||
it('should return an array of results', () => { | ||
recordServiceSpy.getRecords.and.returnValue(of(withRecords)); | ||
recordServiceSpy.totalHits.and.returnValue(1); | ||
pipe.transform('1').subscribe((result: any) => expect(result).toEqual(records)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
...-detail-view/holding/holding-item-in-collection/holding-item-in-collection.component.html
This file was deleted.
Oops, something went wrong.
55 changes: 0 additions & 55 deletions
55
...tail-view/holding/holding-item-in-collection/holding-item-in-collection.component.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.