Skip to content

Commit

Permalink
fix(md-info): only display abstract if defined
Browse files Browse the repository at this point in the history
  • Loading branch information
tkohr committed Oct 18, 2023
1 parent 13bd9db commit ec67fd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
>
record.metadata.about
</p>
<div class="mb-6 md-description sm:mb-4 sm:pr-16">
<div class="mb-6 md-description sm:mb-4 sm:pr-16" *ngIf="metadata.abstract">
<gn-ui-content-ghost ghostClass="h-32" [showContent]="fieldReady('abstract')">
<p
class="whitespace-pre-line break-words"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('MetadataInfoComponent', () => {
component = fixture.componentInstance
component.metadata = {
...DATASET_RECORDS[0],
abstract: null,
useLimitations: null,
accessConstraints: null,
extras: {
Expand All @@ -40,6 +41,11 @@ describe('MetadataInfoComponent', () => {
fixture.nativeElement.querySelector('ng-container')
expect(displayedElement).toBeFalsy()
})
it('should not display the abstract section', () => {
const displayedElement =
fixture.nativeElement.querySelector('.md-description')
expect(displayedElement).toBeFalsy()
})
})

describe('When a section is not empty', () => {
Expand All @@ -53,7 +59,6 @@ describe('MetadataInfoComponent', () => {
const displayedElement = fixture.nativeElement.querySelector('.noUsage')
expect(displayedElement).toBeFalsy()
})

it('should display the keywords section', () => {
// Use waitForAsync to handle asynchronous changes in the DOM.
fixture.whenStable().then(() => {
Expand All @@ -62,5 +67,10 @@ describe('MetadataInfoComponent', () => {
expect(displayedElement).toBeTruthy()
})
})
it('should display the abstract section', () => {
const displayedElement =
fixture.nativeElement.querySelector('.md-description')
expect(displayedElement).toBeTruthy()
})
})
})

0 comments on commit ec67fd5

Please sign in to comment.