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
42e694f3
Commit
42e694f3
authored
Jan 02, 2018
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes Based on MR Discusssions
parent
e4ff8407
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
61 deletions
+53
-61
app/assets/javascripts/ide/components/repo_file.vue
app/assets/javascripts/ide/components/repo_file.vue
+1
-1
app/assets/javascripts/ide/components/repo_tab.vue
app/assets/javascripts/ide/components/repo_tab.vue
+1
-1
app/assets/javascripts/vue_shared/components/file_icon.vue
app/assets/javascripts/vue_shared/components/file_icon.vue
+3
-3
app/assets/javascripts/vue_shared/components/file_icon/file_icon_map.js
...ascripts/vue_shared/components/file_icon/file_icon_map.js
+5
-6
spec/javascripts/vue_shared/components/file_icon_spec.js
spec/javascripts/vue_shared/components/file_icon_spec.js
+43
-50
No files found.
app/assets/javascripts/ide/components/repo_file.vue
View file @
42e694f3
...
...
@@ -95,7 +95,7 @@
class=
"repo-file-name"
>
<file-icon
:file
N
ame=
"file.name"
:file
-n
ame=
"file.name"
:loading=
"file.loading"
:folder=
"file.type === 'tree'"
:opened=
"file.opened"
...
...
app/assets/javascripts/ide/components/repo_tab.vue
View file @
42e694f3
...
...
@@ -71,7 +71,7 @@ export default {
:title="tab.url"
>
<file-icon
:file
N
ame=
"tab.name"
:file
-n
ame=
"tab.name"
:size=
"16"
>
</file-icon>
...
...
app/assets/javascripts/vue_shared/components/file_icon.vue
View file @
42e694f3
<
script
>
import
{
getIconForFile
}
from
'
./file_icon/file_icon_map
'
;
import
getIconForFile
from
'
./file_icon/file_icon_map
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
import
icon
from
'
../../vue_shared/components/icon.vue
'
;
...
...
@@ -43,7 +43,7 @@
size
:
{
type
:
Number
,
required
:
false
,
default
:
0
,
default
:
16
,
},
cssClasses
:
{
...
...
@@ -82,7 +82,7 @@
<icon
v-if=
"!loading && folder"
:name=
"folderIconName"
:size=
"size
|| 16
"
:size=
"size"
/>
<loading-icon
v-if=
"loading"
...
...
app/assets/javascripts/vue_shared/components/file_icon/file_icon_map.js
View file @
42e694f3
...
...
@@ -582,9 +582,8 @@ const fileNameIcons = {
'
.drone.yml
'
:
'
drone
'
,
};
export
const
getIconForFile
=
name
=>
fileNameIcons
[
name
]
||
fileExtensionIcons
[
name
?
name
.
split
(
'
.
'
).
pop
()
:
''
]
||
''
;
export
default
getIconForFile
;
export
default
function
getIconForFile
(
name
)
{
return
fileNameIcons
[
name
]
||
fileExtensionIcons
[
name
?
name
.
split
(
'
.
'
).
pop
()
:
''
]
||
''
;
}
spec/javascripts/vue_shared/components/file_icon_spec.js
View file @
42e694f3
import
Vue
from
'
vue
'
;
import
fileIcon
from
'
~/vue_shared/components/file_icon.vue
'
;
import
mountComponent
from
'
../../helpers/vue_mount_component_helper
'
;
describe
(
'
File Icon component
'
,
()
=>
{
let
vm
;
let
FileIcon
;
beforeEach
(()
=>
{
FileIcon
=
Vue
.
extend
(
fileIcon
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
it
(
'
should render a span element with an svg
'
,
()
=>
{
const
component
=
new
FileIcon
({
propsData
:
{
fileName
:
'
test.js
'
,
},
}).
$mount
();
expect
(
component
.
$el
.
tagName
).
toEqual
(
'
SPAN
'
);
expect
(
component
.
$el
.
querySelector
(
'
span > svg
'
)).
toBeDefined
();
vm
=
mountComponent
(
FileIcon
,
{
fileName
:
'
test.js
'
,
});
expect
(
vm
.
$el
.
tagName
).
toEqual
(
'
SPAN
'
);
expect
(
vm
.
$el
.
querySelector
(
'
span > svg
'
)).
toBeDefined
();
});
it
(
'
should render a javascript icon based on file ending
'
,
()
=>
{
const
component
=
new
FileIcon
({
propsData
:
{
fileName
:
'
test.js
'
,
},
}).
$mount
();
vm
=
mountComponent
(
FileIcon
,
{
fileName
:
'
test.js
'
,
});
expect
(
component
.
$el
.
firstChild
.
firstChild
.
getAttribute
(
'
xlink:href
'
)).
toBe
(
`
${
gon
.
sprite_file_icons
}
#javascript`
);
expect
(
vm
.
$el
.
firstChild
.
firstChild
.
getAttribute
(
'
xlink:href
'
)).
toBe
(
`
${
gon
.
sprite_file_icons
}
#javascript`
);
});
it
(
'
should render a image icon based on file ending
'
,
()
=>
{
const
component
=
new
FileIcon
({
propsData
:
{
fileName
:
'
test.png
'
,
},
}).
$mount
();
vm
=
mountComponent
(
FileIcon
,
{
fileName
:
'
test.png
'
,
});
expect
(
component
.
$el
.
firstChild
.
firstChild
.
getAttribute
(
'
xlink:href
'
)).
toBe
(
`
${
gon
.
sprite_file_icons
}
#image`
);
expect
(
vm
.
$el
.
firstChild
.
firstChild
.
getAttribute
(
'
xlink:href
'
)).
toBe
(
`
${
gon
.
sprite_file_icons
}
#image`
);
});
it
(
'
should render a webpack icon based on file namer
'
,
()
=>
{
const
component
=
new
FileIcon
({
propsData
:
{
fileName
:
'
webpack.js
'
,
},
}).
$mount
();
vm
=
mountComponent
(
FileIcon
,
{
fileName
:
'
webpack.js
'
,
});
expect
(
component
.
$el
.
firstChild
.
firstChild
.
getAttribute
(
'
xlink:href
'
)).
toBe
(
`
${
gon
.
sprite_file_icons
}
#webpack`
);
expect
(
vm
.
$el
.
firstChild
.
firstChild
.
getAttribute
(
'
xlink:href
'
)).
toBe
(
`
${
gon
.
sprite_file_icons
}
#webpack`
);
});
it
(
'
should render a standard folder icon
'
,
()
=>
{
const
component
=
new
FileIcon
({
propsData
:
{
fileName
:
'
js
'
,
folder
:
true
,
},
}).
$mount
();
expect
(
component
.
$el
.
querySelector
(
'
span > svg > use
'
).
getAttribute
(
'
xlink:href
'
)).
toBe
(
`
${
gon
.
sprite_file_icons
}
#folder`
);
vm
=
mountComponent
(
FileIcon
,
{
fileName
:
'
js
'
,
folder
:
true
,
});
expect
(
vm
.
$el
.
querySelector
(
'
span > svg > use
'
).
getAttribute
(
'
xlink:href
'
)).
toBe
(
`
${
gon
.
sprite_file_icons
}
#folder`
);
});
it
(
'
should render a loading icon
'
,
()
=>
{
const
component
=
new
FileIcon
({
propsData
:
{
fileName
:
'
test.js
'
,
loading
:
true
,
},
}).
$mount
();
vm
=
mountComponent
(
FileIcon
,
{
fileName
:
'
test.js
'
,
loading
:
true
,
});
expect
(
component
.
$el
.
querySelector
(
'
i
'
).
getAttribute
(
'
class
'
),
vm
.
$el
.
querySelector
(
'
i
'
).
getAttribute
(
'
class
'
),
).
toEqual
(
'
fa fa-spin fa-spinner fa-1x
'
);
});
it
(
'
should add a special class and a size class
'
,
()
=>
{
const
component
=
new
FileIcon
({
propsData
:
{
fileName
:
'
test.js
'
,
cssClasses
:
'
extraclasses
'
,
size
:
120
,
},
}).
$mount
();
const
classList
=
component
.
$el
.
firstChild
.
classList
;
vm
=
mountComponent
(
FileIcon
,
{
fileName
:
'
test.js
'
,
cssClasses
:
'
extraclasses
'
,
size
:
120
,
});
const
classList
=
vm
.
$el
.
firstChild
.
classList
;
const
containsSizeClass
=
classList
.
contains
(
'
s120
'
);
const
containsCustomClass
=
classList
.
contains
(
'
extraclasses
'
);
expect
(
containsSizeClass
).
toBe
(
true
);
...
...
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