BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d3e007d2
Unverified
Commit
d3e007d2
authored
Apr 18, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added specs to store & activity bar component
parent
ca4751b9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
3 deletions
+150
-3
activity_bar_spec.js
spec/javascripts/ide/components/activity_bar_spec.js
+86
-0
actions_spec.js
spec/javascripts/ide/stores/actions_spec.js
+42
-3
mutations_spec.js
spec/javascripts/ide/stores/mutations_spec.js
+22
-0
No files found.
spec/javascripts/ide/components/activity_bar_spec.js
0 → 100644
View file @
d3e007d2
import
Vue
from
'vue'
;
import
store
from
'~/ide/stores'
;
import
{
ActivityBarViews
}
from
'~/ide/stores/state'
;
import
ActivityBar
from
'~/ide/components/activity_bar.vue'
;
import
{
createComponentWithStore
}
from
'../../helpers/vue_mount_component_helper'
;
import
{
resetStore
}
from
'../helpers'
;
describe
(
'IDE activity bar'
,
()
=>
{
const
Component
=
Vue
.
extend
(
ActivityBar
);
let
vm
;
beforeEach
(()
=>
{
Vue
.
set
(
store
.
state
.
projects
,
'abcproject'
,
{
web_url
:
'testing'
,
});
Vue
.
set
(
store
.
state
,
'currentProjectId'
,
'abcproject'
);
vm
=
createComponentWithStore
(
Component
,
store
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
resetStore
(
vm
.
$store
);
});
describe
(
'goBackUrl'
,
()
=>
{
it
(
'renders the Go Back link with the referrer when present'
,
()
=>
{
const
fakeReferrer
=
'/example/README.md'
;
spyOnProperty
(
document
,
'referrer'
).
and
.
returnValue
(
fakeReferrer
);
vm
.
$mount
();
expect
(
vm
.
goBackUrl
).
toEqual
(
fakeReferrer
);
});
it
(
'renders the Go Back link with the project url when referrer is not present'
,
()
=>
{
const
fakeReferrer
=
''
;
spyOnProperty
(
document
,
'referrer'
).
and
.
returnValue
(
fakeReferrer
);
vm
.
$mount
();
expect
(
vm
.
goBackUrl
).
toEqual
(
'testing'
);
});
});
describe
(
'updateActivityBarView'
,
()
=>
{
beforeEach
(()
=>
{
spyOn
(
vm
,
'updateActivityBarView'
);
vm
.
$mount
();
});
it
(
'calls updateActivityBarView with edit value on click'
,
()
=>
{
vm
.
$el
.
querySelector
(
'.js-ide-edit-mode'
).
click
();
expect
(
vm
.
updateActivityBarView
).
toHaveBeenCalledWith
(
ActivityBarViews
.
edit
);
});
it
(
'calls updateActivityBarView with commit value on click'
,
()
=>
{
vm
.
$el
.
querySelector
(
'.js-ide-commit-mode'
).
click
();
expect
(
vm
.
updateActivityBarView
).
toHaveBeenCalledWith
(
ActivityBarViews
.
commit
);
});
});
describe
(
'active item'
,
()
=>
{
beforeEach
(()
=>
{
vm
.
$mount
();
});
it
(
'sets edit item active'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'.js-ide-edit-mode'
).
classList
).
toContain
(
'active'
);
});
it
(
'sets commit item active'
,
done
=>
{
vm
.
$store
.
state
.
currentActivityView
=
ActivityBarViews
.
commit
;
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'.js-ide-commit-mode'
).
classList
).
toContain
(
'active'
);
done
();
});
});
});
});
spec/javascripts/ide/stores/actions_spec.js
View file @
d3e007d2
import
*
as
urlUtils
from
'~/lib/utils/url_utility'
;
import
*
as
actions
from
'~/ide/stores/actions'
;
import
store
from
'~/ide/stores'
;
import
router
from
'~/ide/ide_router'
;
import
{
resetStore
,
file
}
from
'../helpers'
;
import
testAction
from
'../../helpers/vuex_action_helper'
;
describe
(
'Multi-file store actions'
,
()
=>
{
beforeEach
(()
=>
{
...
...
@@ -191,9 +193,7 @@ describe('Multi-file store actions', () => {
})
.
then
(
f
=>
{
expect
(
f
.
tempFile
).
toBeTruthy
();
expect
(
store
.
state
.
trees
[
'abcproject/mybranch'
].
tree
.
length
).
toBe
(
1
,
);
expect
(
store
.
state
.
trees
[
'abcproject/mybranch'
].
tree
.
length
).
toBe
(
1
);
done
();
})
...
...
@@ -303,4 +303,43 @@ describe('Multi-file store actions', () => {
.
catch
(
done
.
fail
);
});
});
describe
(
'updateActivityBarView'
,
()
=>
{
it
(
'commits UPDATE_ACTIVITY_BAR_VIEW'
,
done
=>
{
testAction
(
actions
.
updateActivityBarView
,
'test'
,
{},
[{
type
:
'UPDATE_ACTIVITY_BAR_VIEW'
,
payload
:
'test'
}],
[],
done
,
);
});
});
describe
(
'setEmptyStateSvgs'
,
()
=>
{
it
(
'commits setEmptyStateSvgs'
,
done
=>
{
testAction
(
actions
.
setEmptyStateSvgs
,
'svg'
,
{},
[{
type
:
'SET_EMPTY_STATE_SVGS'
,
payload
:
'svg'
}],
[],
done
,
);
});
});
describe
(
'setCurrentBranchId'
,
()
=>
{
it
(
'commits setCurrentBranchId'
,
done
=>
{
testAction
(
actions
.
setCurrentBranchId
,
'branchId'
,
{},
[{
type
:
'SET_CURRENT_BRANCH'
,
payload
:
'branchId'
}],
[],
done
,
);
});
});
});
spec/javascripts/ide/stores/mutations_spec.js
View file @
d3e007d2
...
...
@@ -76,4 +76,26 @@ describe('Multi-file store mutations', () => {
expect
(
localState
.
viewer
).
toBe
(
'diff'
);
});
});
describe
(
'UPDATE_ACTIVITY_BAR_VIEW'
,
()
=>
{
it
(
'updates currentActivityBar'
,
()
=>
{
mutations
.
UPDATE_ACTIVITY_BAR_VIEW
(
localState
,
'test'
);
expect
(
localState
.
currentActivityView
).
toBe
(
'test'
);
});
});
describe
(
'SET_EMPTY_STATE_SVGS'
,
()
=>
{
it
(
'updates empty state SVGs'
,
()
=>
{
mutations
.
SET_EMPTY_STATE_SVGS
(
localState
,
{
emptyStateSvgPath
:
'emptyState'
,
noChangesStateSvgPath
:
'noChanges'
,
committedStateSvgPath
:
'commited'
,
});
expect
(
localState
.
emptyStateSvgPath
).
toBe
(
'emptyState'
);
expect
(
localState
.
noChangesStateSvgPath
).
toBe
(
'noChanges'
);
expect
(
localState
.
committedStateSvgPath
).
toBe
(
'commited'
);
});
});
});
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