Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UI
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coscine
frontend
apps
UI
Commits
69c2e545
Commit
69c2e545
authored
Feb 1, 2023
by
Hanna Führ
Committed by
Benedikt Heinrichs
Feb 1, 2023
Browse files
Options
Downloads
Patches
Plain Diff
Update: Setting up ToS tests
parent
4518cd4c
No related branches found
No related tags found
4 merge requests
!192
Release: Sprint/2023 03 :robot:
,
!187
Dev
,
!184
Update: Setting up ToS tests
,
!181
Dev
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/modules/login/pages/ToS.spec.ts
+109
-0
109 additions, 0 deletions
src/modules/login/pages/ToS.spec.ts
src/modules/login/pages/ToS.vue
+11
-2
11 additions, 2 deletions
src/modules/login/pages/ToS.vue
with
120 additions
and
2 deletions
src/modules/login/pages/ToS.spec.ts
0 → 100644
+
109
−
0
View file @
69c2e545
/* Testing imports */
import
{
createLocalVue
,
mount
}
from
"
@vue/test-utils
"
;
import
{
createTestingPinia
}
from
"
@pinia/testing
"
;
/* Vue i18n */
import
i18n
,
{
def
}
from
"
@/plugins/vue-i18n
"
;
import
{
LoginI18nMessages
}
from
"
@/modules/login/i18n/index
"
;
i18n
.
availableLocales
.
forEach
((
locale
)
=>
{
i18n
.
setLocaleMessage
(
locale
,
def
[
locale
]);
// default locale messages
i18n
.
mergeLocaleMessage
(
locale
,
LoginI18nMessages
[
locale
]);
// append the locale messages for the component
});
/* Pinia */
import
{
PiniaVuePlugin
}
from
"
pinia
"
;
/* Tested Component */
import
ToS
from
"
./ToS.vue
"
;
import
type
Vue
from
"
vue
"
;
/* Create a local Vue instance */
const
localVue
=
createLocalVue
();
localVue
.
use
(
PiniaVuePlugin
);
describe
(
"
ToS.vue
"
,
()
=>
{
/* Testing ToS and PP accepted*/
test
(
"
ToSAndPPAccepted
"
,
async
()
=>
{
/* Mount the Component */
const
wrapper
=
mount
(
ToS
as
unknown
as
typeof
Vue
,
{
pinia
:
createTestingPinia
({
createSpy
:
vitest
.
fn
,
}),
i18n
,
localVue
,
});
// wait for created in ToS.vue
await
wrapper
.
vm
.
$nextTick
();
// initial state, Confirm Button is disabled
expect
(
wrapper
.
get
(
"
#confirmBtn
"
).
attributes
()[
"
disabled
"
]).
toBe
(
"
disabled
"
);
// check TosAccepted and PpAccepted
const
toSFound
=
wrapper
.
find
(
"
#TosAccepted
"
);
await
toSFound
.
setChecked
(
true
);
const
pPFound
=
wrapper
.
find
(
"
#PpAccepted
"
);
await
pPFound
.
setChecked
(
true
);
// Confirm button should be active
expect
(
wrapper
.
get
(
"
#confirmBtn
"
).
attributes
()[
"
disabled
"
]).
not
.
toBe
(
"
disabled
"
)
});
/* Testing only ToS accepted*/
test
(
"
ToSAccepted
"
,
async
()
=>
{
/* Mount the Component */
const
wrapper
=
mount
(
ToS
as
unknown
as
typeof
Vue
,
{
pinia
:
createTestingPinia
({
createSpy
:
vitest
.
fn
,
}),
i18n
,
localVue
,
});
// wait for created in ToS.vue
await
wrapper
.
vm
.
$nextTick
();
// initial state, Confirm Button is disabled
expect
(
wrapper
.
get
(
"
#confirmBtn
"
).
attributes
()[
"
disabled
"
]).
toBe
(
"
disabled
"
);
// check TosAccepted
const
toSFound
=
wrapper
.
find
(
"
#TosAccepted
"
);
await
toSFound
.
setChecked
(
true
);
// Confirm button should be disabled, since PP not accepted
expect
(
wrapper
.
get
(
"
#confirmBtn
"
).
attributes
()[
"
disabled
"
]).
toBe
(
"
disabled
"
)
});
/* Testing only Pp accepted*/
test
(
"
PpAccepted
"
,
async
()
=>
{
/* Mount the Component */
const
wrapper
=
mount
(
ToS
as
unknown
as
typeof
Vue
,
{
pinia
:
createTestingPinia
({
createSpy
:
vitest
.
fn
,
}),
i18n
,
localVue
,
});
// wait for created in ToS.vue
await
wrapper
.
vm
.
$nextTick
();
// initial state, Confirm Button is disabled
expect
(
wrapper
.
get
(
"
#confirmBtn
"
).
attributes
()[
"
disabled
"
]).
toBe
(
"
disabled
"
);
// check PpAccepted
const
pPFound
=
wrapper
.
find
(
"
#PpAccepted
"
);
await
pPFound
.
setChecked
(
true
);
// Confirm button should be disabled, since PP not accepted
expect
(
wrapper
.
get
(
"
#confirmBtn
"
).
attributes
()[
"
disabled
"
]).
toBe
(
"
disabled
"
)
});
});
This diff is collapsed.
Click to expand it.
src/modules/login/pages/ToS.vue
+
11
−
2
View file @
69c2e545
...
...
@@ -10,7 +10,11 @@
</a>
</
template
>
</i18n>
<b-form-checkbox
v-model=
"isTosChecked"
:disabled=
"areTosAccepted"
>
<b-form-checkbox
id=
"TosAccepted"
v-model=
"isTosChecked"
:disabled=
"areTosAccepted"
>
{{ $t("page.tos.checkbox.tos") }}
</b-form-checkbox>
</b-card-body>
...
...
@@ -24,13 +28,18 @@
</a>
</
template
>
</i18n>
<b-form-checkbox
v-model=
"isPpChecked"
:disabled=
"areTosAccepted"
>
<b-form-checkbox
id=
"PpAccepted"
v-model=
"isPpChecked"
:disabled=
"areTosAccepted"
>
{{ $t("page.tos.checkbox.pp") }}
</b-form-checkbox>
</b-card-body>
<div
class=
"v_gapped_container"
>
<b-button
id=
"confirmBtn"
variant=
"primary"
:disabled=
"!isTosChecked || !isPpChecked || areTosAccepted"
@
click=
"accept"
...
...
This diff is collapsed.
Click to expand it.
CoscineBot
@CoscineBot
mentioned in commit
2c7f9d12
·
Feb 9, 2023
mentioned in commit
2c7f9d12
mentioned in commit 2c7f9d1285aea308d4b832bffe41181f0562708c
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment