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
65076246
Commit
65076246
authored
Jan 21, 2021
by
Justin Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for sign in / add buttons
And update some eslint issues
parent
0262c6b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
20 deletions
+73
-20
app/assets/javascripts/jira_connect/components/app.vue
app/assets/javascripts/jira_connect/components/app.vue
+11
-8
spec/frontend/jira_connect/components/app_spec.js
spec/frontend/jira_connect/components/app_spec.js
+32
-4
spec/helpers/jira_connect_helper_spec.rb
spec/helpers/jira_connect_helper_spec.rb
+30
-8
No files found.
app/assets/javascripts/jira_connect/components/app.vue
View file @
65076246
...
...
@@ -19,23 +19,27 @@ export default {
GlModalDirective
,
},
mixins
:
[
glFeatureFlagsMixin
()],
data
()
{
return
{
location
:
''
,
};
},
inject
:
{
usersPath
:
{
default
:
''
,
},
},
data
()
{
return
{
location
:
''
,
};
},
computed
:
{
...
mapState
([
'
errorMessage
'
]),
showNewUI
()
{
return
this
.
glFeatures
.
newJiraConnectUi
;
},
usersPathWithReturnTo
()
{
return
`
${
this
.
usersPath
}
?return_to=
${
this
.
location
}
`
;
if
(
this
.
location
)
{
return
`
${
this
.
usersPath
}
?return_to=
${
this
.
location
}
`
;
}
return
this
.
usersPath
;
},
},
modal
:
{
...
...
@@ -49,7 +53,6 @@ export default {
methods
:
{
async
setLocation
()
{
this
.
location
=
await
getLocation
();
console
.
log
(
this
.
location
);
},
},
};
...
...
@@ -65,7 +68,7 @@ export default {
<div
v-if=
"showNewUI"
class=
"gl-display-flex gl-justify-content-space-between gl-my-
5
gl-pb-4 gl-border-b-solid gl-border-b-1 gl-border-b-gray-200"
class=
"gl-display-flex gl-justify-content-space-between gl-my-
7
gl-pb-4 gl-border-b-solid gl-border-b-1 gl-border-b-gray-200"
>
<h5
class=
"gl-align-self-center gl-mb-0"
data-testid=
"new-jira-connect-ui-heading"
>
{{
s__
(
'
Integrations|Linked namespaces
'
)
}}
...
...
spec/frontend/jira_connect/components/app_spec.js
View file @
65076246
import
Vue
from
'
vue
'
;
import
Vuex
from
'
vuex
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
{
GlAlert
}
from
'
@gitlab/ui
'
;
import
{
GlAlert
,
GlButton
,
GlModal
}
from
'
@gitlab/ui
'
;
import
JiraConnectApp
from
'
~/jira_connect/components/app.vue
'
;
import
createStore
from
'
~/jira_connect/store
'
;
import
{
SET_ERROR_MESSAGE
}
from
'
~/jira_connect/store/mutation_types
'
;
Vue
.
use
(
Vuex
);
jest
.
mock
(
'
~/jira_connect/api
'
);
describe
(
'
JiraConnectApp
'
,
()
=>
{
let
wrapper
;
let
store
;
const
findAlert
=
()
=>
wrapper
.
findComponent
(
GlAlert
);
const
findGlButton
=
()
=>
wrapper
.
findComponent
(
GlButton
);
const
findGlModal
=
()
=>
wrapper
.
findComponent
(
GlModal
);
const
findHeader
=
()
=>
wrapper
.
findByTestId
(
'
new-jira-connect-ui-heading
'
);
const
findHeaderText
=
()
=>
findHeader
().
text
();
...
...
@@ -44,6 +45,33 @@ describe('JiraConnectApp', () => {
expect
(
findHeaderText
()).
toBe
(
'
Linked namespaces
'
);
});
describe
(
'
when user is not logged in
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
provide
:
{
glFeatures
:
{
newJiraConnectUi
:
true
},
usersPath
:
'
/users
'
,
},
});
});
it
(
'
renders "Sign in" button
'
,
()
=>
{
expect
(
findGlButton
().
text
()).
toBe
(
'
Sign in to add namespaces
'
);
expect
(
findGlModal
().
exists
()).
toBe
(
false
);
});
});
describe
(
'
when user is logged in
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
});
it
(
'
renders "Add" button and modal
'
,
()
=>
{
expect
(
findGlButton
().
text
()).
toBe
(
'
Add namespace
'
);
expect
(
findGlModal
().
exists
()).
toBe
(
true
);
});
});
describe
(
'
newJiraConnectUi is false
'
,
()
=>
{
it
(
'
does not render new UI
'
,
()
=>
{
createComponent
({
...
...
spec/helpers/jira_connect_helper_spec.rb
View file @
65076246
...
...
@@ -5,20 +5,42 @@ require 'spec_helper'
RSpec
.
describe
JiraConnectHelper
do
describe
'#jira_connect_app_data'
do
let_it_be
(
:subscription
)
{
create
(
:jira_connect_subscription
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
helper
.
jira_connect_app_data
([
subscription
])
}
it
'includes Jira Connect app attributes'
do
is_expected
.
to
include
(
:groups_path
,
:subscriptions_path
)
context
'user is not logged in'
do
before
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
nil
)
end
it
'includes Jira Connect app attributes'
do
is_expected
.
to
include
(
:groups_path
,
:subscriptions_path
,
:users_path
)
end
it
'assigns users_path with value'
do
expect
(
subject
[
:users_path
]).
to
eq
(
jira_connect_users_path
)
end
it
'passes group as "skip_groups" param'
do
skip_groups_param
=
CGI
.
escape
(
'skip_groups[]'
)
expect
(
subject
[
:groups_path
]).
to
include
(
"
#{
skip_groups_param
}
=
#{
subscription
.
namespace
.
id
}
"
)
end
end
it
'passes group as "skip_groups" param'
do
skip_groups_param
=
CGI
.
escape
(
'skip_groups[]'
)
context
'user is logged in'
do
before
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
user
)
end
expect
(
subject
[
:groups_path
]).
to
include
(
"
#{
skip_groups_param
}
=
#{
subscription
.
namespace
.
id
}
"
)
it
'assigns users_path to nil'
do
expect
(
subject
[
:users_path
]).
to
be_nil
end
end
end
end
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