mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
added tests for hostReducer and Header Effects, and switch to typed actions
This commit is contained in:
@@ -1,24 +1,43 @@
|
||||
import { Action } from "@ngrx/store";
|
||||
import { type } from "../shared/ngrx/type";
|
||||
|
||||
export class HeaderActions {
|
||||
static COLLAPSE = 'dspace/header/COLLAPSE';
|
||||
static collapse(): Action {
|
||||
return {
|
||||
type: HeaderActions.COLLAPSE
|
||||
}
|
||||
}
|
||||
/**
|
||||
* For each action type in an action group, make a simple
|
||||
* enum object for all of this group's action types.
|
||||
*
|
||||
* The 'type' utility function coerces strings into string
|
||||
* literal types and runs a simple check to guarantee all
|
||||
* action types in the application are unique.
|
||||
*/
|
||||
export const HeaderActionTypes = {
|
||||
COLLAPSE: type('dspace/header/COLLAPSE'),
|
||||
EXPAND: type('dspace/header/EXPAND'),
|
||||
TOGGLE: type('dspace/header/TOGGLE')
|
||||
};
|
||||
|
||||
static EXPAND = 'dspace/header/EXPAND';
|
||||
static expand(): Action {
|
||||
return {
|
||||
type: HeaderActions.EXPAND
|
||||
}
|
||||
}
|
||||
export class HeaderCollapseAction implements Action {
|
||||
type = HeaderActionTypes.COLLAPSE;
|
||||
|
||||
static TOGGLE = 'dspace/header/TOGGLE';
|
||||
static toggle(): Action {
|
||||
return {
|
||||
type: HeaderActions.TOGGLE
|
||||
}
|
||||
}
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
export class HeaderExpandAction implements Action {
|
||||
type = HeaderActionTypes.EXPAND;
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
export class HeaderToggleAction implements Action {
|
||||
type = HeaderActionTypes.TOGGLE;
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export a type alias of all actions in this action group
|
||||
* so that reducers can easily compose action types
|
||||
*/
|
||||
export type HeaderAction
|
||||
= HeaderCollapseAction
|
||||
| HeaderExpandAction
|
||||
| HeaderToggleAction
|
||||
|
Reference in New Issue
Block a user