Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dspace7 Angular
Manage
Activity
Members
Labels
Plan
Issues
42
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Monday, March 24th
Show more breadcrumbs
vtechworks
Dspace7 Angular
Commits
562f09a3
Commit
562f09a3
authored
8 years ago
by
Art Lowel
Browse files
Options
Downloads
Patches
Plain Diff
turned null actions in to classes
parent
5e523a56
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/header/header.reducer.spec.ts
+15
-8
15 additions, 8 deletions
src/app/header/header.reducer.spec.ts
src/app/shared/host-window.reducer.spec.ts
+13
-5
13 additions, 5 deletions
src/app/shared/host-window.reducer.spec.ts
with
28 additions
and
13 deletions
src/app/header/header.reducer.spec.ts
+
15
−
8
View file @
562f09a3
...
...
@@ -7,19 +7,26 @@ import {
HeaderToggleAction
}
from
"
./header.actions
"
;
describe
(
"
headerReducer
"
,
()
=>
{
let
nullAction
=
new
HeaderCollapseAction
();
nullAction
.
type
=
null
;
class
NullAction
extends
HeaderCollapseAction
{
type
=
null
;
constructor
()
{
super
();
}
}
describe
(
"
headerReducer
"
,
()
=>
{
it
(
"
should return the current state when no valid actions have been made
"
,
()
=>
{
const
state
=
{
navCollapsed
:
false
};
const
newState
=
headerReducer
(
state
,
nullAction
);
const
action
=
new
NullAction
();
const
newState
=
headerReducer
(
state
,
action
);
expect
(
newState
).
toEqual
(
state
);
});
it
(
"
should start with navCollapsed = true
"
,
()
=>
{
const
initialState
=
headerReducer
(
undefined
,
nullAction
);
const
action
=
new
NullAction
();
const
initialState
=
headerReducer
(
undefined
,
action
);
// The navigation starts collapsed
expect
(
initialState
.
navCollapsed
).
toEqual
(
true
);
...
...
@@ -33,7 +40,7 @@ describe("headerReducer", () => {
expect
(
newState
.
navCollapsed
).
toEqual
(
true
);
});
it
(
"
should perform the COLLAPSE action without
muta
ting the previous state
"
,
()
=>
{
it
(
"
should perform the COLLAPSE action without
affec
ting the previous state
"
,
()
=>
{
const
state
=
{
navCollapsed
:
false
};
deepFreeze
(
state
);
...
...
@@ -52,7 +59,7 @@ describe("headerReducer", () => {
expect
(
newState
.
navCollapsed
).
toEqual
(
false
);
});
it
(
"
should perform the EXPAND action without
muta
ting the previous state
"
,
()
=>
{
it
(
"
should perform the EXPAND action without
affec
ting the previous state
"
,
()
=>
{
const
state
=
{
navCollapsed
:
true
};
deepFreeze
(
state
);
...
...
@@ -71,7 +78,7 @@ describe("headerReducer", () => {
expect
(
state3
.
navCollapsed
).
toEqual
(
true
);
});
it
(
"
should perform the TOGGLE action without
muta
ting the previous state
"
,
()
=>
{
it
(
"
should perform the TOGGLE action without
affec
ting the previous state
"
,
()
=>
{
const
state
=
{
navCollapsed
:
true
};
deepFreeze
(
state
);
...
...
This diff is collapsed.
Click to expand it.
src/app/shared/host-window.reducer.spec.ts
+
13
−
5
View file @
562f09a3
...
...
@@ -2,19 +2,27 @@ import * as deepFreeze from "deep-freeze";
import
{
hostWindowReducer
}
from
"
./host-window.reducer
"
;
import
{
HostWindowResizeAction
}
from
"
./host-window.actions
"
;
class
NullAction
extends
HostWindowResizeAction
{
type
=
null
;
constructor
()
{
super
(
0
,
0
);
}
}
describe
(
'
hostWindowReducer
'
,
()
=>
{
let
nullAction
=
new
HostWindowResizeAction
(
0
,
0
);
nullAction
.
type
=
null
;
it
(
"
should return the current state when no valid actions have been made
"
,
()
=>
{
const
state
=
{
width
:
800
,
height
:
600
};
const
newState
=
hostWindowReducer
(
state
,
nullAction
);
const
action
=
new
NullAction
();
const
newState
=
hostWindowReducer
(
state
,
action
);
expect
(
newState
).
toEqual
(
state
);
});
it
(
"
should start with width = null and height = null
"
,
()
=>
{
const
initialState
=
hostWindowReducer
(
undefined
,
nullAction
);
const
action
=
new
NullAction
();
const
initialState
=
hostWindowReducer
(
undefined
,
action
);
expect
(
initialState
.
width
).
toEqual
(
null
);
expect
(
initialState
.
height
).
toEqual
(
null
);
...
...
@@ -29,7 +37,7 @@ describe('hostWindowReducer', () => {
expect
(
newState
.
height
).
toEqual
(
768
);
});
it
(
"
should perform the RESIZE action without
muta
ting the previous state
"
,
()
=>
{
it
(
"
should perform the RESIZE action without
affec
ting the previous state
"
,
()
=>
{
const
state
=
{
width
:
800
,
height
:
600
};
deepFreeze
(
state
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment