diff --git a/packages/design-system/src/lib/assets/styles/bootstrap-customized.scss b/packages/design-system/src/lib/assets/styles/bootstrap-customized.scss index f711f0b80..0d685b92a 100644 --- a/packages/design-system/src/lib/assets/styles/bootstrap-customized.scss +++ b/packages/design-system/src/lib/assets/styles/bootstrap-customized.scss @@ -102,6 +102,8 @@ $navbar-brand-font-size: $dv-brand-font-size; } .dropdown-menu > .dropdown > .dropdown-toggle { + width: 100%; + text-align: start; background-color: transparent; border-color: transparent; } diff --git a/src/stories/WithSettings.tsx b/src/stories/WithSettings.tsx index 081f61645..1a19cd96c 100644 --- a/src/stories/WithSettings.tsx +++ b/src/stories/WithSettings.tsx @@ -23,6 +23,8 @@ export const WithSettings = (Story: StoryFn) => { 'Final Approval' ]) as Setting ) + case SettingName.HAS_PUBLIC_STORE: + return Promise.resolve(SettingMother.createHasPublicStore(false) as Setting) } } diff --git a/src/stories/dataset/dataset-action-buttons/DatasetActionButtons.stories.tsx b/src/stories/dataset/dataset-action-buttons/DatasetActionButtons.stories.tsx index d7dbcfd7a..173f83561 100644 --- a/src/stories/dataset/dataset-action-buttons/DatasetActionButtons.stories.tsx +++ b/src/stories/dataset/dataset-action-buttons/DatasetActionButtons.stories.tsx @@ -26,7 +26,10 @@ export const WithPublishPermissions: Story = { ) @@ -37,7 +40,10 @@ export const WithNoDatasetPermissions: Story = { ) @@ -52,7 +58,10 @@ export const WithUpdateAndNoPublishDatasetPermissions: Story = { canPublishDataset: false, canUpdateDataset: true }), - version: DatasetVersionMother.createDraftAsLatestVersion() + version: DatasetVersionMother.createDraftAsLatestVersion(), + hasValidTermsOfAccess: true, + isValid: true, + isReleased: true })} /> ) diff --git a/src/stories/dataset/dataset-action-buttons/access-dataset-menu/AccessDatasetMenu.stories.tsx b/src/stories/dataset/dataset-action-buttons/access-dataset-menu/AccessDatasetMenu.stories.tsx new file mode 100644 index 000000000..8aba8ca0c --- /dev/null +++ b/src/stories/dataset/dataset-action-buttons/access-dataset-menu/AccessDatasetMenu.stories.tsx @@ -0,0 +1,30 @@ +import { Meta, StoryObj } from '@storybook/react' +import { WithI18next } from '../../../WithI18next' +import { WithSettings } from '../../../WithSettings' +import { + DatasetPermissionsMother, + DatasetVersionMother +} from '../../../../../tests/component/dataset/domain/models/DatasetMother' +import { AccessDatasetMenu } from '../../../../sections/dataset/dataset-action-buttons/access-dataset-menu/AccessDatasetMenu' + +const meta: Meta = { + title: 'Sections/Dataset Page/DatasetActionButtons/AccessDatasetMenu', + component: AccessDatasetMenu, + decorators: [WithI18next, WithSettings], + parameters: { + // Sets the delay for all stories. + chromatic: { delay: 15000, pauseAnimationAtEnd: true } + } +} + +export default meta +type Story = StoryObj + +export const WithAllPermissions: Story = { + render: () => ( + + ) +} diff --git a/src/stories/dataset/dataset-action-buttons/edit-dataset-menu/EditDatasetMenu.stories.tsx b/src/stories/dataset/dataset-action-buttons/edit-dataset-menu/EditDatasetMenu.stories.tsx new file mode 100644 index 000000000..fb1399451 --- /dev/null +++ b/src/stories/dataset/dataset-action-buttons/edit-dataset-menu/EditDatasetMenu.stories.tsx @@ -0,0 +1,54 @@ +import { Meta, StoryObj } from '@storybook/react' +import { WithI18next } from '../../../WithI18next' +import { WithSettings } from '../../../WithSettings' +import { + DatasetMother, + DatasetPermissionsMother +} from '../../../../../tests/component/dataset/domain/models/DatasetMother' +import { EditDatasetMenu } from '../../../../sections/dataset/dataset-action-buttons/edit-dataset-menu/EditDatasetMenu' + +const meta: Meta = { + title: 'Sections/Dataset Page/DatasetActionButtons/EditDatasetMenu', + component: EditDatasetMenu, + decorators: [WithI18next, WithSettings], + parameters: { + // Sets the delay for all stories. + chromatic: { delay: 15000, pauseAnimationAtEnd: true } + } +} + +export default meta +type Story = StoryObj + +export const WithAllPermissions: Story = { + render: () => ( + + ) +} + +export const WithManagePermissionsNotAllowed: Story = { + render: () => ( + + ) +} + +export const WithNoValidTermsOfAccess: Story = { + render: () => ( + + ) +} diff --git a/src/stories/dataset/dataset-action-buttons/link-dataset-button/LinkDatasetButton.stories.tsx b/src/stories/dataset/dataset-action-buttons/link-dataset-button/LinkDatasetButton.stories.tsx new file mode 100644 index 000000000..18c2140e3 --- /dev/null +++ b/src/stories/dataset/dataset-action-buttons/link-dataset-button/LinkDatasetButton.stories.tsx @@ -0,0 +1,22 @@ +import { Meta, StoryObj } from '@storybook/react' +import { WithI18next } from '../../../WithI18next' +import { WithSettings } from '../../../WithSettings' +import { DatasetMother } from '../../../../../tests/component/dataset/domain/models/DatasetMother' +import { LinkDatasetButton } from '../../../../sections/dataset/dataset-action-buttons/link-dataset-button/LinkDatasetButton' + +const meta: Meta = { + title: 'Sections/Dataset Page/DatasetActionButtons/LinkDatasetButton', + component: LinkDatasetButton, + decorators: [WithI18next, WithSettings], + parameters: { + // Sets the delay for all stories. + chromatic: { delay: 15000, pauseAnimationAtEnd: true } + } +} + +export default meta +type Story = StoryObj + +export const ReleasedDataset: Story = { + render: () => +} diff --git a/src/stories/dataset/dataset-action-buttons/publish-dataset-menu/PublishDatasetMenu.stories.tsx b/src/stories/dataset/dataset-action-buttons/publish-dataset-menu/PublishDatasetMenu.stories.tsx new file mode 100644 index 000000000..cbc01d0d3 --- /dev/null +++ b/src/stories/dataset/dataset-action-buttons/publish-dataset-menu/PublishDatasetMenu.stories.tsx @@ -0,0 +1,64 @@ +import { Meta, StoryObj } from '@storybook/react' +import { WithI18next } from '../../../WithI18next' +import { WithSettings } from '../../../WithSettings' +import { + DatasetMother, + DatasetPermissionsMother, + DatasetVersionMother +} from '../../../../../tests/component/dataset/domain/models/DatasetMother' +import { PublishDatasetMenu } from '../../../../sections/dataset/dataset-action-buttons/publish-dataset-menu/PublishDatasetMenu' + +const meta: Meta = { + title: 'Sections/Dataset Page/DatasetActionButtons/PublishDatasetMenu', + component: PublishDatasetMenu, + decorators: [WithI18next, WithSettings], + parameters: { + // Sets the delay for all stories. + chromatic: { delay: 15000, pauseAnimationAtEnd: true } + } +} + +export default meta +type Story = StoryObj + +export const PublishingAllowed: Story = { + render: () => ( + + ) +} + +export const NoValidTermsOfAccess: Story = { + render: () => ( + + ) +} + +export const DatasetInReview: Story = { + render: () => ( + + ) +} diff --git a/src/stories/dataset/dataset-action-buttons/submit-for-review-button/SubmitForReviewButton.stories.tsx b/src/stories/dataset/dataset-action-buttons/submit-for-review-button/SubmitForReviewButton.stories.tsx new file mode 100644 index 000000000..83f534320 --- /dev/null +++ b/src/stories/dataset/dataset-action-buttons/submit-for-review-button/SubmitForReviewButton.stories.tsx @@ -0,0 +1,72 @@ +import { Meta, StoryObj } from '@storybook/react' +import { WithI18next } from '../../../WithI18next' +import { WithSettings } from '../../../WithSettings' +import { + DatasetLockMother, + DatasetMother, + DatasetPermissionsMother, + DatasetVersionMother +} from '../../../../../tests/component/dataset/domain/models/DatasetMother' +import { SubmitForReviewButton } from '../../../../sections/dataset/dataset-action-buttons/submit-for-review-button/SubmitForReviewButton' + +const meta: Meta = { + title: 'Sections/Dataset Page/DatasetActionButtons/SubmitForReviewButton', + component: SubmitForReviewButton, + decorators: [WithI18next, WithSettings], + parameters: { + // Sets the delay for all stories. + chromatic: { delay: 15000, pauseAnimationAtEnd: true } + } +} + +export default meta +type Story = StoryObj + +export const CanSubmitForReview: Story = { + render: () => ( + + ) +} + +export const AlreadySubmittedForReview: Story = { + render: () => ( + + ) +} + +export const NoValidTermsOfAccess: Story = { + render: () => ( + + ) +} diff --git a/tests/component/dataset/domain/models/DatasetMother.ts b/tests/component/dataset/domain/models/DatasetMother.ts index a17fc57b6..8d9996946 100644 --- a/tests/component/dataset/domain/models/DatasetMother.ts +++ b/tests/component/dataset/domain/models/DatasetMother.ts @@ -133,10 +133,6 @@ export class DatasetPermissionsMother { return this.create({ canManageDatasetPermissions: false, canManageFilesPermissions: false }) } - static createWithManagePermissionsAllowed(): DatasetPermissions { - return this.create({ canManageDatasetPermissions: true, canManageFilesPermissions: true }) - } - static createWithDeleteDatasetAllowed(): DatasetPermissions { return this.create({ canDeleteDataset: true }) } @@ -144,6 +140,17 @@ export class DatasetPermissionsMother { static createWithDeleteDatasetNotAllowed(): DatasetPermissions { return this.create({ canDeleteDataset: false }) } + + static createWithNoneAllowed(): DatasetPermissions { + return this.create({ + canDownloadFiles: false, + canUpdateDataset: false, + canPublishDataset: false, + canManageDatasetPermissions: false, + canManageFilesPermissions: false, + canDeleteDataset: false + }) + } } export class DatasetLockMother { diff --git a/tests/component/sections/dataset/dataset-action-buttons/edit-dataset-menu/EditDatasetMenu.spec.tsx b/tests/component/sections/dataset/dataset-action-buttons/edit-dataset-menu/EditDatasetMenu.spec.tsx index 4083056ee..52ec1060f 100644 --- a/tests/component/sections/dataset/dataset-action-buttons/edit-dataset-menu/EditDatasetMenu.spec.tsx +++ b/tests/component/sections/dataset/dataset-action-buttons/edit-dataset-menu/EditDatasetMenu.spec.tsx @@ -12,7 +12,8 @@ describe('EditDatasetMenu', () => { permissions: DatasetPermissionsMother.createWithAllAllowed(), locks: [], hasValidTermsOfAccess: true, - version: DatasetVersionMother.createReleasedWithLatestVersionIsADraft() + version: DatasetVersionMother.createReleasedWithLatestVersionIsADraft(), + isReleased: true }) cy.customMount() diff --git a/tests/component/sections/dataset/dataset-action-buttons/submit-for-review-button/SubmitForReviewButton.spec.tsx b/tests/component/sections/dataset/dataset-action-buttons/submit-for-review-button/SubmitForReviewButton.spec.tsx index 589ec97c0..a41edda9f 100644 --- a/tests/component/sections/dataset/dataset-action-buttons/submit-for-review-button/SubmitForReviewButton.spec.tsx +++ b/tests/component/sections/dataset/dataset-action-buttons/submit-for-review-button/SubmitForReviewButton.spec.tsx @@ -15,7 +15,9 @@ describe('SubmitForReviewButton', () => { canUpdateDataset: true, canPublishDataset: false }), - locks: [] + locks: [], + hasValidTermsOfAccess: true, + isValid: true }) cy.customMount()