Skip to content

Commit

Permalink
show trait description on trait, not space (#76)
Browse files Browse the repository at this point in the history
* show trait description on trait, not space

* test: add test coverage for trait show body

---------

Co-authored-by: James Dabbs <[email protected]>
  • Loading branch information
StevenClontz and jamesdabbs authored Nov 7, 2023
1 parent 8a4bd46 commit 78ab5bf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
18 changes: 17 additions & 1 deletion packages/viewer/cypress/e2e/space.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import { deduce, setup } from '../support'

beforeEach(setup)

function clickTraitFor(name: string) {
cy.get('.related-traits')
.contains(name)
.closest('tr')
.find('.bi-check')
.click()
}

it('links to properties', () => {
cy.visit('spaces/S000004/properties')
deduce()
Expand All @@ -15,7 +23,7 @@ it('links to traits', () => {
cy.visit('spaces/S000004/properties')
deduce()

cy.contains('Semiregular').closest('tr').find('.bi-check').click()
clickTraitFor('Semiregular')

cy.location('pathname').should('eq', '/spaces/S000004/properties/P000010')
})
Expand All @@ -30,3 +38,11 @@ it('filters traits', () => {
.first()
.should('have.text', '16 Compact ')
})

it('displays trait descriptions', () => {
cy.visit('spaces/S000001')

clickTraitFor('Discrete')

cy.contains('By definition of discrete')
})
2 changes: 1 addition & 1 deletion packages/viewer/cypress/fixtures/main.min.json
Original file line number Diff line number Diff line change
Expand Up @@ -6088,7 +6088,7 @@
"refs": [

],
"description": "-"
"description": "By definition of discrete"
},
{
"uid": "T024776",
Expand Down
4 changes: 2 additions & 2 deletions packages/viewer/src/components/Traits/Show.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
<Proof {space} {...proof} />
{:else if meta}
<section class="description">
<Typeset body={space.description} />
<Typeset body={meta.description} />
</section>

<h3>References</h3>
<References references={meta.refs} />
{/if}
{:catch}
Expand Down

0 comments on commit 78ab5bf

Please sign in to comment.