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 {
...
@@ -19,23 +19,27 @@ export default {
GlModalDirective
,
GlModalDirective
,
},
},
mixins
:
[
glFeatureFlagsMixin
()],
mixins
:
[
glFeatureFlagsMixin
()],
data
()
{
return
{
location
:
''
,
};
},
inject
:
{
inject
:
{
usersPath
:
{
usersPath
:
{
default
:
''
,
default
:
''
,
},
},
},
},
data
()
{
return
{
location
:
''
,
};
},
computed
:
{
computed
:
{
...
mapState
([
'
errorMessage
'
]),
...
mapState
([
'
errorMessage
'
]),
showNewUI
()
{
showNewUI
()
{
return
this
.
glFeatures
.
newJiraConnectUi
;
return
this
.
glFeatures
.
newJiraConnectUi
;
},
},
usersPathWithReturnTo
()
{
usersPathWithReturnTo
()
{
return
`
${
this
.
usersPath
}
?return_to=
${
this
.
location
}
`
;
if
(
this
.
location
)
{
return
`
${
this
.
usersPath
}
?return_to=
${
this
.
location
}
`
;
}
return
this
.
usersPath
;
},
},
},
},
modal
:
{
modal
:
{
...
@@ -49,7 +53,6 @@ export default {
...
@@ -49,7 +53,6 @@ export default {
methods
:
{
methods
:
{
async
setLocation
()
{
async
setLocation
()
{
this
.
location
=
await
getLocation
();
this
.
location
=
await
getLocation
();
console
.
log
(
this
.
location
);
},
},
},
},
};
};
...
@@ -65,7 +68,7 @@ export default {
...
@@ -65,7 +68,7 @@ export default {
<div
<div
v-if=
"showNewUI"
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"
>
<h5
class=
"gl-align-self-center gl-mb-0"
data-testid=
"new-jira-connect-ui-heading"
>
{{
s__
(
'
Integrations|Linked namespaces
'
)
}}
{{
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
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
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
JiraConnectApp
from
'
~/jira_connect/components/app.vue
'
;
import
createStore
from
'
~/jira_connect/store
'
;
import
createStore
from
'
~/jira_connect/store
'
;
import
{
SET_ERROR_MESSAGE
}
from
'
~/jira_connect/store/mutation_types
'
;
import
{
SET_ERROR_MESSAGE
}
from
'
~/jira_connect/store/mutation_types
'
;
Vue
.
use
(
Vuex
);
jest
.
mock
(
'
~/jira_connect/api
'
);
describe
(
'
JiraConnectApp
'
,
()
=>
{
describe
(
'
JiraConnectApp
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
let
store
;
let
store
;
const
findAlert
=
()
=>
wrapper
.
findComponent
(
GlAlert
);
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
findHeader
=
()
=>
wrapper
.
findByTestId
(
'
new-jira-connect-ui-heading
'
);
const
findHeaderText
=
()
=>
findHeader
().
text
();
const
findHeaderText
=
()
=>
findHeader
().
text
();
...
@@ -44,6 +45,33 @@ describe('JiraConnectApp', () => {
...
@@ -44,6 +45,33 @@ describe('JiraConnectApp', () => {
expect
(
findHeaderText
()).
toBe
(
'
Linked namespaces
'
);
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
'
,
()
=>
{
describe
(
'
newJiraConnectUi is false
'
,
()
=>
{
it
(
'
does not render new UI
'
,
()
=>
{
it
(
'
does not render new UI
'
,
()
=>
{
createComponent
({
createComponent
({
...
...
spec/helpers/jira_connect_helper_spec.rb
View file @
65076246
...
@@ -5,20 +5,42 @@ require 'spec_helper'
...
@@ -5,20 +5,42 @@ require 'spec_helper'
RSpec
.
describe
JiraConnectHelper
do
RSpec
.
describe
JiraConnectHelper
do
describe
'#jira_connect_app_data'
do
describe
'#jira_connect_app_data'
do
let_it_be
(
:subscription
)
{
create
(
:jira_connect_subscription
)
}
let_it_be
(
:subscription
)
{
create
(
:jira_connect_subscription
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
helper
.
jira_connect_app_data
([
subscription
])
}
subject
{
helper
.
jira_connect_app_data
([
subscription
])
}
it
'includes Jira Connect app attributes'
do
context
'user is not logged in'
do
is_expected
.
to
include
(
before
do
:groups_path
,
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
nil
)
:subscriptions_path
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
end
it
'passes group as "skip_groups" param'
do
context
'user is logged in'
do
skip_groups_param
=
CGI
.
escape
(
'skip_groups[]'
)
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
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