Skip to content
代码片段 群组 项目
提交 f3025f51 编辑于 作者: Jacques's avatar Jacques
浏览文件

Address code review comments

Addressed code review comments
上级 ed4fa2f2
No related branches found
No related tags found
无相关合并请求
......@@ -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, please download to view.'),
tooLargeDescription: __('This PDF is too large to display. Please 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>
......@@ -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, please download to view."
msgid "This PDF is too large to display. Please 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"
......
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.findByTestId('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, please download to view.',
'This PDF is too large to display. Please 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');
});
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册