Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ This changelog follows the principles of [Keep a Changelog](https://keepachangel
- Dataset versions: (1) file changes should be `Access: Restricted` instead of `isResticted: true/false`; (2) logic of View Detail button. (#879)
- File versions: (1) logic of linking to a file version; (2)If file not included, show text information "File not included in this version.". (#879)
- Dataset page publish flow now avoids rendering duplicate tab sets by making tabs skeleton and tabs content mutually exclusive.
- Fixed custom terms navigation url while publishing a datsaet.

### Removed

Expand Down
4 changes: 1 addition & 3 deletions src/sections/dataset/publish-dataset/PublishDatasetModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ export function PublishDatasetModal({
handleCustomTermsClick={() => {
const searchParams = new URLSearchParams(location.search)
searchParams.set('tab', 'terms')
const newUrl = `${import.meta.env.BASE_URL}${
location.pathname
}?${searchParams.toString()}`
const newUrl = `${location.pathname}?${searchParams.toString()}`

window.open(newUrl, '_blank')
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const createCollectionRepository = (options: CreateRepositoryOptions = {}) => {
type MountOptions = {
mountAs?: 'authenticated' | 'superuser'
repository?: DatasetRepository
collectionRepository: CollectionRepository | undefined
collectionRepository?: CollectionRepository | undefined
parentCollection?: ReturnType<typeof UpwardHierarchyNodeMother.createCollection>
handleClose?: sinon.SinonStub
dataverseInfoRepository?: DataverseInfoRepository
Expand Down Expand Up @@ -242,7 +242,7 @@ describe('PublishDatasetModal', () => {
.and('include', `/collections/${parentCollection.id}`)
})

it('Displays custom terms when license is undefined', () => {
it('displays custom terms when license is undefined', () => {
const parentCollection = UpwardHierarchyNodeMother.createCollection({ isReleased: false })

mountPublishDatasetModal({
Expand All @@ -256,6 +256,51 @@ describe('PublishDatasetModal', () => {
cy.findByText(/Custom Dataset Terms/).should('exist')
})

it('renders the Custom Dataset Terms link when license is undefined', () => {
mountPublishDatasetModal({
props: {
license: undefined,
customTerms: CustomTermsMother.create()
}
})

cy.findByRole('link', { name: /Custom Dataset Terms/ }).should('exist')
})

it('does not render the Custom Dataset Terms link when license is defined', () => {
mountPublishDatasetModal({
props: {
license: LicenseMother.create(),
customTerms: undefined
}
})

cy.findByText(/Custom Dataset Terms/).should('not.exist')
cy.findByRole('link', { name: 'CC0 1.0' }).should('exist')
})

it('opens the terms tab URL when Custom Dataset Terms link is clicked', () => {
const windowOpenStub = cy.stub().as('windowOpen')
cy.window().then((win) => {
cy.stub(win, 'open').callsFake(windowOpenStub)
})

mountPublishDatasetModal({
props: {
license: undefined,
customTerms: CustomTermsMother.create()
}
})

cy.findByRole('link', { name: /Custom Dataset Terms/ }).click()

cy.get('@windowOpen').should('have.been.calledOnce')
cy.get('@windowOpen').then((stub) => {
const calledUrl = (stub as unknown as sinon.SinonStub).firstCall.args[0] as string
expect(calledUrl).to.include('tab=terms')
})
})

it('Displays disclaimer text from settings', () => {
const dataverseInfoRepository = new DataverseInfoMockRepository()
const disclaimerText = 'This is custom text for the dataset publish popup.'
Expand Down
Loading