Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#202 Exercise Document Downloads #588

Merged
merged 6 commits into from
Jun 15, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/views/Exercises/Edit/Downloads.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,39 @@
:path="uploadPath"
/>

<h2 class="govuk-heading-l">
Pensions Information
</h2>

<RepeatableFields
v-model="exercise.downloads.pensionsInformation"
ident="candidate-assessement-forms"
:component="repeatableFields.MultiFileUpload"
:path="uploadPath"
/>

<h2 class="govuk-heading-l">
Competency framework
</h2>

<RepeatableFields
v-model="exercise.downloads.competencyFramework"
ident="candidate-assessement-forms"
:component="repeatableFields.MultiFileUpload"
:path="uploadPath"
/>

<h2 class="govuk-heading-l">
Welsh Translation
</h2>

<RepeatableFields
v-model="exercise.downloads.welshTranslation"
ident="candidate-assessement-forms"
:component="repeatableFields.MultiFileUpload"
:path="uploadPath"
/>

<button class="govuk-button">
Save and continue
</button>
Expand Down Expand Up @@ -83,6 +116,8 @@ export default {
termsAndConditions: [],
independentAssessors: [],
candidateAssessementForms: [],
pensionsInformation: [],
competencyFramework: [],
},
};
const data = this.$store.getters['exerciseDocument/data']();
Expand Down
66 changes: 66 additions & 0 deletions src/views/Exercises/Show/Downloads.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,72 @@
</ul>
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Pensions Information
</dt>
<dd class="govuk-summary-list__value">
<span v-if="!exercise.downloads.pensionsInformation.length">
crablab marked this conversation as resolved.
Show resolved Hide resolved
No files uploaded
</span>
<ul class="govuk-list">
<li
v-for="file in exercise.downloads.pensionsInformation"
:key="file.file"
>
<DownloadLink
:file-name="file.file"
:title="file.title"
:exercise-id="exerciseId"
/>
</li>
</ul>
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Competency Framework
</dt>
<dd class="govuk-summary-list__value">
<span v-if="!exercise.downloads.competencyFramework.length">
crablab marked this conversation as resolved.
Show resolved Hide resolved
No files uploaded
</span>
<ul class="govuk-list">
<li
v-for="file in exercise.downloads.competencyFramework"
:key="file.file"
>
<DownloadLink
:file-name="file.file"
:title="file.title"
:exercise-id="exerciseId"
/>
</li>
</ul>
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Welsh Translation
</dt>
<dd class="govuk-summary-list__value">
<span v-if="!exercise.downloads.welshTranslation.length">
No files uploaded
</span>
<ul class="govuk-list">
<li
v-for="file in exercise.downloads.welshTranslation"
:key="file.file"
>
<DownloadLink
:file-name="file.file"
:title="file.title"
:exercise-id="exerciseId"
/>
</li>
</ul>
</dd>
</div>
</dl>
</div>
</template>
Expand Down
12 changes: 7 additions & 5 deletions tests/unit/views/Exercises/Show/Downloads.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ describe('@/views/Exercises/Show/Downloads', () => {
termsAndConditions: [],
independentAssessors: [],
candidateAssessementForms: [],
pensionsInformation: [],
competencyFramework: [],
welshTranslation: [],
},
};

Expand All @@ -100,15 +103,14 @@ describe('@/views/Exercises/Show/Downloads', () => {
let wrapper = createTestSubject();
const lists = wrapper.findAll('dt');

expect(lists.length).toEqual(4);
expect(lists.length).toEqual(7);
});

it('renders message if list is empty', () => {
it('renders message for each item with no downloads available', () => {
mockData.mockReturnValue(exercise);
let wrapper = createTestSubject();
const lists = wrapper.findAll('dd > span');

expect(lists.length).toEqual(4);
expect(lists.length).toEqual(7);
});

it('renders download links for every non-empty list', () => {
Expand All @@ -126,7 +128,7 @@ describe('@/views/Exercises/Show/Downloads', () => {
let wrapper = createTestSubject();
const lists = wrapper.findAll('dd > ul');

expect(lists.length).toEqual(4);
expect(lists.length).toEqual(7);
expect(lists.at(0).findAll(DownloadLink).length).toEqual(1);
});
});
Expand Down