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
5d106b4e
Commit
5d106b4e
authored
Nov 22, 2019
by
Ezekiel Kigbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare limit_warning_component_spec for boostrap2
Minor refactor to vue-test-utils
parent
c6ddde61
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
21 deletions
+22
-21
spec/frontend/cycle_analytics/limit_warning_component_spec.js
.../frontend/cycle_analytics/limit_warning_component_spec.js
+22
-21
No files found.
spec/frontend/cycle_analytics/limit_warning_component_spec.js
View file @
5d106b4e
import
Vue
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
limitWarningComp
from
'
~/cycle_analytics/components/limit_warning_component.vue
'
;
import
LimitWarningComponent
from
'
~/cycle_analytics/components/limit_warning_component.vue
'
;
Vue
.
use
(
Translate
);
const
createComponent
=
props
=>
shallowMount
(
LimitWarningComponent
,
{
propsData
:
{
...
props
,
},
sync
:
false
,
attachToDocument
:
true
,
});
describe
(
'
Limit warning component
'
,
()
=>
{
let
component
;
let
LimitWarningComponent
;
beforeEach
(()
=>
{
LimitWarningComponent
=
Vue
.
extend
(
limitWarningComp
);
component
=
null
;
});
afterEach
(()
=>
{
component
.
destroy
();
});
it
(
'
should not render if count is not exactly than 50
'
,
()
=>
{
component
=
new
LimitWarningComponent
({
propsData
:
{
count
:
5
,
},
}).
$mount
();
component
=
createComponent
({
count
:
5
});
expect
(
component
.
$el
.
textContent
.
trim
()).
toBe
(
''
);
expect
(
component
.
text
()
.
trim
()).
toBe
(
''
);
component
=
new
LimitWarningComponent
({
propsData
:
{
count
:
55
,
},
}).
$mount
();
component
=
createComponent
({
count
:
55
});
expect
(
component
.
$el
.
textContent
.
trim
()).
toBe
(
''
);
expect
(
component
.
text
()
.
trim
()).
toBe
(
''
);
});
it
(
'
should render if count is exactly 50
'
,
()
=>
{
component
=
new
LimitWarningComponent
({
propsData
:
{
count
:
50
,
},
}).
$mount
();
component
=
createComponent
({
count
:
50
});
expect
(
component
.
$el
.
textContent
.
trim
()).
toBe
(
'
Showing 50 events
'
);
expect
(
component
.
text
()
.
trim
()).
toBe
(
'
Showing 50 events
'
);
});
});
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