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
27a6ac35
Commit
27a6ac35
authored
Jan 08, 2024
by
Alejandro Celaya
Committed by
Alejandro Celaya
Jan 08, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add description to annotations export formats
parent
6bd2b21f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
ExportAnnotations.tsx
src/sidebar/components/ShareDialog/ExportAnnotations.tsx
+13
-1
ExportAnnotations-test.js
...bar/components/ShareDialog/test/ExportAnnotations-test.js
+14
-3
No files found.
src/sidebar/components/ShareDialog/ExportAnnotations.tsx
View file @
27a6ac35
...
@@ -34,26 +34,31 @@ type ExportFormat = {
...
@@ -34,26 +34,31 @@ type ExportFormat = {
/** Unique format identifier used also as file extension */
/** Unique format identifier used also as file extension */
value
:
'json'
|
'csv'
|
'txt'
|
'html'
;
value
:
'json'
|
'csv'
|
'txt'
|
'html'
;
name
:
string
;
name
:
string
;
description
:
string
;
};
};
const
exportFormats
:
ExportFormat
[]
=
[
const
exportFormats
:
ExportFormat
[]
=
[
{
{
value
:
'json'
,
value
:
'json'
,
name
:
'JSON'
,
name
:
'JSON'
,
description
:
'For import into another Hypothesis group or document'
,
},
},
{
{
value
:
'txt'
,
value
:
'txt'
,
name
:
'Text'
,
name
:
'Text'
,
description
:
'For import into Word or text editors'
,
},
},
{
{
value
:
'csv'
,
value
:
'csv'
,
name
:
'CSV'
,
name
:
'CSV'
,
description
:
'For import into a spreadsheet'
,
},
},
// TODO Enable these formats when implemented
// TODO Enable these formats when implemented
// {
// {
// value: 'html',
// value: 'html',
// name: 'HTML',
// name: 'HTML',
// description: '',
// },
// },
];
];
...
@@ -228,7 +233,14 @@ function ExportAnnotations({
...
@@ -228,7 +233,14 @@ function ExportAnnotations({
key={exportFormat.value}
key={exportFormat.value}
value={exportFormat}
value={exportFormat}
>
>
<div className="flex-col gap-y-2">
<div className="font-bold" data-testid="format-name">
{exportFormat.name}
{exportFormat.name}
</div>
<div data-testid="format-description">
{exportFormat.description}
</div>
</div>
</SelectNext.Option>
</SelectNext.Option>
))}
))}
</SelectNext>
</SelectNext>
...
...
src/sidebar/components/ShareDialog/test/ExportAnnotations-test.js
View file @
27a6ac35
...
@@ -241,11 +241,22 @@ describe('ExportAnnotations', () => {
...
@@ -241,11 +241,22 @@ describe('ExportAnnotations', () => {
'[data-testid="export-format-select"]'
,
'[data-testid="export-format-select"]'
,
);
);
const
options
=
select
.
find
(
SelectNext
.
Option
);
const
options
=
select
.
find
(
SelectNext
.
Option
);
const
optionText
=
(
index
,
type
)
=>
options
.
at
(
index
).
find
(
`[data-testid="format-
${
type
}
"]`
).
text
();
assert
.
equal
(
options
.
length
,
3
);
assert
.
equal
(
options
.
length
,
3
);
assert
.
equal
(
options
.
at
(
0
).
text
(),
'JSON'
);
assert
.
equal
(
optionText
(
0
,
'name'
),
'JSON'
);
assert
.
equal
(
options
.
at
(
1
).
text
(),
'Text'
);
assert
.
equal
(
assert
.
equal
(
options
.
at
(
2
).
text
(),
'CSV'
);
optionText
(
0
,
'description'
),
'For import into another Hypothesis group or document'
,
);
assert
.
equal
(
optionText
(
1
,
'name'
),
'Text'
);
assert
.
equal
(
optionText
(
1
,
'description'
),
'For import into Word or text editors'
,
);
assert
.
equal
(
optionText
(
2
,
'name'
),
'CSV'
);
assert
.
equal
(
optionText
(
2
,
'description'
),
'For import into a spreadsheet'
);
});
});
describe
(
'export form submitted'
,
()
=>
{
describe
(
'export form submitted'
,
()
=>
{
...
...
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