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
483ade43
Commit
483ade43
authored
Apr 11, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-04-11
parents
18a1d0a5
13bf7094
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
22 deletions
+84
-22
app/assets/javascripts/ide/components/repo_editor.vue
app/assets/javascripts/ide/components/repo_editor.vue
+2
-2
app/controllers/admin/application_settings_controller.rb
app/controllers/admin/application_settings_controller.rb
+2
-0
lib/gitlab/ci/variables/collection/item.rb
lib/gitlab/ci/variables/collection/item.rb
+2
-5
spec/javascripts/ide/components/repo_editor_spec.js
spec/javascripts/ide/components/repo_editor_spec.js
+38
-1
spec/javascripts/test_bundle.js
spec/javascripts/test_bundle.js
+10
-9
spec/lib/gitlab/ci/variables/collection/item_spec.rb
spec/lib/gitlab/ci/variables/collection/item_spec.rb
+30
-5
No files found.
app/assets/javascripts/ide/components/repo_editor.vue
View file @
483ade43
...
...
@@ -22,7 +22,7 @@ export default {
...
mapState
([
'
rightPanelCollapsed
'
,
'
viewer
'
,
'
delayViewerUpdated
'
,
'
panelResizing
'
]),
...
mapGetters
([
'
currentMergeRequest
'
]),
shouldHideEditor
()
{
return
this
.
file
&&
this
.
file
.
binary
&&
!
this
.
file
.
raw
;
return
this
.
file
&&
this
.
file
.
binary
&&
!
this
.
file
.
content
;
},
editTabCSS
()
{
return
{
...
...
@@ -212,7 +212,7 @@ export default {
<content-viewer
v-if=
"shouldHideEditor || file.viewMode === 'preview'"
:content=
"file.content || file.raw"
:path=
"file.rawPath"
:path=
"file.rawPath
|| file.path
"
:file-size=
"file.size"
:project-path=
"file.projectId"
/>
</div>
...
...
app/controllers/admin/application_settings_controller.rb
View file @
483ade43
...
...
@@ -58,7 +58,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
def
application_setting_params
params
[
:application_setting
]
||=
{}
import_sources
=
params
[
:application_setting
][
:import_sources
]
if
import_sources
.
nil?
params
[
:application_setting
][
:import_sources
]
=
[]
else
...
...
lib/gitlab/ci/variables/collection/item.rb
View file @
483ade43
...
...
@@ -3,12 +3,9 @@ module Gitlab
module
Variables
class
Collection
class
Item
def
initialize
(
**
options
)
def
initialize
(
key
:,
value
:,
public:
true
,
file:
false
)
@variable
=
{
key:
options
.
fetch
(
:key
),
value:
options
.
fetch
(
:value
),
public:
options
.
fetch
(
:public
,
true
),
file:
options
.
fetch
(
:files
,
false
)
key:
key
,
value:
value
,
public:
public
,
file:
file
}
end
...
...
spec/javascripts/ide/components/repo_editor_spec.js
View file @
483ade43
import
Vue
from
'
vue
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
store
from
'
~/ide/stores
'
;
import
repoEditor
from
'
~/ide/components/repo_editor.vue
'
;
import
monacoLoader
from
'
~/ide/monaco_loader
'
;
import
Editor
from
'
~/ide/lib/editor
'
;
import
{
createComponentWithStore
}
from
'
../../helpers/vue_mount_component_helper
'
;
import
setTimeoutPromise
from
'
../../helpers/set_timeout_promise_helper
'
;
import
{
file
,
resetStore
}
from
'
../helpers
'
;
describe
(
'
RepoEditor
'
,
()
=>
{
...
...
@@ -35,7 +38,7 @@ describe('RepoEditor', () => {
resetStore
(
vm
.
$store
);
Editor
.
editorInstance
.
modelManager
.
dispose
();
Editor
.
editorInstance
.
dispose
();
});
it
(
'
renders an ide container
'
,
done
=>
{
...
...
@@ -79,16 +82,30 @@ describe('RepoEditor', () => {
});
describe
(
'
when file is markdown and viewer mode is review
'
,
()
=>
{
let
mock
;
beforeEach
(
done
=>
{
mock
=
new
MockAdapter
(
axios
);
vm
.
file
.
projectId
=
'
namespace/project
'
;
vm
.
file
.
previewMode
=
{
id
:
'
markdown
'
,
previewTitle
:
'
Preview Markdown
'
,
};
vm
.
file
.
content
=
'
testing 123
'
;
vm
.
$store
.
state
.
viewer
=
'
diff
'
;
mock
.
onPost
(
/
(
.*
)\/
preview_markdown/
).
reply
(
200
,
{
body
:
'
<p>testing 123</p>
'
,
});
vm
.
$nextTick
(
done
);
});
afterEach
(()
=>
{
mock
.
restore
();
});
it
(
'
renders an Edit and a Preview Tab
'
,
done
=>
{
Vue
.
nextTick
(()
=>
{
const
tabs
=
vm
.
$el
.
querySelectorAll
(
'
.ide-mode-tabs .nav-links li
'
);
...
...
@@ -99,6 +116,26 @@ describe('RepoEditor', () => {
done
();
});
});
it
(
'
renders markdown for tempFile
'
,
done
=>
{
vm
.
file
.
tempFile
=
true
;
vm
.
file
.
path
=
`
${
vm
.
file
.
path
}
.md`
;
vm
.
$store
.
state
.
entries
[
vm
.
file
.
path
]
=
vm
.
file
;
vm
.
$nextTick
()
.
then
(()
=>
{
vm
.
$el
.
querySelectorAll
(
'
.ide-mode-tabs .nav-links a
'
)[
1
].
click
();
})
.
then
(
setTimeoutPromise
)
.
then
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.preview-container
'
).
innerHTML
).
toContain
(
'
<p>testing 123</p>
'
,
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
describe
(
'
when open file is binary and not raw
'
,
()
=>
{
...
...
spec/javascripts/test_bundle.js
View file @
483ade43
...
...
@@ -21,7 +21,7 @@ Vue.config.warnHandler = (msg, vm, trace) => {
};
let
hasVueErrors
=
false
;
Vue
.
config
.
errorHandler
=
function
(
err
)
{
Vue
.
config
.
errorHandler
=
function
(
err
)
{
hasVueErrors
=
true
;
fail
(
err
);
};
...
...
@@ -42,10 +42,11 @@ window.gl = window.gl || {};
window
.
gl
.
TEST_HOST
=
TEST_HOST
;
window
.
gon
=
window
.
gon
||
{};
window
.
gon
.
test_env
=
true
;
gon
.
relative_url_root
=
''
;
let
hasUnhandledPromiseRejections
=
false
;
window
.
addEventListener
(
'
unhandledrejection
'
,
(
event
)
=>
{
window
.
addEventListener
(
'
unhandledrejection
'
,
event
=>
{
hasUnhandledPromiseRejections
=
true
;
console
.
error
(
'
Unhandled promise rejection:
'
);
console
.
error
(
event
.
reason
.
stack
||
event
.
reason
);
...
...
@@ -70,13 +71,13 @@ const axiosDefaultAdapter = getDefaultAdapter();
// render all of our tests
const
testsContext
=
require
.
context
(
'
.
'
,
true
,
/_spec$/
);
testsContext
.
keys
().
forEach
(
function
(
path
)
{
testsContext
.
keys
().
forEach
(
function
(
path
)
{
try
{
testsContext
(
path
);
}
catch
(
err
)
{
console
.
error
(
'
[ERROR] Unable to load spec:
'
,
path
);
describe
(
'
Test bundle
'
,
function
()
{
it
(
`includes '
${
path
}
'`
,
function
()
{
describe
(
'
Test bundle
'
,
function
()
{
it
(
`includes '
${
path
}
'`
,
function
()
{
expect
(
err
).
toBeNull
();
});
});
...
...
@@ -84,7 +85,7 @@ testsContext.keys().forEach(function (path) {
});
describe
(
'
test errors
'
,
()
=>
{
beforeAll
(
(
done
)
=>
{
beforeAll
(
done
=>
{
if
(
hasUnhandledPromiseRejections
||
hasVueWarnings
||
hasVueErrors
)
{
setTimeout
(
done
,
1000
);
}
else
{
...
...
@@ -148,18 +149,18 @@ if (process.env.BABEL_ENV === 'coverage') {
'
./issue_show/index.js
'
,
];
describe
(
'
Uncovered files
'
,
function
()
{
describe
(
'
Uncovered files
'
,
function
()
{
const
sourceFiles
=
require
.
context
(
'
~
'
,
true
,
/
\.
js$/
);
$
.
holdReady
(
true
);
sourceFiles
.
keys
().
forEach
(
function
(
path
)
{
sourceFiles
.
keys
().
forEach
(
function
(
path
)
{
// ignore if there is a matching spec file
if
(
testsContext
.
keys
().
indexOf
(
`
${
path
.
replace
(
/
\.
js$/
,
''
)}
_spec`
)
>
-
1
)
{
return
;
}
it
(
`includes '
${
path
}
'`
,
function
()
{
it
(
`includes '
${
path
}
'`
,
function
()
{
try
{
sourceFiles
(
path
);
}
catch
(
err
)
{
...
...
spec/lib/gitlab/ci/variables/collection/item_spec.rb
View file @
483ade43
...
...
@@ -5,6 +5,18 @@ describe Gitlab::Ci::Variables::Collection::Item do
{
key:
'VAR'
,
value:
'something'
,
public:
true
}
end
describe
'.new'
do
it
'raises error if unknown key i specified'
do
expect
{
described_class
.
new
(
key:
'VAR'
,
value:
'abc'
,
files:
true
)
}
.
to
raise_error
ArgumentError
,
'unknown keyword: files'
end
it
'raises error when required keywords are not specified'
do
expect
{
described_class
.
new
(
key:
'VAR'
)
}
.
to
raise_error
ArgumentError
,
'missing keyword: value'
end
end
describe
'.fabricate'
do
it
'supports using a hash'
do
resource
=
described_class
.
fabricate
(
variable
)
...
...
@@ -47,12 +59,25 @@ describe Gitlab::Ci::Variables::Collection::Item do
end
describe
'#to_runner_variable'
do
it
'returns a runner-compatible hash representation'
do
runner_variable
=
described_class
.
new
(
**
variable
)
.
to_runner_variable
context
'when variable is not a file-related'
do
it
'returns a runner-compatible hash representation'
do
runner_variable
=
described_class
.
new
(
**
variable
)
.
to_runner_variable
expect
(
runner_variable
).
to
eq
variable
end
end
context
'when variable is file-related'
do
it
'appends file description component'
do
runner_variable
=
described_class
.
new
(
key:
'VAR'
,
value:
'value'
,
file:
true
)
.
to_runner_variable
expect
(
runner_variable
).
to
eq
variable
expect
(
runner_variable
)
.
to
eq
(
key:
'VAR'
,
value:
'value'
,
public:
true
,
file:
true
)
end
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