Commit ec969158 authored by Alexander Turinske's avatar Alexander Turinske

Update CSS selector for sticky section

parent ad2656fc
...@@ -20,7 +20,11 @@ export default { ...@@ -20,7 +20,11 @@ export default {
<slot name="header"></slot> <slot name="header"></slot>
</header> </header>
<section v-if="hasStickySlot" class="position-sticky gl-z-index-2 security_dashboard_filters"> <section
v-if="hasStickySlot"
data-testid="sticky-section"
class="position-sticky gl-z-index-2 security_dashboard_filters"
>
<slot name="sticky"></slot> <slot name="sticky"></slot>
</section> </section>
......
...@@ -4,6 +4,7 @@ import SecurityDashboardLayout from 'ee/security_dashboard/components/security_d ...@@ -4,6 +4,7 @@ import SecurityDashboardLayout from 'ee/security_dashboard/components/security_d
describe('Security Dashboard Layout component', () => { describe('Security Dashboard Layout component', () => {
let wrapper; let wrapper;
const SMALLER_SECTION_CLASS = 'col-xl-7'; const SMALLER_SECTION_CLASS = 'col-xl-7';
const STICKY_SECTION_SELECTOR = '[data-testid="sticky-section"]';
const DummyComponent = { const DummyComponent = {
name: 'dummy-component', name: 'dummy-component',
...@@ -17,7 +18,7 @@ describe('Security Dashboard Layout component', () => { ...@@ -17,7 +18,7 @@ describe('Security Dashboard Layout component', () => {
const findArticle = () => wrapper.find('article'); const findArticle = () => wrapper.find('article');
const findHeader = () => wrapper.find('header'); const findHeader = () => wrapper.find('header');
const findAside = () => wrapper.find('aside'); const findAside = () => wrapper.find('aside');
const findStickySection = () => wrapper.find('section'); const findStickySection = () => wrapper.find(STICKY_SECTION_SELECTOR);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -31,11 +32,11 @@ describe('Security Dashboard Layout component', () => { ...@@ -31,11 +32,11 @@ describe('Security Dashboard Layout component', () => {
}); });
it.each` it.each`
element | exists element | exists
${'article'} | ${true} ${'article'} | ${true}
${'header'} | ${false} ${'header'} | ${false}
${'aside'} | ${false} ${'aside'} | ${false}
${'section section'} | ${false} ${STICKY_SECTION_SELECTOR} | ${false}
`('should find that $element exists is $exists', ({ element, exists }) => { `('should find that $element exists is $exists', ({ element, exists }) => {
expect(wrapper.find(element).exists()).toBe(exists); expect(wrapper.find(element).exists()).toBe(exists);
}); });
...@@ -62,11 +63,11 @@ describe('Security Dashboard Layout component', () => { ...@@ -62,11 +63,11 @@ describe('Security Dashboard Layout component', () => {
}); });
it.each` it.each`
element | exists element | exists
${'article'} | ${true} ${'article'} | ${true}
${'header'} | ${true} ${'header'} | ${true}
${'aside'} | ${false} ${'aside'} | ${false}
${'section section'} | ${false} ${STICKY_SECTION_SELECTOR} | ${false}
`('should find that $element exists is $exists', ({ element, exists }) => { `('should find that $element exists is $exists', ({ element, exists }) => {
expect(wrapper.find(element).exists()).toBe(exists); expect(wrapper.find(element).exists()).toBe(exists);
}); });
...@@ -92,11 +93,11 @@ describe('Security Dashboard Layout component', () => { ...@@ -92,11 +93,11 @@ describe('Security Dashboard Layout component', () => {
}); });
it.each` it.each`
element | exists element | exists
${'article'} | ${true} ${'article'} | ${true}
${'header'} | ${false} ${'header'} | ${false}
${'aside'} | ${false} ${'aside'} | ${false}
${'section section'} | ${true} ${STICKY_SECTION_SELECTOR} | ${true}
`('should find that $element exists is $exists', ({ element, exists }) => { `('should find that $element exists is $exists', ({ element, exists }) => {
expect(wrapper.find(element).exists()).toBe(exists); expect(wrapper.find(element).exists()).toBe(exists);
}); });
...@@ -123,11 +124,11 @@ describe('Security Dashboard Layout component', () => { ...@@ -123,11 +124,11 @@ describe('Security Dashboard Layout component', () => {
}); });
it.each` it.each`
element | exists element | exists
${'article'} | ${true} ${'article'} | ${true}
${'header'} | ${false} ${'header'} | ${false}
${'aside'} | ${true} ${'aside'} | ${true}
${'section section'} | ${false} ${STICKY_SECTION_SELECTOR} | ${false}
`('should find that $element exists is $exists', ({ element, exists }) => { `('should find that $element exists is $exists', ({ element, exists }) => {
expect(wrapper.find(element).exists()).toBe(exists); expect(wrapper.find(element).exists()).toBe(exists);
}); });
......
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