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
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<template>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocking: The acceptance criteria in issue #5631 state:

If there is no unit test suite, a new one is created. Do not use obsolete @vue/test-utils approach. Instead, use @testing-library/vue.

This new component has no unit tests. Consider adding tests for:

  • Rendering with required header prop
  • Rendering with optional text prop
  • Default slot content
  • Named back slot override

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the input, I will work on this 👍


<div class="message-layout-wrapper">
<StudioPage
:centered="true"
:marginTop="0"
>
<div class="message-layout-content">
<h1 class="message-header">
{{ header }}
</h1>
<p
v-if="text"
class="message-text"
>
{{ text }}
</p>
<div class="message-slot-container">
<slot></slot>
</div>
<div class="link-container">
<slot name="back">
<KRouterLink
:to="{ name: 'Main' }"
:text="$tr('backToLogin')"
appearance="basic-link"
/>
</slot>
</div>
</div>
</StudioPage>
</div>

</template>


<script>

import StudioPage from '../../shared/views/StudioPage';

export default {
name: 'StudioMessageLayout',
components: {
StudioPage,
},
props: {
header: {
type: String,
required: true,
},
text: {
type: String,
required: false,
default: '',
},
},
$trs: {
backToLogin: 'Continue to sign-in page',
},
};

</script>


<style scoped>

.message-layout-wrapper {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please add a comment here on that it was needed because of Vuetify problems? That way, we can understand later more easily, and cleanup after Vuetify is gone.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I have added it :)

.link,
a.link {
/* Removes Vuetify default button background and border styles */
background-color: transparent !important;
border-color: transparent !important;
}

.message-layout-content {
display: flex;
flex-direction: column;
max-width: 900px;
padding-top: 80px;
padding-bottom: 48px;
text-align: center;
}

.message-header {
margin-bottom: 6px;
font-size: 24px;
font-weight: bold;
}

.message-text {
margin-top: 4px;
margin-bottom: 20px;
font-size: 16px;
}

.message-slot-container {
max-width: 400px;
margin: 24px auto 0;
text-align: center;
}

.link-container {
margin-top: 24px;
}

</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { render, screen } from '@testing-library/vue';
import VueRouter from 'vue-router';
import StudioMessageLayout from '../StudioMessageLayout.vue';

const createRouter = () => {
return new VueRouter({
mode: 'abstract',
routes: [{ path: '/', name: 'Main', component: { template: '<div />' } }],
});
};

const renderComponent = (props = {}, slots = {}) => {
return render(StudioMessageLayout, {
props: {
header: 'Default Header',
...props,
},
slots,
routes: createRouter(),
stubs: {
StudioPage: {
template: '<div class="studio-page-stub"><slot /></div>',
},
KRouterLink: {
props: ['to', 'text', 'appearance'],
template: '<a href="#">{{ text }}</a>',
},
},
});
};

