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
26df1614
Commit
26df1614
authored
Dec 10, 2021
by
Angelo Gulina
Committed by
Vitaly Slobodin
Dec 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update condition for submit button on 'just me' cases
parent
8ab9f4b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
21 deletions
+76
-21
ee/app/assets/javascripts/subscriptions/new/components/checkout/subscription_details.vue
...riptions/new/components/checkout/subscription_details.vue
+23
-8
ee/spec/frontend/subscriptions/new/components/checkout/subscription_details_spec.js
...ions/new/components/checkout/subscription_details_spec.js
+53
-13
No files found.
ee/app/assets/javascripts/subscriptions/new/components/checkout/subscription_details.vue
View file @
26df1614
...
...
@@ -72,16 +72,31 @@ export default {
selectedPlanTextLine
()
{
return
sprintf
(
this
.
$options
.
i18n
.
selectedPlan
,
{
selectedPlanText
:
this
.
selectedPlanText
});
},
isValid
()
{
hasAtLeastOneUser
()
{
return
this
.
numberOfUsers
>
0
;
},
hasSelectedPlan
()
{
return
!
isEmpty
(
this
.
selectedPlan
);
},
hasOrganizationName
()
{
return
!
isEmpty
(
this
.
organizationName
);
},
hasRequisitesForCompany
()
{
if
(
this
.
isSetupForCompany
)
{
return
(
!
isEmpty
(
this
.
selectedPlan
)
&&
(
!
isEmpty
(
this
.
organizationName
)
||
this
.
isGroupSelected
)
&&
this
.
numberOfUsers
>
0
&&
this
.
numberOfUsers
>=
this
.
selectedGroupUsers
);
return
this
.
hasOrganizationName
||
this
.
isGroupSelected
;
}
return
!
isEmpty
(
this
.
selectedPlan
)
&&
this
.
numberOfUsers
===
1
;
return
true
;
},
isSelectedUsersEqualOrGreaterThanGroupUsers
()
{
return
this
.
numberOfUsers
>=
this
.
selectedGroupUsers
;
},
isValid
()
{
return
(
this
.
hasSelectedPlan
&&
this
.
hasAtLeastOneUser
&&
this
.
isSelectedUsersEqualOrGreaterThanGroupUsers
&&
this
.
hasRequisitesForCompany
);
},
isShowingGroupSelector
()
{
return
!
this
.
isNewUser
&&
this
.
groupData
.
length
;
...
...
ee/spec/frontend/subscriptions/new/components/checkout/subscription_details_spec.js
View file @
26df1614
...
...
@@ -345,18 +345,19 @@ describe('Subscription Details', () => {
const
isStepValid
=
()
=>
wrapper
.
findComponent
(
Step
).
props
(
'
isValid
'
);
let
store
;
beforeEach
(()
=>
{
const
mockApollo
=
createMockApolloProvider
(
STEPS
);
store
=
createStore
(
createDefaultInitialStoreData
());
wrapper
=
createComponent
({
apolloProvider
:
mockApollo
,
store
});
});
describe
(
'
when setting up for a company
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
commit
(
types
.
UPDATE_IS_SETUP_FOR_COMPANY
,
true
);
const
mockApollo
=
createMockApolloProvider
(
STEPS
);
store
=
createStore
(
createDefaultInitialStoreData
({
namespaceId
:
483
,
newUser
:
'
true
'
,
setupForCompany
:
'
true
'
,
}),
);
wrapper
=
createComponent
({
apolloProvider
:
mockApollo
,
store
});
store
.
commit
(
types
.
UPDATE_SELECTED_PLAN
,
'
firstPlanId
'
);
store
.
commit
(
types
.
UPDATE_ORGANIZATION_NAME
,
'
Organization name
'
);
store
.
commit
(
types
.
UPDATE_SELECTED_GROUP
,
483
);
store
.
commit
(
types
.
UPDATE_NUMBER_OF_USERS
,
14
);
});
...
...
@@ -398,10 +399,41 @@ describe('Subscription Details', () => {
});
});
describe
(
'
when not setting up for a company
'
,
()
=>
{
describe
(
'
when not setting up for a company and a new user
'
,
()
=>
{
beforeEach
(()
=>
{
const
mockApollo
=
createMockApolloProvider
(
STEPS
);
store
=
createStore
(
createDefaultInitialStoreData
({
namespaceId
:
111
,
newUser
:
'
true
'
,
setupForCompany
:
'
false
'
,
groupData
:
JSON
.
stringify
([{
id
:
111
,
name
:
'
Just me group
'
,
users
:
1
}]),
}),
);
wrapper
=
createComponent
({
apolloProvider
:
mockApollo
,
store
});
});
it
(
'
should disable the number of users input field
'
,
()
=>
{
expect
(
numberOfUsersInput
().
attributes
(
'
disabled
'
)).
toBeDefined
();
});
it
(
'
should be valid
'
,
()
=>
{
expect
(
isStepValid
()).
toBe
(
true
);
});
});
describe
(
'
when not setting up for a company and not a new user
'
,
()
=>
{
beforeEach
(()
=>
{
store
.
commit
(
types
.
UPDATE_IS_SETUP_FOR_COMPANY
,
false
);
store
.
commit
(
types
.
UPDATE_NUMBER_OF_USERS
,
1
);
const
mockApollo
=
createMockApolloProvider
(
STEPS
);
store
=
createStore
(
createDefaultInitialStoreData
({
namespaceId
:
132
,
newUser
:
'
false
'
,
setupForCompany
:
'
false
'
,
}),
);
wrapper
=
createComponent
({
apolloProvider
:
mockApollo
,
store
});
store
.
commit
(
types
.
UPDATE_NUMBER_OF_USERS
,
3
);
});
it
(
'
should be valid
'
,
()
=>
{
...
...
@@ -416,7 +448,7 @@ describe('Subscription Details', () => {
});
});
it
(
'
should be invalid when n
o number of
users is 0
'
,
()
=>
{
it
(
'
should be invalid when n
umber
users is 0
'
,
()
=>
{
store
.
commit
(
types
.
UPDATE_NUMBER_OF_USERS
,
0
);
return
localVue
.
nextTick
().
then
(()
=>
{
...
...
@@ -424,7 +456,15 @@ describe('Subscription Details', () => {
});
});
it
(
'
should be invalid when no number of users is greater than 1
'
,
()
=>
{
it
(
'
should be valid when number of users is greater than group users
'
,
()
=>
{
store
.
commit
(
types
.
UPDATE_NUMBER_OF_USERS
,
4
);
return
localVue
.
nextTick
().
then
(()
=>
{
expect
(
isStepValid
()).
toBe
(
true
);
});
});
it
(
'
should not be valid when number of users is less than group users
'
,
()
=>
{
store
.
commit
(
types
.
UPDATE_NUMBER_OF_USERS
,
2
);
return
localVue
.
nextTick
().
then
(()
=>
{
...
...
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