mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge pull request #563 from 4Science/fix_store_selectors
Fix history and bitstreamFormats store selector after moved in CoreState
This commit is contained in:
@@ -25,8 +25,12 @@ import {
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { coreSelector } from '../core.selectors';
|
||||
|
||||
const bitstreamFormatsStateSelector = (state: CoreState) => state.bitstreamFormats;
|
||||
const bitstreamFormatsStateSelector = createSelector(
|
||||
coreSelector,
|
||||
(state: CoreState) => state.bitstreamFormats
|
||||
);
|
||||
const selectedBitstreamFormatSelector = createSelector(bitstreamFormatsStateSelector,
|
||||
(bitstreamFormatRegistryState: BitstreamFormatRegistryState) => bitstreamFormatRegistryState.selectedBitstreamFormats);
|
||||
|
||||
|
@@ -1,3 +1,8 @@
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { createSelector } from '@ngrx/store';
|
||||
import { coreSelector } from '../core.selectors';
|
||||
|
||||
export const historySelector = (state: CoreState) => state.history;
|
||||
export const historySelector = createSelector(
|
||||
coreSelector,
|
||||
(state: CoreState) => state.history
|
||||
);
|
||||
|
@@ -142,7 +142,11 @@ describe('RouteService', () => {
|
||||
|
||||
describe('getHistory', () => {
|
||||
it('should dispatch AddUrlToHistoryAction on NavigationEnd event', () => {
|
||||
serviceAsAny.store = observableOf({ history: ['url', 'newurl'] });
|
||||
serviceAsAny.store = observableOf({
|
||||
core: {
|
||||
history: ['url', 'newurl']
|
||||
}
|
||||
});
|
||||
|
||||
service.getHistory().subscribe((history) => {
|
||||
expect(history).toEqual(['url', 'newurl']);
|
||||
|
Reference in New Issue
Block a user