Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f3025f51
Commit
f3025f51
authored
Dec 07, 2021
by
Jacques
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address code review comments
Addressed code review comments
parent
ed4fa2f2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
21 deletions
+10
-21
app/assets/javascripts/repository/components/blob_viewers/pdf_viewer.vue
...scripts/repository/components/blob_viewers/pdf_viewer.vue
+5
-12
locale/gitlab.pot
locale/gitlab.pot
+1
-1
spec/frontend/repository/components/blob_viewers/pdf_viewer_spec.js
...end/repository/components/blob_viewers/pdf_viewer_spec.js
+4
-8
No files found.
app/assets/javascripts/repository/components/blob_viewers/pdf_viewer.vue
View file @
f3025f51
...
...
@@ -7,7 +7,7 @@ import { PDF_MAX_FILE_SIZE, PDF_MAX_PAGE_LIMIT } from '../../constants';
export
default
{
components
:
{
GlButton
,
PdfViewer
},
i18n
:
{
tooLargeDescription
:
__
(
'
This PDF is too large to display
, p
lease download to view.
'
),
tooLargeDescription
:
__
(
'
This PDF is too large to display
. P
lease download to view.
'
),
tooLargeButtonText
:
__
(
'
Download PDF
'
),
},
props
:
{
...
...
@@ -40,18 +40,11 @@ export default {
<pdf-viewer
v-if=
"!tooLargeToDisplay"
:pdf=
"url"
@
pdflabload=
"handleOnLoad"
/>
<div
v-else
class=
"gl-display-flex gl-flex-direction-column gl-align-items-center gl-p-5"
>
<p
data-testid=
"download-help-text"
>
{{
$options
.
i18n
.
tooLargeDescription
}}
</p>
<p>
{{
$options
.
i18n
.
tooLargeDescription
}}
</p>
<gl-button
icon=
"download"
category=
"secondary"
variant=
"confirm"
:href=
"url"
:aria-label=
"$options.i18n.tooLargeButtonText"
:title=
"$options.i18n.tooLargeButtonText"
download
>
{{
$options
.
i18n
.
tooLargeButtonText
}}
</gl-button
>
<gl-button
icon=
"download"
category=
"secondary"
variant=
"confirm"
:href=
"url"
download
>
{{
$options
.
i18n
.
tooLargeButtonText
}}
</gl-button>
</div>
</div>
</
template
>
locale/gitlab.pot
View file @
f3025f51
...
...
@@ -35552,7 +35552,7 @@ msgstr ""
msgid "This GitLab instance is undergoing maintenance and is operating in read-only mode."
msgstr ""
msgid "This PDF is too large to display
, p
lease download to view."
msgid "This PDF is too large to display
. P
lease download to view."
msgstr ""
msgid "This Project is currently archived and read-only. Please unarchive the project first if you want to resume Pull mirroring"
...
...
spec/frontend/repository/components/blob_viewers/pdf_viewer_spec.js
View file @
f3025f51
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
Component
from
'
~/repository/components/blob_viewers/pdf_viewer.vue
'
;
import
PdfViewer
from
'
~/blob/pdf/pdf_viewer.vue
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
describe
(
'
PDF Viewer
'
,
()
=>
{
let
wrapper
;
...
...
@@ -10,13 +9,11 @@ describe('PDF Viewer', () => {
const
defaultPropsData
=
{
url
:
'
some/pdf_blob.pdf
'
};
const
createComponent
=
(
fileSize
=
999
)
=>
{
wrapper
=
extendedWrapper
(
shallowMount
(
Component
,
{
propsData
:
{
...
defaultPropsData
,
fileSize
}
}),
);
wrapper
=
shallowMountExtended
(
Component
,
{
propsData
:
{
...
defaultPropsData
,
fileSize
}
});
};
const
findPDFViewer
=
()
=>
wrapper
.
findComponent
(
PdfViewer
);
const
findHelpText
=
()
=>
wrapper
.
find
ByTestId
(
'
download-help-text
'
);
const
findHelpText
=
()
=>
wrapper
.
find
(
'
p
'
);
const
findDownLoadButton
=
()
=>
wrapper
.
findComponent
(
GlButton
);
it
(
'
renders a PDF Viewer component
'
,
()
=>
{
...
...
@@ -35,12 +32,11 @@ describe('PDF Viewer', () => {
it
(
'
renders help text
'
,
()
=>
{
expect
(
findHelpText
().
text
()).
toBe
(
'
This PDF is too large to display
, p
lease download to view.
'
,
'
This PDF is too large to display
. P
lease download to view.
'
,
);
});
it
(
'
renders a download button
'
,
()
=>
{
expect
(
findDownLoadButton
().
exists
()).
toBe
(
true
);
expect
(
findDownLoadButton
().
text
()).
toBe
(
'
Download PDF
'
);
expect
(
findDownLoadButton
().
props
(
'
icon
'
)).
toBe
(
'
download
'
);
});
...
...
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