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
cfed3691
Commit
cfed3691
authored
May 12, 2021
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for date_picker behavior
parent
798125f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
spec/frontend/behaviors/date_picker_spec.js
spec/frontend/behaviors/date_picker_spec.js
+30
-0
No files found.
spec/frontend/behaviors/date_picker_spec.js
0 → 100644
View file @
cfed3691
import
*
as
Pikaday
from
'
pikaday
'
;
import
initDatePickers
from
'
~/behaviors/date_picker
'
;
import
*
as
utils
from
'
~/lib/utils/datetime_utility
'
;
jest
.
mock
(
'
pikaday
'
);
jest
.
mock
(
'
~/lib/utils/datetime_utility
'
);
describe
(
'
date_picker behavior
'
,
()
=>
{
let
pikadayMock
;
let
parseMock
;
beforeEach
(()
=>
{
pikadayMock
=
jest
.
spyOn
(
Pikaday
,
'
default
'
);
parseMock
=
jest
.
spyOn
(
utils
,
'
parsePikadayDate
'
);
setFixtures
(
`
<div>
<input class="datepicker" value="2020-10-01" />
</div>
<div>
<input class="datepicker" value="" />
</div>`
);
});
it
(
'
Instantiates Pickaday for every instance of a .datepicker class
'
,
()
=>
{
initDatePickers
();
expect
(
pikadayMock
.
mock
.
calls
.
length
).
toEqual
(
2
);
expect
(
parseMock
.
mock
.
calls
).
toEqual
([[
'
2020-10-01
'
],
[
''
]]);
});
});
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