FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nativescript-angular/tests/app/tests/ns-router-link.ts at master · NativeScript/nativescript-angular · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
NativeScript
/
nativescript-angular
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
240
Star
1.2k
Code
Issues
294
Pull requests
2
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
nativescript-angular
/
tests
/
app
/
tests
/
ns-router-link.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (36 loc) · 1.6 KB
Breadcrumbs
nativescript-angular
/
tests
/
app
/
tests
/
ns-router-link.ts
Copy path
File metadata and controls
43 lines (36 loc) · 1.6 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import
{
NSRouterLink
}
from
"@nativescript/angular/router/ns-router-link"
;
import
{
ActivatedRoute
,
Router
}
from
"@angular/router"
;
import
{
RouterExtensions
}
from
"@nativescript/angular/router"
;
import
{
assert
,
fake
,
spy
,
stub
}
from
"./test-config"
;
import
{
SinonStub
}
from
"sinon"
;
describe
(
"NSRouterLink"
,
(
)
=>
{
const
mockRouter
=
{
}
as
Router
;
let
mockRouterExtensions
=
{
navigateByUrl
:
fake
(
)
}
;
const
mockActivatedRoute
=
{
}
as
ActivatedRoute
;
let
nsRouterLink
:
NSRouterLink
;
let
urlTreeStub
:
SinonStub
;
beforeEach
(
(
)
=>
{
nsRouterLink
=
new
NSRouterLink
(
mockRouter
,
mockRouterExtensions
as
unknown
as
RouterExtensions
,
mockActivatedRoute
)
;
urlTreeStub
=
stub
(
nsRouterLink
,
'urlTree'
)
.
get
(
(
)
=>
null
)
;
}
)
;
afterEach
(
(
)
=>
{
urlTreeStub
.
restore
(
)
;
}
)
;
it
(
'#tap should call navigateByUrl with undefined transition in extras when boolean is given for pageTransition input'
,
(
)
=>
{
nsRouterLink
.
pageTransition
=
false
;
nsRouterLink
.
onTap
(
)
;
assert
.
isUndefined
(
mockRouterExtensions
.
navigateByUrl
.
lastCall
.
args
[
1
]
.
transition
)
;
}
)
;
it
(
'#tap should call navigateByUrl with correct transition in extras when NavigationTransition object is given for pageTransition input'
,
(
)
=>
{
const
pageTransition
=
{
name
:
'slide'
,
duration
:
500
}
;
nsRouterLink
.
pageTransition
=
pageTransition
;
stub
(
nsRouterLink
,
'urlTree'
)
.
get
(
(
)
=>
null
)
;
nsRouterLink
.
onTap
(
)
;
assert
.
equal
(
pageTransition
,
mockRouterExtensions
.
navigateByUrl
.
lastCall
.
args
[
1
]
.
transition
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL