Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dspace7 Angular
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vtechworks
Dspace7 Angular
Commits
2d0a43f9
Commit
2d0a43f9
authored
7 years ago
by
Art Lowel
Browse files
Options
Downloads
Patches
Plain Diff
added tests for new HostWindowService code
parent
994c0899
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
nodemon.json
+1
-1
1 addition, 1 deletion
nodemon.json
src/app/shared/host-window.service.spec.ts
+74
-1
74 additions, 1 deletion
src/app/shared/host-window.service.spec.ts
webpack/webpack.common.js
+1
-1
1 addition, 1 deletion
webpack/webpack.common.js
with
76 additions
and
3 deletions
nodemon.json
+
1
−
1
View file @
2d0a43f9
...
...
@@ -5,5 +5,5 @@
"src/index.html"
],
"ext"
:
"js ts json html"
,
"delay"
:
"50
0
"
"delay"
:
"50"
}
This diff is collapsed.
Click to expand it.
src/app/shared/host-window.service.spec.ts
+
74
−
1
View file @
2d0a43f9
import
{
Store
}
from
'
@ngrx/store
'
;
import
{
cold
,
hot
}
from
'
jasmine-marbles
'
;
import
{
Observable
}
from
'
rxjs/Observable
'
;
import
{
AppState
}
from
'
../app.reducer
'
;
import
{
HostWindowState
}
from
'
./host-window.reducer
'
;
import
{
HostWindowService
}
from
'
./host-window.service
'
;
import
{
GridBreakpoint
,
HostWindowService
,
WidthCategory
}
from
'
./host-window.service
'
;
describe
(
'
HostWindowService
'
,
()
=>
{
let
service
:
HostWindowService
;
...
...
@@ -189,4 +190,76 @@ describe('HostWindowService', () => {
});
});
describe
(
'
widthCategory
'
,
()
=>
{
beforeEach
(()
=>
{
service
=
new
HostWindowService
({}
as
Store
<
AppState
>
);
});
it
(
'
should call getWithObs to get the current width
'
,
()
=>
{
spyOn
(
service
as
any
,
'
getWidthObs
'
).
and
.
returnValue
(
hot
(
'
a-
'
,
{
a
:
GridBreakpoint
.
SM_MIN
-
1
}));
const
result
=
service
.
widthCategory
;
expect
((
service
as
any
).
getWidthObs
).
toHaveBeenCalled
();
});
it
(
'
should return XS if width < SM_MIN
'
,
()
=>
{
spyOn
(
service
as
any
,
'
getWidthObs
'
).
and
.
returnValue
(
hot
(
'
a-
'
,
{
a
:
GridBreakpoint
.
SM_MIN
-
1
}));
const
result
=
service
.
widthCategory
;
const
expected
=
cold
(
'
b-
'
,
{
b
:
WidthCategory
.
XS
});
expect
(
result
).
toBeObservable
(
expected
);
});
it
(
'
should return SM if SM_MIN <= width < MD_MIN
'
,
()
=>
{
spyOn
(
service
as
any
,
'
getWidthObs
'
).
and
.
returnValue
(
hot
(
'
a-
'
,
{
a
:
GridBreakpoint
.
SM_MIN
+
Math
.
floor
((
GridBreakpoint
.
MD_MIN
-
GridBreakpoint
.
SM_MIN
)
/
2
)
}));
const
result
=
service
.
widthCategory
;
const
expected
=
cold
(
'
b-
'
,
{
b
:
WidthCategory
.
SM
});
expect
(
result
).
toBeObservable
(
expected
);
});
it
(
'
should return MD if MD_MIN <= width < LG_MIN
'
,
()
=>
{
spyOn
(
service
as
any
,
'
getWidthObs
'
).
and
.
returnValue
(
hot
(
'
a-
'
,
{
a
:
GridBreakpoint
.
MD_MIN
+
Math
.
floor
((
GridBreakpoint
.
LG_MIN
-
GridBreakpoint
.
MD_MIN
)
/
2
)
}));
const
result
=
service
.
widthCategory
;
const
expected
=
cold
(
'
b-
'
,
{
b
:
WidthCategory
.
MD
});
expect
(
result
).
toBeObservable
(
expected
);
});
it
(
'
should return LG if LG_MIN <= width < XL_MIN
'
,
()
=>
{
spyOn
(
service
as
any
,
'
getWidthObs
'
).
and
.
returnValue
(
hot
(
'
a-
'
,
{
a
:
GridBreakpoint
.
LG_MIN
+
Math
.
floor
((
GridBreakpoint
.
XL_MIN
-
GridBreakpoint
.
LG_MIN
)
/
2
)
}));
const
result
=
service
.
widthCategory
;
const
expected
=
cold
(
'
b-
'
,
{
b
:
WidthCategory
.
LG
});
expect
(
result
).
toBeObservable
(
expected
);
});
it
(
'
should return XL if width >= XL_MIN
'
,
()
=>
{
spyOn
(
service
as
any
,
'
getWidthObs
'
).
and
.
returnValue
(
hot
(
'
a-
'
,
{
a
:
GridBreakpoint
.
XL_MIN
+
1
}));
const
result
=
service
.
widthCategory
;
const
expected
=
cold
(
'
b-
'
,
{
b
:
WidthCategory
.
XL
});
expect
(
result
).
toBeObservable
(
expected
);
});
});
});
This diff is collapsed.
Click to expand it.
webpack/webpack.common.js
+
1
−
1
View file @
2d0a43f9
...
...
@@ -14,7 +14,7 @@ module.exports = {
path
:
root
(
'
dist
'
)
},
watchOptions
:
{
aggregateTimeout
:
50
0
,
aggregateTimeout
:
50
,
},
module
:
{
rules
:
[{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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