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
51dac583
Unverified
Commit
51dac583
authored
Mar 03, 2020
by
Lyza Gardner
Committed by
GitHub
Mar 03, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1868 from hypothesis/annotation-omega-css-classes
Add reply and collapsed classnames to `AnnotationOmega`
parents
911112cd
df5f4b95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
annotation-omega.js
src/sidebar/components/annotation-omega.js
+8
-1
annotation-omega-test.js
src/sidebar/components/test/annotation-omega-test.js
+19
-0
No files found.
src/sidebar/components/annotation-omega.js
View file @
51dac583
import
classnames
from
'classnames'
;
import
{
createElement
}
from
'preact'
;
import
{
createElement
}
from
'preact'
;
import
{
useEffect
,
useState
}
from
'preact/hooks'
;
import
{
useEffect
,
useState
}
from
'preact/hooks'
;
import
propTypes
from
'prop-types'
;
import
propTypes
from
'prop-types'
;
...
@@ -115,7 +116,13 @@ function AnnotationOmega({
...
@@ -115,7 +116,13 @@ function AnnotationOmega({
return
(
return
(
/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */
/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */
<
div
className
=
"annotation-omega"
onKeyDown
=
{
onKeyDown
}
>
<
div
className
=
{
classnames
(
'annotation-omega'
,
{
'annotation--reply'
:
isReply
(
annotation
),
'is-collapsed'
:
threadIsCollapsed
,
})}
onKeyDown
=
{
onKeyDown
}
>
<
AnnotationHeader
<
AnnotationHeader
annotation
=
{
annotation
}
annotation
=
{
annotation
}
isEditing
=
{
isEditing
}
isEditing
=
{
isEditing
}
...
...
src/sidebar/components/test/annotation-omega-test.js
View file @
51dac583
...
@@ -95,6 +95,25 @@ describe('AnnotationOmega', () => {
...
@@ -95,6 +95,25 @@ describe('AnnotationOmega', () => {
it
(
'should test `isSaving`'
);
it
(
'should test `isSaving`'
);
describe
(
'annotation classnames'
,
()
=>
{
it
(
'should assign a reply class if the annotation is a reply'
,
()
=>
{
fakeMetadata
.
isReply
.
returns
(
true
);
const
wrapper
=
createComponent
({
threadIsCollapsed
:
false
});
const
annot
=
wrapper
.
find
(
'.annotation-omega'
);
assert
.
isTrue
(
annot
.
hasClass
(
'annotation--reply'
));
assert
.
isFalse
(
annot
.
hasClass
(
'is-collapsed'
));
});
it
(
'should assign a collapsed class if the annotation thread is collapsed'
,
()
=>
{
const
wrapper
=
createComponent
({
threadIsCollapsed
:
true
});
const
annot
=
wrapper
.
find
(
'.annotation-omega'
);
assert
.
isTrue
(
annot
.
hasClass
(
'is-collapsed'
));
});
});
describe
(
'annotation quote'
,
()
=>
{
describe
(
'annotation quote'
,
()
=>
{
it
(
'renders quote if annotation has a quote'
,
()
=>
{
it
(
'renders quote if annotation has a quote'
,
()
=>
{
fakeMetadata
.
quote
.
returns
(
'quote'
);
fakeMetadata
.
quote
.
returns
(
'quote'
);
...
...
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