-
Notifications
You must be signed in to change notification settings - Fork 274
[Remove Vuetify from Studio] Informative pages in Accounts #5635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: unstable
Are you sure you want to change the base?
Changes from all commits
a9bc625
7b48919
6a2a22c
27476d4
445a2a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| <template> | ||
|
|
||
| <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; | ||
| } | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
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:
This new component has no unit tests. Consider adding tests for:
headerproptextpropbackslot overrideThere was a problem hiding this comment.
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 👍