Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5c0d1953
Commit
5c0d1953
authored
Mar 23, 2020
by
Sam Beckham
Committed by
Mark Florian
Mar 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds a new `security_dashboard_layout` component
Adds and tests the component but doesn't use it yet.
parent
c901cb74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
149 additions
and
0 deletions
+149
-0
ee/app/assets/javascripts/security_dashboard/components/security_dashboard_layout.vue
...curity_dashboard/components/security_dashboard_layout.vue
+30
-0
ee/spec/frontend/security_dashboard/components/security_dashboard_layout_spec.js
...ty_dashboard/components/security_dashboard_layout_spec.js
+119
-0
No files found.
ee/app/assets/javascripts/security_dashboard/components/security_dashboard_layout.vue
0 → 100644
View file @
5c0d1953
<
script
>
export
default
{
computed
:
{
hasHeaderSlot
()
{
return
Boolean
(
this
.
$slots
.
header
);
},
hasAsideSlot
()
{
return
Boolean
(
this
.
$slots
.
aside
);
},
},
};
</
script
>
<
template
>
<section>
<header
v-if=
"hasHeaderSlot"
>
<slot
name=
"header"
></slot>
</header>
<div
class=
"row mt-4"
>
<article
class=
"col"
:class=
"
{ 'col-xl-7': hasAsideSlot }">
<slot></slot>
</article>
<aside
v-if=
"hasAsideSlot"
class=
"col-xl-5"
>
<slot
name=
"aside"
></slot>
</aside>
</div>
</section>
</
template
>
ee/spec/frontend/security_dashboard/components/security_dashboard_layout_spec.js
0 → 100644
View file @
5c0d1953
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
SecurityDashboardLayout
from
'
ee/security_dashboard/components/security_dashboard_layout.vue
'
;
describe
(
'
Security Dashboard Layout component
'
,
()
=>
{
let
wrapper
;
const
SMALLER_SECTION_CLASS
=
'
col-xl-7
'
;
const
DummyComponent
=
{
name
:
'
dummy-component
'
,
template
:
'
<p>dummy component</p>
'
,
};
const
createWrapper
=
slots
=>
{
wrapper
=
shallowMount
(
SecurityDashboardLayout
,
{
slots
});
};
const
findArticle
=
()
=>
wrapper
.
find
(
'
article
'
);
const
findHeader
=
()
=>
wrapper
.
find
(
'
header
'
);
const
findAside
=
()
=>
wrapper
.
find
(
'
aside
'
);
afterEach
(()
=>
{
wrapper
.
destroy
();
});
describe
(
'
with the main slot only
'
,
()
=>
{
beforeEach
(()
=>
{
createWrapper
({
default
:
DummyComponent
,
});
});
it
.
each
`
element | exists
${
'
article
'
}
|
${
true
}
${
'
header
'
}
|
${
false
}
${
'
aside
'
}
|
${
false
}
`
(
'
should find that $element exists is $exists
'
,
({
element
,
exists
})
=>
{
expect
(
wrapper
.
find
(
element
).
exists
()).
toBe
(
exists
);
});
it
(
'
should render the dummy component in the main section
'
,
()
=>
{
const
article
=
wrapper
.
find
(
'
article
'
);
expect
(
article
.
find
(
DummyComponent
).
exists
()).
toBe
(
true
);
});
it
(
'
should not make the main section smaller
'
,
()
=>
{
const
article
=
wrapper
.
find
(
'
article
'
);
expect
(
article
.
classes
()).
not
.
toContain
(
SMALLER_SECTION_CLASS
);
});
});
describe
(
'
with the header and main slots
'
,
()
=>
{
beforeEach
(()
=>
{
createWrapper
({
default
:
DummyComponent
,
header
:
DummyComponent
,
});
});
it
.
each
`
element | exists
${
'
article
'
}
|
${
true
}
${
'
header
'
}
|
${
true
}
${
'
aside
'
}
|
${
false
}
`
(
'
should find that $element exists is $exists
'
,
({
element
,
exists
})
=>
{
expect
(
wrapper
.
find
(
element
).
exists
()).
toBe
(
exists
);
});
it
(
'
should render the dummy component in the main section
'
,
()
=>
{
const
article
=
findArticle
();
expect
(
article
.
find
(
DummyComponent
).
exists
()).
toBe
(
true
);
});
it
(
'
should render the dummy component in the header section
'
,
()
=>
{
const
header
=
findHeader
();
expect
(
header
.
find
(
DummyComponent
).
exists
()).
toBe
(
true
);
});
});
describe
(
'
with the aside and main slots
'
,
()
=>
{
beforeEach
(()
=>
{
createWrapper
({
default
:
DummyComponent
,
aside
:
DummyComponent
,
});
});
it
.
each
`
element | exists
${
'
article
'
}
|
${
true
}
${
'
header
'
}
|
${
false
}
${
'
aside
'
}
|
${
true
}
`
(
'
should find that $element exists is $exists
'
,
({
element
,
exists
})
=>
{
expect
(
wrapper
.
find
(
element
).
exists
()).
toBe
(
exists
);
});
it
(
'
should render the dummy component in the main section
'
,
()
=>
{
const
article
=
findArticle
();
expect
(
article
.
find
(
DummyComponent
).
exists
()).
toBe
(
true
);
});
it
(
'
should render the dummy component in the header section
'
,
()
=>
{
const
aside
=
findAside
();
expect
(
aside
.
find
(
DummyComponent
).
exists
()).
toBe
(
true
);
});
it
(
'
should make the main section smaller
'
,
()
=>
{
const
article
=
findArticle
();
expect
(
article
.
classes
()).
toContain
(
SMALLER_SECTION_CLASS
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment