Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
08c78ab8
Commit
08c78ab8
authored
Jan 26, 2018
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashfolders: fix tests for ViewStore after merge
parent
49634593
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
8 deletions
+5
-8
public/app/stores/NavStore/NavItem.ts
+0
-6
public/app/stores/ViewStore/ViewStore.jest.ts
+3
-2
public/app/stores/ViewStore/ViewStore.ts
+2
-0
No files found.
public/app/stores/NavStore/NavItem.ts
View file @
08c78ab8
import
{
types
}
from
'mobx-state-tree'
;
const
BreadcrumbItem
=
types
.
model
(
'BreadcrumbItem'
,
{
title
:
types
.
string
,
url
:
types
.
string
,
});
export
const
NavItem
=
types
.
model
(
'NavItem'
,
{
id
:
types
.
identifier
(
types
.
string
),
text
:
types
.
string
,
...
...
@@ -15,7 +10,6 @@ export const NavItem = types.model('NavItem', {
active
:
types
.
optional
(
types
.
boolean
,
false
),
breadcrumbs
:
types
.
optional
(
types
.
array
(
types
.
late
(()
=>
Breadcrumb
)),
[]),
children
:
types
.
optional
(
types
.
array
(
types
.
late
(()
=>
NavItem
)),
[]),
breadcrumbs
:
types
.
optional
(
types
.
array
(
BreadcrumbItem
),
[]),
});
export
const
Breadcrumb
=
types
.
model
(
'Breadcrumb'
,
{
...
...
public/app/stores/ViewStore/ViewStore.jest.ts
View file @
08c78ab8
...
...
@@ -8,18 +8,19 @@ describe('ViewStore', () => {
store
=
ViewStore
.
create
({
path
:
''
,
query
:
{},
routeParams
:
{},
});
});
it
(
'Can update path and query'
,
()
=>
{
store
.
updatePathAndQuery
(
'/hello'
,
{
key
:
1
,
otherParam
:
'asd'
});
store
.
updatePathAndQuery
(
'/hello'
,
{
key
:
1
,
otherParam
:
'asd'
}
,
{
key
:
1
,
otherParam
:
'asd'
}
);
expect
(
store
.
path
).
toBe
(
'/hello'
);
expect
(
store
.
query
.
get
(
'key'
)).
toBe
(
1
);
expect
(
store
.
currentUrl
).
toBe
(
'/hello?key=1&otherParam=asd'
);
});
it
(
'Query can contain arrays'
,
()
=>
{
store
.
updatePathAndQuery
(
'/hello'
,
{
values
:
[
'A'
,
'B'
]
});
store
.
updatePathAndQuery
(
'/hello'
,
{
values
:
[
'A'
,
'B'
]
}
,
{
key
:
1
,
otherParam
:
'asd'
}
);
expect
(
toJS
(
store
.
query
.
get
(
'values'
))).
toMatchObject
([
'A'
,
'B'
]);
expect
(
store
.
currentUrl
).
toBe
(
'/hello?values=A&values=B'
);
});
...
...
public/app/stores/ViewStore/ViewStore.ts
View file @
08c78ab8
...
...
@@ -22,6 +22,7 @@ export const ViewStore = types
},
}))
.
actions
(
self
=>
{
// querystring only
function
updateQuery
(
query
:
any
)
{
self
.
query
.
clear
();
for
(
let
key
of
Object
.
keys
(
query
))
{
...
...
@@ -29,6 +30,7 @@ export const ViewStore = types
}
}
// needed to get route parameters like slug from the url
function
updateRouteParams
(
routeParams
:
any
)
{
self
.
routeParams
.
clear
();
for
(
let
key
of
Object
.
keys
(
routeParams
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment