Commit 23b10a21 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '342955-configuration-page-layout-ux-improvements' into 'master'

Improve ConfigurationPageLayout UX

See merge request gitlab-org/gitlab!73071
parents 2b63a368 aa3a160a
...@@ -72,7 +72,7 @@ export default { ...@@ -72,7 +72,7 @@ export default {
</script> </script>
<template> <template>
<configuration-page-layout v-if="hasData"> <configuration-page-layout v-if="hasData" no-border>
<template #heading> <template #heading>
{{ $options.i18n.title }} {{ $options.i18n.title }}
</template> </template>
......
<script>
export default {
props: {
noBorder: {
type: Boolean,
required: false,
default: false,
},
},
};
</script>
<template> <template>
<article> <article>
<slot name="alert"></slot> <slot name="alert"></slot>
<header <header
class="gl-my-5 gl-border-b-1 gl-border-b-gray-100 gl-border-b-solid gl-display-flex gl-justify-content-space-between" class="gl-mt-5 gl-display-flex gl-justify-content-space-between"
:class="{
['gl-mb-5 gl-border-b-1 gl-border-b-gray-100 gl-border-b-solid']: !noBorder,
}"
> >
<div> <div
<h4 class="gl-mt-0"> class="gl-display-flex gl-flex-direction-column gl-w-full gl-justify-content-space-between gl-md-flex-direction-row"
<slot name="heading"></slot> >
</h4> <div>
<p> <h4 class="gl-mt-0">
<slot name="description"></slot> <slot name="heading"></slot>
</p> </h4>
</div> <p>
<div> <slot name="description"></slot>
<slot name="actions"></slot> </p>
</div>
<div class="">
<slot name="actions"></slot>
</div>
</div> </div>
</header> </header>
<slot></slot> <slot></slot>
......
...@@ -4,22 +4,26 @@ exports[`Security Configuration Page Layout component matches the snapshot 1`] = ...@@ -4,22 +4,26 @@ exports[`Security Configuration Page Layout component matches the snapshot 1`] =
<article> <article>
Page alert Page alert
<header <header
class="gl-my-5 gl-border-b-1 gl-border-b-gray-100 gl-border-b-solid gl-display-flex gl-justify-content-space-between" class="gl-mt-5 gl-display-flex gl-justify-content-space-between gl-mb-5 gl-border-b-1 gl-border-b-gray-100 gl-border-b-solid"
> >
<div> <div
<h4 class="gl-display-flex gl-flex-direction-column gl-w-full gl-justify-content-space-between gl-md-flex-direction-row"
class="gl-mt-0" >
> <div>
Page title <h4
</h4> class="gl-mt-0"
>
Page title
</h4>
<p>
Scanner description
</p>
</div>
<p> <div>
Scanner description Action
</p> </div>
</div>
<div>
Action
</div> </div>
</header> </header>
......
import { within } from '@testing-library/dom';
import ConfigurationPageLayout from 'ee/security_configuration/components/configuration_page_layout.vue'; import ConfigurationPageLayout from 'ee/security_configuration/components/configuration_page_layout.vue';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
describe('Security Configuration Page Layout component', () => { describe('Security Configuration Page Layout component', () => {
let wrapper; let wrapper;
const withinComponent = () => within(wrapper.element);
const findHeader = () => withinComponent().getByRole('banner');
const createComponent = (options = {}) => { const createComponent = (options = {}) => {
wrapper = shallowMountExtended(ConfigurationPageLayout, { wrapper = shallowMountExtended(ConfigurationPageLayout, {
slots: { slots: {
...@@ -25,4 +29,24 @@ describe('Security Configuration Page Layout component', () => { ...@@ -25,4 +29,24 @@ describe('Security Configuration Page Layout component', () => {
createComponent(); createComponent();
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
describe('border', () => {
const borderClasses = 'gl-mb-5 gl-border-b-1 gl-border-b-gray-100 gl-border-b-solid';
it('adds border classes by default', () => {
createComponent();
expect(findHeader().className).toContain(borderClasses);
});
it('does not add border classes if no-border is true', () => {
createComponent({
propsData: {
noBorder: true,
},
});
expect(findHeader().className).not.toContain(borderClasses);
});
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment