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
8ed5f601
Commit
8ed5f601
authored
Jun 11, 2021
by
Denys Mishunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed master-to-main in WebIDE files
We're preparing to move to main as default branch
parent
726054b8
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
189 additions
and
189 deletions
+189
-189
app/assets/javascripts/ide/constants.js
app/assets/javascripts/ide/constants.js
+2
-0
app/assets/javascripts/ide/ide_router.js
app/assets/javascripts/ide/ide_router.js
+5
-5
app/assets/javascripts/ide/index.js
app/assets/javascripts/ide/index.js
+2
-1
app/assets/javascripts/ide/utils.js
app/assets/javascripts/ide/utils.js
+1
-1
app/assets/javascripts/static_site_editor/rich_content_editor/services/renderers/render_identifier_instance_text.js
...tor/services/renderers/render_identifier_instance_text.js
+1
-1
app/assets/stylesheets/components/rich_content_editor.scss
app/assets/stylesheets/components/rich_content_editor.scss
+1
-1
app/helpers/ide_helper.rb
app/helpers/ide_helper.rb
+1
-0
spec/frontend/ide/components/branches/item_spec.js
spec/frontend/ide/components/branches/item_spec.js
+1
-1
spec/frontend/ide/components/commit_sidebar/actions_spec.js
spec/frontend/ide/components/commit_sidebar/actions_spec.js
+5
-9
spec/frontend/ide/components/commit_sidebar/form_spec.js
spec/frontend/ide/components/commit_sidebar/form_spec.js
+1
-1
spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js
...omponents/commit_sidebar/new_merge_request_option_spec.js
+3
-3
spec/frontend/ide/components/ide_review_spec.js
spec/frontend/ide/components/ide_review_spec.js
+2
-2
spec/frontend/ide/components/ide_spec.js
spec/frontend/ide/components/ide_spec.js
+2
-2
spec/frontend/ide/components/ide_status_bar_spec.js
spec/frontend/ide/components/ide_status_bar_spec.js
+1
-1
spec/frontend/ide/components/ide_tree_list_spec.js
spec/frontend/ide/components/ide_tree_list_spec.js
+3
-3
spec/frontend/ide/components/ide_tree_spec.js
spec/frontend/ide/components/ide_tree_spec.js
+2
-2
spec/frontend/ide/components/merge_requests/list_spec.js
spec/frontend/ide/components/merge_requests/list_spec.js
+1
-1
spec/frontend/ide/components/nav_dropdown_spec.js
spec/frontend/ide/components/nav_dropdown_spec.js
+2
-2
spec/frontend/ide/components/new_dropdown/index_spec.js
spec/frontend/ide/components/new_dropdown/index_spec.js
+1
-1
spec/frontend/ide/components/repo_commit_section_spec.js
spec/frontend/ide/components/repo_commit_section_spec.js
+3
-3
spec/frontend/ide/components/repo_editor_spec.js
spec/frontend/ide/components/repo_editor_spec.js
+3
-3
spec/frontend/ide/ide_router_spec.js
spec/frontend/ide/ide_router_spec.js
+6
-6
spec/frontend/ide/mock_data.js
spec/frontend/ide/mock_data.js
+7
-7
spec/frontend/ide/services/index_spec.js
spec/frontend/ide/services/index_spec.js
+1
-1
spec/frontend/ide/stores/actions/file_spec.js
spec/frontend/ide/stores/actions/file_spec.js
+8
-8
spec/frontend/ide/stores/actions/merge_request_spec.js
spec/frontend/ide/stores/actions/merge_request_spec.js
+2
-2
spec/frontend/ide/stores/actions/project_spec.js
spec/frontend/ide/stores/actions/project_spec.js
+16
-16
spec/frontend/ide/stores/actions/tree_spec.js
spec/frontend/ide/stores/actions/tree_spec.js
+11
-11
spec/frontend/ide/stores/actions_spec.js
spec/frontend/ide/stores/actions_spec.js
+3
-3
spec/frontend/ide/stores/getters_spec.js
spec/frontend/ide/stores/getters_spec.js
+18
-18
spec/frontend/ide/stores/modules/commit/actions_spec.js
spec/frontend/ide/stores/modules/commit/actions_spec.js
+11
-11
spec/frontend/ide/stores/modules/commit/getters_spec.js
spec/frontend/ide/stores/modules/commit/getters_spec.js
+2
-2
spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js
...ontend/ide/stores/modules/terminal/actions/checks_spec.js
+1
-1
spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js
.../stores/modules/terminal/actions/session_controls_spec.js
+1
-1
spec/frontend/ide/stores/mutations/branch_spec.js
spec/frontend/ide/stores/mutations/branch_spec.js
+5
-5
spec/frontend/ide/stores/mutations/file_spec.js
spec/frontend/ide/stores/mutations/file_spec.js
+3
-3
spec/frontend/ide/stores/mutations/tree_spec.js
spec/frontend/ide/stores/mutations/tree_spec.js
+12
-12
spec/frontend/ide/stores/mutations_spec.js
spec/frontend/ide/stores/mutations_spec.js
+11
-11
spec/frontend/ide/stores/utils_spec.js
spec/frontend/ide/stores/utils_spec.js
+9
-9
spec/frontend/ide/utils_spec.js
spec/frontend/ide/utils_spec.js
+17
-17
spec/frontend/vue_shared/components/web_ide_link_spec.js
spec/frontend/vue_shared/components/web_ide_link_spec.js
+2
-2
No files found.
app/assets/javascripts/ide/constants.js
View file @
8ed5f601
...
...
@@ -112,3 +112,5 @@ export const LIVE_PREVIEW_DEBOUNCE = 2000;
// This is the maximum number of files to auto open when opening the Web IDE
// from a merge request
export
const
MAX_MR_FILES_AUTO_OPEN
=
10
;
export
const
DEFAULT_BRANCH
=
'
main
'
;
app/assets/javascripts/ide/ide_router.js
View file @
8ed5f601
...
...
@@ -16,8 +16,8 @@ Vue.use(IdeRouter);
/**
* Routes below /-/ide/:
/project/h5bp/html5-boilerplate/blob/ma
ster
/project/h5bp/html5-boilerplate/blob/ma
ster
/app/js/test.js
/project/h5bp/html5-boilerplate/blob/ma
in
/project/h5bp/html5-boilerplate/blob/ma
in
/app/js/test.js
/project/h5bp/html5-boilerplate/mr/123
/project/h5bp/html5-boilerplate/mr/123/app/js/test.js
...
...
@@ -39,7 +39,7 @@ const EmptyRouterComponent = {
},
};
export
const
createRouter
=
(
store
)
=>
{
export
const
createRouter
=
(
store
,
defaultBranch
)
=>
{
const
router
=
new
IdeRouter
({
mode
:
'
history
'
,
base
:
joinPaths
(
gon
.
relative_url_root
||
''
,
'
/-/ide/
'
),
...
...
@@ -58,7 +58,7 @@ export const createRouter = (store) => {
},
{
path
:
'
:targetmode(edit|tree|blob)
'
,
redirect
:
(
to
)
=>
joinPaths
(
to
.
path
,
'
/master/-/
'
),
redirect
:
(
to
)
=>
joinPaths
(
to
.
path
,
`/
${
defaultBranch
}
/-/`
),
},
{
path
:
'
merge_requests/:mrid
'
,
...
...
@@ -66,7 +66,7 @@ export const createRouter = (store) => {
},
{
path
:
''
,
redirect
:
(
to
)
=>
joinPaths
(
to
.
path
,
'
/edit/master/-/
'
),
redirect
:
(
to
)
=>
joinPaths
(
to
.
path
,
`/edit/
${
defaultBranch
}
/-/`
),
},
],
},
...
...
app/assets/javascripts/ide/index.js
View file @
8ed5f601
import
{
identity
}
from
'
lodash
'
;
import
Vue
from
'
vue
'
;
import
{
mapActions
}
from
'
vuex
'
;
import
{
DEFAULT_BRANCH
}
from
'
~/ide/constants
'
;
import
PerformancePlugin
from
'
~/performance/vue_performance_plugin
'
;
import
Translate
from
'
~/vue_shared/translate
'
;
import
{
parseBoolean
}
from
'
../lib/utils/common_utils
'
;
...
...
@@ -38,7 +39,7 @@ export function initIde(el, options = {}) {
const
{
rootComponent
=
ide
,
extendStore
=
identity
}
=
options
;
const
store
=
createStore
();
const
router
=
createRouter
(
store
);
const
router
=
createRouter
(
store
,
el
.
dataset
.
defaultBranch
||
DEFAULT_BRANCH
);
return
new
Vue
({
el
,
...
...
app/assets/javascripts/ide/utils.js
View file @
8ed5f601
...
...
@@ -146,7 +146,7 @@ export function getFileEOL(content = '') {
* hello.md -> hello-1.md
* hello_2.md -> hello_3.md
* hello_ -> hello_1
* ma
ster-patch-22432 -> master
-patch-22433
* ma
in-patch-22432 -> main
-patch-22433
* patch_332 -> patch_333
*
* @param {string} filename File name or branch name
...
...
app/assets/javascripts/static_site_editor/rich_content_editor/services/renderers/render_identifier_instance_text.js
View file @
8ed5f601
...
...
@@ -4,7 +4,7 @@ import { buildTextToken, buildUneditableInlineTokens } from './build_uneditable_
Use case examples:
- Majority: two bracket pairs, back-to-back, each with content (including spaces)
- `[environment terraform plans][terraform]`
- `[an issue labelled `~"ma
ster:broken"`][broken-master
-issues]`
- `[an issue labelled `~"ma
in:broken"`][broken-main
-issues]`
- Minority: two bracket pairs the latter being empty or only one pair with content (including spaces)
- `[this link][]`
- `[this link]`
...
...
app/assets/stylesheets/components/rich_content_editor.scss
View file @
8ed5f601
...
...
@@ -47,7 +47,7 @@
/**
* Styling below ensures that YouTube videos are displayed in the editor the same as they would in about.gitlab.com
* https://gitlab.com/gitlab-com/www-gitlab-com/-/blob/ma
ster
/source/stylesheets/_base.scss#L977
* https://gitlab.com/gitlab-com/www-gitlab-com/-/blob/ma
in
/source/stylesheets/_base.scss#L977
*/
.video_container
{
padding-bottom
:
56
.25%
;
...
...
app/helpers/ide_helper.rb
View file @
8ed5f601
...
...
@@ -14,6 +14,7 @@ module IdeHelper
'render-whitespace-in-code'
:
current_user
.
render_whitespace_in_code
.
to_s
,
'codesandbox-bundler-url'
:
Gitlab
::
CurrentSettings
.
web_ide_clientside_preview_bundler_url
,
'branch-name'
=>
@branch
,
'default-branch'
=>
@project
&&
@project
.
default_branch
,
'file-path'
=>
@path
,
'merge-request'
=>
@merge_request
,
'fork-info'
=>
@fork_info
&
.
to_json
,
...
...
spec/frontend/ide/components/branches/item_spec.js
View file @
8ed5f601
...
...
@@ -7,7 +7,7 @@ import Timeago from '~/vue_shared/components/time_ago_tooltip.vue';
import
{
projectData
}
from
'
../../mock_data
'
;
const
TEST_BRANCH
=
{
name
:
'
ma
ster
'
,
name
:
'
ma
in
'
,
committedDate
:
'
2018-01-05T05:50Z
'
,
};
const
TEST_PROJECT_ID
=
projectData
.
name_with_namespace
;
...
...
spec/frontend/ide/components/commit_sidebar/actions_spec.js
View file @
8ed5f601
...
...
@@ -10,7 +10,7 @@ import {
const
ACTION_UPDATE_COMMIT_ACTION
=
'
commit/updateCommitAction
'
;
const
BRANCH_DEFAULT
=
'
ma
ster
'
;
const
BRANCH_DEFAULT
=
'
ma
in
'
;
const
BRANCH_PROTECTED
=
'
protected/access
'
;
const
BRANCH_PROTECTED_NO_ACCESS
=
'
protected/no-access
'
;
const
BRANCH_REGULAR
=
'
regular
'
;
...
...
@@ -20,11 +20,7 @@ describe('IDE commit sidebar actions', () => {
let
store
;
let
vm
;
const
createComponent
=
({
hasMR
=
false
,
currentBranchId
=
'
master
'
,
emptyRepo
=
false
,
}
=
{})
=>
{
const
createComponent
=
({
hasMR
=
false
,
currentBranchId
=
'
main
'
,
emptyRepo
=
false
}
=
{})
=>
{
const
Component
=
Vue
.
extend
(
commitActions
);
vm
=
createComponentWithStore
(
Component
,
store
);
...
...
@@ -72,7 +68,7 @@ describe('IDE commit sidebar actions', () => {
it
(
'
renders current branch text
'
,
()
=>
{
createComponent
();
expect
(
findText
()).
toContain
(
'
Commit to ma
ster
branch
'
);
expect
(
findText
()).
toContain
(
'
Commit to ma
in
branch
'
);
});
it
(
'
hides merge request option when project merge requests are disabled
'
,
(
done
)
=>
{
...
...
@@ -112,7 +108,7 @@ describe('IDE commit sidebar actions', () => {
it
(
'
calls again after staged changes
'
,
(
done
)
=>
{
createComponent
({
currentBranchId
:
null
});
vm
.
$store
.
state
.
currentBranchId
=
'
ma
ster
'
;
vm
.
$store
.
state
.
currentBranchId
=
'
ma
in
'
;
vm
.
$store
.
state
.
changedFiles
.
push
({});
vm
.
$store
.
state
.
stagedFiles
.
push
({});
...
...
@@ -158,7 +154,7 @@ describe('IDE commit sidebar actions', () => {
it
(
'
only renders commit to current branch
'
,
()
=>
{
expect
(
findRadios
().
length
).
toBe
(
1
);
expect
(
findText
()).
toContain
(
'
Commit to ma
ster
branch
'
);
expect
(
findText
()).
toContain
(
'
Commit to ma
in
branch
'
);
});
});
});
spec/frontend/ide/components/commit_sidebar/form_spec.js
View file @
8ed5f601
...
...
@@ -67,7 +67,7 @@ describe('IDE commit form', () => {
store
=
createStore
();
store
.
state
.
stagedFiles
.
push
(
'
test
'
);
store
.
state
.
currentProjectId
=
'
abcproject
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
Vue
.
set
(
store
.
state
.
projects
,
'
abcproject
'
,
{
...
projectData
,
userPermissions
:
{
pushCode
:
true
},
...
...
spec/frontend/ide/components/commit_sidebar/new_merge_request_option_spec.js
View file @
8ed5f601
...
...
@@ -24,7 +24,7 @@ describe('create new MR checkbox', () => {
store
.
state
.
projects
[
store
.
state
.
currentProjectId
].
userPermissions
=
permissions
;
};
const
createComponent
=
({
currentBranchId
=
'
ma
ster
'
,
createNewBranch
=
false
}
=
{})
=>
{
const
createComponent
=
({
currentBranchId
=
'
ma
in
'
,
createNewBranch
=
false
}
=
{})
=>
{
const
Component
=
Vue
.
extend
(
NewMergeRequestOption
);
vm
=
createComponentWithStore
(
Component
,
store
);
...
...
@@ -63,7 +63,7 @@ describe('create new MR checkbox', () => {
describe
(
'
is rendered when pushing to a new branch
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
currentBranchId
:
'
ma
ster
'
,
currentBranchId
:
'
ma
in
'
,
createNewBranch
:
true
,
});
});
...
...
@@ -87,7 +87,7 @@ describe('create new MR checkbox', () => {
describe
(
'
is NOT rendered when pushing to the same branch
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
currentBranchId
:
'
ma
ster
'
,
currentBranchId
:
'
ma
in
'
,
createNewBranch
:
false
,
});
});
...
...
spec/frontend/ide/components/ide_review_spec.js
View file @
8ed5f601
...
...
@@ -19,9 +19,9 @@ describe('IDE review mode', () => {
beforeEach
(()
=>
{
store
=
createStore
();
store
.
state
.
currentProjectId
=
'
abcproject
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
store
.
state
.
projects
.
abcproject
=
{
...
projectData
};
Vue
.
set
(
store
.
state
.
trees
,
'
abcproject/ma
ster
'
,
{
Vue
.
set
(
store
.
state
.
trees
,
'
abcproject/ma
in
'
,
{
tree
:
[
file
(
'
fileName
'
)],
loading
:
false
,
});
...
...
spec/frontend/ide/components/ide_spec.js
View file @
8ed5f601
...
...
@@ -22,9 +22,9 @@ describe('WebIDE', () => {
const
createComponent
=
({
projData
=
emptyProjData
,
state
=
{}
}
=
{})
=>
{
store
.
state
.
currentProjectId
=
'
abcproject
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
store
.
state
.
projects
.
abcproject
=
projData
&&
{
...
projData
};
store
.
state
.
trees
[
'
abcproject/ma
ster
'
]
=
{
store
.
state
.
trees
[
'
abcproject/ma
in
'
]
=
{
tree
:
[],
loading
:
false
,
};
...
...
spec/frontend/ide/components/ide_status_bar_spec.js
View file @
8ed5f601
...
...
@@ -24,7 +24,7 @@ describe('ideStatusBar', () => {
store
=
createStore
();
store
.
state
.
currentProjectId
=
TEST_PROJECT_ID
;
store
.
state
.
projects
[
TEST_PROJECT_ID
]
=
_
.
clone
(
projectData
);
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
});
afterEach
(()
=>
{
...
...
spec/frontend/ide/components/ide_tree_list_spec.js
View file @
8ed5f601
...
...
@@ -14,9 +14,9 @@ describe('IDE tree list', () => {
const
bootstrapWithTree
=
(
tree
=
normalBranchTree
)
=>
{
store
.
state
.
currentProjectId
=
'
abcproject
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
store
.
state
.
projects
.
abcproject
=
{
...
projectData
};
Vue
.
set
(
store
.
state
.
trees
,
'
abcproject/ma
ster
'
,
{
Vue
.
set
(
store
.
state
.
trees
,
'
abcproject/ma
in
'
,
{
tree
,
loading
:
false
,
});
...
...
@@ -42,7 +42,7 @@ describe('IDE tree list', () => {
});
it
(
'
renders loading indicator
'
,
(
done
)
=>
{
store
.
state
.
trees
[
'
abcproject/ma
ster
'
].
loading
=
true
;
store
.
state
.
trees
[
'
abcproject/ma
in
'
].
loading
=
true
;
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.multi-file-loading-container
'
)).
not
.
toBeNull
();
...
...
spec/frontend/ide/components/ide_tree_spec.js
View file @
8ed5f601
...
...
@@ -18,9 +18,9 @@ describe('IdeTree', () => {
store
=
createStore
();
store
.
state
.
currentProjectId
=
'
abcproject
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
store
.
state
.
projects
.
abcproject
=
{
...
projectData
};
Vue
.
set
(
store
.
state
.
trees
,
'
abcproject/ma
ster
'
,
{
Vue
.
set
(
store
.
state
.
trees
,
'
abcproject/ma
in
'
,
{
tree
:
[
file
(
'
fileName
'
)],
loading
:
false
,
});
...
...
spec/frontend/ide/components/merge_requests/list_spec.js
View file @
8ed5f601
...
...
@@ -21,7 +21,7 @@ describe('IDE merge requests list', () => {
const
fakeStore
=
new
Vuex
.
Store
({
state
:
{
currentMergeRequestId
:
'
1
'
,
currentProjectId
:
'
project/ma
ster
'
,
currentProjectId
:
'
project/ma
in
'
,
...
restOfState
,
},
modules
:
{
...
...
spec/frontend/ide/components/nav_dropdown_spec.js
View file @
8ed5f601
...
...
@@ -14,14 +14,14 @@ describe('IDE NavDropdown', () => {
store
=
createStore
();
Object
.
assign
(
store
.
state
,
{
currentProjectId
:
TEST_PROJECT_ID
,
currentBranchId
:
'
ma
ster
'
,
currentBranchId
:
'
ma
in
'
,
projects
:
{
[
TEST_PROJECT_ID
]:
{
userPermissions
:
{
[
PERMISSION_READ_MR
]:
true
,
},
branches
:
{
ma
ster
:
{
id
:
'
master
'
},
ma
in
:
{
id
:
'
main
'
},
},
},
},
...
...
spec/frontend/ide/components/new_dropdown/index_spec.js
View file @
8ed5f601
...
...
@@ -13,7 +13,7 @@ describe('new dropdown component', () => {
const
component
=
Vue
.
extend
(
newDropdown
);
vm
=
createComponentWithStore
(
component
,
store
,
{
branch
:
'
ma
ster
'
,
branch
:
'
ma
in
'
,
path
:
''
,
mouseOver
:
false
,
type
:
'
tree
'
,
...
...
spec/frontend/ide/components/repo_commit_section_spec.js
View file @
8ed5f601
...
...
@@ -22,11 +22,11 @@ describe('RepoCommitSection', () => {
store
.
state
.
noChangesStateSvgPath
=
'
svg
'
;
store
.
state
.
committedStateSvgPath
=
'
commitsvg
'
;
store
.
state
.
currentProjectId
=
'
abcproject
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
store
.
state
.
projects
.
abcproject
=
{
web_url
:
''
,
branches
:
{
ma
ster
:
{
ma
in
:
{
workingReference
:
'
1
'
,
},
},
...
...
@@ -39,7 +39,7 @@ describe('RepoCommitSection', () => {
}),
);
store
.
state
.
currentBranch
=
'
ma
ster
'
;
store
.
state
.
currentBranch
=
'
ma
in
'
;
store
.
state
.
changedFiles
=
[];
store
.
state
.
stagedFiles
=
[{
...
files
[
0
]
},
{
...
files
[
1
]
}];
store
.
state
.
stagedFiles
.
forEach
((
f
)
=>
...
...
spec/frontend/ide/components/repo_editor_spec.js
View file @
8ed5f601
...
...
@@ -63,8 +63,8 @@ const prepareStore = (state, activeFile) => {
projects
:
{
'
gitlab-org/gitlab
'
:
{
branches
:
{
ma
ster
:
{
name
:
'
ma
ster
'
,
ma
in
:
{
name
:
'
ma
in
'
,
commit
:
{
id
:
'
abcdefgh
'
,
},
...
...
@@ -73,7 +73,7 @@ const prepareStore = (state, activeFile) => {
},
},
currentProjectId
:
'
gitlab-org/gitlab
'
,
currentBranchId
:
'
ma
ster
'
,
currentBranchId
:
'
ma
in
'
,
entries
:
{
[
activeFile
.
path
]:
activeFile
,
},
...
...
spec/frontend/ide/ide_router_spec.js
View file @
8ed5f601
...
...
@@ -18,14 +18,14 @@ describe('IDE router', () => {
});
[
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/tree/ma
ster
/-/src/blob/`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/tree/ma
ster
/-/src/blob`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/tree/ma
in
/-/src/blob/`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/tree/ma
in
/-/src/blob`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/tree/blob/-/src/blob`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/tree/ma
ster
/-/src/tree/`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/tree/ma
in
/-/src/tree/`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/tree/weird:branch/name-123/-/src/tree/`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/blob/ma
ster
/-/src/blob`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/blob/ma
ster
/-/src/edit`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/blob/ma
ster
/-/src/merge_requests/2`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/blob/ma
in
/-/src/blob`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/blob/ma
in
/-/src/edit`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/blob/ma
in
/-/src/merge_requests/2`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/blob/blob/-/src/blob`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/edit/blob/-/src/blob`
,
`/project/
${
PROJECT_NAMESPACE
}
/
${
PROJECT_NAME
}
/merge_requests/2`
,
...
...
spec/frontend/ide/mock_data.js
View file @
8ed5f601
...
...
@@ -8,8 +8,8 @@ export const projectData = {
path
:
''
,
name_with_namespace
:
'
namespace/abcproject
'
,
branches
:
{
ma
ster
:
{
treeId
:
'
abcproject/ma
ster
'
,
ma
in
:
{
treeId
:
'
abcproject/ma
in
'
,
can_push
:
true
,
commit
:
{
id
:
'
123
'
,
...
...
@@ -19,13 +19,13 @@ export const projectData = {
mergeRequests
:
{},
merge_requests_enabled
:
true
,
userPermissions
:
{},
default_branch
:
'
ma
ster
'
,
default_branch
:
'
ma
in
'
,
};
export
const
pipelines
=
[
{
id
:
1
,
ref
:
'
ma
ster
'
,
ref
:
'
ma
in
'
,
sha
:
'
123
'
,
details
:
{
status
:
{
...
...
@@ -38,7 +38,7 @@ export const pipelines = [
},
{
id
:
2
,
ref
:
'
ma
ster
'
,
ref
:
'
ma
in
'
,
sha
:
'
213
'
,
details
:
{
status
:
{
...
...
@@ -178,9 +178,9 @@ export const mergeRequests = [
export
const
branches
=
[
{
id
:
1
,
name
:
'
ma
ster
'
,
name
:
'
ma
in
'
,
commit
:
{
message
:
'
Update ma
ster
branch
'
,
message
:
'
Update ma
in
branch
'
,
committed_date
:
'
2018-08-01T00:20:05Z
'
,
},
can_push
:
true
,
...
...
spec/frontend/ide/services/index_spec.js
View file @
8ed5f601
...
...
@@ -15,7 +15,7 @@ jest.mock('~/ide/services/gql');
const
TEST_NAMESPACE
=
'
alice
'
;
const
TEST_PROJECT
=
'
wonderland
'
;
const
TEST_PROJECT_ID
=
`
${
TEST_NAMESPACE
}
/
${
TEST_PROJECT
}
`
;
const
TEST_BRANCH
=
'
ma
ster
-patch-123
'
;
const
TEST_BRANCH
=
'
ma
in
-patch-123
'
;
const
TEST_COMMIT_SHA
=
'
123456789
'
;
const
TEST_FILE_PATH
=
'
README2.md
'
;
const
TEST_FILE_OLD_PATH
=
'
OLD_README2.md
'
;
...
...
spec/frontend/ide/stores/actions/file_spec.js
View file @
8ed5f601
...
...
@@ -29,7 +29,7 @@ describe('IDE store file actions', () => {
store
=
createStore
();
store
.
state
.
currentProjectId
=
'
test/test
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
router
=
createRouter
(
store
);
...
...
@@ -85,7 +85,7 @@ describe('IDE store file actions', () => {
.
dispatch
(
'
closeFile
'
,
localFile
)
.
then
(
Vue
.
nextTick
)
.
then
(()
=>
{
expect
(
router
.
push
).
toHaveBeenCalledWith
(
'
/project/test/test/tree/ma
ster
/-/newOpenFile/
'
);
expect
(
router
.
push
).
toHaveBeenCalledWith
(
'
/project/test/test/tree/ma
in
/-/newOpenFile/
'
);
});
});
...
...
@@ -177,11 +177,11 @@ describe('IDE store file actions', () => {
store
.
state
.
entries
[
localFile
.
path
]
=
localFile
;
store
.
state
.
currentProjectId
=
'
test/test
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
store
.
state
.
projects
[
'
test/test
'
]
=
{
branches
:
{
ma
ster
:
{
ma
in
:
{
commit
:
{
id
:
'
7297abc
'
,
},
...
...
@@ -260,7 +260,7 @@ describe('IDE store file actions', () => {
it
(
'
sets document title with the branchId
'
,
()
=>
{
return
store
.
dispatch
(
'
getFileData
'
,
{
path
:
localFile
.
path
}).
then
(()
=>
{
expect
(
document
.
title
).
toBe
(
`
${
localFile
.
path
}
· ma
ster
· test/test · GitLab`
);
expect
(
document
.
title
).
toBe
(
`
${
localFile
.
path
}
· ma
in
· test/test · GitLab`
);
});
});
...
...
@@ -329,7 +329,7 @@ describe('IDE store file actions', () => {
it
(
'
sets document title considering `prevPath` on a file
'
,
()
=>
{
return
store
.
dispatch
(
'
getFileData
'
,
{
path
:
localFile
.
path
}).
then
(()
=>
{
expect
(
document
.
title
).
toBe
(
`new-shiny-file · ma
ster
· test/test · GitLab`
);
expect
(
document
.
title
).
toBe
(
`new-shiny-file · ma
in
· test/test · GitLab`
);
});
});
});
...
...
@@ -702,7 +702,7 @@ describe('IDE store file actions', () => {
});
it
(
'
pushes route for active file
'
,
()
=>
{
expect
(
router
.
push
).
toHaveBeenCalledWith
(
'
/project/test/test/tree/ma
ster
/-/tempFile/
'
);
expect
(
router
.
push
).
toHaveBeenCalledWith
(
'
/project/test/test/tree/ma
in
/-/tempFile/
'
);
});
});
});
...
...
@@ -778,7 +778,7 @@ describe('IDE store file actions', () => {
it
(
'
pushes router URL when added
'
,
()
=>
{
return
store
.
dispatch
(
'
openPendingTab
'
,
{
file
:
f
,
keyPrefix
:
'
pending
'
}).
then
(()
=>
{
expect
(
router
.
push
).
toHaveBeenCalledWith
(
'
/project/test/test/tree/ma
ster
/
'
);
expect
(
router
.
push
).
toHaveBeenCalledWith
(
'
/project/test/test/tree/ma
in
/
'
);
});
});
});
...
...
spec/frontend/ide/stores/actions/merge_request_spec.js
View file @
8ed5f601
...
...
@@ -463,11 +463,11 @@ describe('IDE store merge request actions', () => {
};
store.state.currentProjectId = 'test/test';
store.state.currentBranchId = 'ma
ster
';
store.state.currentBranchId = 'ma
in
';
store.state.projects['test/test'] = {
branches: {
ma
ster
: {
ma
in
: {
commit: {
id: '7297abc',
},
...
...
spec/frontend/ide/stores/actions/project_spec.js
View file @
8ed5f601
...
...
@@ -37,11 +37,11 @@ describe('IDE store project actions', () => {
describe
(
'
refreshLastCommitData
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
state
.
currentProjectId
=
'
abc/def
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
store
.
state
.
projects
[
'
abc/def
'
]
=
{
id
:
4
,
branches
:
{
ma
ster
:
{
ma
in
:
{
commit
:
null
,
},
},
...
...
@@ -60,7 +60,7 @@ describe('IDE store project actions', () => {
branchId
:
store
.
state
.
currentBranchId
,
})
.
then
(()
=>
{
expect
(
service
.
getBranchData
).
toHaveBeenCalledWith
(
'
abc/def
'
,
'
ma
ster
'
);
expect
(
service
.
getBranchData
).
toHaveBeenCalledWith
(
'
abc/def
'
,
'
ma
in
'
);
done
();
})
...
...
@@ -81,7 +81,7 @@ describe('IDE store project actions', () => {
type
:
'
SET_BRANCH_COMMIT
'
,
payload
:
{
projectId
:
TEST_PROJECT_ID
,
branchId
:
'
ma
ster
'
,
branchId
:
'
ma
in
'
,
commit
:
{
id
:
'
123
'
},
},
},
...
...
@@ -97,17 +97,17 @@ describe('IDE store project actions', () => {
it
(
'
dispatches setErrorMessage
'
,
(
done
)
=>
{
testAction
(
showBranchNotFoundError
,
'
ma
ster
'
,
'
ma
in
'
,
null
,
[],
[
{
type
:
'
setErrorMessage
'
,
payload
:
{
text
:
"
Branch <strong>ma
ster
</strong> was not found in this project's repository.
"
,
text
:
"
Branch <strong>ma
in
</strong> was not found in this project's repository.
"
,
action
:
expect
.
any
(
Function
),
actionText
:
'
Create branch
'
,
actionPayload
:
'
ma
ster
'
,
actionPayload
:
'
ma
in
'
,
},
},
],
...
...
@@ -131,7 +131,7 @@ describe('IDE store project actions', () => {
},
getters
:
{
currentProject
:
{
default_branch
:
'
ma
ster
'
,
default_branch
:
'
ma
in
'
,
},
},
dispatch
()
{},
...
...
@@ -140,7 +140,7 @@ describe('IDE store project actions', () => {
)
.
then
(()
=>
{
expect
(
api
.
createBranch
).
toHaveBeenCalledWith
(
'
project-path
'
,
{
ref
:
'
ma
ster
'
,
ref
:
'
ma
in
'
,
branch
:
'
new-branch-name
'
,
});
})
...
...
@@ -158,7 +158,7 @@ describe('IDE store project actions', () => {
},
getters
:
{
currentProject
:
{
default_branch
:
'
ma
ster
'
,
default_branch
:
'
ma
in
'
,
},
},
dispatch
:
dispatchSpy
,
...
...
@@ -180,7 +180,7 @@ describe('IDE store project actions', () => {
},
getters
:
{
currentProject
:
{
default_branch
:
'
ma
ster
'
,
default_branch
:
'
ma
in
'
,
},
},
dispatch
()
{},
...
...
@@ -199,13 +199,13 @@ describe('IDE store project actions', () => {
it
(
'
creates a blank tree and sets loading state to false
'
,
(
done
)
=>
{
testAction
(
loadEmptyBranch
,
{
projectId
:
TEST_PROJECT_ID
,
branchId
:
'
ma
ster
'
},
{
projectId
:
TEST_PROJECT_ID
,
branchId
:
'
ma
in
'
},
store
.
state
,
[
{
type
:
'
CREATE_TREE
'
,
payload
:
{
treePath
:
`
${
TEST_PROJECT_ID
}
/ma
ster
`
}
},
{
type
:
'
CREATE_TREE
'
,
payload
:
{
treePath
:
`
${
TEST_PROJECT_ID
}
/ma
in
`
}
},
{
type
:
'
TOGGLE_LOADING
'
,
payload
:
{
entry
:
store
.
state
.
trees
[
`
${
TEST_PROJECT_ID
}
/ma
ster
`
],
forceValue
:
false
},
payload
:
{
entry
:
store
.
state
.
trees
[
`
${
TEST_PROJECT_ID
}
/ma
ind
`
],
forceValue
:
false
},
},
],
expect
.
any
(
Object
),
...
...
@@ -214,11 +214,11 @@ describe('IDE store project actions', () => {
});
it
(
'
does nothing, if tree already exists
'
,
(
done
)
=>
{
const
trees
=
{
[
`
${
TEST_PROJECT_ID
}
/ma
ster
`
]:
[]
};
const
trees
=
{
[
`
${
TEST_PROJECT_ID
}
/ma
in
`
]:
[]
};
testAction
(
loadEmptyBranch
,
{
projectId
:
TEST_PROJECT_ID
,
branchId
:
'
ma
ster
'
},
{
projectId
:
TEST_PROJECT_ID
,
branchId
:
'
ma
in
'
},
{
trees
},
[],
[],
...
...
spec/frontend/ide/stores/actions/tree_spec.js
View file @
8ed5f601
...
...
@@ -18,8 +18,8 @@ describe('Multi-file store tree actions', () => {
const
basicCallParameters
=
{
endpoint
:
'
rootEndpoint
'
,
projectId
:
'
abcproject
'
,
branch
:
'
ma
ster
'
,
branchId
:
'
ma
ster
'
,
branch
:
'
ma
in
'
,
branchId
:
'
ma
in
'
,
ref
:
'
12345678
'
,
};
...
...
@@ -31,7 +31,7 @@ describe('Multi-file store tree actions', () => {
mock
=
new
MockAdapter
(
axios
);
store
.
state
.
currentProjectId
=
'
abcproject
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
store
.
state
.
projects
.
abcproject
=
{
web_url
:
''
,
path_with_namespace
:
'
foo/abcproject
'
,
...
...
@@ -66,7 +66,7 @@ describe('Multi-file store tree actions', () => {
store
.
dispatch
(
'
getFiles
'
,
basicCallParameters
)
.
then
(()
=>
{
projectTree
=
store
.
state
.
trees
[
'
abcproject/ma
ster
'
];
projectTree
=
store
.
state
.
trees
[
'
abcproject/ma
in
'
];
expect
(
projectTree
.
tree
.
length
).
toBe
(
2
);
expect
(
projectTree
.
tree
[
0
].
type
).
toBe
(
'
tree
'
);
...
...
@@ -89,7 +89,7 @@ describe('Multi-file store tree actions', () => {
'
abc/def
'
:
{
web_url
:
`
${
TEST_HOST
}
/files`
,
branches
:
{
'
ma
ster
-testing
'
:
{
'
ma
in
-testing
'
:
{
commit
:
{
id
:
'
12345
'
,
},
...
...
@@ -98,7 +98,7 @@ describe('Multi-file store tree actions', () => {
},
};
const
getters
=
{
findBranch
:
()
=>
store
.
state
.
projects
[
'
abc/def
'
].
branches
[
'
ma
ster
-testing
'
],
findBranch
:
()
=>
store
.
state
.
projects
[
'
abc/def
'
].
branches
[
'
ma
in
-testing
'
],
};
mock
.
onGet
(
/
(
.*
)
/
).
replyOnce
(
500
);
...
...
@@ -112,7 +112,7 @@ describe('Multi-file store tree actions', () => {
},
{
projectId
:
'
abc/def
'
,
branchId
:
'
ma
ster
-testing
'
,
branchId
:
'
ma
in
-testing
'
,
},
)
.
then
(
done
.
fail
)
...
...
@@ -121,7 +121,7 @@ describe('Multi-file store tree actions', () => {
text
:
'
An error occurred while loading all the files.
'
,
action
:
expect
.
any
(
Function
),
actionText
:
'
Please try again
'
,
actionPayload
:
{
projectId
:
'
abc/def
'
,
branchId
:
'
ma
ster
-testing
'
},
actionPayload
:
{
projectId
:
'
abc/def
'
,
branchId
:
'
ma
in
-testing
'
},
});
done
();
});
...
...
@@ -178,17 +178,17 @@ describe('Multi-file store tree actions', () => {
describe
(
'
setDirectoryData
'
,
()
=>
{
it
(
'
sets tree correctly if there are no opened files yet
'
,
(
done
)
=>
{
const
treeFile
=
file
({
name
:
'
README.md
'
});
store
.
state
.
trees
[
'
abcproject/ma
ster
'
]
=
{};
store
.
state
.
trees
[
'
abcproject/ma
in
'
]
=
{};
testAction
(
setDirectoryData
,
{
projectId
:
'
abcproject
'
,
branchId
:
'
ma
ster
'
,
treeList
:
[
treeFile
]
},
{
projectId
:
'
abcproject
'
,
branchId
:
'
ma
in
'
,
treeList
:
[
treeFile
]
},
store
.
state
,
[
{
type
:
types
.
SET_DIRECTORY_DATA
,
payload
:
{
treePath
:
'
abcproject/ma
ster
'
,
treePath
:
'
abcproject/ma
in
'
,
data
:
[
treeFile
],
},
},
...
...
spec/frontend/ide/stores/actions_spec.js
View file @
8ed5f601
...
...
@@ -777,7 +777,7 @@ describe('Multi-file store actions', () => {
it
(
'
routes to the renamed file if the original file has been opened
'
,
(
done
)
=>
{
store
.
state
.
currentProjectId
=
'
test/test
'
;
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
Object
.
assign
(
store
.
state
.
entries
.
orig
,
{
opened
:
true
,
...
...
@@ -790,7 +790,7 @@ describe('Multi-file store actions', () => {
})
.
then
(()
=>
{
expect
(
router
.
push
.
mock
.
calls
).
toHaveLength
(
1
);
expect
(
router
.
push
).
toHaveBeenCalledWith
(
`/project/test/test/tree/ma
ster
/-/renamed/`
);
expect
(
router
.
push
).
toHaveBeenCalledWith
(
`/project/test/test/tree/ma
in
/-/renamed/`
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
...
...
@@ -1019,7 +1019,7 @@ describe('Multi-file store actions', () => {
},
{
projectId
:
'
abc/def
'
,
branchId
:
'
ma
ster
-testing
'
,
branchId
:
'
ma
in
-testing
'
,
},
];
dispatch
=
jest
.
fn
();
...
...
spec/frontend/ide/stores/getters_spec.js
View file @
8ed5f601
...
...
@@ -209,12 +209,12 @@ describe('IDE store getters', () => {
describe
(
'
currentBranch
'
,
()
=>
{
it
(
'
returns current projects branch
'
,
()
=>
{
localState
.
currentProjectId
=
'
abcproject
'
;
localState
.
currentBranchId
=
'
ma
ster
'
;
localState
.
currentBranchId
=
'
ma
in
'
;
localState
.
projects
.
abcproject
=
{
name
:
'
abcproject
'
,
branches
:
{
ma
ster
:
{
name
:
'
ma
ster
'
,
ma
in
:
{
name
:
'
ma
in
'
,
},
},
};
...
...
@@ -223,7 +223,7 @@ describe('IDE store getters', () => {
};
getters
.
currentBranch
(
localState
,
localGetters
);
expect
(
localGetters
.
findBranch
).
toHaveBeenCalledWith
(
'
abcproject
'
,
'
ma
ster
'
);
expect
(
localGetters
.
findBranch
).
toHaveBeenCalledWith
(
'
abcproject
'
,
'
ma
in
'
);
});
});
...
...
@@ -243,12 +243,12 @@ describe('IDE store getters', () => {
it
(
'
returns the selected branch from a project
'
,
()
=>
{
localState
.
currentProjectId
=
'
abcproject
'
;
localState
.
currentBranchId
=
'
ma
ster
'
;
localState
.
currentBranchId
=
'
ma
in
'
;
localState
.
projects
.
abcproject
=
{
name
:
'
abcproject
'
,
branches
:
{
ma
ster
:
{
name
:
'
ma
ster
'
,
ma
in
:
{
name
:
'
ma
in
'
,
},
},
};
...
...
@@ -256,9 +256,9 @@ describe('IDE store getters', () => {
findProject
:
()
=>
localState
.
projects
.
abcproject
,
};
result
=
getters
.
findBranch
(
localState
,
localGetters
)(
'
abcproject
'
,
'
ma
ster
'
);
result
=
getters
.
findBranch
(
localState
,
localGetters
)(
'
abcproject
'
,
'
ma
in
'
);
expect
(
result
.
name
).
toBe
(
'
ma
ster
'
);
expect
(
result
.
name
).
toBe
(
'
ma
in
'
);
});
});
...
...
@@ -274,9 +274,9 @@ describe('IDE store getters', () => {
it
(
"
returns true when project's default branch matches current branch
"
,
()
=>
{
const
localGetters
=
{
currentProject
:
{
default_branch
:
'
ma
ster
'
,
default_branch
:
'
ma
in
'
,
},
branchName
:
'
ma
ster
'
,
branchName
:
'
ma
in
'
,
};
expect
(
getters
.
isOnDefaultBranch
({},
localGetters
)).
toBeTruthy
();
...
...
@@ -285,7 +285,7 @@ describe('IDE store getters', () => {
it
(
"
returns false when project's default branch doesn't match current branch
"
,
()
=>
{
const
localGetters
=
{
currentProject
:
{
default_branch
:
'
ma
ster
'
,
default_branch
:
'
ma
in
'
,
},
branchName
:
'
feature
'
,
};
...
...
@@ -620,10 +620,10 @@ describe('IDE store getters', () => {
describe
(
'
getUrlForPath
'
,
()
=>
{
it
(
'
returns a route url for the given path
'
,
()
=>
{
localState
.
currentProjectId
=
'
test/test
'
;
localState
.
currentBranchId
=
'
ma
ster
'
;
localState
.
currentBranchId
=
'
ma
in
'
;
expect
(
localStore
.
getters
.
getUrlForPath
(
'
path/to/foo/bar-1.jpg
'
)).
toBe
(
`/project/test/test/tree/ma
ster
/-/path/to/foo/bar-1.jpg/`
,
`/project/test/test/tree/ma
in
/-/path/to/foo/bar-1.jpg/`
,
);
});
});
...
...
@@ -631,13 +631,13 @@ describe('IDE store getters', () => {
describe
(
'
getJsonSchemaForPath
'
,
()
=>
{
beforeEach
(()
=>
{
localState
.
currentProjectId
=
'
path/to/some/project
'
;
localState
.
currentBranchId
=
'
ma
ster
'
;
localState
.
currentBranchId
=
'
ma
in
'
;
});
it
(
'
returns a json schema uri and match config for a json/yaml file that can be loaded by monaco
'
,
()
=>
{
expect
(
localStore
.
getters
.
getJsonSchemaForPath
(
'
.gitlab-ci.yml
'
)).
toEqual
({
fileMatch
:
[
'
*.gitlab-ci.yml
'
],
uri
:
`
${
TEST_HOST
}
/path/to/some/project/-/schema/ma
ster
/.gitlab-ci.yml`
,
uri
:
`
${
TEST_HOST
}
/path/to/some/project/-/schema/ma
in
/.gitlab-ci.yml`
,
});
});
...
...
@@ -645,8 +645,8 @@ describe('IDE store getters', () => {
localState
.
projects
[
'
path/to/some/project
'
]
=
{
name
:
'
project
'
,
branches
:
{
ma
ster
:
{
name
:
'
ma
ster
'
,
ma
in
:
{
name
:
'
ma
in
'
,
commit
:
{
id
:
'
abcdef123456
'
,
},
...
...
spec/frontend/ide/stores/modules/commit/actions_spec.js
View file @
8ed5f601
...
...
@@ -47,7 +47,7 @@ describe('IDE commit module actions', () => {
jest
.
spyOn
(
router
,
'
push
'
).
mockImplementation
();
mock
.
onGet
(
'
/api/v1/projects/abcproject/repository/branches/ma
ster
'
)
.
onGet
(
'
/api/v1/projects/abcproject/repository/branches/ma
in
'
)
.
reply
(
200
,
{
commit
:
COMMIT_RESPONSE
});
});
...
...
@@ -101,7 +101,7 @@ describe('IDE commit module actions', () => {
originalGon
=
window
.
gon
;
window
.
gon
=
{
current_username
:
'
johndoe
'
};
store
.
state
.
currentBranchId
=
'
ma
ster
'
;
store
.
state
.
currentBranchId
=
'
ma
in
'
;
});
afterEach
(()
=>
{
...
...
@@ -177,7 +177,7 @@ describe('IDE commit module actions', () => {
committed_date
:
'
123
'
,
committer_name
:
'
root
'
,
};
const
branch
=
'
ma
ster
'
;
const
branch
=
'
ma
in
'
;
let
f
;
beforeEach
(()
=>
{
...
...
@@ -192,12 +192,12 @@ describe('IDE commit module actions', () => {
Object
.
assign
(
store
.
state
,
{
currentProjectId
:
'
abcproject
'
,
currentBranchId
:
'
ma
ster
'
,
currentBranchId
:
'
ma
in
'
,
projects
:
{
abcproject
:
{
web_url
:
'
web_url
'
,
branches
:
{
ma
ster
:
{
ma
in
:
{
workingReference
:
''
,
commit
:
{
short_id
:
TEST_COMMIT_SHA
,
...
...
@@ -228,7 +228,7 @@ describe('IDE commit module actions', () => {
branch
,
})
.
then
(()
=>
{
expect
(
store
.
state
.
projects
.
abcproject
.
branches
.
ma
ster
.
workingReference
).
toBe
(
data
.
id
);
expect
(
store
.
state
.
projects
.
abcproject
.
branches
.
ma
in
.
workingReference
).
toBe
(
data
.
id
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
...
...
@@ -310,14 +310,14 @@ describe('IDE commit module actions', () => {
changedFiles
:
[
f
],
openFiles
:
[
f
],
currentProjectId
:
'
abcproject
'
,
currentBranchId
:
'
ma
ster
'
,
currentBranchId
:
'
ma
in
'
,
projects
:
{
abcproject
:
{
default_branch
:
'
ma
ster
'
,
default_branch
:
'
ma
in
'
,
web_url
:
'
webUrl
'
,
branches
:
{
ma
ster
:
{
name
:
'
ma
ster
'
,
ma
in
:
{
name
:
'
ma
in
'
,
workingReference
:
'
1
'
,
commit
:
{
id
:
TEST_COMMIT_SHA
,
...
...
@@ -460,7 +460,7 @@ describe('IDE commit module actions', () => {
.
dispatch
(
'
commit/commitChanges
'
)
.
then
(()
=>
{
expect
(
visitUrl
).
toHaveBeenCalledWith
(
`webUrl/-/merge_requests/new?merge_request[source_branch]=
${
store
.
getters
[
'
commit/placeholderBranchName
'
]}
&merge_request[target_branch]=ma
ster
&nav_source=webide`
,
`webUrl/-/merge_requests/new?merge_request[source_branch]=
${
store
.
getters
[
'
commit/placeholderBranchName
'
]}
&merge_request[target_branch]=ma
in
&nav_source=webide`
,
);
done
();
...
...
spec/frontend/ide/stores/modules/commit/getters_spec.js
View file @
8ed5f601
...
...
@@ -46,7 +46,7 @@ describe('IDE commit module getters', () => {
describe
(
'
branchName
'
,
()
=>
{
const
rootState
=
{
currentBranchId
:
'
ma
ster
'
,
currentBranchId
:
'
ma
in
'
,
};
const
localGetters
=
{
placeholderBranchName
:
'
placeholder-branch-name
'
,
...
...
@@ -61,7 +61,7 @@ describe('IDE commit module getters', () => {
it
(
'
defaults to currentBranchId when not committing to a new branch
'
,
()
=>
{
localGetters
.
isCreatingNewBranch
=
false
;
expect
(
getters
.
branchName
(
state
,
localGetters
,
rootState
)).
toBe
(
'
ma
ster
'
);
expect
(
getters
.
branchName
(
state
,
localGetters
,
rootState
)).
toBe
(
'
ma
in
'
);
});
describe
(
'
commit to a new branch
'
,
()
=>
{
...
...
spec/frontend/ide/stores/modules/terminal/actions/checks_spec.js
View file @
8ed5f601
...
...
@@ -13,7 +13,7 @@ import axios from '~/lib/utils/axios_utils';
import
httpStatus
from
'
~/lib/utils/http_status
'
;
const
TEST_PROJECT_PATH
=
'
lorem/root
'
;
const
TEST_BRANCH_ID
=
'
ma
ster
'
;
const
TEST_BRANCH_ID
=
'
ma
in
'
;
const
TEST_YAML_HELP_PATH
=
`
${
TEST_HOST
}
/test/yaml/help`
;
const
TEST_RUNNERS_HELP_PATH
=
`
${
TEST_HOST
}
/test/runners/help`
;
...
...
spec/frontend/ide/stores/modules/terminal/actions/session_controls_spec.js
View file @
8ed5f601
...
...
@@ -11,7 +11,7 @@ import httpStatus from '~/lib/utils/http_status';
jest
.
mock
(
'
~/flash
'
);
const
TEST_PROJECT_PATH
=
'
lorem/root
'
;
const
TEST_BRANCH_ID
=
'
ma
ster
'
;
const
TEST_BRANCH_ID
=
'
ma
in
'
;
const
TEST_SESSION
=
{
id
:
7
,
status
:
PENDING
,
...
...
spec/frontend/ide/stores/mutations/branch_spec.js
View file @
8ed5f601
...
...
@@ -10,9 +10,9 @@ describe('Multi-file store branch mutations', () => {
describe
(
'
SET_CURRENT_BRANCH
'
,
()
=>
{
it
(
'
sets currentBranch
'
,
()
=>
{
mutations
.
SET_CURRENT_BRANCH
(
localState
,
'
ma
ster
'
);
mutations
.
SET_CURRENT_BRANCH
(
localState
,
'
ma
in
'
);
expect
(
localState
.
currentBranchId
).
toBe
(
'
ma
ster
'
);
expect
(
localState
.
currentBranchId
).
toBe
(
'
ma
in
'
);
});
});
...
...
@@ -21,20 +21,20 @@ describe('Multi-file store branch mutations', () => {
localState
.
projects
=
{
Example
:
{
branches
:
{
ma
ster
:
{},
ma
in
:
{},
},
},
};
mutations
.
SET_BRANCH_COMMIT
(
localState
,
{
projectId
:
'
Example
'
,
branchId
:
'
ma
ster
'
,
branchId
:
'
ma
in
'
,
commit
:
{
title
:
'
Example commit
'
,
},
});
expect
(
localState
.
projects
.
Example
.
branches
.
ma
ster
.
commit
.
title
).
toBe
(
'
Example commit
'
);
expect
(
localState
.
projects
.
Example
.
branches
.
ma
in
.
commit
.
title
).
toBe
(
'
Example commit
'
);
});
});
...
...
spec/frontend/ide/stores/mutations/file_spec.js
View file @
8ed5f601
...
...
@@ -319,8 +319,8 @@ describe('IDE store file mutations', () => {
localFile
.
content
=
'
test
'
;
localFile
.
changed
=
true
;
localState
.
currentProjectId
=
'
gitlab-ce
'
;
localState
.
currentBranchId
=
'
ma
ster
'
;
localState
.
trees
[
'
gitlab-ce/ma
ster
'
]
=
{
localState
.
currentBranchId
=
'
ma
in
'
;
localState
.
trees
[
'
gitlab-ce/ma
in
'
]
=
{
tree
:
[],
};
});
...
...
@@ -337,7 +337,7 @@ describe('IDE store file mutations', () => {
mutations
.
DISCARD_FILE_CHANGES
(
localState
,
localFile
.
path
);
expect
(
localState
.
trees
[
'
gitlab-ce/ma
ster
'
].
tree
).
toEqual
([{
...
localFile
,
deleted
:
false
}]);
expect
(
localState
.
trees
[
'
gitlab-ce/ma
in
'
].
tree
).
toEqual
([{
...
localFile
,
deleted
:
false
}]);
});
it
(
'
adds to parent tree if deleted
'
,
()
=>
{
...
...
spec/frontend/ide/stores/mutations/tree_spec.js
View file @
8ed5f601
...
...
@@ -33,16 +33,16 @@ describe('Multi-file store tree mutations', () => {
});
it
(
'
adds directory data
'
,
()
=>
{
localState
.
trees
[
'
project/ma
ster
'
]
=
{
localState
.
trees
[
'
project/ma
in
'
]
=
{
tree
:
[],
};
mutations
.
SET_DIRECTORY_DATA
(
localState
,
{
data
,
treePath
:
'
project/ma
ster
'
,
treePath
:
'
project/ma
in
'
,
});
const
tree
=
localState
.
trees
[
'
project/ma
ster
'
];
const
tree
=
localState
.
trees
[
'
project/ma
in
'
];
expect
(
tree
.
tree
.
length
).
toBe
(
3
);
expect
(
tree
.
tree
[
0
].
name
).
toBe
(
'
tree
'
);
...
...
@@ -52,30 +52,30 @@ describe('Multi-file store tree mutations', () => {
it
(
'
keeps loading state
'
,
()
=>
{
mutations
.
CREATE_TREE
(
localState
,
{
treePath
:
'
project/ma
ster
'
,
treePath
:
'
project/ma
in
'
,
});
mutations
.
SET_DIRECTORY_DATA
(
localState
,
{
data
,
treePath
:
'
project/ma
ster
'
,
treePath
:
'
project/ma
in
'
,
});
expect
(
localState
.
trees
[
'
project/ma
ster
'
].
loading
).
toBe
(
true
);
expect
(
localState
.
trees
[
'
project/ma
in
'
].
loading
).
toBe
(
true
);
});
it
(
'
does not override tree already in state, but merges the two with correct order
'
,
()
=>
{
const
openedFile
=
file
(
'
new
'
);
localState
.
trees
[
'
project/ma
ster
'
]
=
{
localState
.
trees
[
'
project/ma
in
'
]
=
{
loading
:
true
,
tree
:
[
openedFile
],
};
mutations
.
SET_DIRECTORY_DATA
(
localState
,
{
data
,
treePath
:
'
project/ma
ster
'
,
treePath
:
'
project/ma
in
'
,
});
const
{
tree
}
=
localState
.
trees
[
'
project/ma
ster
'
];
const
{
tree
}
=
localState
.
trees
[
'
project/ma
in
'
];
expect
(
tree
.
length
).
toBe
(
4
);
expect
(
tree
[
0
].
name
).
toBe
(
'
blob
'
);
...
...
@@ -86,17 +86,17 @@ describe('Multi-file store tree mutations', () => {
it
(
'
returns tree unchanged if the opened file is already in the tree
'
,
()
=>
{
const
openedFile
=
file
(
'
foo
'
);
localState
.
trees
[
'
project/ma
ster
'
]
=
{
localState
.
trees
[
'
project/ma
in
'
]
=
{
loading
:
true
,
tree
:
[
openedFile
],
};
mutations
.
SET_DIRECTORY_DATA
(
localState
,
{
data
,
treePath
:
'
project/ma
ster
'
,
treePath
:
'
project/ma
in
'
,
});
const
{
tree
}
=
localState
.
trees
[
'
project/ma
ster
'
];
const
{
tree
}
=
localState
.
trees
[
'
project/ma
in
'
];
expect
(
tree
.
length
).
toBe
(
3
);
...
...
spec/frontend/ide/stores/mutations_spec.js
View file @
8ed5f601
...
...
@@ -98,8 +98,8 @@ describe('Multi-file store mutations', () => {
describe
(
'
CREATE_TMP_ENTRY
'
,
()
=>
{
beforeEach
(()
=>
{
localState
.
currentProjectId
=
'
gitlab-ce
'
;
localState
.
currentBranchId
=
'
ma
ster
'
;
localState
.
trees
[
'
gitlab-ce/ma
ster
'
]
=
{
localState
.
currentBranchId
=
'
ma
in
'
;
localState
.
trees
[
'
gitlab-ce/ma
in
'
]
=
{
tree
:
[],
};
});
...
...
@@ -115,7 +115,7 @@ describe('Multi-file store mutations', () => {
},
});
expect
(
localState
.
trees
[
'
gitlab-ce/ma
ster
'
].
tree
.
length
).
toEqual
(
1
);
expect
(
localState
.
trees
[
'
gitlab-ce/ma
in
'
].
tree
.
length
).
toEqual
(
1
);
expect
(
localState
.
entries
.
test
.
tempFile
).
toEqual
(
true
);
});
});
...
...
@@ -163,8 +163,8 @@ describe('Multi-file store mutations', () => {
describe
(
'
DELETE_ENTRY
'
,
()
=>
{
beforeEach
(()
=>
{
localState
.
currentProjectId
=
'
gitlab-ce
'
;
localState
.
currentBranchId
=
'
ma
ster
'
;
localState
.
trees
[
'
gitlab-ce/ma
ster
'
]
=
{
localState
.
currentBranchId
=
'
ma
in
'
;
localState
.
trees
[
'
gitlab-ce/ma
in
'
]
=
{
tree
:
[],
};
});
...
...
@@ -184,11 +184,11 @@ describe('Multi-file store mutations', () => {
path
:
'
filePath
'
,
deleted
:
false
,
};
localState
.
trees
[
'
gitlab-ce/ma
ster
'
].
tree
.
push
(
localState
.
entries
.
filePath
);
localState
.
trees
[
'
gitlab-ce/ma
in
'
].
tree
.
push
(
localState
.
entries
.
filePath
);
mutations
.
DELETE_ENTRY
(
localState
,
'
filePath
'
);
expect
(
localState
.
trees
[
'
gitlab-ce/ma
ster
'
].
tree
).
toEqual
([]);
expect
(
localState
.
trees
[
'
gitlab-ce/ma
in
'
].
tree
).
toEqual
([]);
});
it
(
'
removes from parent tree
'
,
()
=>
{
...
...
@@ -279,12 +279,12 @@ describe('Multi-file store mutations', () => {
describe
(
'
RENAME_ENTRY
'
,
()
=>
{
beforeEach
(()
=>
{
localState
.
trees
=
{
'
gitlab-ce/ma
ster
'
:
{
'
gitlab-ce/ma
in
'
:
{
tree
:
[],
},
};
localState
.
currentProjectId
=
'
gitlab-ce
'
;
localState
.
currentBranchId
=
'
ma
ster
'
;
localState
.
currentBranchId
=
'
ma
in
'
;
localState
.
entries
=
{
oldPath
:
file
(
'
oldPath
'
,
'
oldPath
'
,
'
blob
'
),
};
...
...
@@ -462,7 +462,7 @@ describe('Multi-file store mutations', () => {
gamma
,
};
localState
.
trees
[
'
gitlab-ce/ma
ster
'
].
tree
=
[
alpha
,
beta
,
gamma
];
localState
.
trees
[
'
gitlab-ce/ma
in
'
].
tree
=
[
alpha
,
beta
,
gamma
];
mutations
.
RENAME_ENTRY
(
localState
,
{
path
:
'
alpha
'
,
...
...
@@ -471,7 +471,7 @@ describe('Multi-file store mutations', () => {
parentPath
:
''
,
});
expect
(
localState
.
trees
[
'
gitlab-ce/ma
ster
'
].
tree
).
toEqual
([
expect
(
localState
.
trees
[
'
gitlab-ce/ma
in
'
].
tree
).
toEqual
([
expect
.
objectContaining
({
name
:
'
beta
'
,
}),
...
...
spec/frontend/ide/stores/utils_spec.js
View file @
8ed5f601
...
...
@@ -18,13 +18,13 @@ describe('Multi-file store utils', () => {
};
const
state
=
{
currentBranchId
:
'
ma
ster
'
,
currentBranchId
:
'
ma
in
'
,
currentProjectId
:
'
test/test
'
,
};
utils
.
setPageTitleForFile
(
state
,
f
);
expect
(
document
.
title
).
toBe
(
'
README.md · ma
ster
· test/test · GitLab
'
);
expect
(
document
.
title
).
toBe
(
'
README.md · ma
in
· test/test · GitLab
'
);
});
});
...
...
@@ -52,10 +52,10 @@ describe('Multi-file store utils', () => {
{
...
file
(
'
deletedFile
'
),
path
:
'
deletedFile
'
,
deleted
:
true
},
{
...
file
(
'
renamedFile
'
),
path
:
'
renamedFile
'
,
prevPath
:
'
prevPath
'
},
],
currentBranchId
:
'
ma
ster
'
,
currentBranchId
:
'
ma
in
'
,
};
const
payload
=
utils
.
createCommitPayload
({
branch
:
'
ma
ster
'
,
branch
:
'
ma
in
'
,
newBranch
:
false
,
state
,
rootState
,
...
...
@@ -63,7 +63,7 @@ describe('Multi-file store utils', () => {
});
expect
(
payload
).
toEqual
({
branch
:
'
ma
ster
'
,
branch
:
'
ma
in
'
,
commit_message
:
'
commit message
'
,
actions
:
[
{
...
...
@@ -122,10 +122,10 @@ describe('Multi-file store utils', () => {
lastCommitSha
:
'
123456789
'
,
},
],
currentBranchId
:
'
ma
ster
'
,
currentBranchId
:
'
ma
in
'
,
};
const
payload
=
utils
.
createCommitPayload
({
branch
:
'
ma
ster
'
,
branch
:
'
ma
in
'
,
newBranch
:
false
,
state
:
{},
rootState
,
...
...
@@ -135,7 +135,7 @@ describe('Multi-file store utils', () => {
});
expect
(
payload
).
toEqual
({
branch
:
'
ma
ster
'
,
branch
:
'
ma
in
'
,
commit_message
:
'
prebuilt test commit message
'
,
actions
:
[
{
...
...
@@ -377,7 +377,7 @@ describe('Multi-file store utils', () => {
let
localState
;
let
branchInfo
;
const
currentProjectId
=
'
123-foo
'
;
const
currentBranchId
=
'
ma
ster
'
;
const
currentBranchId
=
'
ma
in
'
;
beforeEach
(()
=>
{
localState
=
{
...
...
spec/frontend/ide/utils_spec.js
View file @
8ed5f601
...
...
@@ -274,33 +274,33 @@ describe('WebIDE utils', () => {
* hello.md -> hello-1.md
* hello_2.md -> hello_3.md
* hello_ -> hello_1
* ma
ster-patch-22432 -> master
-patch-22433
* ma
in-patch-22432 -> main
-patch-22433
* patch_332 -> patch_333
*/
describe
(
'
addNumericSuffix
'
,
()
=>
{
it
.
each
`
input
| output
${
'
hello
'
}
|
${
'
hello-1
'
}
${
'
hello2
'
}
|
${
'
hello-3
'
}
${
'
hello.md
'
}
|
${
'
hello-1.md
'
}
${
'
hello_2.md
'
}
|
${
'
hello_3.md
'
}
${
'
hello_
'
}
|
${
'
hello_1
'
}
${
'
ma
ster-patch-22432
'
}
|
${
'
master
-patch-22433
'
}
${
'
patch_332
'
}
|
${
'
patch_333
'
}
input | output
${
'
hello
'
}
|
${
'
hello-1
'
}
${
'
hello2
'
}
|
${
'
hello-3
'
}
${
'
hello.md
'
}
|
${
'
hello-1.md
'
}
${
'
hello_2.md
'
}
|
${
'
hello_3.md
'
}
${
'
hello_
'
}
|
${
'
hello_1
'
}
${
'
ma
in-patch-22432
'
}
|
${
'
main
-patch-22433
'
}
${
'
patch_332
'
}
|
${
'
patch_333
'
}
`
(
'
adds a numeric suffix to a given filename/branch name: $input
'
,
({
input
,
output
})
=>
{
expect
(
addNumericSuffix
(
input
)).
toBe
(
output
);
});
it
.
each
`
input
| output
${
'
hello
'
}
|
${
'
hello-39135
'
}
${
'
hello2
'
}
|
${
'
hello-39135
'
}
${
'
hello.md
'
}
|
${
'
hello-39135.md
'
}
${
'
hello_2.md
'
}
|
${
'
hello_39135.md
'
}
${
'
hello_
'
}
|
${
'
hello_39135
'
}
${
'
ma
ster-patch-22432
'
}
|
${
'
master
-patch-39135
'
}
${
'
patch_332
'
}
|
${
'
patch_39135
'
}
input | output
${
'
hello
'
}
|
${
'
hello-39135
'
}
${
'
hello2
'
}
|
${
'
hello-39135
'
}
${
'
hello.md
'
}
|
${
'
hello-39135.md
'
}
${
'
hello_2.md
'
}
|
${
'
hello_39135.md
'
}
${
'
hello_
'
}
|
${
'
hello_39135
'
}
${
'
ma
in-patch-22432
'
}
|
${
'
main
-patch-39135
'
}
${
'
patch_332
'
}
|
${
'
patch_39135
'
}
`
(
'
adds a random suffix if randomize=true is passed for name: $input
'
,
({
input
,
output
})
=>
{
jest
.
spyOn
(
Math
,
'
random
'
).
mockReturnValue
(
0.391352525
);
...
...
spec/frontend/vue_shared/components/web_ide_link_spec.js
View file @
8ed5f601
...
...
@@ -3,8 +3,8 @@ import ActionsButton from '~/vue_shared/components/actions_button.vue';
import
LocalStorageSync
from
'
~/vue_shared/components/local_storage_sync.vue
'
;
import
WebIdeLink
from
'
~/vue_shared/components/web_ide_link.vue
'
;
const
TEST_EDIT_URL
=
'
/gitlab-test/test/-/edit/ma
ster
/
'
;
const
TEST_WEB_IDE_URL
=
'
/-/ide/project/gitlab-test/test/edit/ma
ster
/-/
'
;
const
TEST_EDIT_URL
=
'
/gitlab-test/test/-/edit/ma
in
/
'
;
const
TEST_WEB_IDE_URL
=
'
/-/ide/project/gitlab-test/test/edit/ma
in
/-/
'
;
const
TEST_GITPOD_URL
=
'
https://gitpod.test/
'
;
const
ACTION_EDIT
=
{
...
...
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