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
8cffd0f4
Commit
8cffd0f4
authored
Aug 05, 2022
by
Lyza Danger Gardner
Committed by
Lyza Gardner
Aug 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure proper handling of missing subtitle in content info banner
parent
384d3adc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
ContentInfoBanner.js
src/annotator/components/ContentInfoBanner.js
+4
-3
ContentInfoBanner-test.js
src/annotator/components/test/ContentInfoBanner-test.js
+9
-0
No files found.
src/annotator/components/ContentInfoBanner.js
View file @
8cffd0f4
...
...
@@ -25,9 +25,10 @@ import {
*/
export
default
function
ContentInfoBanner
({
info
})
{
// Format item title to show subtitle
const
itemTitle
=
`
${
info
.
item
.
title
}${
info
.
item
.
subtitle
&&
': '
}${
info
.
item
.
subtitle
}
`
;
let
itemTitle
=
info
.
item
.
title
;
if
(
info
.
item
.
subtitle
)
{
itemTitle
+=
`:
${
info
.
item
.
subtitle
}
`
;
}
return
(
<
div
className
=
{
classnames
(
...
...
src/annotator/components/test/ContentInfoBanner-test.js
View file @
8cffd0f4
...
...
@@ -51,6 +51,15 @@ describe('ContentInfoBanner', () => {
assert
.
equal
(
link
.
prop
(
'target'
),
'_blank'
);
});
it
(
'handles missing subtitle'
,
()
=>
{
delete
contentInfo
.
item
.
subtitle
;
const
wrapper
=
createComponent
();
const
link
=
wrapper
.
find
(
'LinkUnstyled[data-testid="content-item-link"]'
);
assert
.
equal
(
link
.
text
(),
'Chapter 2'
);
});
it
(
'provides disclosure of long titles through title attributes'
,
()
=>
{
const
wrapper
=
createComponent
();
...
...
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