diff --git a/app/assets/stylesheets/stackmap_customizations.scss b/app/assets/stylesheets/stackmap_customizations.scss index 4e57f309d..460e7052b 100644 --- a/app/assets/stylesheets/stackmap_customizations.scss +++ b/app/assets/stylesheets/stackmap_customizations.scss @@ -7,10 +7,10 @@ display:inline-block; white-space:nowrap; margin:4px 0 4px 15px; - // padding:4px;text-shadow:0 1px 1px rgba(0,0,0,.2); + padding:0; text-shadow:none; font-size:1rem; - // font-weight:700; + font-weight:normal; color:#ffffff; background-color: #3072AB; border-color: #3072AB; diff --git a/spec/javascript/orangelight/availability.spec.js b/spec/javascript/orangelight/availability.spec.js index 0eb37ead0..c3bf6645b 100644 --- a/spec/javascript/orangelight/availability.spec.js +++ b/spec/javascript/orangelight/availability.spec.js @@ -10,9 +10,9 @@ describe('AvailabilityUpdater', function () { }); test('search results page with available, unavailable, mixed holdings display desired labels and badges', async () => { - const avail_id = "99120385083506421"; - const unavail_id = "99121744283506421"; - const mixed_id = "99119590233506421"; + const avail_id = '99120385083506421'; + const unavail_id = '99121744283506421'; + const mixed_id = '99119590233506421'; document.body.innerHTML = '
' + '
' + @@ -55,26 +55,35 @@ describe('AvailabilityUpdater', function () { '
' + '' + ''; - let bibdata_response = await fs.readFile("spec/fixtures/bibliographic_availability_3_bibs.json", 'utf8'); + let bibdata_response = await fs.readFile( + 'spec/fixtures/bibliographic_availability_3_bibs.json', + 'utf8' + ); bibdata_response = JSON.parse(bibdata_response); - const u = new updater; + const u = new updater(); u.process_results_list(bibdata_response); - const available_result = $(`*[data-record-id="${avail_id}"] .availability-icon`); + const available_result = $( + `*[data-record-id="${avail_id}"] .availability-icon` + ); expect(available_result.hasClass('badge')).toBe(true); expect(available_result.hasClass('badge-success')).toBe(true); - expect(available_result.text()).toEqual("Available"); + expect(available_result.text()).toEqual('Available'); - const unavailable_result = $(`*[data-record-id="${unavail_id}"] .availability-icon`); + const unavailable_result = $( + `*[data-record-id="${unavail_id}"] .availability-icon` + ); expect(unavailable_result.hasClass('badge')).toBe(true); expect(unavailable_result.hasClass('badge-danger')).toBe(true); - expect(unavailable_result.text()).toEqual("Unavailable"); + expect(unavailable_result.text()).toEqual('Unavailable'); - const mixed_result = $(`*[data-record-id="${mixed_id}"] .availability-icon`); + const mixed_result = $( + `*[data-record-id="${mixed_id}"] .availability-icon` + ); expect(mixed_result.hasClass('badge')).toBe(true); expect(mixed_result.hasClass('badge-secondary')).toBe(true); - expect(mixed_result.text()).toEqual("Some items not available"); + expect(mixed_result.text()).toEqual('Some items not available'); }); test('search results - SCSB availability - Unavailable', () => { document.body.innerHTML = @@ -93,21 +102,27 @@ describe('AvailabilityUpdater', function () { ''; const item_data = { - "itemBarcode": "CU15957330", - "itemAvailabilityStatus": "Unavailable", - "errorMessage": null, - "collectionGroupDesignation": "Shared" - } - const barcode_id = item_data["itemBarcode"] - const availabilityBadgeBefore = document.getElementsByClassName('availability-icon'); + itemBarcode: 'CU15957330', + itemAvailabilityStatus: 'Unavailable', + errorMessage: null, + collectionGroupDesignation: 'Shared', + }; + const barcode_id = item_data['itemBarcode']; + const availabilityBadgeBefore = + document.getElementsByClassName('availability-icon'); expect(availabilityBadgeBefore[0].textContent).toEqual('Unavailable'); - const u = new updater; - u.apply_scsb_record(barcode_id, item_data) + const u = new updater(); + u.apply_scsb_record(barcode_id, item_data); u.scsb_search_availability; - const availabilityBadgeAfter = document.getElementsByClassName('availability-icon'); + const availabilityBadgeAfter = + document.getElementsByClassName('availability-icon'); expect(availabilityBadgeAfter[0].textContent).toEqual('Unavailable'); - expect(document.querySelector('.holding-status[data-holding-id="5459517"] > .badge-danger')).toBeTruthy(); - }) + expect( + document.querySelector( + '.holding-status[data-holding-id="5459517"] > .badge-danger' + ) + ).toBeTruthy(); + }); test('search results availability for records in temporary locations says View record for Full Availability', () => { document.body.innerHTML = '
  • ' + @@ -134,43 +149,43 @@ describe('AvailabilityUpdater', function () { ' ' + '
  • '; - const apiResponse = { - "9972879153506421": { - "lewis$resterm": { - "on_reserve": "N", - "location": "lewis$resterm", - "label": "Lewis Library - Term Loan Reserves", - "status_label": "Available", - "copy_number": null, - "cdl": false, - "temp_location": true, - "id": "lewis$resterm" + '9972879153506421': { + lewis$resterm: { + on_reserve: 'N', + location: 'lewis$resterm', + label: 'Lewis Library - Term Loan Reserves', + status_label: 'Available', + copy_number: null, + cdl: false, + temp_location: true, + id: 'lewis$resterm', }, - "22732100160006421": { - "on_reserve": "N", - "location": "engineer$stacks", - "label": "Engineering Library - Stacks", - "status_label": "Available", - "copy_number": null, - "cdl": false, - "temp_location": false, - "id": "22732100160006421" - } - } + '22732100160006421': { + on_reserve: 'N', + location: 'engineer$stacks', + label: 'Engineering Library - Stacks', + status_label: 'Available', + copy_number: null, + cdl: false, + temp_location: false, + id: '22732100160006421', + }, + }, }; - const badgesBefore = document.getElementsByClassName('availability-icon'); expect(badgesBefore[0].textContent).toEqual('Loading...'); const bibId = '9972879153506421'; const holdingData = apiResponse[bibId]; - const u = new updater; + const u = new updater(); u.process_result(bibId, holdingData); const badgesAfter = document.getElementsByClassName('availability-icon'); - expect(badgesAfter[0].textContent).toEqual('View record for Full Availability'); + expect(badgesAfter[0].textContent).toEqual( + 'View record for Full Availability' + ); }); test('record show page with an available holding displays the status label in green', () => { @@ -180,8 +195,20 @@ describe('AvailabilityUpdater', function () { '' + '' + ''; - const holding_records = { "99118400923506421": { "22105449840006421": { "on_reserve": "N", "location": "stacks", "label": "Firestone Library (F)", "status_label": "Available", "more_items": false, "holding_type": "physical", "id": "22105449840006421" } } }; - const u = new updater; + const holding_records = { + '99118400923506421': { + '22105449840006421': { + on_reserve: 'N', + location: 'stacks', + label: 'Firestone Library (F)', + status_label: 'Available', + more_items: false, + holding_type: 'physical', + id: '22105449840006421', + }, + }, + }; + const u = new updater(); u.id = '99118400923506421'; u.process_single(holding_records); @@ -199,8 +226,20 @@ describe('AvailabilityUpdater', function () { '' + '' + ''; - const holding_records = { "99118400923506421": { "22105449840006421": { "on_reserve": "N", "location": "stacks", "label": "Firestone Library (F)", "status_label": "Unavailable", "more_items": false, "holding_type": "physical", "id": "22105449840006421" } } }; - const u = new updater; + const holding_records = { + '99118400923506421': { + '22105449840006421': { + on_reserve: 'N', + location: 'stacks', + label: 'Firestone Library (F)', + status_label: 'Unavailable', + more_items: false, + holding_type: 'physical', + id: '22105449840006421', + }, + }, + }; + const u = new updater(); u.id = '99118400923506421'; u.process_single(holding_records); @@ -218,8 +257,20 @@ describe('AvailabilityUpdater', function () { '' + '' + ''; - const holding_records = { "99118400923506421": { "22105449840006421": { "on_reserve": "N", "location": "stacks", "label": "Firestone Library (F)", "status_label": "Some items not available", "more_items": false, "holding_type": "physical", "id": "22105449840006421" } } }; - const u = new updater; + const holding_records = { + '99118400923506421': { + '22105449840006421': { + on_reserve: 'N', + location: 'stacks', + label: 'Firestone Library (F)', + status_label: 'Some items not available', + more_items: false, + holding_type: 'physical', + id: '22105449840006421', + }, + }, + }; + const u = new updater(); u.id = '99118400923506421'; u.process_single(holding_records); @@ -237,11 +288,23 @@ describe('AvailabilityUpdater', function () { '' + '' + ''; - const holding_records = { "9965126093506421": { "22202918790006421": { "on_reserve": "N", "location": "firestone$stacks", "label": "Stacks", "status_label": "Unavailable", "cdl": true, "holding_type": "physical", "id": "22202918790006421" } } }; + const holding_records = { + '9965126093506421': { + '22202918790006421': { + on_reserve: 'N', + location: 'firestone$stacks', + label: 'Stacks', + status_label: 'Unavailable', + cdl: true, + holding_type: 'physical', + id: '22202918790006421', + }, + }, + }; const spy = jest.spyOn(orangelight_online_link, 'insert_online_link'); - const u = new updater; + const u = new updater(); u.id = '9965126093506421'; u.process_single(holding_records); @@ -259,15 +322,16 @@ describe('AvailabilityUpdater', function () { '' + ''; - const u = new updater; + const u = new updater(); u.id = '9965126093506421'; u.update_availability_undetermined(); - expect(document.body.innerHTML).toContain("Undetermined"); + expect(document.body.innerHTML).toContain('Undetermined'); }); test('when a record has temporary and permanent locations we display the status for both', () => { - document.body.innerHTML = '' + + document.body.innerHTML = + '
    ' + ' ' + ' ' + ' ' + ' ' + '
    ' + @@ -283,7 +347,8 @@ describe('AvailabilityUpdater', function () { ' ' + ' ' + - ' Request' + + ' Request' + ' ' + '
      ' + @@ -313,30 +378,30 @@ describe('AvailabilityUpdater', function () { '
      '; const availability_response = { - "9972879153506421": { - "lewis$resterm": { - "on_reserve": "N", - "location": "lewis$resterm", - "label": "Lewis Library - Term Loan Reserves", - "status_label": "Available", - "copy_number": null, - "cdl": false, - "temp_location": true, - "id": "lewis$resterm" + '9972879153506421': { + lewis$resterm: { + on_reserve: 'N', + location: 'lewis$resterm', + label: 'Lewis Library - Term Loan Reserves', + status_label: 'Available', + copy_number: null, + cdl: false, + temp_location: true, + id: 'lewis$resterm', }, - "22732100160006421": { - "on_reserve": "N", - "location": "engineer$stacks", - "label": "Engineering Library - Stacks", - "status_label": "Available", - "copy_number": null, - "cdl": false, - "temp_location": false, - "id": "22732100160006421" - } - } + '22732100160006421': { + on_reserve: 'N', + location: 'engineer$stacks', + label: 'Engineering Library - Stacks', + status_label: 'Available', + copy_number: null, + cdl: false, + temp_location: false, + id: '22732100160006421', + }, + }, }; - const u = new updater; + const u = new updater(); u.id = '9972879153506421'; u.process_single(availability_response); @@ -345,7 +410,8 @@ describe('AvailabilityUpdater', function () { expect(badge.classList.values()).toContain('badge-success'); expect(badge.textContent).toEqual('Available'); - const badge_second = document.getElementsByClassName('availability-icon')[1]; + const badge_second = + document.getElementsByClassName('availability-icon')[1]; expect(badge_second.classList.values()).toContain('badge'); expect(badge_second.classList.values()).toContain('badge-success'); expect(badge_second.textContent).toEqual('Available'); @@ -358,11 +424,23 @@ describe('AvailabilityUpdater', function () { '' + '' + ''; - const holding_records = { "9965126093506421": { "22202918790006421": { "on_reserve": "N", "location": "firestone$stacks", "label": "Stacks", "status_label": "Unavailable", "cdl": false, "holding_type": "physical", "id": "22202918790006421" } } }; + const holding_records = { + '9965126093506421': { + '22202918790006421': { + on_reserve: 'N', + location: 'firestone$stacks', + label: 'Stacks', + status_label: 'Unavailable', + cdl: false, + holding_type: 'physical', + id: '22202918790006421', + }, + }, + }; const spy = jest.spyOn(orangelight_online_link, 'insert_online_link'); - const u = new updater; + const u = new updater(); u.id = '9965126093506421'; u.process_single(holding_records); @@ -378,14 +456,25 @@ describe('AvailabilityUpdater', function () { '' + ''; const holding_records = { - "9929455793506421": {}, - "99124994093506421": { "22488152160006421": { "on_reserve": "N", "location": "recap$pa", "label": "ReCAP - ReCAP - rcppa RECAP", "status_label": "Available", "copy_number": null, "cdl": false, "temp_location": false, "id": "22488152160006421" } } + '9929455793506421': {}, + '99124994093506421': { + '22488152160006421': { + on_reserve: 'N', + location: 'recap$pa', + label: 'ReCAP - ReCAP - rcppa RECAP', + status_label: 'Available', + copy_number: null, + cdl: false, + temp_location: false, + id: '22488152160006421', + }, + }, }; - const u = new updater; + const u = new updater(); u.id = '9929455793506421'; // constituent record - u.host_id = ["99124994093506421"]; // host mms_id - u.mms_id = u.host_id[0]; // + u.host_id = ['99124994093506421']; // host mms_id + u.mms_id = u.host_id[0]; // const update_single = jest.spyOn(u, 'update_single'); u.process_single(holding_records); @@ -395,7 +484,6 @@ describe('AvailabilityUpdater', function () { update_single.mockRestore(); }); - test('record search results page for a bound-with record', () => { // Notice the data-bound-with="true" document.body.innerHTML = @@ -404,29 +492,33 @@ describe('AvailabilityUpdater', function () { '' + '' + ''; - const holding_records = - { - "22488152160006421": { - "on_reserve": "N", - "location": "recap$pa", - "label": "ReCAP - Remote Storage", - "status_label": "Available", - "copy_number": null, - "cdl": false, - "temp_location": false, - "id": "22488152160006421" - } + const holding_records = { + '22488152160006421': { + on_reserve: 'N', + location: 'recap$pa', + label: 'ReCAP - Remote Storage', + status_label: 'Available', + copy_number: null, + cdl: false, + temp_location: false, + id: '22488152160006421', + }, }; - const holding_badge = $("*[data-availability-record='true'][data-record-id='9929455793506421'][data-bound-with='true'] span.availability-icon")[0]; + const holding_badge = $( + "*[data-availability-record='true'][data-record-id='9929455793506421'][data-bound-with='true'] span.availability-icon" + )[0]; - const u = new updater; - u.process_result("9929455793506421", holding_records); + const u = new updater(); + u.process_result('9929455793506421', holding_records); - expect(holding_badge.textContent).toContain('View record for Full Availability'); + expect(holding_badge.textContent).toContain( + 'View record for Full Availability' + ); }); test('extra Online availability added for CDL records that are reported as unavailable', () => { - document.body.innerHTML = '