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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
f868badb
Commit
f868badb
authored
Sep 05, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into issues-filters-reset-btn
parents
1a23b74d
beb0b666
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
190 additions
and
91 deletions
+190
-91
CHANGELOG
CHANGELOG
+5
-0
app/assets/images/icon-link.png
app/assets/images/icon-link.png
+0
-0
app/assets/images/icon_anchor.svg
app/assets/images/icon_anchor.svg
+1
-0
app/assets/javascripts/project_new.js
app/assets/javascripts/project_new.js
+14
-6
app/assets/stylesheets/framework/buttons.scss
app/assets/stylesheets/framework/buttons.scss
+3
-1
app/assets/stylesheets/framework/typography.scss
app/assets/stylesheets/framework/typography.scss
+10
-17
app/assets/stylesheets/pages/labels.scss
app/assets/stylesheets/pages/labels.scss
+1
-0
app/assets/stylesheets/pages/tree.scss
app/assets/stylesheets/pages/tree.scss
+4
-0
app/assets/stylesheets/pages/xterm.scss
app/assets/stylesheets/pages/xterm.scss
+3
-0
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+1
-1
app/views/projects/_merge_request_settings.html.haml
app/views/projects/_merge_request_settings.html.haml
+14
-11
app/views/projects/buttons/_fork.html.haml
app/views/projects/buttons/_fork.html.haml
+2
-2
app/views/projects/forks/index.html.haml
app/views/projects/forks/index.html.haml
+2
-2
doc/api/README.md
doc/api/README.md
+2
-1
spec/features/expand_collapse_diffs_spec.rb
spec/features/expand_collapse_diffs_spec.rb
+7
-0
spec/features/projects/edit_spec.rb
spec/features/projects/edit_spec.rb
+57
-0
spec/javascripts/datetime_utility_spec.js.coffee
spec/javascripts/datetime_utility_spec.js.coffee
+0
-50
spec/javascripts/datetime_utility_spec.js.es6
spec/javascripts/datetime_utility_spec.js.es6
+64
-0
No files found.
CHANGELOG
View file @
f868badb
...
@@ -17,11 +17,13 @@ v 8.12.0 (unreleased)
...
@@ -17,11 +17,13 @@ v 8.12.0 (unreleased)
- Fix bug where pagination is still displayed despite all todos marked as done (ClemMakesApps)
- Fix bug where pagination is still displayed despite all todos marked as done (ClemMakesApps)
- Center build stage columns in pipeline overview (ClemMakesApps)
- Center build stage columns in pipeline overview (ClemMakesApps)
- Rename behaviour to behavior in bug issue template for consistency (ClemMakesApps)
- Rename behaviour to behavior in bug issue template for consistency (ClemMakesApps)
- Remove suggested colors hover underline (ClemMakesApps)
- Shorten task status phrase (ClemMakesApps)
- Shorten task status phrase (ClemMakesApps)
- Add hover color to emoji icon (ClemMakesApps)
- Add hover color to emoji icon (ClemMakesApps)
- Fix branches page dropdown sort alignment (ClemMakesApps)
- Fix branches page dropdown sort alignment (ClemMakesApps)
- Add white background for no readme container (ClemMakesApps)
- Add white background for no readme container (ClemMakesApps)
- API: Expose issue confidentiality flag. (Robert Schilling)
- API: Expose issue confidentiality flag. (Robert Schilling)
- Fix markdown anchor icon interaction (ClemMakesApps)
- Optimistic locking for Issues and Merge Requests (title and description overriding prevention)
- Optimistic locking for Issues and Merge Requests (title and description overriding prevention)
- Add `wiki_page_events` to project hook APIs (Ben Boeckel)
- Add `wiki_page_events` to project hook APIs (Ben Boeckel)
- Remove Gitorious import
- Remove Gitorious import
...
@@ -43,6 +45,7 @@ v 8.12.0 (unreleased)
...
@@ -43,6 +45,7 @@ v 8.12.0 (unreleased)
- Remove redundant js-timeago-pending from user activity log (ClemMakesApps)
- Remove redundant js-timeago-pending from user activity log (ClemMakesApps)
- Ability to manage project issues, snippets, wiki, merge requests and builds access level
- Ability to manage project issues, snippets, wiki, merge requests and builds access level
- Remove inconsistent font weight for sidebar's labels (ClemMakesApps)
- Remove inconsistent font weight for sidebar's labels (ClemMakesApps)
- Align add button on repository view (ClemMakesApps)
- Added tests for diff notes
- Added tests for diff notes
- Add a button to download latest successful artifacts for branches and tags !5142
- Add a button to download latest successful artifacts for branches and tags !5142
- Remove redundant pipeline tooltips (ClemMakesApps)
- Remove redundant pipeline tooltips (ClemMakesApps)
...
@@ -61,6 +64,7 @@ v 8.12.0 (unreleased)
...
@@ -61,6 +64,7 @@ v 8.12.0 (unreleased)
- Move to project dropdown with infinite scroll for better performance
- Move to project dropdown with infinite scroll for better performance
- Fix leaking of submit buttons outside the width of a main container !18731 (originally by @pavelloz)
- Fix leaking of submit buttons outside the width of a main container !18731 (originally by @pavelloz)
- Load branches asynchronously in Cherry Pick and Revert dialogs.
- Load branches asynchronously in Cherry Pick and Revert dialogs.
- Convert datetime coffeescript spec to ES6 (ClemMakesApps)
- Add merge request versions !5467
- Add merge request versions !5467
- Change using size to use count and caching it for number of group members. !5935
- Change using size to use count and caching it for number of group members. !5935
- Replace play icon font with svg (ClemMakesApps)
- Replace play icon font with svg (ClemMakesApps)
...
@@ -178,6 +182,7 @@ v 8.11.0
...
@@ -178,6 +182,7 @@ v 8.11.0
- Get issue and merge request description templates from repositories
- Get issue and merge request description templates from repositories
- Add hover state to todos !5361 (winniehell)
- Add hover state to todos !5361 (winniehell)
- Fix icon alignment of star and fork buttons !5451 (winniehell)
- Fix icon alignment of star and fork buttons !5451 (winniehell)
- Fix alignment of icon buttons !5887 (winniehell)
- Enforce 2FA restrictions on API authentication endpoints !5820
- Enforce 2FA restrictions on API authentication endpoints !5820
- Limit git rev-list output count to one in forced push check
- Limit git rev-list output count to one in forced push check
- Show deployment status on merge requests with external URLs
- Show deployment status on merge requests with external URLs
...
...
app/assets/images/icon-link.png
deleted
100644 → 0
View file @
1a23b74d
729 Bytes
app/assets/images/icon_anchor.svg
0 → 100644
View file @
f868badb
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
viewBox=
"0 0 16 16"
><path
fill=
"#333"
fill-rule=
"evenodd"
d=
"M9.683 6.676l-.047-.048C8.27 5.26 6.07 5.243 4.726 6.588l-2.29 2.29c-1.344 1.344-1.328 3.544.04 4.91 1.366 1.368 3.564 1.385 4.908.04l1.753-1.752c-.695.074-1.457-.078-2.176-.444L5.934 12.66c-.634.634-1.67.625-2.312-.017-.642-.643-.65-1.677-.017-2.312L6.035 7.9c.634-.634 1.67-.625 2.312.017.024.024.048.05.07.075l.003-.002c.36.36.943.366 1.3.01.355-.356.35-.938-.01-1.3l-.027-.024zM6.58 9.586l.048.05c1.367 1.366 3.565 1.384 4.91.04l2.29-2.292c1.344-1.343 1.328-3.542-.04-4.91-1.366-1.366-3.564-1.384-4.908-.04L7.127 4.187c.695-.074 1.457.078 2.176.444l1.028-1.027c.635-.634 1.67-.624 2.313.017.643.644.652 1.678.018 2.312l-2.43 2.432c-.635.634-1.67.624-2.313-.018-.024-.024-.048-.05-.07-.075l-.003.004c-.36-.362-.943-.367-1.3-.01-.355.355-.35.937.01 1.3.01.007.018.015.027.023z"
/></svg>
\ No newline at end of file
app/assets/javascripts/project_new.js
View file @
f868badb
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
this
.
ProjectNew
=
(
function
()
{
this
.
ProjectNew
=
(
function
()
{
function
ProjectNew
()
{
function
ProjectNew
()
{
this
.
toggleSettings
=
bind
(
this
.
toggleSettings
,
this
);
this
.
toggleSettings
=
bind
(
this
.
toggleSettings
,
this
);
this
.
$selects
=
$
(
'
.features select
'
);
$
(
'
.project-edit-container
'
).
on
(
'
ajax:before
'
,
(
function
(
_this
)
{
$
(
'
.project-edit-container
'
).
on
(
'
ajax:before
'
,
(
function
(
_this
)
{
return
function
()
{
return
function
()
{
$
(
'
.project-edit-container
'
).
hide
();
$
(
'
.project-edit-container
'
).
hide
();
...
@@ -15,18 +17,24 @@
...
@@ -15,18 +17,24 @@
}
}
ProjectNew
.
prototype
.
toggleSettings
=
function
()
{
ProjectNew
.
prototype
.
toggleSettings
=
function
()
{
this
.
_showOrHide
(
'
#project_builds_enabled
'
,
'
.builds-feature
'
);
var
self
=
this
;
return
this
.
_showOrHide
(
'
#project_merge_requests_enabled
'
,
'
.merge-requests-feature
'
);
this
.
$selects
.
each
(
function
()
{
var
$select
=
$
(
this
),
className
=
$select
.
data
(
'
field
'
).
replace
(
/_/g
,
'
-
'
)
.
replace
(
'
access-level
'
,
'
feature
'
);
self
.
_showOrHide
(
$select
,
'
.
'
+
className
);
});
};
};
ProjectNew
.
prototype
.
toggleSettingsOnclick
=
function
()
{
ProjectNew
.
prototype
.
toggleSettingsOnclick
=
function
()
{
return
$
(
'
#project_builds_enabled, #project_merge_requests_enabled
'
).
on
(
'
click
'
,
this
.
toggleSettings
);
this
.
$selects
.
on
(
'
change
'
,
this
.
toggleSettings
);
};
};
ProjectNew
.
prototype
.
_showOrHide
=
function
(
checkElement
,
container
)
{
ProjectNew
.
prototype
.
_showOrHide
=
function
(
checkElement
,
container
)
{
var
$container
;
var
$container
=
$
(
container
)
;
$container
=
$
(
container
);
if
(
$
(
checkElement
).
prop
(
'
checked
'
)
)
{
if
(
$
(
checkElement
).
val
()
!==
'
0
'
)
{
return
$container
.
show
();
return
$container
.
show
();
}
else
{
}
else
{
return
$container
.
hide
();
return
$container
.
hide
();
...
...
app/assets/stylesheets/framework/buttons.scss
View file @
f868badb
...
@@ -206,8 +206,10 @@
...
@@ -206,8 +206,10 @@
}
}
svg
,
.fa
{
svg
,
.fa
{
&
:not
(
:last-child
)
{
margin-right
:
3px
;
margin-right
:
3px
;
}
}
}
}
}
.btn-lg
{
.btn-lg
{
...
...
app/assets/stylesheets/framework/typography.scss
View file @
f868badb
...
@@ -159,25 +159,18 @@
...
@@ -159,25 +159,18 @@
position
:
relative
;
position
:
relative
;
a
.anchor
{
a
.anchor
{
// Setting `display: none` would prevent the anchor being scrolled to, so
left
:
-16px
;
// instead we set the height to 0 and it gets updated on hover.
position
:
absolute
;
height
:
0
;
text-decoration
:
none
;
&
:after
{
content
:
url('icon_anchor.svg')
;
visibility
:
hidden
;
}
}
}
&
:hover
>
a
.anchor
{
&
:hover
>
a
.anchor
:after
{
$size
:
14px
;
visibility
:
visible
;
position
:
absolute
;
right
:
100%
;
top
:
50%
;
margin-top
:
-11px
;
margin-right
:
0
;
padding-right
:
15px
;
display
:
inline-block
;
width
:
$size
;
height
:
$size
;
background-image
:
image-url
(
"icon-link.png"
);
background-size
:
contain
;
background-repeat
:
no-repeat
;
}
}
}
}
}
}
...
...
app/assets/stylesheets/pages/labels.scss
View file @
f868badb
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
display
:
inline-block
;
display
:
inline-block
;
margin-right
:
10px
;
margin-right
:
10px
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
text-decoration
:
none
;
}
}
&
.suggest-colors-dropdown
{
&
.suggest-colors-dropdown
{
...
...
app/assets/stylesheets/pages/tree.scss
View file @
f868badb
...
@@ -11,6 +11,10 @@
...
@@ -11,6 +11,10 @@
}
}
}
}
.add-to-tree
{
vertical-align
:
top
;
}
.last-commit
{
.last-commit
{
max-width
:
506px
;
max-width
:
506px
;
...
...
app/assets/stylesheets/pages/xterm.scss
View file @
f868badb
...
@@ -20,6 +20,9 @@
...
@@ -20,6 +20,9 @@
$l-cyan
:
#8abeb7
;
$l-cyan
:
#8abeb7
;
$l-white
:
$ci-text-color
;
$l-white
:
$ci-text-color
;
.term-bold
{
font-weight
:
bold
;
}
.term-italic
{
.term-italic
{
font-style
:
italic
;
font-style
:
italic
;
}
}
...
...
app/helpers/projects_helper.rb
View file @
f868badb
...
@@ -431,6 +431,6 @@ module ProjectsHelper
...
@@ -431,6 +431,6 @@ module ProjectsHelper
options
.
delete
(
'Everyone with access'
)
if
@project
.
private?
&&
level
!=
ProjectFeature
::
ENABLED
options
.
delete
(
'Everyone with access'
)
if
@project
.
private?
&&
level
!=
ProjectFeature
::
ENABLED
options
=
options_for_select
(
options
,
selected:
@project
.
project_feature
.
public_send
(
field
)
||
ProjectFeature
::
ENABLED
)
options
=
options_for_select
(
options
,
selected:
@project
.
project_feature
.
public_send
(
field
)
||
ProjectFeature
::
ENABLED
)
content_tag
(
:select
,
options
,
name:
"project[project_feature_attributes][
#{
field
.
to_s
}
]"
,
id:
"project_project_feature_attributes_
#{
field
.
to_s
}
"
,
class:
"pull-right form-control"
).
html_safe
content_tag
(
:select
,
options
,
name:
"project[project_feature_attributes][
#{
field
.
to_s
}
]"
,
id:
"project_project_feature_attributes_
#{
field
.
to_s
}
"
,
class:
"pull-right form-control"
,
data:
{
field:
field
}
).
html_safe
end
end
end
end
app/views/projects/_merge_request_settings.html.haml
View file @
f868badb
%fieldset
.builds-feature
.merge-requests-feature
%fieldset
.builds-feature
%hr
%h5
.prepend-top-0
%h5
.prepend-top-0
Merge Requests
Merge Requests
.form-group
.form-group
...
@@ -6,6 +8,7 @@
...
@@ -6,6 +8,7 @@
=
f
.
label
:only_allow_merge_if_build_succeeds
do
=
f
.
label
:only_allow_merge_if_build_succeeds
do
=
f
.
check_box
:only_allow_merge_if_build_succeeds
=
f
.
check_box
:only_allow_merge_if_build_succeeds
%strong
Only allow merge requests to be merged if the build succeeds
%strong
Only allow merge requests to be merged if the build succeeds
.help-block
%br
%span
.descr
Builds need to be configured to enable this feature.
Builds need to be configured to enable this feature.
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/merge_requests'
,
anchor:
'only-allow-merge-requests-to-be-merged-if-the-build-succeeds'
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/merge_requests'
,
anchor:
'only-allow-merge-requests-to-be-merged-if-the-build-succeeds'
)
app/views/projects/buttons/_fork.html.haml
View file @
f868badb
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
-
if
current_user
.
already_forked?
(
@project
)
&&
current_user
.
manageable_namespaces
.
size
<
2
-
if
current_user
.
already_forked?
(
@project
)
&&
current_user
.
manageable_namespaces
.
size
<
2
=
link_to
namespace_project_path
(
current_user
,
current_user
.
fork_of
(
@project
)),
title:
'Go to your fork'
,
class:
'btn has-tooltip'
do
=
link_to
namespace_project_path
(
current_user
,
current_user
.
fork_of
(
@project
)),
title:
'Go to your fork'
,
class:
'btn has-tooltip'
do
=
custom_icon
(
'icon_fork'
)
=
custom_icon
(
'icon_fork'
)
Fork
%span
Fork
-
else
-
else
=
link_to
new_namespace_project_fork_path
(
@project
.
namespace
,
@project
),
title:
"Fork project"
,
class:
'btn has-tooltip'
do
=
link_to
new_namespace_project_fork_path
(
@project
.
namespace
,
@project
),
title:
"Fork project"
,
class:
'btn has-tooltip'
do
=
custom_icon
(
'icon_fork'
)
=
custom_icon
(
'icon_fork'
)
Fork
%span
Fork
%div
.count-with-arrow
%div
.count-with-arrow
%span
.arrow
%span
.arrow
=
link_to
namespace_project_forks_path
(
@project
.
namespace
,
@project
),
class:
"count"
do
=
link_to
namespace_project_forks_path
(
@project
.
namespace
,
@project
),
class:
"count"
do
...
...
app/views/projects/forks/index.html.haml
View file @
f868badb
...
@@ -32,11 +32,11 @@
...
@@ -32,11 +32,11 @@
-
if
current_user
.
already_forked?
(
@project
)
&&
current_user
.
manageable_namespaces
.
size
<
2
-
if
current_user
.
already_forked?
(
@project
)
&&
current_user
.
manageable_namespaces
.
size
<
2
=
link_to
namespace_project_path
(
current_user
,
current_user
.
fork_of
(
@project
)),
title:
'Go to your fork'
,
class:
'btn btn-new'
do
=
link_to
namespace_project_path
(
current_user
,
current_user
.
fork_of
(
@project
)),
title:
'Go to your fork'
,
class:
'btn btn-new'
do
=
custom_icon
(
'icon_fork'
)
=
custom_icon
(
'icon_fork'
)
Fork
%span
Fork
-
else
-
else
=
link_to
new_namespace_project_fork_path
(
@project
.
namespace
,
@project
),
title:
"Fork project"
,
class:
'btn btn-new'
do
=
link_to
new_namespace_project_fork_path
(
@project
.
namespace
,
@project
),
title:
"Fork project"
,
class:
'btn btn-new'
do
=
custom_icon
(
'icon_fork'
)
=
custom_icon
(
'icon_fork'
)
Fork
%span
Fork
=
render
'projects'
,
projects:
@forks
=
render
'projects'
,
projects:
@forks
doc/api/README.md
View file @
f868badb
...
@@ -11,9 +11,10 @@ following locations:
...
@@ -11,9 +11,10 @@ following locations:
-
[
Award Emoji
](
award_emoji.md
)
-
[
Award Emoji
](
award_emoji.md
)
-
[
Branches
](
branches.md
)
-
[
Branches
](
branches.md
)
-
[
Builds
](
builds.md
)
-
[
Builds
](
builds.md
)
-
[
Build
t
riggers
](
build_triggers.md
)
-
[
Build
T
riggers
](
build_triggers.md
)
-
[
Build Variables
](
build_variables.md
)
-
[
Build Variables
](
build_variables.md
)
-
[
Commits
](
commits.md
)
-
[
Commits
](
commits.md
)
-
[
Deployments
](
deployments.md
)
-
[
Deploy Keys
](
deploy_keys.md
)
-
[
Deploy Keys
](
deploy_keys.md
)
-
[
Groups
](
groups.md
)
-
[
Groups
](
groups.md
)
-
[
Group Access Requests
](
access_requests.md
)
-
[
Group Access Requests
](
access_requests.md
)
...
...
spec/features/expand_collapse_diffs_spec.rb
View file @
f868badb
...
@@ -211,6 +211,13 @@ feature 'Expand and collapse diffs', js: true, feature: true do
...
@@ -211,6 +211,13 @@ feature 'Expand and collapse diffs', js: true, feature: true do
context
'expanding all diffs'
do
context
'expanding all diffs'
do
before
do
before
do
click_link
(
'Expand all'
)
click_link
(
'Expand all'
)
# Wait for elements to appear to ensure full page reload
expect
(
page
).
to
have_content
(
'This diff was suppressed by a .gitattributes entry'
)
expect
(
page
).
to
have_content
(
'This diff could not be displayed because it is too large.'
)
expect
(
page
).
to
have_content
(
'too_large_image.jpg'
)
find
(
'.note-textarea'
)
wait_for_ajax
wait_for_ajax
execute_script
(
'window.ajaxUris = []; $(document).ajaxSend(function(event, xhr, settings) { ajaxUris.push(settings.url) });'
)
execute_script
(
'window.ajaxUris = []; $(document).ajaxSend(function(event, xhr, settings) { ajaxUris.push(settings.url) });'
)
end
end
...
...
spec/features/projects/edit_spec.rb
0 → 100644
View file @
f868badb
require
'rails_helper'
feature
'Project edit'
,
feature:
true
,
js:
true
do
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
visit
edit_namespace_project_path
(
project
.
namespace
,
project
)
end
context
'feature visibility'
do
context
'merge requests select'
do
it
'hides merge requests section'
do
select
(
'Disabled'
,
from:
'project_project_feature_attributes_merge_requests_access_level'
)
expect
(
page
).
to
have_selector
(
'.merge-requests-feature'
,
visible:
false
)
end
it
'hides merge requests section after save'
do
select
(
'Disabled'
,
from:
'project_project_feature_attributes_merge_requests_access_level'
)
expect
(
page
).
to
have_selector
(
'.merge-requests-feature'
,
visible:
false
)
click_button
'Save changes'
wait_for_ajax
expect
(
page
).
to
have_selector
(
'.merge-requests-feature'
,
visible:
false
)
end
end
context
'builds select'
do
it
'hides merge requests section'
do
select
(
'Disabled'
,
from:
'project_project_feature_attributes_builds_access_level'
)
expect
(
page
).
to
have_selector
(
'.builds-feature'
,
visible:
false
)
end
it
'hides merge requests section after save'
do
select
(
'Disabled'
,
from:
'project_project_feature_attributes_builds_access_level'
)
expect
(
page
).
to
have_selector
(
'.builds-feature'
,
visible:
false
)
click_button
'Save changes'
wait_for_ajax
expect
(
page
).
to
have_selector
(
'.builds-feature'
,
visible:
false
)
end
end
end
end
spec/javascripts/datetime_utility_spec.js.coffee
deleted
100644 → 0
View file @
1a23b74d
#= require lib/utils/datetime_utility
describe
'Date time utils'
,
->
describe
'get day name'
,
->
it
'should return Sunday'
,
->
day
=
gl
.
utils
.
getDayName
(
new
Date
(
'07/17/2016'
))
expect
(
day
).
toBe
(
'Sunday'
)
it
'should return Monday'
,
->
day
=
gl
.
utils
.
getDayName
(
new
Date
(
'07/18/2016'
))
expect
(
day
).
toBe
(
'Monday'
)
it
'should return Tuesday'
,
->
day
=
gl
.
utils
.
getDayName
(
new
Date
(
'07/19/2016'
))
expect
(
day
).
toBe
(
'Tuesday'
)
it
'should return Wednesday'
,
->
day
=
gl
.
utils
.
getDayName
(
new
Date
(
'07/20/2016'
))
expect
(
day
).
toBe
(
'Wednesday'
)
it
'should return Thursday'
,
->
day
=
gl
.
utils
.
getDayName
(
new
Date
(
'07/21/2016'
))
expect
(
day
).
toBe
(
'Thursday'
)
it
'should return Friday'
,
->
day
=
gl
.
utils
.
getDayName
(
new
Date
(
'07/22/2016'
))
expect
(
day
).
toBe
(
'Friday'
)
it
'should return Saturday'
,
->
day
=
gl
.
utils
.
getDayName
(
new
Date
(
'07/23/2016'
))
expect
(
day
).
toBe
(
'Saturday'
)
describe
'get day difference'
,
->
it
'should return 7'
,
->
firstDay
=
new
Date
(
'07/01/2016'
)
secondDay
=
new
Date
(
'07/08/2016'
)
difference
=
gl
.
utils
.
getDayDifference
(
firstDay
,
secondDay
)
expect
(
difference
).
toBe
(
7
)
it
'should return 31'
,
->
firstDay
=
new
Date
(
'07/01/2016'
)
secondDay
=
new
Date
(
'08/01/2016'
)
difference
=
gl
.
utils
.
getDayDifference
(
firstDay
,
secondDay
)
expect
(
difference
).
toBe
(
31
)
it
'should return 365'
,
->
firstDay
=
new
Date
(
'07/02/2015'
)
secondDay
=
new
Date
(
'07/01/2016'
)
difference
=
gl
.
utils
.
getDayDifference
(
firstDay
,
secondDay
)
expect
(
difference
).
toBe
(
365
)
\ No newline at end of file
spec/javascripts/datetime_utility_spec.js.es6
0 → 100644
View file @
f868badb
//= require lib/utils/datetime_utility
(() => {
describe('Date time utils', () => {
describe('get day name', () => {
it('should return Sunday', () => {
const day = gl.utils.getDayName(new Date('07/17/2016'));
expect(day).toBe('Sunday');
});
it('should return Monday', () => {
const day = gl.utils.getDayName(new Date('07/18/2016'));
expect(day).toBe('Monday');
});
it('should return Tuesday', () => {
const day = gl.utils.getDayName(new Date('07/19/2016'));
expect(day).toBe('Tuesday');
});
it('should return Wednesday', () => {
const day = gl.utils.getDayName(new Date('07/20/2016'));
expect(day).toBe('Wednesday');
});
it('should return Thursday', () => {
const day = gl.utils.getDayName(new Date('07/21/2016'));
expect(day).toBe('Thursday');
});
it('should return Friday', () => {
const day = gl.utils.getDayName(new Date('07/22/2016'));
expect(day).toBe('Friday');
});
it('should return Saturday', () => {
const day = gl.utils.getDayName(new Date('07/23/2016'));
expect(day).toBe('Saturday');
});
});
describe('get day difference', () => {
it('should return 7', () => {
const firstDay = new Date('07/01/2016');
const secondDay = new Date('07/08/2016');
const difference = gl.utils.getDayDifference(firstDay, secondDay);
expect(difference).toBe(7);
});
it('should return 31', () => {
const firstDay = new Date('07/01/2016');
const secondDay = new Date('08/01/2016');
const difference = gl.utils.getDayDifference(firstDay, secondDay);
expect(difference).toBe(31);
});
it('should return 365', () => {
const firstDay = new Date('07/02/2015');
const secondDay = new Date('07/01/2016');
const difference = gl.utils.getDayDifference(firstDay, secondDay);
expect(difference).toBe(365);
});
});
});
})();
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