Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
c9002b9c
Commit
c9002b9c
authored
Apr 10, 2020
by
Lyza Danger Gardner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add selector for retrieving `expandedThreads`
parent
35fdf55e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
6 deletions
+11
-6
root-thread.js
src/sidebar/services/root-thread.js
+1
-1
root-thread-test.js
src/sidebar/services/test/root-thread-test.js
+2
-2
selection.js
src/sidebar/store/modules/selection.js
+5
-0
selection-test.js
src/sidebar/store/modules/test/selection-test.js
+1
-1
index-test.js
src/sidebar/store/test/index-test.js
+2
-2
No files found.
src/sidebar/services/root-thread.js
View file @
c9002b9c
...
...
@@ -89,7 +89,7 @@ export default function RootThread(
// determines what is visible and build the visible thread structure
return
buildThread
(
state
.
annotations
.
annotations
,
{
forceVisible
:
truthyKeys
(
state
.
selection
.
forceVisible
),
expanded
:
st
ate
.
selection
.
expanded
,
expanded
:
st
ore
.
expandedThreads
()
,
highlighted
:
state
.
selection
.
highlighted
,
selected
:
truthyKeys
(
store
.
getSelectedAnnotationMap
()
||
{}),
sortCompareFn
:
sortFn
,
...
...
src/sidebar/services/test/root-thread-test.js
View file @
c9002b9c
...
...
@@ -46,7 +46,6 @@ describe('rootThread', function () {
},
drafts
:
[],
selection
:
{
expanded
:
{},
filterQuery
:
null
,
forceVisible
:
{},
highlighted
:
[],
...
...
@@ -62,6 +61,7 @@ describe('rootThread', function () {
return
this
.
state
;
},
expandedThreads
:
sinon
.
stub
().
returns
({}),
getSelectedAnnotationMap
:
sinon
.
stub
().
returns
(
null
),
subscribe
:
sinon
.
stub
(),
removeAnnotations
:
sinon
.
stub
(),
...
...
@@ -143,7 +143,7 @@ describe('rootThread', function () {
});
it
(
'passes the current expanded set to buildThread()'
,
function
()
{
fakeStore
.
state
.
selection
.
expanded
=
{
id1
:
true
,
id2
:
true
}
;
fakeStore
.
expandedThreads
.
returns
({
id1
:
true
,
id2
:
true
})
;
rootThread
.
thread
(
fakeStore
.
state
);
assert
.
calledWith
(
fakeBuildThread
,
...
...
src/sidebar/store/modules/selection.js
View file @
c9002b9c
...
...
@@ -430,6 +430,10 @@ const getFirstSelectedAnnotationId = createSelector(
selected
=>
(
selected
?
Object
.
keys
(
selected
)[
0
]
:
null
)
);
function
expandedThreads
(
state
)
{
return
state
.
selection
.
expanded
;
}
function
filterQuery
(
state
)
{
return
state
.
selection
.
filterQuery
;
}
...
...
@@ -531,6 +535,7 @@ export default {
selectors
:
{
hasSelectedAnnotations
,
expandedThreads
,
filterQuery
,
focusModeFocused
,
focusModeEnabled
,
...
...
src/sidebar/store/modules/test/selection-test.js
View file @
c9002b9c
...
...
@@ -38,7 +38,7 @@ describe('sidebar/store/modules/selection', () => {
describe
(
'setCollapsed()'
,
function
()
{
it
(
'sets the expanded state of the annotation'
,
function
()
{
store
.
setCollapsed
(
'parent_id'
,
false
);
assert
.
deepEqual
(
getSelectionState
().
expanded
,
{
parent_id
:
true
});
assert
.
deepEqual
(
store
.
expandedThreads
()
,
{
parent_id
:
true
});
});
});
...
...
src/sidebar/store/test/index-test.js
View file @
c9002b9c
...
...
@@ -37,7 +37,7 @@ describe('store', function () {
describe
(
'initialization'
,
function
()
{
it
(
'does not set a selection when settings.annotations is null'
,
function
()
{
assert
.
isFalse
(
store
.
hasSelectedAnnotations
());
assert
.
equal
(
Object
.
keys
(
store
.
getState
().
selection
.
expanded
).
length
,
0
);
assert
.
equal
(
Object
.
keys
(
store
.
expandedThreads
()
).
length
,
0
);
});
it
(
'sets the selection when settings.annotations is set'
,
function
()
{
...
...
@@ -49,7 +49,7 @@ describe('store', function () {
it
(
'expands the selected annotations when settings.annotations is set'
,
function
()
{
store
=
storeFactory
(
fakeRootScope
,
{
annotations
:
'testid'
});
assert
.
deepEqual
(
store
.
getState
().
selection
.
expanded
,
{
assert
.
deepEqual
(
store
.
expandedThreads
()
,
{
testid
:
true
,
});
});
...
...
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