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
Jérome Perrin
gitlab-ce
Commits
bca86c85
Commit
bca86c85
authored
Oct 03, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for external HTML artifact
parent
b4d95002
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
6 deletions
+26
-6
app/assets/javascripts/lib/utils/url_utility.js
app/assets/javascripts/lib/utils/url_utility.js
+1
-1
app/views/projects/artifacts/_tree_file.html.haml
app/views/projects/artifacts/_tree_file.html.haml
+1
-1
doc/user/project/pipelines/img/job_artifacts_browser.png
doc/user/project/pipelines/img/job_artifacts_browser.png
+0
-0
spec/features/projects/artifacts/browse_spec.rb
spec/features/projects/artifacts/browse_spec.rb
+24
-4
No files found.
app/assets/javascripts/lib/utils/url_utility.js
View file @
bca86c85
...
...
@@ -90,7 +90,7 @@ w.gl.utils.refreshCurrentPage = () => gl.utils.visitUrl(document.location.href);
// eslint-disable-next-line import/prefer-default-export
export
function
visitUrl
(
url
,
external
=
false
)
{
if
(
external
)
{
// Simulate `target="blank" re
f
="noopener noreferrer"`
// Simulate `target="blank" re
l
="noopener noreferrer"`
// See https://mathiasbynens.github.io/rel-noopener/
const
otherWindow
=
window
.
open
();
otherWindow
.
opener
=
null
;
...
...
app/views/projects/artifacts/_tree_file.html.haml
View file @
bca86c85
...
...
@@ -12,6 +12,6 @@
title:
(
'Opens in a new window'
if
is_external_link
)
do
%span
.str-truncated
>=
blob
.
name
-
if
is_external_link
=
icon
(
'external-link'
)
=
icon
(
'external-link'
,
class:
'js-artifact-tree-external-icon'
)
%td
=
number_to_human_size
(
blob
.
size
,
precision:
2
)
doc/user/project/pipelines/img/job_artifacts_browser.png
deleted
100644 → 0
View file @
b4d95002
3.85 KB
spec/features/projects/artifacts/browse_spec.rb
View file @
bca86c85
require
'spec_helper'
feature
'Browse artifact'
,
:js
do
include
ArtifactHelper
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
let
(
:job
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline
)
}
let
(
:browse_url
)
do
browse_path
(
'other_artifacts_0.1.2'
)
end
def
browse_path
(
path
)
browse_project_job_artifacts_path
(
project
,
job
,
path
)
end
context
'when visiting old URL'
do
let
(
:browse_url
)
do
browse_path
(
'other_artifacts_0.1.2'
)
end
before
do
visit
browse_url
.
sub
(
'/-/jobs'
,
'/builds'
)
end
...
...
@@ -22,4 +23,23 @@ feature 'Browse artifact', :js do
expect
(
page
.
current_path
).
to
eq
(
browse_url
)
end
end
context
'when browsing a directory with an HTML file'
do
let
(
:html_entry
)
{
job
.
artifacts_metadata_entry
(
"other_artifacts_0.1.2/index.html"
)
}
before
do
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:enabled
).
and_return
(
true
)
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:artifacts_server
).
and_return
(
true
)
visit
browse_url
end
it
"shows external link icon and styles"
do
link
=
first
(
'.tree-item-file-external-link'
)
expect
(
link
).
to
have_content
(
'index.html'
)
expect
(
link
[
:href
]).
to
eq
(
html_artifact_url
(
project
,
job
,
html_entry
.
blob
))
expect
(
page
).
to
have_selector
(
'.js-artifact-tree-external-icon'
)
end
end
end
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