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
356a37cf
Commit
356a37cf
authored
Apr 19, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added spec to new file dropdown
parent
abccda6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
52 deletions
+60
-52
app/assets/javascripts/ide/components/new_dropdown/index.vue
app/assets/javascripts/ide/components/new_dropdown/index.vue
+44
-46
spec/javascripts/ide/components/new_dropdown/index_spec.js
spec/javascripts/ide/components/new_dropdown/index_spec.js
+16
-6
No files found.
app/assets/javascripts/ide/components/new_dropdown/index.vue
View file @
356a37cf
<
script
>
import
{
mapActions
}
from
'
vuex
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
newModal
from
'
./modal.vue
'
;
import
upload
from
'
./upload.vue
'
;
import
{
mapActions
}
from
'
vuex
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
newModal
from
'
./modal.vue
'
;
import
upload
from
'
./upload.vue
'
;
export
default
{
components
:
{
icon
,
newModal
,
upload
,
export
default
{
components
:
{
icon
,
newModal
,
upload
,
},
props
:
{
branch
:
{
type
:
String
,
required
:
true
,
},
props
:
{
branch
:
{
type
:
String
,
required
:
true
,
},
path
:
{
type
:
String
,
required
:
true
,
},
path
:
{
type
:
String
,
required
:
true
,
},
data
()
{
return
{
openModal
:
false
,
modalType
:
''
,
dropdownOpen
:
false
,
};
},
data
()
{
return
{
openModal
:
false
,
modalType
:
''
,
dropdownOpen
:
false
,
};
},
watch
:
{
dropdownOpen
()
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
dropdownMenu
.
scrollIntoView
();
});
},
watch
:
{
dropdownOpen
()
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
dropdownMenu
.
scrollIntoView
();
});
},
},
methods
:
{
...
mapActions
([
'
createTempEntry
'
]),
createNewItem
(
type
)
{
this
.
modalType
=
type
;
this
.
openModal
=
true
;
this
.
dropdownOpen
=
false
;
},
methods
:
{
...
mapActions
([
'
createTempEntry
'
,
]),
createNewItem
(
type
)
{
this
.
modalType
=
type
;
this
.
openModal
=
true
;
this
.
dropdownOpen
=
false
;
},
hideModal
()
{
this
.
openModal
=
false
;
},
openDropdown
()
{
this
.
dropdownOpen
=
!
this
.
dropdownOpen
;
},
hideModal
()
{
this
.
openModal
=
false
;
},
};
openDropdown
()
{
this
.
dropdownOpen
=
!
this
.
dropdownOpen
;
},
},
};
</
script
>
<
template
>
...
...
spec/javascripts/ide/components/new_dropdown/index_spec.js
View file @
356a37cf
...
...
@@ -32,12 +32,8 @@ describe('new dropdown component', () => {
it
(
'
renders new file, upload and new directory links
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
a
'
)[
0
].
textContent
.
trim
()).
toBe
(
'
New file
'
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
a
'
)[
1
].
textContent
.
trim
()).
toBe
(
'
Upload file
'
,
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
a
'
)[
2
].
textContent
.
trim
()).
toBe
(
'
New directory
'
,
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
a
'
)[
1
].
textContent
.
trim
()).
toBe
(
'
Upload file
'
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
a
'
)[
2
].
textContent
.
trim
()).
toBe
(
'
New directory
'
);
});
describe
(
'
createNewItem
'
,
()
=>
{
...
...
@@ -81,4 +77,18 @@ describe('new dropdown component', () => {
.
catch
(
done
.
fail
);
});
});
describe
(
'
dropdownOpen
'
,
()
=>
{
it
(
'
scrolls dropdown into view
'
,
done
=>
{
spyOn
(
vm
.
$refs
.
dropdownMenu
,
'
scrollIntoView
'
);
vm
.
dropdownOpen
=
true
;
setTimeout
(()
=>
{
expect
(
vm
.
$refs
.
dropdownMenu
.
scrollIntoView
).
toHaveBeenCalled
();
done
();
});
});
});
});
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