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
4699cf77
Commit
4699cf77
authored
Oct 20, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added feature spec
parent
4c186f99
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
4 deletions
+107
-4
app/assets/javascripts/repo/helpers/repo_helper.js
app/assets/javascripts/repo/helpers/repo_helper.js
+8
-3
app/controllers/projects/tree_controller.rb
app/controllers/projects/tree_controller.rb
+0
-1
spec/features/projects/tree/create_directory_spec.rb
spec/features/projects/tree/create_directory_spec.rb
+43
-0
spec/features/projects/tree/create_file_spec.rb
spec/features/projects/tree/create_file_spec.rb
+40
-0
spec/javascripts/repo/components/new_dropdown/modal_spec.js
spec/javascripts/repo/components/new_dropdown/modal_spec.js
+16
-0
No files found.
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
4699cf77
...
...
@@ -98,8 +98,8 @@ const RepoHelper = {
.
then
((
response
)
=>
{
const
data
=
response
.
data
;
if
(
response
.
headers
&&
response
.
headers
[
'
page-title
'
])
data
.
pageTitle
=
decodeURI
(
response
.
headers
[
'
page-title
'
]);
if
(
response
.
headers
&&
response
.
headers
[
'
is-root
'
]
&&
!
Store
.
isInitialRoot
)
{
Store
.
isRoot
=
convertPermissionToBoolean
(
response
.
headers
[
'
is-root
'
])
;
if
(
data
.
path
&&
!
Store
.
isInitialRoot
)
{
Store
.
isRoot
=
data
.
path
===
'
/
'
;
Store
.
isInitialRoot
=
Store
.
isRoot
;
}
...
...
@@ -140,6 +140,10 @@ const RepoHelper = {
addToDirectory
(
file
,
data
)
{
const
tree
=
file
||
Store
;
// TODO: Figure out why `popstate` is being trigger in the specs
if
(
!
tree
.
files
)
return
;
const
files
=
tree
.
files
.
concat
(
this
.
dataToListOfFiles
(
data
,
file
?
file
.
level
+
1
:
0
));
tree
.
files
=
files
;
...
...
@@ -236,7 +240,8 @@ const RepoHelper = {
return
Store
.
openedFiles
.
find
(
file
=>
file
.
url
===
path
);
},
loadingError
()
{
loadingError
(
e
)
{
console
.
log
(
e
);
Flash
(
'
Unable to load this content at this time.
'
);
},
...
...
app/controllers/projects/tree_controller.rb
View file @
4699cf77
...
...
@@ -36,7 +36,6 @@ class Projects::TreeController < Projects::ApplicationController
format
.
json
do
page_title
@path
.
presence
||
_
(
"Files"
),
@ref
,
@project
.
name_with_namespace
response
.
header
[
'is-root'
]
=
@path
.
empty?
# n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/38261
Gitlab
::
GitalyClient
.
allow_n_plus_1_calls
do
...
...
spec/features/projects/tree/create_directory_spec.rb
0 → 100644
View file @
4699cf77
require
'spec_helper'
feature
'Multi-file editor new directory'
,
:js
do
include
WaitForRequests
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
page
.
driver
.
set_cookie
(
'new_repo'
,
'true'
)
visit
project_tree_path
(
project
,
:master
)
wait_for_requests
end
it
'creates directory in current directory'
do
find
(
'.add-to-tree'
).
click
click_link
(
'New directory'
)
page
.
within
(
'.popup-dialog'
)
do
find
(
'.form-control'
).
set
(
'foldername'
)
click_button
(
'Create directory'
)
end
fill_in
(
'commit-message'
,
with:
'commit message'
)
click_button
(
'Commit 1 file'
)
expect
(
page
).
to
have_content
(
'Your changes have been committed'
)
expect
(
page
).
to
have_selector
(
'td'
,
text:
'commit message'
)
click_link
(
'foldername'
)
expect
(
page
).
to
have_selector
(
'td'
,
text:
'commit message'
,
count:
2
)
expect
(
page
).
to
have_selector
(
'td'
,
text:
'.gitkeep'
)
end
end
spec/features/projects/tree/create_file_spec.rb
0 → 100644
View file @
4699cf77
require
'spec_helper'
feature
'Multi-file editor new file'
,
:js
do
include
WaitForRequests
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
page
.
driver
.
set_cookie
(
'new_repo'
,
'true'
)
visit
project_tree_path
(
project
,
:master
)
wait_for_requests
end
it
'creates file in current directory'
do
find
(
'.add-to-tree'
).
click
click_link
(
'New file'
)
page
.
within
(
'.popup-dialog'
)
do
find
(
'.form-control'
).
set
(
'filename'
)
click_button
(
'Create file'
)
end
find
(
'.inputarea'
).
send_keys
(
'file content'
)
fill_in
(
'commit-message'
,
with:
'commit message'
)
click_button
(
'Commit 1 file'
)
expect
(
page
).
to
have_content
(
'Your changes have been committed'
)
expect
(
page
).
to
have_selector
(
'td'
,
text:
'commit message'
)
end
end
spec/javascripts/repo/components/new_dropdown/modal_spec.js
View file @
4699cf77
...
...
@@ -71,6 +71,22 @@ describe('new file modal component', () => {
expect
(
RepoStore
.
openedFiles
.
length
).
toBe
(
1
);
});
it
(
`creates
${
type
}
in the current stores path`
,
()
=>
{
RepoStore
.
path
=
'
testing
'
;
vm
.
entryName
=
'
testing/app
'
;
vm
.
$el
.
querySelector
(
'
.btn-success
'
).
click
();
expect
(
RepoStore
.
files
[
0
].
path
).
toBe
(
'
testing/app
'
);
expect
(
RepoStore
.
files
[
0
].
name
).
toBe
(
'
app
'
);
if
(
type
===
'
tree
'
)
{
expect
(
RepoStore
.
files
[
0
].
files
.
length
).
toBe
(
1
);
}
RepoStore
.
path
=
''
;
});
});
});
...
...
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