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
813ea768
Commit
813ea768
authored
Mar 16, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed tests as code is already tested in store
parent
174c2f80
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
151 deletions
+40
-151
ee/app/assets/javascripts/ide/components/ide_project_branches_tree.vue
.../javascripts/ide/components/ide_project_branches_tree.vue
+19
-19
ee/app/assets/javascripts/ide/components/ide_repo_tree.vue
ee/app/assets/javascripts/ide/components/ide_repo_tree.vue
+8
-6
ee/app/assets/javascripts/ide/components/new_dropdown/upload.vue
...assets/javascripts/ide/components/new_dropdown/upload.vue
+1
-0
spec/javascripts/ide/components/new_dropdown/index_spec.js
spec/javascripts/ide/components/new_dropdown/index_spec.js
+9
-124
spec/javascripts/ide/stores/actions_spec.js
spec/javascripts/ide/stores/actions_spec.js
+3
-2
No files found.
ee/app/assets/javascripts/ide/components/ide_project_branches_tree.vue
View file @
813ea768
<
script
>
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
repoTree
from
'
./ide_repo_tree.vue
'
;
import
newDropdown
from
'
./new_dropdown/index.vue
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
repoTree
from
'
./ide_repo_tree.vue
'
;
import
newDropdown
from
'
./new_dropdown/index.vue
'
;
export
default
{
components
:
{
repoTree
,
icon
,
newDropdown
,
},
props
:
{
projectId
:
{
type
:
String
,
required
:
true
,
export
default
{
components
:
{
repoTree
,
icon
,
newDropdown
,
},
branch
:
{
type
:
Object
,
required
:
true
,
props
:
{
projectId
:
{
type
:
String
,
required
:
true
,
},
branch
:
{
type
:
Object
,
required
:
true
,
},
},
},
};
};
</
script
>
<
template
>
...
...
@@ -40,7 +40,7 @@ export default {
/>
</div>
</div>
<template
v-if=
"branch.tree"
>
<template
v-if=
"branch.tree
.length
"
>
<repo-tree
:tree=
"branch.tree"
/>
...
...
ee/app/assets/javascripts/ide/components/ide_repo_tree.vue
View file @
813ea768
...
...
@@ -29,11 +29,13 @@ export default {
<skeleton-loading-container
/>
</div>
</
template
>
<repo-file
v-for=
"file in tree.tree"
:key=
"file.key"
:file=
"file"
:level=
"0"
/>
<
template
v-else
>
<repo-file
v-for=
"file in tree.tree"
:key=
"file.key"
:file=
"file"
:level=
"0"
/>
</
template
>
</div>
</template>
ee/app/assets/javascripts/ide/components/new_dropdown/upload.vue
View file @
813ea768
...
...
@@ -7,6 +7,7 @@
},
path
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
},
...
...
spec/javascripts/ide/components/new_dropdown/index_spec.js
View file @
813ea768
...
...
@@ -32,8 +32,12 @@ 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
'
,
()
=>
{
...
...
@@ -49,7 +53,7 @@ describe('new dropdown component', () => {
expect
(
vm
.
modalType
).
toBe
(
'
tree
'
);
});
it
(
'
opens modal when link is clicked
'
,
(
done
)
=>
{
it
(
'
opens modal when link is clicked
'
,
done
=>
{
vm
.
$el
.
querySelectorAll
(
'
a
'
)[
0
].
click
();
Vue
.
nextTick
(()
=>
{
...
...
@@ -61,12 +65,12 @@ describe('new dropdown component', () => {
});
describe
(
'
hideModal
'
,
()
=>
{
beforeAll
(
(
done
)
=>
{
beforeAll
(
done
=>
{
vm
.
openModal
=
true
;
Vue
.
nextTick
(
done
);
});
it
(
'
closes modal after toggling
'
,
(
done
)
=>
{
it
(
'
closes modal after toggling
'
,
done
=>
{
vm
.
hideModal
();
Vue
.
nextTick
()
...
...
@@ -77,123 +81,4 @@ describe('new dropdown component', () => {
.
catch
(
done
.
fail
);
});
});
// TODO: move all this to the action spec
describe
(
'
createTempEntry
'
,
()
=>
{
[
'
tree
'
,
'
blob
'
].
forEach
((
type
)
=>
{
if
(
type
===
'
blob
'
)
{
it
(
'
creates new file
'
,
(
done
)
=>
{
vm
.
createTempEntry
({
branchId
:
'
mybranch
'
,
name
:
'
testing
'
,
type
,
}).
then
(()
=>
{
const
baseTree
=
vm
.
$store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
;
expect
(
baseTree
.
length
).
toBe
(
1
);
expect
(
baseTree
[
0
].
name
).
toBe
(
'
testing
'
);
expect
(
baseTree
[
0
].
type
).
toBe
(
'
blob
'
);
expect
(
baseTree
[
0
].
tempFile
).
toBeTruthy
();
done
();
})
.
catch
(
done
.
fail
);
});
it
(
'
does not create temp file when file already exists
'
,
(
done
)
=>
{
const
baseTree
=
vm
.
$store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
;
baseTree
.
push
(
file
(
'
testing
'
,
'
1
'
,
type
));
vm
.
createTempEntry
({
branchId
:
'
mybranch
'
,
name
:
'
testing
'
,
type
,
})
.
then
(()
=>
{
expect
(
baseTree
.
length
).
toBe
(
1
);
expect
(
baseTree
[
0
].
name
).
toBe
(
'
testing
'
);
expect
(
baseTree
[
0
].
type
).
toBe
(
'
blob
'
);
expect
(
baseTree
[
0
].
tempFile
).
toBeFalsy
();
done
();
})
.
catch
(
done
.
fail
);
});
}
else
{
it
(
'
creates new tree
'
,
(
done
)
=>
{
vm
.
createTempEntry
({
branchId
:
'
mybranch
'
,
name
:
'
testing
'
,
type
,
})
.
then
(()
=>
{
const
baseTree
=
vm
.
$store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
;
expect
(
baseTree
.
length
).
toBe
(
1
);
expect
(
baseTree
[
0
].
name
).
toBe
(
'
testing
'
);
expect
(
baseTree
[
0
].
type
).
toBe
(
'
tree
'
);
expect
(
baseTree
[
0
].
tempFile
).
toBeTruthy
();
done
();
})
.
catch
(
done
.
fail
);
});
it
(
'
creates multiple trees when entryName has slashes
'
,
(
done
)
=>
{
vm
.
createTempEntry
({
branchId
:
'
mybranch
'
,
name
:
'
app/test
'
,
type
,
})
.
then
(()
=>
{
const
baseTree
=
vm
.
$store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
;
expect
(
baseTree
.
length
).
toBe
(
1
);
expect
(
baseTree
[
0
].
name
).
toBe
(
'
app
'
);
done
();
})
.
catch
(
done
.
fail
);
});
it
(
'
creates tree in existing tree
'
,
(
done
)
=>
{
const
f
=
file
(
'
app
'
,
'
1
'
,
'
tree
'
);
const
baseTree
=
vm
.
$store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
;
baseTree
.
push
(
f
);
vm
.
$store
.
state
.
entries
[
f
.
path
]
=
f
;
vm
.
entryName
=
'
app/test
'
;
vm
.
createTempEntry
({
branchId
:
'
mybranch
'
,
name
:
'
app/test
'
,
type
,
}).
then
(()
=>
{
expect
(
baseTree
.
length
).
toBe
(
1
);
// console.log(baseTree[0].tree);
expect
(
baseTree
[
0
].
name
).
toBe
(
'
app
'
);
expect
(
baseTree
[
0
].
tempFile
).
toBeFalsy
();
expect
(
baseTree
[
0
].
tree
[
0
].
tempFile
).
toBeTruthy
();
expect
(
baseTree
[
0
].
tree
[
0
].
name
).
toBe
(
'
test
'
);
done
();
}).
catch
(
done
.
fail
);
});
it
(
'
does not create new tree when already exists
'
,
(
done
)
=>
{
const
baseTree
=
vm
.
$store
.
state
.
trees
[
'
abcproject/mybranch
'
].
tree
;
baseTree
.
push
(
file
(
'
app
'
,
'
1
'
,
'
tree
'
));
vm
.
createTempEntry
({
branchId
:
'
mybranch
'
,
name
:
'
app
'
,
type
,
}).
then
(()
=>
{
expect
(
baseTree
.
length
).
toBe
(
1
);
expect
(
baseTree
[
0
].
name
).
toBe
(
'
app
'
);
expect
(
baseTree
[
0
].
tempFile
).
toBeFalsy
();
expect
(
baseTree
[
0
].
tree
.
length
).
toBe
(
0
);
done
();
}).
catch
(
done
.
fail
);
});
}
});
});
});
spec/javascripts/ide/stores/actions_spec.js
View file @
813ea768
...
...
@@ -293,8 +293,9 @@ describe('Multi-file store actions', () => {
});
describe
(
'
updateViewer
'
,
()
=>
{
it
(
'
updates viewer state
'
,
(
done
)
=>
{
store
.
dispatch
(
'
updateViewer
'
,
'
diff
'
)
it
(
'
updates viewer state
'
,
done
=>
{
store
.
dispatch
(
'
updateViewer
'
,
'
diff
'
)
.
then
(()
=>
{
expect
(
store
.
state
.
viewer
).
toBe
(
'
diff
'
);
})
...
...
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