describe('StudioMessageLayout', () => {
it('renders with required header prop', () => {
renderComponent({ header: 'Test Message' });

expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Test Message');
});

it('renders with optional text prop', () => {
renderComponent({
header: 'Header',
text: 'This is additional information',
});

expect(screen.getByText('This is additional information')).toBeInTheDocument();
});

it('renders default slot content', () => {
renderComponent({ header: 'Header' }, { default: 'Custom slot content here' });

expect(screen.getByText('Custom slot content here')).toBeInTheDocument();
});

it('renders named back slot override', () => {
renderComponent({ header: 'Header' }, { back: 'Custom back content' });

expect(screen.getByText('Custom back content')).toBeInTheDocument();
expect(screen.queryByText('Continue to sign-in page')).not.toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<MessageLayout :header="$tr('accountDeletedTitle')">
<StudioMessageLayout :header="$tr('accountDeletedTitle')">
<template #back>
<KRouterLink
:to="{ name: 'Main' }"
Expand All @@ -9,19 +9,19 @@
appearance="raised-button"
/>
</template>
</MessageLayout>
</StudioMessageLayout>

</template>


<script>

import MessageLayout from '../../components/MessageLayout';
import StudioMessageLayout from '../../components/StudioMessageLayout.vue';

export default {
name: 'AccountDeleted',
components: {
MessageLayout,
StudioMessageLayout,
},
$trs: {
accountDeletedTitle: 'Account successfully deleted',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<MessageLayout :header="$tr('accountCreatedTitle')">
<StudioMessageLayout :header="$tr('accountCreatedTitle')">
<template #back>
<KRouterLink
:to="{ name: 'Main' }"
Expand All @@ -9,19 +9,19 @@
appearance="raised-button"
/>
</template>
</MessageLayout>
</StudioMessageLayout>

</template>


<script>

import MessageLayout from '../../components/MessageLayout';
import StudioMessageLayout from '../../components/StudioMessageLayout';

export default {
name: 'AccountCreated',
components: {
MessageLayout,
StudioMessageLayout,
},
$trs: {
accountCreatedTitle: 'Account successfully created',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<MessageLayout
<StudioMessageLayout
:header="$tr('title')"
:text="$tr('text')"
>
Expand All @@ -10,19 +10,19 @@
:to="{ name: 'RequestNewActivationLink' }"
appearance="raised-button"
/>
</MessageLayout>
</StudioMessageLayout>

</template>


<script>

import MessageLayout from '../../components/MessageLayout';
import StudioMessageLayout from '../../components/StudioMessageLayout';

export default {
name: 'AccountNotActivated',
components: {
MessageLayout,
StudioMessageLayout,
},
$trs: {
title: 'Account has not been activated',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<MessageLayout
<StudioMessageLayout
:header="$tr('activationExpiredTitle')"
:text="$tr('activationExpiredText')"
>
Expand All @@ -10,19 +10,19 @@
:to="{ name: 'RequestNewActivationLink' }"
appearance="raised-button"
/>
</MessageLayout>
</StudioMessageLayout>

</template>


<script>

import MessageLayout from '../../components/MessageLayout';
import StudioMessageLayout from '../../components/StudioMessageLayout';

export default {
name: 'ActivationExpired',
components: {
MessageLayout,
StudioMessageLayout,
},
$trs: {
activationExpiredTitle: 'Activation failed',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<MessageLayout
<StudioMessageLayout
:header="$tr('activationReSentTitle')"
:text="$tr('activationReSentText')"
/>
Expand All @@ -10,12 +10,12 @@

<script>

import MessageLayout from '../../components/MessageLayout';
import StudioMessageLayout from '../../components/StudioMessageLayout';

export default {
name: 'ActivationLinkReSent',
components: {
MessageLayout,
StudioMessageLayout,
},
$trs: {
activationReSentTitle: 'Instructions sent. Thank you!',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<MessageLayout
<StudioMessageLayout
:header="$tr('header')"
:text="$tr('text')"
/>
Expand All @@ -10,12 +10,12 @@

<script>

import MessageLayout from '../../components/MessageLayout';
import StudioMessageLayout from '../../components/StudioMessageLayout';

export default {
name: 'ActivationSent',
components: {
MessageLayout,
StudioMessageLayout,
},
$trs: {
header: 'Activation link sent',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<MessageLayout
<StudioMessageLayout
:header="$tr('passwordInstructionsHeader')"
:text="$tr('passwordInstructionsText')"
/>
Expand All @@ -10,12 +10,12 @@

<script>

import MessageLayout from '../../components/MessageLayout';
import StudioMessageLayout from '../../components/StudioMessageLayout';

export default {
name: 'PasswordInstructionsSent',
components: {
MessageLayout,
StudioMessageLayout,
},
$trs: {
passwordInstructionsHeader: 'Instructions sent. Thank you!',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<MessageLayout
<StudioMessageLayout
:header="$tr('resetExpiredTitle')"
:text="$tr('resetExpiredText')"
>
Expand All @@ -10,19 +10,19 @@
:to="{ name: 'ForgotPassword' }"
appearance="raised-button"
/>
</MessageLayout>
</StudioMessageLayout>

</template>


<script>

import MessageLayout from '../../components/MessageLayout';
import StudioMessageLayout from '../../components/StudioMessageLayout';

export default {
name: 'ResetLinkExpired',
components: {
MessageLayout,
StudioMessageLayout,
},
$trs: {
resetExpiredTitle: 'Reset link expired',
Expand Down
Loading