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
Boxiang Sun
gitlab-ce
Commits
ef2dc89e
Commit
ef2dc89e
authored
Oct 30, 2018
by
Amit Rathi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://gitlab.com/gitlab-org/gitlab-ce
parents
f7d4d8e4
e4e40b96
Changes
26
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
301 additions
and
341 deletions
+301
-341
GITLAB_PAGES_VERSION
GITLAB_PAGES_VERSION
+1
-1
Gemfile.lock
Gemfile.lock
+1
-1
app/assets/javascripts/diffs/components/compare_versions.vue
app/assets/javascripts/diffs/components/compare_versions.vue
+6
-6
app/assets/javascripts/ide/components/pipelines/list.vue
app/assets/javascripts/ide/components/pipelines/list.vue
+1
-1
app/models/milestone.rb
app/models/milestone.rb
+1
-1
app/models/user.rb
app/models/user.rb
+1
-1
app/services/delete_merged_branches_service.rb
app/services/delete_merged_branches_service.rb
+2
-2
app/services/labels/transfer_service.rb
app/services/labels/transfer_service.rb
+1
-1
app/views/projects/pipelines/_with_tabs.html.haml
app/views/projects/pipelines/_with_tabs.html.haml
+13
-20
app/views/projects/pipelines/show.html.haml
app/views/projects/pipelines/show.html.haml
+9
-1
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+1
-1
changelogs/unreleased/45669-table-in-jobs-on-pipeline.yml
changelogs/unreleased/45669-table-in-jobs-on-pipeline.yml
+5
-0
changelogs/unreleased/52122-fix-broken-whitespace-button.yml
changelogs/unreleased/52122-fix-broken-whitespace-button.yml
+5
-0
changelogs/unreleased/53273-update-moment-to-2-22-2.yml
changelogs/unreleased/53273-update-moment-to-2-22-2.yml
+5
-0
changelogs/unreleased/gt-truncate-milestone-title-on-collapsed-sidebar.yml
...ased/gt-truncate-milestone-title-on-collapsed-sidebar.yml
+5
-0
changelogs/unreleased/rails5-deprecated-uniq.yml
changelogs/unreleased/rails5-deprecated-uniq.yml
+5
-0
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
+1
-1
lib/gitlab/contributions_calendar.rb
lib/gitlab/contributions_calendar.rb
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+3
-3
qa/qa/factory/repository/push.rb
qa/qa/factory/repository/push.rb
+1
-1
qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb
...er_ui/3_create/repository/push_http_private_token_spec.rb
+32
-0
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+33
-27
spec/javascripts/diffs/components/compare_versions_spec.js
spec/javascripts/diffs/components/compare_versions_spec.js
+125
-1
spec/javascripts/diffs/mock_data/merge_request_diffs.js
spec/javascripts/diffs/mock_data/merge_request_diffs.js
+42
-0
spec/javascripts/job_spec.js
spec/javascripts/job_spec.js
+0
-265
yarn.lock
yarn.lock
+1
-6
No files found.
GITLAB_PAGES_VERSION
View file @
ef2dc89e
1.
2.1
1.
3.0
Gemfile.lock
View file @
ef2dc89e
...
@@ -547,7 +547,7 @@ GEM
...
@@ -547,7 +547,7 @@ GEM
orm_adapter (0.5.0)
orm_adapter (0.5.0)
os (1.0.0)
os (1.0.0)
parallel (1.12.1)
parallel (1.12.1)
parser (2.5.
1.2
)
parser (2.5.
3.0
)
ast (~> 2.4.0)
ast (~> 2.4.0)
parslet (1.8.2)
parslet (1.8.2)
peek (1.0.1)
peek (1.0.1)
...
...
app/assets/javascripts/diffs/components/compare_versions.vue
View file @
ef2dc89e
...
@@ -40,17 +40,14 @@ export default {
...
@@ -40,17 +40,14 @@ export default {
comparableDiffs
()
{
comparableDiffs
()
{
return
this
.
mergeRequestDiffs
.
slice
(
1
);
return
this
.
mergeRequestDiffs
.
slice
(
1
);
},
},
isWhitespaceVisible
()
{
return
!
getParameterValues
(
'
w
'
)[
0
];
},
toggleWhitespaceText
()
{
toggleWhitespaceText
()
{
if
(
this
.
isWhitespaceVisible
)
{
if
(
this
.
isWhitespaceVisible
()
)
{
return
__
(
'
Hide whitespace changes
'
);
return
__
(
'
Hide whitespace changes
'
);
}
}
return
__
(
'
Show whitespace changes
'
);
return
__
(
'
Show whitespace changes
'
);
},
},
toggleWhitespacePath
()
{
toggleWhitespacePath
()
{
if
(
this
.
isWhitespaceVisible
)
{
if
(
this
.
isWhitespaceVisible
()
)
{
return
mergeUrlParams
({
w
:
1
},
window
.
location
.
href
);
return
mergeUrlParams
({
w
:
1
},
window
.
location
.
href
);
}
}
...
@@ -67,6 +64,9 @@ export default {
...
@@ -67,6 +64,9 @@ export default {
'
expandAllFiles
'
,
'
expandAllFiles
'
,
'
toggleShowTreeList
'
,
'
toggleShowTreeList
'
,
]),
]),
isWhitespaceVisible
()
{
return
getParameterValues
(
'
w
'
)[
0
]
!==
'
1
'
;
},
},
},
};
};
</
script
>
</
script
>
...
@@ -121,7 +121,7 @@ export default {
...
@@ -121,7 +121,7 @@ export default {
</a>
</a>
<a
<a
:href=
"toggleWhitespacePath"
:href=
"toggleWhitespacePath"
class=
"btn btn-default"
class=
"btn btn-default
qa-toggle-whitespace
"
>
>
{{
toggleWhitespaceText
}}
{{
toggleWhitespaceText
}}
</a>
</a>
...
...
app/assets/javascripts/ide/components/pipelines/list.vue
View file @
ef2dc89e
...
@@ -25,7 +25,7 @@ export default {
...
@@ -25,7 +25,7 @@ export default {
...
mapState
(
'
pipelines
'
,
[
'
isLoadingPipeline
'
,
'
latestPipeline
'
,
'
stages
'
,
'
isLoadingJobs
'
]),
...
mapState
(
'
pipelines
'
,
[
'
isLoadingPipeline
'
,
'
latestPipeline
'
,
'
stages
'
,
'
isLoadingJobs
'
]),
ciLintText
()
{
ciLintText
()
{
return
sprintf
(
return
sprintf
(
__
(
'
You can
also test your .gitlab-ci.yml in the %{linkStart}Lint%{linkEnd}
'
),
__
(
'
You can
test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}.
'
),
{
{
linkStart
:
`<a href="
${
_
.
escape
(
this
.
currentProject
.
web_url
)}
/-/ci/lint">`
,
linkStart
:
`<a href="
${
_
.
escape
(
this
.
currentProject
.
web_url
)}
/-/ci/lint">`
,
linkEnd
:
'
</a>
'
,
linkEnd
:
'
</a>
'
,
...
...
app/models/milestone.rb
View file @
ef2dc89e
...
@@ -145,7 +145,7 @@ class Milestone < ActiveRecord::Base
...
@@ -145,7 +145,7 @@ class Milestone < ActiveRecord::Base
end
end
def
participants
def
participants
User
.
joins
(
assigned_issues: :milestone
).
where
(
"milestones.id = ?"
,
id
).
uniq
User
.
joins
(
assigned_issues: :milestone
).
where
(
"milestones.id = ?"
,
id
).
distinct
end
end
def
self
.
sort_by_attribute
(
method
)
def
self
.
sort_by_attribute
(
method
)
...
...
app/models/user.rb
View file @
ef2dc89e
...
@@ -1138,7 +1138,7 @@ class User < ActiveRecord::Base
...
@@ -1138,7 +1138,7 @@ class User < ActiveRecord::Base
events
=
Event
.
select
(
:project_id
)
events
=
Event
.
select
(
:project_id
)
.
contributions
.
where
(
author_id:
self
)
.
contributions
.
where
(
author_id:
self
)
.
where
(
"created_at > ?"
,
Time
.
now
-
1
.
year
)
.
where
(
"created_at > ?"
,
Time
.
now
-
1
.
year
)
.
uniq
.
distinct
.
reorder
(
nil
)
.
reorder
(
nil
)
Project
.
where
(
id:
events
)
Project
.
where
(
id:
events
)
...
...
app/services/delete_merged_branches_service.rb
View file @
ef2dc89e
...
@@ -24,8 +24,8 @@ class DeleteMergedBranchesService < BaseService
...
@@ -24,8 +24,8 @@ class DeleteMergedBranchesService < BaseService
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
merge_request_branch_names
def
merge_request_branch_names
# reorder(nil) is necessary for SELECT DISTINCT because default scope adds an ORDER BY
# reorder(nil) is necessary for SELECT DISTINCT because default scope adds an ORDER BY
source_names
=
project
.
origin_merge_requests
.
opened
.
reorder
(
nil
).
uniq
.
pluck
(
:source_branch
)
source_names
=
project
.
origin_merge_requests
.
opened
.
reorder
(
nil
).
distinct
.
pluck
(
:source_branch
)
target_names
=
project
.
merge_requests
.
opened
.
reorder
(
nil
).
uniq
.
pluck
(
:target_branch
)
target_names
=
project
.
merge_requests
.
opened
.
reorder
(
nil
).
distinct
.
pluck
(
:target_branch
)
(
source_names
+
target_names
).
uniq
(
source_names
+
target_names
).
uniq
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
...
...
app/services/labels/transfer_service.rb
View file @
ef2dc89e
...
@@ -40,7 +40,7 @@ module Labels
...
@@ -40,7 +40,7 @@ module Labels
group_labels_applied_to_merge_requests
group_labels_applied_to_merge_requests
])
])
.
reorder
(
nil
)
.
reorder
(
nil
)
.
uniq
.
distinct
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
...
...
app/views/projects/pipelines/_with_tabs.html.haml
View file @
ef2dc89e
...
@@ -19,18 +19,7 @@
...
@@ -19,18 +19,7 @@
#js-pipeline-graph-vue
#js-pipeline-graph-vue
#js-tab-builds
.tab-pane
#js-tab-builds
.tab-pane
-
if
pipeline
.
yaml_errors
.
present?
-
if
pipeline
.
legacy_stages
.
present?
.bs-callout.bs-callout-danger
%h4
Found errors in your .gitlab-ci.yml:
%ul
-
pipeline
.
yaml_errors
.
split
(
","
).
each
do
|
error
|
%li
=
error
You can also test your .gitlab-ci.yml in the
#{
link_to
"Lint"
,
project_ci_lint_path
(
@project
)
}
-
if
pipeline
.
project
.
builds_enabled?
&&
!
pipeline
.
ci_yaml_file
.bs-callout.bs-callout-warning
\.gitlab-ci.yml not found in this commit
.table-holder.pipeline-holder
.table-holder.pipeline-holder
%table
.table.ci-table.pipeline
%table
.table.ci-table.pipeline
%thead
%thead
...
@@ -43,6 +32,10 @@
...
@@ -43,6 +32,10 @@
%th
%th
=
render
partial:
"projects/stage/stage"
,
collection:
pipeline
.
legacy_stages
,
as: :stage
=
render
partial:
"projects/stage/stage"
,
collection:
pipeline
.
legacy_stages
,
as: :stage
-
elsif
pipeline
.
project
.
builds_enabled?
&&
!
pipeline
.
ci_yaml_file
.bs-callout.bs-callout-warning
\.gitlab-ci.yml not found in this commit
-
if
@pipeline
.
failed_builds
.
present?
-
if
@pipeline
.
failed_builds
.
present?
#js-tab-failures
.build-failures.tab-pane.build-page
#js-tab-failures
.build-failures.tab-pane.build-page
%table
.table.responsive-table.ci-table.responsive-table-sm-rounded
%table
.table.responsive-table.ci-table.responsive-table-sm-rounded
...
...
app/views/projects/pipelines/show.html.haml
View file @
ef2dc89e
...
@@ -9,6 +9,14 @@
...
@@ -9,6 +9,14 @@
-
if
@pipeline
.
commit
.
present?
-
if
@pipeline
.
commit
.
present?
=
render
"projects/pipelines/info"
,
commit:
@pipeline
.
commit
=
render
"projects/pipelines/info"
,
commit:
@pipeline
.
commit
-
if
@pipeline
.
builds
.
empty?
&&
@pipeline
.
yaml_errors
.
present?
.bs-callout.bs-callout-danger
%h4
Found errors in your .gitlab-ci.yml:
%ul
-
@pipeline
.
yaml_errors
.
split
(
","
).
each
do
|
error
|
%li
=
error
You can test your .gitlab-ci.yml in
#{
link_to
"CI Lint"
,
project_ci_lint_path
(
@project
)
}
.
-
else
=
render
"projects/pipelines/with_tabs"
,
pipeline:
@pipeline
=
render
"projects/pipelines/with_tabs"
,
pipeline:
@pipeline
.js-pipeline-details-vue
{
data:
{
endpoint:
project_pipeline_path
(
@project
,
@pipeline
,
format: :json
)
}
}
.js-pipeline-details-vue
{
data:
{
endpoint:
project_pipeline_path
(
@project
,
@pipeline
,
format: :json
)
}
}
app/views/shared/issuable/_sidebar.html.haml
View file @
ef2dc89e
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
.block.milestone
.block.milestone
.sidebar-collapsed-icon.has-tooltip
{
title:
milestone_tooltip_title
(
issuable
.
milestone
),
data:
{
container:
'body'
,
html:
'true'
,
placement:
'left'
,
boundary:
'viewport'
}
}
.sidebar-collapsed-icon.has-tooltip
{
title:
milestone_tooltip_title
(
issuable
.
milestone
),
data:
{
container:
'body'
,
html:
'true'
,
placement:
'left'
,
boundary:
'viewport'
}
}
=
icon
(
'clock-o'
,
'aria-hidden'
:
'true'
)
=
icon
(
'clock-o'
,
'aria-hidden'
:
'true'
)
%span
.milestone-title
%span
.milestone-title
.collapse-truncated-title
-
if
issuable
.
milestone
-
if
issuable
.
milestone
=
issuable
.
milestone
.
title
=
issuable
.
milestone
.
title
-
else
-
else
...
...
changelogs/unreleased/45669-table-in-jobs-on-pipeline.yml
0 → 100644
View file @
ef2dc89e
---
title
:
Hide all tables on Pipeline when no Jobs for the Pipeline
merge_request
:
18540
author
:
Takuya Noguchi
type
:
fixed
changelogs/unreleased/52122-fix-broken-whitespace-button.yml
0 → 100644
View file @
ef2dc89e
---
title
:
Fix broken "Show whitespace changes" button on MRs.
merge_request
:
22539
author
:
type
:
fixed
changelogs/unreleased/53273-update-moment-to-2-22-2.yml
0 → 100644
View file @
ef2dc89e
---
title
:
Update moment to 2.22.2
merge_request
:
22648
author
:
Takuya Noguchi
type
:
security
changelogs/unreleased/gt-truncate-milestone-title-on-collapsed-sidebar.yml
0 → 100644
View file @
ef2dc89e
---
title
:
Truncate milestone title on collapsed sidebar
merge_request
:
22624
author
:
George Tsiolis
type
:
changed
changelogs/unreleased/rails5-deprecated-uniq.yml
0 → 100644
View file @
ef2dc89e
---
title
:
Replace deprecated uniq on a Relation with distinct
merge_request
:
22625
author
:
Jasper Maes
type
:
other
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
View file @
ef2dc89e
...
@@ -210,7 +210,7 @@ container_scanning:
...
@@ -210,7 +210,7 @@ container_scanning:
refs
:
refs
:
-
branches
-
branches
variables
:
variables
:
-
$GITLAB_FEATURES =~ /\b
sast_container
\b/
-
$GITLAB_FEATURES =~ /\b
container_scanning
\b/
except
:
except
:
variables
:
variables
:
-
$CONTAINER_SCANNING_DISABLED
-
$CONTAINER_SCANNING_DISABLED
...
...
lib/gitlab/contributions_calendar.rb
View file @
ef2dc89e
...
@@ -73,7 +73,7 @@ module Gitlab
...
@@ -73,7 +73,7 @@ module Gitlab
# re-running the contributed projects query in each union is expensive, so
# re-running the contributed projects query in each union is expensive, so
# use IN(project_ids...) instead. It's the intersection of two users so
# use IN(project_ids...) instead. It's the intersection of two users so
# the list will be (relatively) short
# the list will be (relatively) short
@contributed_project_ids
||=
projects
.
uniq
.
pluck
(
:id
)
@contributed_project_ids
||=
projects
.
distinct
.
pluck
(
:id
)
authed_projects
=
Project
.
where
(
id:
@contributed_project_ids
)
authed_projects
=
Project
.
where
(
id:
@contributed_project_ids
)
.
with_feature_available_for_user
(
feature
,
current_user
)
.
with_feature_available_for_user
(
feature
,
current_user
)
.
reorder
(
nil
)
.
reorder
(
nil
)
...
...
locale/gitlab.pot
View file @
ef2dc89e
...
@@ -7014,9 +7014,6 @@ msgstr ""
...
@@ -7014,9 +7014,6 @@ msgstr ""
msgid "You can also star a label to make it a priority label."
msgid "You can also star a label to make it a priority label."
msgstr ""
msgstr ""
msgid "You can also test your .gitlab-ci.yml in the %{linkStart}Lint%{linkEnd}"
msgstr ""
msgid "You can easily contribute to them by requesting to join these groups."
msgid "You can easily contribute to them by requesting to join these groups."
msgstr ""
msgstr ""
...
@@ -7038,6 +7035,9 @@ msgstr ""
...
@@ -7038,6 +7035,9 @@ msgstr ""
msgid "You can set up jobs to only use Runners with specific tags. Separate tags with commas."
msgid "You can set up jobs to only use Runners with specific tags. Separate tags with commas."
msgstr ""
msgstr ""
msgid "You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}."
msgstr ""
msgid "You cannot write to this read-only GitLab instance."
msgid "You cannot write to this read-only GitLab instance."
msgstr ""
msgstr ""
...
...
qa/qa/factory/repository/push.rb
View file @
ef2dc89e
...
@@ -45,7 +45,7 @@ module QA
...
@@ -45,7 +45,7 @@ module QA
repository
.
use_ssh_key
(
ssh_key
)
repository
.
use_ssh_key
(
ssh_key
)
else
else
repository
.
uri
=
repository_http_uri
repository
.
uri
=
repository_http_uri
repository
.
use_default_credentials
repository
.
use_default_credentials
unless
user
end
end
username
=
'GitLab QA'
username
=
'GitLab QA'
...
...
qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb
0 → 100644
View file @
ef2dc89e
# frozen_string_literal: true
module
QA
context
'Create'
do
describe
'Git push over HTTP'
,
:ldap_no_tls
do
it
'user using a personal access token pushes code to the repository'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
perform
(
&
:sign_in_using_credentials
)
access_token
=
Factory
::
Resource
::
PersonalAccessToken
.
fabricate!
.
access_token
user
=
Factory
::
Resource
::
User
.
new
.
tap
do
|
user
|
user
.
username
=
Runtime
::
User
.
username
user
.
password
=
access_token
end
push
=
Factory
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
user
=
user
push
.
file_name
=
'README.md'
push
.
file_content
=
'# This is a test project'
push
.
commit_message
=
'Add README.md'
end
push
.
project
.
visit!
Page
::
Project
::
Show
.
perform
(
&
:wait_for_push
)
expect
(
page
).
to
have_content
(
'README.md'
)
expect
(
page
).
to
have_content
(
'This is a test project'
)
end
end
end
end
spec/features/commits_spec.rb
View file @
ef2dc89e
...
@@ -114,33 +114,6 @@ describe 'Commits' do
...
@@ -114,33 +114,6 @@ describe 'Commits' do
expect
(
page
).
to
have_content
'canceled'
expect
(
page
).
to
have_content
'canceled'
end
end
end
end
describe
'.gitlab-ci.yml not found warning'
do
context
'ci builds enabled'
do
it
"does not show warning"
do
visit
pipeline_path
(
pipeline
)
expect
(
page
).
not_to
have_content
'.gitlab-ci.yml not found in this commit'
end
it
'shows warning'
do
stub_ci_pipeline_yaml_file
(
nil
)
visit
pipeline_path
(
pipeline
)
expect
(
page
).
to
have_content
'.gitlab-ci.yml not found in this commit'
end
end
context
'ci builds disabled'
do
before
do
stub_ci_builds_disabled
stub_ci_pipeline_yaml_file
(
nil
)
visit
pipeline_path
(
pipeline
)
end
it
'does not show warning'
do
expect
(
page
).
not_to
have_content
'.gitlab-ci.yml not found in this commit'
end
end
end
end
end
context
"when logged as reporter"
do
context
"when logged as reporter"
do
...
@@ -182,6 +155,39 @@ describe 'Commits' do
...
@@ -182,6 +155,39 @@ describe 'Commits' do
end
end
end
end
end
end
describe
'.gitlab-ci.yml not found warning'
do
before
do
project
.
add_reporter
(
user
)
end
context
'ci builds enabled'
do
it
'does not show warning'
do
visit
pipeline_path
(
pipeline
)
expect
(
page
).
not_to
have_content
'.gitlab-ci.yml not found in this commit'
end
it
'shows warning'
do
stub_ci_pipeline_yaml_file
(
nil
)
visit
pipeline_path
(
pipeline
)
expect
(
page
).
to
have_content
'.gitlab-ci.yml not found in this commit'
end
end
context
'ci builds disabled'
do
it
'does not show warning'
do
stub_ci_builds_disabled
stub_ci_pipeline_yaml_file
(
nil
)
visit
pipeline_path
(
pipeline
)
expect
(
page
).
not_to
have_content
'.gitlab-ci.yml not found in this commit'
end
end
end
end
end
context
'viewing commits for a branch'
do
context
'viewing commits for a branch'
do
...
...
spec/javascripts/diffs/components/compare_versions_spec.js
View file @
ef2dc89e
// TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034
import
Vue
from
'
vue
'
;
import
CompareVersionsComponent
from
'
~/diffs/components/compare_versions.vue
'
;
import
store
from
'
~/mr_notes/stores
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
diffsMockData
from
'
../mock_data/merge_request_diffs
'
;
describe
(
'
CompareVersions
'
,
()
=>
{
let
vm
;
const
targetBranch
=
{
branchName
:
'
tmp-wine-dev
'
,
versionIndex
:
-
1
};
beforeEach
(()
=>
{
vm
=
createComponentWithStore
(
Vue
.
extend
(
CompareVersionsComponent
),
store
,
{
mergeRequestDiffs
:
diffsMockData
,
mergeRequestDiff
:
diffsMockData
[
0
],
targetBranch
,
}).
$mount
();
});
describe
(
'
template
'
,
()
=>
{
it
(
'
should render Tree List toggle button with correct attribute values
'
,
()
=>
{
const
treeListBtn
=
vm
.
$el
.
querySelector
(
'
.js-toggle-tree-list
'
);
expect
(
treeListBtn
).
not
.
toBeNull
();
expect
(
treeListBtn
.
dataset
.
originalTitle
).
toBe
(
'
Toggle file browser
'
);
expect
(
treeListBtn
.
querySelectorAll
(
'
svg use
'
).
length
).
not
.
toBe
(
0
);
expect
(
treeListBtn
.
querySelector
(
'
svg use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
#hamburger
'
,
);
});
it
(
'
should render comparison dropdowns with correct values
'
,
()
=>
{
const
sourceDropdown
=
vm
.
$el
.
querySelector
(
'
.mr-version-dropdown
'
);
const
targetDropdown
=
vm
.
$el
.
querySelector
(
'
.mr-version-compare-dropdown
'
);
expect
(
sourceDropdown
).
not
.
toBeNull
();
expect
(
targetDropdown
).
not
.
toBeNull
();
expect
(
sourceDropdown
.
querySelector
(
'
a span
'
).
innerHTML
).
toContain
(
'
latest version
'
);
expect
(
targetDropdown
.
querySelector
(
'
a span
'
).
innerHTML
).
toContain
(
targetBranch
.
branchName
);
});
it
(
'
should not render comparison dropdowns if no mergeRequestDiffs are specified
'
,
()
=>
{
vm
.
mergeRequestDiffs
=
[];
vm
.
$nextTick
(()
=>
{
const
sourceDropdown
=
vm
.
$el
.
querySelector
(
'
.mr-version-dropdown
'
);
const
targetDropdown
=
vm
.
$el
.
querySelector
(
'
.mr-version-compare-dropdown
'
);
expect
(
sourceDropdown
).
toBeNull
();
expect
(
targetDropdown
).
toBeNull
();
});
});
it
(
'
should render whitespace toggle button with correct attributes
'
,
()
=>
{
const
whitespaceBtn
=
vm
.
$el
.
querySelector
(
'
.qa-toggle-whitespace
'
);
const
href
=
vm
.
toggleWhitespacePath
;
expect
(
whitespaceBtn
).
not
.
toBeNull
();
expect
(
whitespaceBtn
.
getAttribute
(
'
href
'
)).
toEqual
(
href
);
expect
(
whitespaceBtn
.
innerHTML
).
toContain
(
'
Hide whitespace changes
'
);
});
it
(
'
should render view types buttons with correct values
'
,
()
=>
{
const
inlineBtn
=
vm
.
$el
.
querySelector
(
'
#inline-diff-btn
'
);
const
parallelBtn
=
vm
.
$el
.
querySelector
(
'
#parallel-diff-btn
'
);
expect
(
inlineBtn
).
not
.
toBeNull
();
expect
(
parallelBtn
).
not
.
toBeNull
();
expect
(
inlineBtn
.
dataset
.
viewType
).
toEqual
(
'
inline
'
);
expect
(
parallelBtn
.
dataset
.
viewType
).
toEqual
(
'
parallel
'
);
expect
(
inlineBtn
.
innerHTML
).
toContain
(
'
Inline
'
);
expect
(
parallelBtn
.
innerHTML
).
toContain
(
'
Side-by-side
'
);
});
});
describe
(
'
setInlineDiffViewType
'
,
()
=>
{
it
(
'
should persist the view type in the url
'
,
()
=>
{
const
viewTypeBtn
=
vm
.
$el
.
querySelector
(
'
#inline-diff-btn
'
);
viewTypeBtn
.
click
();
expect
(
window
.
location
.
toString
()).
toContain
(
'
?view=inline
'
);
});
});
describe
(
'
setParallelDiffViewType
'
,
()
=>
{
it
(
'
should persist the view type in the url
'
,
()
=>
{
const
viewTypeBtn
=
vm
.
$el
.
querySelector
(
'
#parallel-diff-btn
'
);
viewTypeBtn
.
click
();
expect
(
window
.
location
.
toString
()).
toContain
(
'
?view=parallel
'
);
});
});
describe
(
'
comparableDiffs
'
,
()
=>
{
it
(
'
should not contain the first item in the mergeRequestDiffs property
'
,
()
=>
{
const
{
comparableDiffs
}
=
vm
;
const
comparableDiffsMock
=
diffsMockData
.
slice
(
1
);
expect
(
comparableDiffs
).
toEqual
(
comparableDiffsMock
);
});
});
describe
(
'
isWhitespaceVisible
'
,
()
=>
{
const
originalHref
=
window
.
location
.
href
;
afterEach
(()
=>
{
window
.
history
.
replaceState
({},
null
,
originalHref
);
});
it
(
'
should return "true" when no "w" flag is present in the URL (default)
'
,
()
=>
{
expect
(
vm
.
isWhitespaceVisible
()).
toBe
(
true
);
});
it
(
'
should return "false" when the flag is set to "1" in the URL
'
,
()
=>
{
window
.
history
.
replaceState
({},
null
,
'
?w=1
'
);
expect
(
vm
.
isWhitespaceVisible
()).
toBe
(
false
);
});
it
(
'
should return "true" when the flag is set to "0" in the URL
'
,
()
=>
{
window
.
history
.
replaceState
({},
null
,
'
?w=0
'
);
expect
(
vm
.
isWhitespaceVisible
()).
toBe
(
true
);
});
});
});
spec/javascripts/diffs/mock_data/merge_request_diffs.js
0 → 100644
View file @
ef2dc89e
export
default
[
{
versionIndex
:
4
,
createdAt
:
'
2018-10-23T11:49:16.611Z
'
,
commitsCount
:
4
,
latest
:
true
,
shortCommitSha
:
'
de7a8f7f
'
,
versionPath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37
'
,
comparePath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=de7a8f7f20c3ea2e0bef3ba01cfd41c21f6b4995
'
,
},
{
versionIndex
:
3
,
createdAt
:
'
2018-10-23T11:46:40.617Z
'
,
commitsCount
:
3
,
latest
:
false
,
shortCommitSha
:
'
e78fc18f
'
,
versionPath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=36
'
,
comparePath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=e78fc18fa37acb2185c59ca94d4a964464feb50e
'
,
},
{
versionIndex
:
2
,
createdAt
:
'
2018-10-04T09:57:39.648Z
'
,
commitsCount
:
2
,
latest
:
false
,
shortCommitSha
:
'
48da7e7e
'
,
versionPath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=35
'
,
comparePath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=48da7e7e9a99d41c852578bd9cb541ca4d864b3e
'
,
},
{
versionIndex
:
1
,
createdAt
:
'
2018-09-25T20:30:39.493Z
'
,
commitsCount
:
1
,
latest
:
false
,
shortCommitSha
:
'
47bac2ed
'
,
versionPath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=20
'
,
comparePath
:
'
/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=47bac2ed972c5bee344c1cea159a22cd7f711dc0
'
,
},
];
spec/javascripts/job_spec.js
deleted
100644 → 0
View file @
f7d4d8e4
// import $ from 'jquery';
// import MockAdapter from 'axios-mock-adapter';
// import axios from '~/lib/utils/axios_utils';
// import { numberToHumanSize } from '~/lib/utils/number_utils';
// import '~/lib/utils/datetime_utility';
// import Job from '~/job';
// import '~/breakpoints';
// import waitForPromises from 'spec/helpers/wait_for_promises';
// describe('Job', () => {
// const JOB_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/-/jobs/1`;
// let mock;
// let response;
// let job;
// preloadFixtures('builds/build-with-artifacts.html.raw');
// beforeEach(() => {
// loadFixtures('builds/build-with-artifacts.html.raw');
// spyOnDependency(Job, 'visitUrl');
// response = {};
// mock = new MockAdapter(axios);
// mock.onGet(new RegExp(`${JOB_URL}/trace.json?(.*)`)).reply(() => [200, response]);
// });
// afterEach(() => {
// mock.restore();
// clearTimeout(job.timeout);
// });
// describe('class constructor', () => {
// beforeEach(() => {
// jasmine.clock().install();
// });
// afterEach(() => {
// jasmine.clock().uninstall();
// });
// describe('running build', () => {
// it('updates the build trace on an interval', function (done) {
// response = {
// html: '<span>Update<span>',
// status: 'running',
// state: 'newstate',
// append: true,
// complete: false,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect($('#build-trace .js-build-output').text()).toMatch(/Update/);
// expect(job.state).toBe('newstate');
// response = {
// html: '<span>More</span>',
// status: 'running',
// state: 'finalstate',
// append: true,
// complete: true,
// };
// })
// .then(() => jasmine.clock().tick(4001))
// .then(waitForPromises)
// .then(() => {
// expect($('#build-trace .js-build-output').text()).toMatch(/UpdateMore/);
// expect(job.state).toBe('finalstate');
// })
// .then(done)
// .catch(done.fail);
// });
// it('replaces the entire build trace', (done) => {
// response = {
// html: '<span>Update<span>',
// status: 'running',
// append: false,
// complete: false,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect($('#build-trace .js-build-output').text()).toMatch(/Update/);
// response = {
// html: '<span>Different</span>',
// status: 'running',
// append: false,
// };
// })
// .then(() => jasmine.clock().tick(4001))
// .then(waitForPromises)
// .then(() => {
// expect($('#build-trace .js-build-output').text()).not.toMatch(/Update/);
// expect($('#build-trace .js-build-output').text()).toMatch(/Different/);
// })
// .then(done)
// .catch(done.fail);
// });
// });
// describe('truncated information', () => {
// describe('when size is less than total', () => {
// it('shows information about truncated log', (done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(document.querySelector('.js-truncated-info').classList).not.toContain('hidden');
// })
// .then(done)
// .catch(done.fail);
// });
// it('shows the size in KiB', (done) => {
// const size = 50;
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(
// document.querySelector('.js-truncated-info-size').textContent.trim(),
// ).toEqual(`${numberToHumanSize(size)}`);
// })
// .then(done)
// .catch(done.fail);
// });
// it('shows incremented size', (done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// complete: false,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(
// document.querySelector('.js-truncated-info-size').textContent.trim(),
// ).toEqual(`${numberToHumanSize(50)}`);
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: true,
// size: 10,
// total: 100,
// complete: true,
// };
// })
// .then(() => jasmine.clock().tick(4001))
// .then(waitForPromises)
// .then(() => {
// expect(
// document.querySelector('.js-truncated-info-size').textContent.trim(),
// ).toEqual(`${numberToHumanSize(60)}`);
// })
// .then(done)
// .catch(done.fail);
// });
// it('renders the raw link', () => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// };
// job = new Job();
// expect(
// document.querySelector('.js-raw-link').textContent.trim(),
// ).toContain('Complete Raw');
// });
// });
// describe('when size is equal than total', () => {
// it('does not show the trunctated information', (done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 100,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(document.querySelector('.js-truncated-info').classList).toContain('hidden');
// })
// .then(done)
// .catch(done.fail);
// });
// });
// });
// describe('output trace', () => {
// beforeEach((done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(done)
// .catch(done.fail);
// });
// it('should render trace controls', () => {
// const controllers = document.querySelector('.controllers');
// expect(controllers.querySelector('.js-raw-link-controller')).not.toBeNull();
// expect(controllers.querySelector('.js-scroll-up')).not.toBeNull();
// expect(controllers.querySelector('.js-scroll-down')).not.toBeNull();
// });
// it('should render received output', () => {
// expect(
// document.querySelector('.js-build-output').innerHTML,
// ).toEqual('<span>Update</span>');
// });
// });
// });
// });
yarn.lock
View file @
ef2dc89e
...
@@ -5502,12 +5502,7 @@ mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0:
...
@@ -5502,12 +5502,7 @@ mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0:
dependencies:
dependencies:
minimist "0.0.8"
minimist "0.0.8"
moment@2.x:
moment@2.x, moment@^2.21.0:
version "2.19.2"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.2.tgz#8a7f774c95a64550b4c7ebd496683908f9419dbe"
integrity sha512-Rf6jiHPEfxp9+dlzxPTmRHbvoFXsh2L/U8hOupUMpnuecHQmI6cF6lUbJl3QqKPko1u6ujO+FxtcajLVfLpAtA==
moment@^2.21.0:
version "2.22.2"
version "2.22.2"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=
integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=
...
...
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