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
e92b8b76
Commit
e92b8b76
authored
Jan 08, 2020
by
Lyza Danger Gardner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update `AnnotationThread` to render `AnnotationOmega` if flag set
parent
7c328fa8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
2 deletions
+67
-2
annotation-thread.js
src/sidebar/components/annotation-thread.js
+5
-1
annotation-thread-test.js
src/sidebar/components/test/annotation-thread-test.js
+56
-1
annotation-thread.html
src/sidebar/templates/annotation-thread.html
+6
-0
No files found.
src/sidebar/components/annotation-thread.js
View file @
e92b8b76
...
@@ -33,7 +33,7 @@ function showAllParents(thread, showFn) {
...
@@ -33,7 +33,7 @@ function showAllParents(thread, showFn) {
}
}
// @ngInject
// @ngInject
function
AnnotationThreadController
(
store
)
{
function
AnnotationThreadController
(
features
,
store
)
{
// Flag that tracks whether the content of the annotation is hovered,
// Flag that tracks whether the content of the annotation is hovered,
// excluding any replies.
// excluding any replies.
this
.
annotationHovered
=
false
;
this
.
annotationHovered
=
false
;
...
@@ -103,6 +103,10 @@ function AnnotationThreadController(store) {
...
@@ -103,6 +103,10 @@ function AnnotationThreadController(store) {
store
.
setCollapsed
(
thread
.
parent
.
id
,
false
);
store
.
setCollapsed
(
thread
.
parent
.
id
,
false
);
}
}
};
};
this
.
shouldShowAnnotationOmega
=
()
=>
{
return
features
.
flagEnabled
(
'client_preact_annotation'
);
};
}
}
/**
/**
...
...
src/sidebar/components/test/annotation-thread-test.js
View file @
e92b8b76
...
@@ -34,16 +34,20 @@ describe('annotationThread', function() {
...
@@ -34,16 +34,20 @@ describe('annotationThread', function() {
});
});
});
});
let
fakeFeatures
;
let
fakeStore
;
let
fakeStore
;
beforeEach
(
function
()
{
beforeEach
(
function
()
{
fakeFeatures
=
{
flagEnabled
:
sinon
.
stub
().
returns
(
false
),
};
fakeStore
=
{
fakeStore
=
{
setForceVisible
:
sinon
.
stub
(),
setForceVisible
:
sinon
.
stub
(),
setCollapsed
:
sinon
.
stub
(),
setCollapsed
:
sinon
.
stub
(),
getState
:
sinon
.
stub
(),
getState
:
sinon
.
stub
(),
};
};
angular
.
mock
.
module
(
'app'
,
{
store
:
fakeStore
});
angular
.
mock
.
module
(
'app'
,
{
features
:
fakeFeatures
,
store
:
fakeStore
});
});
});
it
(
'renders the tree structure of parent and child annotations'
,
function
()
{
it
(
'renders the tree structure of parent and child annotations'
,
function
()
{
...
@@ -253,4 +257,55 @@ describe('annotationThread', function() {
...
@@ -253,4 +257,55 @@ describe('annotationThread', function() {
assert
.
notOk
(
element
[
0
].
querySelector
(
'moderation-banner'
));
assert
.
notOk
(
element
[
0
].
querySelector
(
'moderation-banner'
));
assert
.
notOk
(
element
[
0
].
querySelector
(
'annotation'
));
assert
.
notOk
(
element
[
0
].
querySelector
(
'annotation'
));
});
});
describe
(
'preact-migrated Annotation component'
,
()
=>
{
it
(
'additionally renders `AnnotationOmega` when `client_preact_annotation` feature flag is enabled'
,
()
=>
{
fakeFeatures
.
flagEnabled
.
withArgs
(
'client_preact_annotation'
)
.
returns
(
true
);
const
element
=
util
.
createDirective
(
document
,
'annotationThread'
,
{
thread
:
{
id
:
'1'
,
annotation
:
{
id
:
'1'
,
text
:
'text'
},
children
:
[
{
id
:
'2'
,
annotation
:
{
id
:
'2'
,
text
:
'areply'
},
children
:
[],
visible
:
true
,
},
],
visible
:
true
,
},
});
assert
.
ok
(
element
[
0
].
querySelector
(
'annotation'
));
assert
.
ok
(
element
[
0
].
querySelector
(
'annotation-omega'
));
});
it
(
'does not render `AnnotationOmega` if `client_preact_annotation` feature flag is not enabled'
,
()
=>
{
fakeFeatures
.
flagEnabled
.
withArgs
(
'client_preact_annotation'
)
.
returns
(
false
);
const
element
=
util
.
createDirective
(
document
,
'annotationThread'
,
{
thread
:
{
id
:
'1'
,
annotation
:
{
id
:
'1'
,
text
:
'text'
},
children
:
[
{
id
:
'2'
,
annotation
:
{
id
:
'2'
,
text
:
'areply'
},
children
:
[],
visible
:
true
,
},
],
visible
:
true
,
},
});
assert
.
ok
(
element
[
0
].
querySelector
(
'annotation'
));
assert
.
notOk
(
element
[
0
].
querySelector
(
'annotation-omega'
));
});
});
});
});
src/sidebar/templates/annotation-thread.html
View file @
e92b8b76
...
@@ -14,6 +14,12 @@
...
@@ -14,6 +14,12 @@
annotation=
"vm.thread.annotation"
annotation=
"vm.thread.annotation"
ng-if=
"vm.thread.annotation"
>
ng-if=
"vm.thread.annotation"
>
</moderation-banner>
</moderation-banner>
<annotation-omega
ng-if=
"vm.shouldShowAnnotationOmega()"
annotation=
"vm.thread.annotation"
reply-count=
"vm.thread.replyCount"
on-reply-count-click=
"vm.toggleCollapsed()"
show-document-info=
"vm.showDocumentInfo"
>
</annotation-omega>
<annotation
ng-class=
"vm.annotationClasses()"
<annotation
ng-class=
"vm.annotationClasses()"
annotation=
"vm.thread.annotation"
annotation=
"vm.thread.annotation"
is-collapsed=
"vm.thread.collapsed"
is-collapsed=
"vm.thread.collapsed"
...
...
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