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
a00fea40
Commit
a00fea40
authored
Feb 17, 2021
by
Brandon Everett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to GlTab in repo tabs view
Fixes
https://gitlab.com/gitlab-org/gitlab/-/issues/230726
parent
266744a6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
28 deletions
+48
-28
app/assets/javascripts/ide/components/repo_tab.vue
app/assets/javascripts/ide/components/repo_tab.vue
+24
-22
app/assets/javascripts/ide/components/repo_tabs.vue
app/assets/javascripts/ide/components/repo_tabs.vue
+4
-2
changelogs/unreleased/feature-230726-repo-tabs.yml
changelogs/unreleased/feature-230726-repo-tabs.yml
+5
-0
spec/frontend/ide/components/repo_tab_spec.js
spec/frontend/ide/components/repo_tab_spec.js
+15
-4
No files found.
app/assets/javascripts/ide/components/repo_tab.vue
View file @
a00fea40
<
script
>
<
script
>
import
{
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
GlIcon
,
GlTab
}
from
'
@gitlab/ui
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
...
@@ -13,6 +13,7 @@ export default {
...
@@ -13,6 +13,7 @@ export default {
FileIcon
,
FileIcon
,
GlIcon
,
GlIcon
,
ChangedFileIcon
,
ChangedFileIcon
,
GlTab
,
},
},
props
:
{
props
:
{
tab
:
{
tab
:
{
...
@@ -71,15 +72,15 @@ export default {
...
@@ -71,15 +72,15 @@ export default {
</
script
>
</
script
>
<
template
>
<
template
>
<li
<gl-tab
:class=
"
{
:active=
"tab.active"
active: tab.active,
:disabled=
"tab.pending"
disabled: tab.pending,
:title=
"tab.name"
}"
@
click=
"clickFile(tab)"
@
click=
"clickFile(tab)"
@
mouseover=
"mouseOverTab"
@
mouseover=
"mouseOverTab"
@
mouseout=
"mouseOutTab"
@
mouseout=
"mouseOutTab"
>
>
<template
#title
>
<div
:title=
"getUrlForPath(tab.path)"
class=
"multi-file-tab"
>
<div
:title=
"getUrlForPath(tab.path)"
class=
"multi-file-tab"
>
<file-icon
:file-name=
"tab.name"
:size=
"16"
/>
<file-icon
:file-name=
"tab.name"
:size=
"16"
/>
{{
tab
.
name
}}
{{
tab
.
name
}}
...
@@ -95,5 +96,6 @@ export default {
...
@@ -95,5 +96,6 @@ export default {
<gl-icon
v-if=
"!showChangedIcon"
:size=
"12"
name=
"close"
/>
<gl-icon
v-if=
"!showChangedIcon"
:size=
"12"
name=
"close"
/>
<changed-file-icon
v-else
:file=
"tab"
/>
<changed-file-icon
v-else
:file=
"tab"
/>
</button>
</button>
</li>
</
template
>
</gl-tab>
</template>
</template>
app/assets/javascripts/ide/components/repo_tabs.vue
View file @
a00fea40
<
script
>
<
script
>
import
{
GlTabs
}
from
'
@gitlab/ui
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
RepoTab
from
'
./repo_tab.vue
'
;
import
RepoTab
from
'
./repo_tab.vue
'
;
export
default
{
export
default
{
components
:
{
components
:
{
RepoTab
,
RepoTab
,
GlTabs
,
},
},
props
:
{
props
:
{
activeFile
:
{
activeFile
:
{
...
@@ -42,8 +44,8 @@ export default {
...
@@ -42,8 +44,8 @@ export default {
<
template
>
<
template
>
<div
class=
"multi-file-tabs"
>
<div
class=
"multi-file-tabs"
>
<
ul
ref=
"tabsScroller"
class=
"list-unstyled gl-mb-0"
>
<
gl-tabs
>
<repo-tab
v-for=
"tab in files"
:key=
"tab.key"
:tab=
"tab"
/>
<repo-tab
v-for=
"tab in files"
:key=
"tab.key"
:tab=
"tab"
/>
</
ul
>
</
gl-tabs
>
</div>
</div>
</
template
>
</
template
>
changelogs/unreleased/feature-230726-repo-tabs.yml
0 → 100644
View file @
a00fea40
---
title
:
convert to GlTabs in app/assets/javascripts/ide/components/repo_tabs.vue
merge_request
:
42162
author
:
Brandon Everett
type
:
added
spec/frontend/ide/components/repo_tab_spec.js
View file @
a00fea40
import
{
GlTab
}
from
'
@gitlab/ui
'
;
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
mount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
import
RepoTab
from
'
~/ide/components/repo_tab.vue
'
;
import
RepoTab
from
'
~/ide/components/repo_tab.vue
'
;
import
{
createRouter
}
from
'
~/ide/ide_router
'
;
import
{
createRouter
}
from
'
~/ide/ide_router
'
;
import
{
createStore
}
from
'
~/ide/stores
'
;
import
{
createStore
}
from
'
~/ide/stores
'
;
...
@@ -8,16 +10,25 @@ import { file } from '../helpers';
...
@@ -8,16 +10,25 @@ import { file } from '../helpers';
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
const
GlTabStub
=
stubComponent
(
GlTab
,
{
template
:
'
<li><slot name="title" /></li>
'
,
});
describe
(
'
RepoTab
'
,
()
=>
{
describe
(
'
RepoTab
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
let
store
;
let
store
;
let
router
;
let
router
;
const
findTab
=
()
=>
wrapper
.
find
(
GlTabStub
);
function
createComponent
(
propsData
)
{
function
createComponent
(
propsData
)
{
wrapper
=
mount
(
RepoTab
,
{
wrapper
=
mount
(
RepoTab
,
{
localVue
,
localVue
,
store
,
store
,
propsData
,
propsData
,
stubs
:
{
GlTab
:
GlTabStub
,
},
});
});
}
}
...
@@ -55,7 +66,7 @@ describe('RepoTab', () => {
...
@@ -55,7 +66,7 @@ describe('RepoTab', () => {
jest
.
spyOn
(
wrapper
.
vm
,
'
openPendingTab
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
wrapper
.
vm
,
'
openPendingTab
'
).
mockImplementation
(()
=>
{});
await
wrapper
.
trigger
(
'
click
'
);
await
findTab
().
vm
.
$emit
(
'
click
'
);
expect
(
wrapper
.
vm
.
openPendingTab
).
not
.
toHaveBeenCalled
();
expect
(
wrapper
.
vm
.
openPendingTab
).
not
.
toHaveBeenCalled
();
});
});
...
@@ -67,7 +78,7 @@ describe('RepoTab', () => {
...
@@ -67,7 +78,7 @@ describe('RepoTab', () => {
jest
.
spyOn
(
wrapper
.
vm
,
'
clickFile
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
wrapper
.
vm
,
'
clickFile
'
).
mockImplementation
(()
=>
{});
wrapper
.
trigger
(
'
click
'
);
findTab
().
vm
.
$emit
(
'
click
'
);
expect
(
wrapper
.
vm
.
clickFile
).
toHaveBeenCalledWith
(
wrapper
.
vm
.
tab
);
expect
(
wrapper
.
vm
.
clickFile
).
toHaveBeenCalledWith
(
wrapper
.
vm
.
tab
);
});
});
...
@@ -91,11 +102,11 @@ describe('RepoTab', () => {
...
@@ -91,11 +102,11 @@ describe('RepoTab', () => {
tab
,
tab
,
});
});
await
wrapper
.
trigger
(
'
mouseover
'
);
await
findTab
().
vm
.
$emit
(
'
mouseover
'
);
expect
(
wrapper
.
find
(
'
.file-modified
'
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
(
'
.file-modified
'
).
exists
()).
toBe
(
false
);
await
wrapper
.
trigger
(
'
mouseout
'
);
await
findTab
().
vm
.
$emit
(
'
mouseout
'
);
expect
(
wrapper
.
find
(
'
.file-modified
'
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
'
.file-modified
'
).
exists
()).
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