Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 7 additions & 1 deletion src/components/panels/edit/modals/helpers/DetailsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
<a target="_blank" :href="v">{{ v.split("/").at(-1).split("_").at(-1) }}</a>
</template>
<template v-else-if="key == 'notes'">
<span :class="{ unusable: v.includes('CANNOT BE USED UNDER RDA') }">{{ v
<span :class="{ unusable: (v.includes('CANNOT BE USED UNDER RDA') || v.includes('not valid for use as a subject')) }">{{ v
}}</span>
</template>
<template v-else>
Expand Down Expand Up @@ -332,11 +332,17 @@ export default {
getUsabilityNote: function(data){
let notes = data.notes || []
let needsNote = notes.filter((i) => i.includes("CANNOT BE USED") ? true : false)
if (needsNote.length < 1){
needsNote = notes.filter((i) => i.includes("not valid for use as a subject") ? true : false)
}
return needsNote[0]
},
checkIsUsable: function(data){
let notes = data.notes || []
let needsUpdate = notes.filter((i) => i.includes("CANNOT BE USED") ? true : false).length > 0
if (!needsUpdate){
needsUpdate = notes.filter((i) => i.includes("not valid for use as a subject") ? true : false).length > 0
}
return !needsUpdate
},
newSearch: function (term) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ export default {
checkIsUsable: function(data) {
let notes = data.extra.notes || []
let needsUpdate = notes.filter((i) => i.includes("CANNOT BE USED") ? true : false).length > 0
if (!needsUpdate){
needsUpdate = notes.filter((i) => i.includes("not valid for use as a subject") ? true : false).length > 0
}
return !needsUpdate
},
calculateIndex: function (i) {
Expand Down
16 changes: 16 additions & 0 deletions tests-playwright/components/complex_lookup/subject_builder.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,4 +764,20 @@ test('Correct USE appears for a Complex Heading', async ({ page }) => {
await expect(page.locator('#app')).toContainText('Agricultural innovations');
await expect(page.locator('#app')).toContainText('150 $aAgricultural innovations');
await expect(page.locator('#app')).toContainText('rdf:about="http://id.loc.gov/authorities/subjects/sh85002334"');
});

test('Subject Usage note appears highlighted', async ({ page }) => {
await page.goto('http://localhost:5555/bfe2/quartz/');

// Update the preferences for this test
let prefs = JSON.stringify(preferences)
await page.evaluate(prefs => localStorage.setItem("marva-preferences", prefs), prefs)
await page.reload();

await page.getByText('Click Here').click();
await page.getByRole('button', { name: 'Monograph', exact: true }).nth(1).click();
await page.locator('form').filter({ hasText: 'Search LCSH/LCNAF' }).getByRole('textbox').click();
await page.locator('form').filter({ hasText: 'Search LCSH/LCNAFbolt' }).getByRole('textbox').fill('Mebane (Family : Mebane, N.C.)');
await page.getByText('Mebane (Family : Mebane, N.C.)').nth(1).click();
await expect(page.getByRole('heading')).toContainText('[SUBJECT USAGE: This heading is not valid for use as a subject; use a family name heading from LCSH.]');
});