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

281 notes #293

Merged
merged 2 commits into from
Apr 18, 2024
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
57 changes: 45 additions & 12 deletions src/components/Concept.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,55 @@ const Concept = ({
</Markdown>
</div>
)}
{concept.scopeNote && (
{concept.note && i18n(language)(concept.note) !== "" && (
<div className="markdown">
<h3>Scope Note</h3>
<Markdown>
{i18n(language)(concept.scopeNote) ||
`*No scope note in language "${language}" provided.*`}
</Markdown>
<h3 id="note">Note</h3>
<ul aria-labelledby="note">
{i18n(language)(concept.note).map((note, i) => (
<li key={i}>{note}</li>
))}
</ul>
</div>
)}
{concept.note && (
{concept.changeNote && i18n(language)(concept.changeNote) !== "" && (
<div className="markdown">
<h3>Note</h3>
<Markdown>
{i18n(language)(concept.note) ||
`*No note in language "${language}" provided.*`}
</Markdown>
<h3 id="changenote">ChangeNote</h3>
<ul aria-labelledby="changenote">
{i18n(language)(concept.changeNote).map((changeNote, i) => (
<li key={i}>{changeNote}</li>
))}
</ul>
</div>
)}
{concept.editorialNote &&
i18n(language)(concept.editorialNote) !== "" && (
<div className="markdown">
<h3 id="editorialnote">EditorialNote</h3>
<ul aria-labelledby="editorialnote">
{i18n(language)(concept.editorialNote).map((editorialNote, i) => (
<li key={i}>{editorialNote}</li>
))}
</ul>
</div>
)}
{concept.historyNote && i18n(language)(concept.historyNote) !== "" && (
<div className="markdown">
<h3 id="historynote">HistoryNote</h3>
<ul aria-labelledby="historynote">
{i18n(language)(concept.historyNote).map((historyNote, i) => (
<li key={i}>{historyNote}</li>
))}
</ul>
</div>
)}
{concept.scopeNote && i18n(language)(concept.scopeNote) !== "" && (
<div className="markdown">
<h3 id="scopenote">ScopeNote</h3>
<ul aria-labelledby="scopenote">
{i18n(language)(concept.scopeNote).map((scopeNote, i) => (
<li key={i}>{scopeNote}</li>
))}
</ul>
</div>
)}
{concept.altLabel && i18n(language)(concept.altLabel) !== "" && (
Expand Down
17 changes: 13 additions & 4 deletions src/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,20 @@ const jsonld = {
definition: {
"@container": "@language",
},
scopeNote: {
"@container": "@language",
},
note: {
"@container": "@language",
"@container": ["@language", "@set"],
},
changeNote: {
"@container": ["@language", "@set"],
},
editorialNote: {
"@container": ["@language", "@set"],
},
historyNote: {
"@container": ["@language", "@set"],
},
scopeNote: {
"@container": ["@language", "@set"],
},
notation: {
"@container": "@set",
Expand Down
13 changes: 11 additions & 2 deletions src/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,19 @@ module.exports.allConcept = (inScheme, languages) => `
definition {
${[...languages].join(" ")}
}
scopeNote {
note {
${[...languages].join(" ")}
}
note {
changeNote {
${[...languages].join(" ")}
}
editorialNote {
${[...languages].join(" ")}
}
historyNote {
${[...languages].join(" ")}
}
scopeNote {
${[...languages].join(" ")}
}
notation
Expand Down
7 changes: 5 additions & 2 deletions src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ module.exports = (languages) => `
altLabel: LanguageMapArray,
hiddenLabel: LanguageMapArray,
definition: LanguageMap,
scopeNote: LanguageMap,
note: LanguageMap,
note: LanguageMapArray,
changeNote: LanguageMapArray,
editorialNote: LanguageMapArray,
historyNote: LanguageMapArray,
scopeNote: LanguageMapArray,
notation: [String],
example: LanguageMap,
topConceptOf: [ConceptScheme] @link(from: "topConceptOf___NODE"),
Expand Down
65 changes: 65 additions & 0 deletions test/concept.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,71 @@ describe.concurrent("Concept", () => {
).toBeInTheDocument()
})

it("renders notes", () => {
render(<Concept pageContext={ConceptPC} />)

expect(screen.getByText(/Meine Anmerkung/i)).toBeInTheDocument()

const list = screen.getByRole("list", {
name: "Note",
})
const { getAllByRole } = within(list)
const items = getAllByRole("listitem")
expect(items.length).toBe(2)
})

it("renders changeNotes", () => {
render(<Concept pageContext={ConceptPC} />)

expect(screen.getByText(/Meine Change Note/i)).toBeInTheDocument()

const list = screen.getByRole("list", {
name: /changenote/i,
})
const { getAllByRole } = within(list)
const items = getAllByRole("listitem")
expect(items.length).toBe(2)
})

it("renders editorialNotes", () => {
render(<Concept pageContext={ConceptPC} />)

expect(screen.getByText(/Meine Editorial Note/i)).toBeInTheDocument()

const list = screen.getByRole("list", {
name: /editorialnote/i,
})
const { getAllByRole } = within(list)
const items = getAllByRole("listitem")
expect(items.length).toBe(2)
})

it("renders historyNotes", () => {
render(<Concept pageContext={ConceptPC} />)

expect(screen.getByText(/Meine History Note/i)).toBeInTheDocument()

const list = screen.getByRole("list", {
name: /historynote/i,
})
const { getAllByRole } = within(list)
const items = getAllByRole("listitem")
expect(items.length).toBe(2)
})

it("renders scopeNotes", () => {
render(<Concept pageContext={ConceptPC} />)

expect(screen.getByText(/Meine Scope Note/i)).toBeInTheDocument()

const list = screen.getByRole("list", {
name: /scopenote/i,
})
const { getAllByRole } = within(list)
const items = getAllByRole("listitem")
expect(items.length).toBe(2)
})

it("renders related Concepts", () => {
render(<Concept pageContext={ConceptPC} />)
expect(
Expand Down
17 changes: 13 additions & 4 deletions test/data/pageContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,20 @@ export const topConcept = {
example: {
de: "Ein Beispiel",
},
scopeNote: {
de: "Meine Scope Note",
},
note: {
de: "Meine Anmerkung",
de: ["Meine Anmerkung", "Noch eine Anmerkung"],
},
changeNote: {
de: ["Meine Change Note", "Noch eine Change Note"],
},
editorialNote: {
de: ["Meine Editorial Note", "Noch eine Editorial Note"],
},
historyNote: {
de: ["Meine History Note", "Noch eine History Note"],
},
scopeNote: {
de: ["Meine Scope Note", "Noch eine Scope Note"],
},
notation: ["1"],
narrower: [concept2],
Expand Down
Loading