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
1611beae
Commit
1611beae
authored
Feb 07, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes new directory not working corretly
Closes
https://gitlab.com/gitlab-org/gitlab/issues/202656
parent
ad751861
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
4 deletions
+34
-4
app/assets/javascripts/repository/utils/dom.js
app/assets/javascripts/repository/utils/dom.js
+3
-1
spec/features/projects/files/user_creates_directory_spec.rb
spec/features/projects/files/user_creates_directory_spec.rb
+21
-0
spec/frontend/repository/utils/dom_spec.js
spec/frontend/repository/utils/dom_spec.js
+10
-3
No files found.
app/assets/javascripts/repository/utils/dom.js
View file @
1611beae
import
{
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
export
const
updateElementsVisibility
=
(
selector
,
isVisible
)
=>
{
export
const
updateElementsVisibility
=
(
selector
,
isVisible
)
=>
{
document
.
querySelectorAll
(
selector
).
forEach
(
elem
=>
elem
.
classList
.
toggle
(
'
hidden
'
,
!
isVisible
));
document
.
querySelectorAll
(
selector
).
forEach
(
elem
=>
elem
.
classList
.
toggle
(
'
hidden
'
,
!
isVisible
));
};
};
...
@@ -6,6 +8,6 @@ export const updateFormAction = (selector, basePath, path) => {
...
@@ -6,6 +8,6 @@ export const updateFormAction = (selector, basePath, path) => {
const
form
=
document
.
querySelector
(
selector
);
const
form
=
document
.
querySelector
(
selector
);
if
(
form
)
{
if
(
form
)
{
form
.
action
=
`
${
basePath
}${
path
}
`
;
form
.
action
=
joinPaths
(
basePath
,
path
)
;
}
}
};
};
spec/features/projects/files/user_creates_directory_spec.rb
View file @
1611beae
...
@@ -16,6 +16,8 @@ describe 'Projects > Files > User creates a directory', :js do
...
@@ -16,6 +16,8 @@ describe 'Projects > Files > User creates a directory', :js do
project
.
add_developer
(
user
)
project
.
add_developer
(
user
)
sign_in
(
user
)
sign_in
(
user
)
visit
project_tree_path
(
project
,
'master'
)
visit
project_tree_path
(
project
,
'master'
)
wait_for_requests
end
end
context
'with default target branch'
do
context
'with default target branch'
do
...
@@ -43,6 +45,25 @@ describe 'Projects > Files > User creates a directory', :js do
...
@@ -43,6 +45,25 @@ describe 'Projects > Files > User creates a directory', :js do
end
end
end
end
context
'inside sub-folder'
do
it
'creates new directory'
do
click_link
'files'
page
.
within
(
'.repo-breadcrumb'
)
do
expect
(
page
).
to
have_link
(
'files'
)
end
first
(
'.add-to-tree'
).
click
click_link
(
'New directory'
)
fill_in
(
:dir_name
,
with:
'new_directory'
)
click_button
(
'Create directory'
)
expect
(
page
).
to
have_content
(
'files'
)
expect
(
page
).
to
have_content
(
'new_directory'
)
end
end
context
'with a new target branch'
do
context
'with a new target branch'
do
before
do
before
do
first
(
'.add-to-tree'
).
click
first
(
'.add-to-tree'
).
click
...
...
spec/frontend/repository/utils/dom_spec.js
View file @
1611beae
...
@@ -20,11 +20,18 @@ describe('updateElementsVisibility', () => {
...
@@ -20,11 +20,18 @@ describe('updateElementsVisibility', () => {
});
});
describe
(
'
updateFormAction
'
,
()
=>
{
describe
(
'
updateFormAction
'
,
()
=>
{
it
(
'
updates form action
'
,
()
=>
{
it
.
each
`
path
${
'
/test
'
}
${
'
test
'
}
${
'
/
'
}
`
(
'
updates form action for $path
'
,
({
path
})
=>
{
setHTMLFixture
(
'
<form class="js-test" action="/"></form>
'
);
setHTMLFixture
(
'
<form class="js-test" action="/"></form>
'
);
updateFormAction
(
'
.js-test
'
,
'
/gitlab/create
'
,
'
/test
'
);
updateFormAction
(
'
.js-test
'
,
'
/gitlab/create
'
,
path
);
expect
(
document
.
querySelector
(
'
.js-test
'
).
action
).
toBe
(
'
http://localhost/gitlab/create/test
'
);
expect
(
document
.
querySelector
(
'
.js-test
'
).
action
).
toBe
(
`http://localhost/gitlab/create/
${
path
.
replace
(
/^
\/
/
,
''
)}
`
,
);
});
});
});
});
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