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
8da798c8
Commit
8da798c8
authored
Jan 08, 2020
by
Lyza Danger Gardner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update `AnnotationHeader` to use util for `isHighlight`
parent
591c2338
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
8 deletions
+14
-8
annotation-header.js
src/sidebar/components/annotation-header.js
+3
-4
annotation-header-test.js
src/sidebar/components/test/annotation-header-test.js
+11
-3
annotation.html
src/sidebar/templates/annotation.html
+0
-1
No files found.
src/sidebar/components/annotation-header.js
View file @
8da798c8
const
propTypes
=
require
(
'prop-types'
);
const
{
createElement
}
=
require
(
'preact'
);
const
{
isHighlight
}
=
require
(
'../util/annotation-metadata'
);
const
AnnotationDocumentInfo
=
require
(
'./annotation-document-info'
);
const
AnnotationShareInfo
=
require
(
'./annotation-share-info'
);
const
AnnotationUser
=
require
(
'./annotation-user'
);
...
...
@@ -15,7 +17,6 @@ const Timestamp = require('./timestamp');
function
AnnotationHeader
({
annotation
,
isEditing
,
isHighlight
,
onReplyCountClick
,
replyCount
,
showDocumentInfo
,
...
...
@@ -60,7 +61,7 @@ function AnnotationHeader({
<
div
className
=
"annotation-header__row"
>
<
AnnotationShareInfo
annotation
=
{
annotation
}
/
>
{
!
isEditing
&&
isHighlight
&&
(
{
!
isEditing
&&
isHighlight
(
annotation
)
&&
(
<
div
className
=
"annotation-header__highlight"
>
<
SvgIcon
name
=
"highlight"
...
...
@@ -81,8 +82,6 @@ AnnotationHeader.propTypes = {
annotation
:
propTypes
.
object
.
isRequired
,
/* Whether the annotation is actively being edited */
isEditing
:
propTypes
.
bool
,
/* Whether the annotation is a highlight */
isHighlight
:
propTypes
.
bool
,
/* Callback for when the toggle-replies element is clicked */
onReplyCountClick
:
propTypes
.
func
.
isRequired
,
/* How many replies this annotation currently has */
...
...
src/sidebar/components/test/annotation-header-test.js
View file @
8da798c8
...
...
@@ -8,12 +8,13 @@ const { $imports } = require('../annotation-header');
const
mockImportedComponents
=
require
(
'./mock-imported-components'
);
describe
(
'AnnotationHeader'
,
()
=>
{
let
fakeIsHighlight
;
const
createAnnotationHeader
=
props
=>
{
return
mount
(
<
AnnotationHeader
annotation
=
{
fixtures
.
defaultAnnotation
()}
isEditing
=
{
false
}
isHighlight
=
{
false
}
onReplyCountClick
=
{
sinon
.
stub
()}
replyCount
=
{
0
}
showDocumentInfo
=
{
false
}
...
...
@@ -23,7 +24,14 @@ describe('AnnotationHeader', () => {
};
beforeEach
(()
=>
{
fakeIsHighlight
=
sinon
.
stub
().
returns
(
false
);
$imports
.
$mock
(
mockImportedComponents
());
$imports
.
$mock
({
'../util/annotation-metadata'
:
{
isHighlight
:
fakeIsHighlight
,
},
});
});
afterEach
(()
=>
{
...
...
@@ -111,9 +119,9 @@ describe('AnnotationHeader', () => {
describe
(
'annotation is-highlight icon'
,
()
=>
{
it
(
'should display is-highlight icon if annotation is a highlight'
,
()
=>
{
fakeIsHighlight
.
returns
(
true
);
const
wrapper
=
createAnnotationHeader
({
isEditing
:
false
,
isHighlight
:
true
,
});
const
highlightIcon
=
wrapper
.
find
(
'.annotation-header__highlight'
);
...
...
@@ -121,9 +129,9 @@ describe('AnnotationHeader', () => {
});
it
(
'should not display the is-highlight icon if annotation is not a highlight'
,
()
=>
{
fakeIsHighlight
.
returns
(
false
);
const
wrapper
=
createAnnotationHeader
({
isEditing
:
false
,
isHighlight
:
false
,
});
const
highlightIcon
=
wrapper
.
find
(
'.annotation-header__highlight'
);
...
...
src/sidebar/templates/annotation.html
View file @
8da798c8
...
...
@@ -6,7 +6,6 @@
<annotation-header
annotation=
"vm.annotation"
is-editing=
"vm.editing()"
is-highlight=
"vm.isHighlight()"
on-reply-count-click=
"vm.onReplyCountClick()"
reply-count=
"vm.replyCount"
show-document-info=
"vm.showDocumentInfo"
>
...
...
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