Skip to content

Commit

Permalink
Merge pull request #194 from OnroerendErfgoed/feature/184_system_fiel…
Browse files Browse the repository at this point in the history
…ds_optional_status

Feature/184 system fields optional status
  • Loading branch information
wouter-adriaens authored Jan 11, 2024
2 parents 9631dcb + 1ee9a1e commit 48af99b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/__tests__/SystemFields.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ describe('SystemFields - no data', () => {
mount(TestComponent);
});

it('has an empty status field', () => {
it('hides the status field when empty', () => {
mount(TestComponent);
cy.dataCy('systemfield-status').should('have.text', 'Status: -');
cy.dataCy('systemfield-status').should('not.exist');
});

it('has an empty aangemaakt door field', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/dumb/SystemFields.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<ul data-cy="systemfield-ul">
<li data-cy="systemfield-status"><span>Status:</span> {{ props.status || '-' }}</li>
<li v-if="props.status" data-cy="systemfield-status">Status: {{ props.status }}</li>
<li data-cy="systemfield-aangemaakt-door">
<span>Aangemaakt door:</span> {{ props.createdBy || '-' }} op {{ createdAt }}
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/models/system-fields.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface ISystemFieldsProps {
status: string;
status?: string;
createdBy: string;
createdAt: string;
updatedBy: string;
Expand Down
13 changes: 1 addition & 12 deletions src/stories/dumb-components/system-fields.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,12 @@ const meta: Meta<typeof SystemFields> = {
updatedBy: 'Miss. Foo',
updatedAt: '2023-05-24T13:45:03.497579+02:00',
},
render: (args) => ({
setup() {
return { args };
},
template: `<SystemFields></SystemFields>`,
}),
};

export default meta;
type Story = StoryObj<typeof SystemFields>;

export const Default: Story = {
render: () => ({
components: { SystemFields },
template: `<SystemFields></SystemFields>`,
}),
};
export const Default: Story = {};

export const Slot: Story = {
render: (args) => ({
Expand Down

0 comments on commit 48af99b

Please sign in to comment.