diff --git a/static/js/vue-cdr-access/src/components/full_record/downloadOptions.vue b/static/js/vue-cdr-access/src/components/full_record/downloadOptions.vue
index 239cf10160..309c877880 100644
--- a/static/js/vue-cdr-access/src/components/full_record/downloadOptions.vue
+++ b/static/js/vue-cdr-access/src/components/full_record/downloadOptions.vue
@@ -3,7 +3,7 @@
Contact Wilson/Log in to access
@@ -14,13 +14,13 @@
diff --git a/static/js/vue-cdr-access/tests/unit/downloadOptions.spec.js b/static/js/vue-cdr-access/tests/unit/downloadOptions.spec.js
index 0411644bef..755aabb15d 100644
--- a/static/js/vue-cdr-access/tests/unit/downloadOptions.spec.js
+++ b/static/js/vue-cdr-access/tests/unit/downloadOptions.spec.js
@@ -41,11 +41,12 @@ const record = {
]
}
+const uuid = '4db695c0-5fd5-4abf-9248-2e115d43f57d';
+
const div = document.createElement('div')
div.id = 'document'
document.body.appendChild(div);
-
let wrapper, store;
describe('downloadOption.vue', () => {
@@ -109,24 +110,24 @@ describe('downloadOption.vue', () => {
it('displays a download button with all download options for image with viewOriginal', async () => {
const updated_data = cloneDeep(record);
- updated_data.dataFileUrl = 'content/4db695c0-5fd5-4abf-9248-2e115d43f57d';
+ updated_data.dataFileUrl = `content/${uuid}`;
updated_data.resourceType = 'File';
await setRecordPermissions(updated_data, ['viewAccessCopies', 'viewReducedResImages', 'viewOriginal']);
expect(wrapper.find('.dropdown-menu').exists()).toBe(true);
await wrapper.find('button.download-images').trigger('click'); // Open
const dropdown_items = wrapper.findAll('.dropdown-item');
- expect(dropdown_items[0].text()).toEqual('Small JPG (800px)');
- expect(dropdown_items[1].text()).toEqual('Medium JPG (1600px)');
- expect(dropdown_items[2].text()).toEqual('Large JPG (2500px)');
- expect(dropdown_items[3].text()).toEqual('Full Size JPG');
- expect(dropdown_items[4].text()).toEqual('Original File');
+ expect(dropdown_items[0].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/800`);
+ expect(dropdown_items[1].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/1600`);
+ expect(dropdown_items[2].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/2500`);
+ expect(dropdown_items[3].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/max`);
+ expect(dropdown_items[4].attributes('href')).toEqual(`/content/${uuid}?dl=true`);
expect(dropdown_items.length).toEqual(5);
});
it('displays a download button with reduced download options for image with only viewReducedResImages', async () => {
const updated_data = cloneDeep(record);
- updated_data.dataFileUrl = 'content/4db695c0-5fd5-4abf-9248-2e115d43f57d';
+ updated_data.dataFileUrl = `content/${uuid}`;
updated_data.resourceType = 'File';
await setRecordPermissions(updated_data, ['viewAccessCopies', 'viewReducedResImages']);
@@ -134,15 +135,15 @@ describe('downloadOption.vue', () => {
await wrapper.find('button.download-images').trigger('click'); // Open
const dropdown_items = wrapper.findAll('.dropdown-item');
- expect(dropdown_items[0].text()).toEqual('Small JPG (800px)');
- expect(dropdown_items[1].text()).toEqual('Medium JPG (1600px)');
- expect(dropdown_items[2].text()).toEqual('Large JPG (2500px)');
+ expect(dropdown_items[0].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/800`);
+ expect(dropdown_items[1].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/1600`);
+ expect(dropdown_items[2].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/2500`);
expect(dropdown_items.length).toEqual(3);
});
it('shows a download button with no reduced download options when viewOriginal set and image is smaller than min size', async () => {
const updated_data = cloneDeep(record);
- updated_data.dataFileUrl = 'content/4db695c0-5fd5-4abf-9248-2e115d43f57d';
+ updated_data.dataFileUrl = `content/${uuid}`;
updated_data.resourceType = 'File';
updated_data.datastream[1] = "original_file|image/jpeg|tinyz||69490|urn:sha1:0d48dadb5d61ae0d41b4998280a3c39577a2f94a||640x480";
await setRecordPermissions(updated_data, ['viewAccessCopies', 'viewReducedResImages', 'viewOriginal']);
@@ -150,8 +151,8 @@ describe('downloadOption.vue', () => {
expect(wrapper.find('.dropdown-menu').exists()).toBe(true);
await wrapper.find('button.download-images').trigger('click'); // Open
const dropdown_items = wrapper.findAll('.dropdown-item');
- expect(dropdown_items[0].text()).toEqual('Full Size JPG');
- expect(dropdown_items[1].text()).toEqual('Original File');
+ expect(dropdown_items[0].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/max`);
+ expect(dropdown_items[1].attributes('href')).toEqual(`/content/${uuid}?dl=true`);
expect(dropdown_items.length).toEqual(2);
});
@@ -167,7 +168,7 @@ describe('downloadOption.vue', () => {
it('shows a download button with partial reduced download options with viewReducedResImages when image is smaller than largest size', async () => {
const updated_data = cloneDeep(record);
- updated_data.dataFileUrl = 'content/4db695c0-5fd5-4abf-9248-2e115d43f57d';
+ updated_data.dataFileUrl = `content/${uuid}`;
updated_data.resourceType = 'File';
updated_data.datastream[1] = "original_file|image/jpeg|midz||69490|urn:sha1:0d48dadb5d61ae0d41b4998280a3c39577a2f94a||1700x1200";
await setRecordPermissions(updated_data, ['viewAccessCopies', 'viewReducedResImages']);
@@ -175,8 +176,8 @@ describe('downloadOption.vue', () => {
expect(wrapper.find('.dropdown-menu').exists()).toBe(true);
await wrapper.find('button.download-images').trigger('click'); // Open
const dropdown_items = wrapper.findAll('.dropdown-item');
- expect(dropdown_items[0].text()).toEqual('Small JPG (800px)');
- expect(dropdown_items[1].text()).toEqual('Medium JPG (1600px)');
+ expect(dropdown_items[0].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/800`);
+ expect(dropdown_items[1].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/1600`);
expect(dropdown_items.length).toEqual(2);
});
@@ -204,9 +205,9 @@ describe('downloadOption.vue', () => {
expect(wrapper.find('.dropdown-menu').exists()).toBe(true);
await wrapper.find('button.download-images').trigger('click'); // Open
const dropdown_items = wrapper.findAll('.dropdown-item');
- expect(dropdown_items[0].text()).toEqual('Small JPG (800px)');
- expect(dropdown_items[1].text()).toEqual('Full Size JPG');
- expect(dropdown_items[2].text()).toEqual('Original File');
+ expect(dropdown_items[0].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/800`);
+ expect(dropdown_items[1].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/max`);
+ expect(dropdown_items[2].attributes('href')).toEqual(`/content/${uuid}?dl=true`);
expect(dropdown_items.length).toEqual(3);
});
@@ -221,11 +222,11 @@ describe('downloadOption.vue', () => {
expect(wrapper.find('.dropdown-menu').exists()).toBe(true);
await wrapper.find('button.download-images').trigger('click'); // Open
const dropdown_items = wrapper.findAll('.dropdown-item');
- expect(dropdown_items[0].text()).toEqual('Small JPG (800px)');
- expect(dropdown_items[1].text()).toEqual('Medium JPG (1600px)');
- expect(dropdown_items[2].text()).toEqual('Large JPG (2500px)');
- expect(dropdown_items[3].text()).toEqual('Full Size JPG');
- expect(dropdown_items[4].text()).toEqual('Original File');
+ expect(dropdown_items[0].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/800`);
+ expect(dropdown_items[1].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/1600`);
+ expect(dropdown_items[2].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/2500`);
+ expect(dropdown_items[3].attributes('href')).toEqual(`/services/api/downloadImage/${uuid}/max`);
+ expect(dropdown_items[4].attributes('href')).toEqual(`/content/${uuid}?dl=true`);
expect(dropdown_items.length).toEqual(5);
});