Skip to content

Commit

Permalink
Merge pull request geonetwork#767 from geonetwork/DH/redesign-abstract
Browse files Browse the repository at this point in the history
[Datahub] [Resdesign] Abstract section
  • Loading branch information
cmoinier authored Jan 22, 2024
2 parents 9ae0a68 + d8f14f4 commit 55bb5e1
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 78 deletions.
44 changes: 1 addition & 43 deletions apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,7 @@ describe('dataset pages', () => {
it('should display the description', () => {
cy.get('datahub-record-metadata')
.find('[id="about"]')
.find('gn-ui-metadata-info')
.find('gn-ui-content-ghost')
.find('gn-ui-max-lines')
.children('div')
.children('div')
.children('p')
.find('gn-ui-markdown-parser')
.should(($element) => {
const text = $element.text().trim()
expect(text).not.to.equal('')
Expand Down Expand Up @@ -133,18 +128,6 @@ describe('dataset pages', () => {
expect(text).not.to.equal('')
})
})
it('should display the keywords', () => {
cy.get('datahub-record-metadata')
.find('[id="about"]')
.find('gn-ui-metadata-info')
.find('gn-ui-content-ghost')
.find('gn-ui-max-lines')
.children('div')
.children('div')
.children('div')
.children('gn-ui-badge')
.should('have.length.gt', 0)
})
it('should display the lineage and usage tabs', () => {
cy.get('datahub-record-metadata')
.find('[id="about"]')
Expand Down Expand Up @@ -177,31 +160,6 @@ describe('dataset pages', () => {
cy.get('[data-cy="organization-name"]').click()
cy.url().should('include', '/search?publisher=')
})
it('should go to dataset search page when clicking on keyword and filter by keyword', () => {
cy.get('datahub-record-metadata')
.find('[id="about"]')
.find('gn-ui-metadata-info')
.find('gn-ui-content-ghost')
.find('gn-ui-max-lines')
.children('div')
.contains('Read more')
.click()

cy.get('datahub-record-metadata')
.find('gn-ui-badge')
.children('div')
.first()
.as('keyword')

cy.get('@keyword').then((key) => {
keyword = key.text().toUpperCase()
cy.get('@keyword').first().click()
cy.url().should('include', '/search?q=')
cy.get('gn-ui-fuzzy-search')
.find('input')
.should('have.value', keyword)
})
})
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
class="sm:block"
[metadata]="facade.metadata$ | async"
[incomplete]="facade.isIncomplete$ | async"
(keyword)="onInfoKeywordClick($event)"
>
</gn-ui-metadata-info>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
<p
class="text-[28px] text-title text-center mb-6 font-title sm:text-left"
translate
>
record.metadata.about
</p>
<div class="mb-6 md-description sm:mb-4 sm:pr-16">
<gn-ui-content-ghost ghostClass="h-32" [showContent]="fieldReady('abstract')">
<gn-ui-max-lines [maxLines]="6" *ngIf="metadata.abstract">
<div>
<gn-ui-markdown-parser
[textContent]="metadata.abstract"
></gn-ui-markdown-parser>
<ng-container *ngIf="metadata.keywords?.length">
<p class="mb-3 font-medium text-primary text-sm" translate>
record.metadata.keywords
</p>
<div class="sm:pb-4 sm:pr-16">
<gn-ui-badge
class="inline-block mr-2 mb-2 lowercase"
(click)="onKeywordClick(keyword)"
[clickable]="true"
*ngFor="let keyword of metadata.keywords"
>{{ keyword }}</gn-ui-badge
>
</div>
</ng-container>
</div>
</gn-ui-max-lines>
</gn-ui-content-ghost>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,10 @@ 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(() => {
const displayedElement =
fixture.nativeElement.querySelector('ng-container')
expect(displayedElement).toBeTruthy()
})
})
it('should display the abstract section', () => {
const displayedElement =
fixture.nativeElement.querySelector('.md-description p')
const displayedElement = fixture.nativeElement.querySelector(
'gn-ui-markdown-parser'
)
expect(displayedElement).toBeTruthy()
})
it('should display the metadata origin even if there is no lineage text', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,4 @@ export class MetadataInfoComponent {
fieldReady(propName: string) {
return !this.incomplete || propName in this.metadata
}

onKeywordClick(keyword: string) {
this.keyword.emit(keyword)
}
}

0 comments on commit 55bb5e1

Please sign in to comment.