update frontend lib : remove histoire (obselete) + update vitest - #1815
This commit is contained in:
49
tests/unit/specs/views/Group/CreateView.spec.ts
Normal file
49
tests/unit/specs/views/Group/CreateView.spec.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
import CreateView from "@/views/Group/CreateView.vue";
|
||||
import { CREATE_GROUP } from "@/graphql/group";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = () => {
|
||||
const global_data = getMockClient([CREATE_GROUP]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(CreateView, {
|
||||
props: {},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("CreateView", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
58
tests/unit/specs/views/Group/GroupFollowers.spec.ts
Normal file
58
tests/unit/specs/views/Group/GroupFollowers.spec.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
import GroupFollowers from "@/views/Group/GroupFollowers.vue";
|
||||
import { GROUP_FOLLOWERS, UPDATE_FOLLOWER } from "@/graphql/followers";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = () => {
|
||||
const global_data = getMockClient([GROUP_FOLLOWERS, UPDATE_FOLLOWER]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(GroupFollowers, {
|
||||
props: {
|
||||
preferredUsername: "my-group",
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("GroupFollowers", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
approved: true,
|
||||
followersLimit: 10,
|
||||
followersPage: 1,
|
||||
name: "my-group",
|
||||
});
|
||||
});
|
||||
});
|
||||
73
tests/unit/specs/views/Group/GroupMembers.spec.ts
Normal file
73
tests/unit/specs/views/Group/GroupMembers.spec.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
import GroupMembers from "@/views/Group/GroupMembers.vue";
|
||||
import {
|
||||
INVITE_MEMBER,
|
||||
GROUP_MEMBERS,
|
||||
REMOVE_MEMBER,
|
||||
UPDATE_MEMBER,
|
||||
APPROVE_MEMBER,
|
||||
} from "@/graphql/member";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = () => {
|
||||
const global_data = getMockClient([
|
||||
INVITE_MEMBER,
|
||||
GROUP_MEMBERS,
|
||||
REMOVE_MEMBER,
|
||||
UPDATE_MEMBER,
|
||||
APPROVE_MEMBER,
|
||||
]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(GroupMembers, {
|
||||
props: {
|
||||
preferredUsername: "my-group",
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("GroupMembers", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_2).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_3).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_4).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledWith({
|
||||
groupName: "my-group",
|
||||
limit: 10,
|
||||
page: 1,
|
||||
roles: undefined,
|
||||
});
|
||||
});
|
||||
});
|
||||
56
tests/unit/specs/views/Group/GroupSettings.spec.ts
Normal file
56
tests/unit/specs/views/Group/GroupSettings.spec.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
import GroupSettings from "@/views/Group/GroupSettings.vue";
|
||||
import { FETCH_GROUP_PUBLIC } from "@/graphql/group";
|
||||
import { DELETE_GROUP } from "@/graphql/group";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = () => {
|
||||
const global_data = getMockClient([FETCH_GROUP_PUBLIC, DELETE_GROUP]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(GroupSettings, {
|
||||
props: {
|
||||
preferredUsername: "my-group",
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("GroupSettings", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
name: "my-group",
|
||||
});
|
||||
});
|
||||
});
|
||||
79
tests/unit/specs/views/Group/GroupView.spec.ts
Normal file
79
tests/unit/specs/views/Group/GroupView.spec.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
import GroupView from "@/views/Group/GroupView.vue";
|
||||
import { FETCH_GROUP_PUBLIC } from "@/graphql/group";
|
||||
import { JOIN_GROUP } from "@/graphql/member";
|
||||
import {
|
||||
GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED,
|
||||
PERSON_STATUS_GROUP,
|
||||
} from "@/graphql/actor";
|
||||
import {
|
||||
FOLLOW_GROUP,
|
||||
UNFOLLOW_GROUP,
|
||||
UPDATE_GROUP_FOLLOW,
|
||||
} from "@/graphql/followers";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = () => {
|
||||
const global_data = getMockClient([
|
||||
FETCH_GROUP_PUBLIC,
|
||||
JOIN_GROUP,
|
||||
GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED,
|
||||
PERSON_STATUS_GROUP,
|
||||
FOLLOW_GROUP,
|
||||
UNFOLLOW_GROUP,
|
||||
UPDATE_GROUP_FOLLOW,
|
||||
]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(GroupView, {
|
||||
props: {
|
||||
preferredUsername: "my-group",
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("GroupView", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_2).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_3).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_4).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_5).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_6).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
name: "my-group",
|
||||
afterDateTime: new Date("2022-02-02T02:04:00.000Z"),
|
||||
});
|
||||
});
|
||||
});
|
||||
51
tests/unit/specs/views/Group/MyGroups.spec.ts
Normal file
51
tests/unit/specs/views/Group/MyGroups.spec.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
import MyGroups from "@/views/Group/MyGroups.vue";
|
||||
import { LOGGED_USER_MEMBERSHIPS } from "@/graphql/actor";
|
||||
import { LEAVE_GROUP } from "@/graphql/group";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = () => {
|
||||
const global_data = getMockClient([LOGGED_USER_MEMBERSHIPS, LEAVE_GROUP]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(MyGroups, {
|
||||
props: {},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("MyGroups", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
49
tests/unit/specs/views/Group/SettingsView.spec.ts
Normal file
49
tests/unit/specs/views/Group/SettingsView.spec.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { config, shallowMount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { getMockClient } from "../../mocks/client";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
import SettingsView from "@/views/Group/SettingsView.vue";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = () => {
|
||||
const global_data = getMockClient([]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return shallowMount(SettingsView, {
|
||||
props: {
|
||||
preferredUsername: "my-group",
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("SettingsView", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
58
tests/unit/specs/views/Group/TimelineView.spec.ts
Normal file
58
tests/unit/specs/views/Group/TimelineView.spec.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
import TimelineView from "@/views/Group/TimelineView.vue";
|
||||
import { GROUP_TIMELINE } from "@/graphql/group";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = () => {
|
||||
const global_data = getMockClient([GROUP_TIMELINE]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(TimelineView, {
|
||||
props: {
|
||||
preferredUsername: "my-group",
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("TimelineView", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
author: undefined,
|
||||
limit: 25,
|
||||
page: 1,
|
||||
preferredUsername: "my-group",
|
||||
type: undefined,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,138 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`CreateView > Show simple 1`] = `
|
||||
"<section class="container mx-auto">
|
||||
<h1>Create a new group</h1>
|
||||
<form>
|
||||
<div data-oruga="field" class="o-field"><label for="group-display-name" class="o-field__label">Group display name</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded"><input aria-required="true" required="" id="group-display-name" data-oruga-input="text" type="text" class="o-input" autocomplete="off">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div class="field"><label class="label" for="group-preferred-username">Federated Group Name</label>
|
||||
<div class="field-body">
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded"><input aria-required="true" required="" pattern="[a-z0-9_]+" id="group-preferred-username" data-oruga-input="text" type="text" class="o-input" autocomplete="off">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
<p class="control"><span class="button is-static">@localhost</span></p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="o-field__message">Only alphanumeric lowercased characters and underscores are supported.</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--v-if-->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field"><label for="group-summary" class="o-field__label">Description</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div class="address-autocomplete">
|
||||
<div data-oruga="field" class="o-field !-mt-2" id="FullAddressAutoComplete-o-field"><label for="full-address-autocomplete-1" class="o-field__label">Group address</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<!--v-if-->
|
||||
<div data-oruga="autocomplete" class="o-drop o-drop--expanded o-drop--position-auto o-acp">
|
||||
<div tabindex="-1" class="o-drop__trigger" aria-haspopup="listbox">
|
||||
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded"><input dir="auto" class="FullAddressAutoComplete-o-autocomplete !mt-0 !h-full o-input o-input--iconspace-left" role="combobox" aria-autocomplete="list" aria-controls="" aria-expanded="false" id="full-address-autocomplete-1" data-oruga-input="text" type="text" autocomplete="off" placeholder="e.g. 10 Rue Jangot"><span class="o-icon o-input__icon-left" data-oruga="icon"><i class="mdi mdi-map-marker mdi-24px"></i></span>
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
<!--teleport start-->
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<div id="" tabindex="-1" class="o-drop__menu o-drop__menu--auto" style="max-height: 200px; overflow: auto; display: none;" role="listbox" aria-hidden="true" aria-modal="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-drop__item o-drop__item--clickable o-acp__item o-acp__item--empty" role="listitem" tabindex="0" data-oruga="dropdown-item"></div>
|
||||
<!---->
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
</div><button disabled="" type="button" class="o-btn o-btn--disabled reset-area !h-auto" role="button" data-oruga="button" title="Clear address field"><span class="o-btn__wrapper"><span class="o-icon o-btn__icon o-btn__icon-left" data-oruga="icon"><i class="mdi mdi-close mdi-24px"></i></span>
|
||||
<!---->
|
||||
<!----></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
</div>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
<div class="field"><b class="field-label">Avatar</b>
|
||||
<div><label class="o-upl !flex" data-oruga="upload">
|
||||
<div class="o-upl__draggable" role="button" tabindex="0">
|
||||
<div class="w-100 text-center p-4 rounded-xl border-dashed border-2 border-gray-600"><span class="mx-auto flex w-fit"><span aria-hidden="true" class="material-design-icon upload-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z"><!--v-if--></path></svg></span><span class="capitalize">Click to upload Avatar</span></span>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
</div>
|
||||
</div><input type="file" data-oruga-input="file" accept="image/gif,image/png,image/jpeg,image/webp">
|
||||
</label></div>
|
||||
<!--v-if-->
|
||||
</div>
|
||||
<div class="field"><b class="field-label">Banner</b>
|
||||
<div><label class="o-upl !flex" data-oruga="upload">
|
||||
<div class="o-upl__draggable" role="button" tabindex="0">
|
||||
<div class="w-100 text-center p-4 rounded-xl border-dashed border-2 border-gray-600"><span class="mx-auto flex w-fit"><span aria-hidden="true" class="material-design-icon upload-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="24" height="24" viewBox="0 0 24 24"><path d="M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z"><!--v-if--></path></svg></span><span class="capitalize">Click to upload Banner</span></span>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
</div>
|
||||
</div><input type="file" data-oruga-input="file" accept="image/gif,image/png,image/jpeg,image/webp">
|
||||
</label></div>
|
||||
<!--v-if-->
|
||||
</div>
|
||||
<fieldset>
|
||||
<legend class="field-label !mb-0 mt-2">Group visibility</legend><label class="o-radio o-radio--checked" data-oruga="radio" role="radio" aria-checked="true"><input type="radio" data-oruga-input="radio" class="o-radio__input o-radio__input--checked" name="groupVisibility" autocomplete="off" value="PUBLIC"><span class="o-radio__label">Visible everywhere on the web<br><small>The group will be publicly listed in search results and may be suggested in the explore section. Only public informations will be shown on it's page.</small></span></label><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" name="groupVisibility" autocomplete="off" value="UNLISTED"><span class="o-radio__label">Only accessible through link<br><small>You'll need to transmit the group URL so people may access the group's profile. The group won't be findable in Mobilizon's search or regular search engines.</small></span></label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend class="mt-2"><span class="field-label !mb-0">New members</span><span>Members will also access private sections like discussions, resources and restricted posts.</span></legend>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" name="groupOpenness" autocomplete="off" value="OPEN"><span class="o-radio__label">Anyone can join freely<br><small>Anyone wanting to be a member from your group will be able to from your group page.</small></span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio o-radio--checked" data-oruga="radio" role="radio" aria-checked="true"><input type="radio" data-oruga-input="radio" class="o-radio__input o-radio__input--checked" name="groupOpenness" autocomplete="off" value="MODERATED"><span class="o-radio__label">Moderate new members<br><small>Anyone can request being a member, but an administrator needs to approve the membership.</small></span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" name="groupOpenness" autocomplete="off" value="INVITE_ONLY"><span class="o-radio__label">Manually invite new members<br><small>The only way for your group to get new members is if an admininistrator invites them.</small></span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend class="mt-2"><span class="field-label !mb-0">Followers</span><span>Followers will receive new public events and posts.</span></legend><label class="o-chk" data-oruga="checkbox" role="checkbox" aria-checked="false"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Manually approve new followers</span></label>
|
||||
</fieldset><button type="submit" class="o-btn o-btn--primary mt-3" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Create my group</span>
|
||||
<!----></span>
|
||||
</button>
|
||||
</form>
|
||||
</section>"
|
||||
`;
|
||||
@@ -0,0 +1,11 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`GroupFollowers > Show simple 1`] = `
|
||||
"<div>
|
||||
<!--v-if-->
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!--v-if-->
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,11 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`GroupMembers > Show simple 1`] = `
|
||||
"<div>
|
||||
<!--v-if-->
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!--v-if-->
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,19 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`GroupSettings > Show simple 1`] = `
|
||||
"<div>
|
||||
<!--v-if-->
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<article class="o-notification o-notification--top" data-oruga="notification">
|
||||
<!---->
|
||||
<div class="o-notification__wrapper">
|
||||
<!---->
|
||||
<div class="o-notification__content">You are not an administrator for this group.</div>
|
||||
</div>
|
||||
</article>
|
||||
</transition-stub>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,25 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`GroupView > Show simple 1`] = `
|
||||
"<div data-v-63850a71="" class="container mx-auto is-widescreen">
|
||||
<!--v-if-->
|
||||
<transition-stub data-v-63850a71="" name="fade" appear="false" persisted="false" css="true">
|
||||
<article class="o-notification o-notification--danger o-notification--top" data-oruga="notification">
|
||||
<!---->
|
||||
<div class="o-notification__wrapper">
|
||||
<!---->
|
||||
<div class="o-notification__content">No group found</div>
|
||||
</div>
|
||||
</article>
|
||||
</transition-stub>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
<div data-v-63850a71="" class="my-2">
|
||||
<!--v-if-->
|
||||
</div>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,25 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`MyGroups > Show simple 1`] = `
|
||||
"<section data-v-59f508e2="" class="container mx-auto px-1 mb-6">
|
||||
<h1 data-v-59f508e2="" class="title">My groups</h1>
|
||||
<p data-v-59f508e2="">Groups are spaces for coordination and preparation to better organize events and manage your community.</p>
|
||||
<div data-v-59f508e2="" class="flex my-3"><a data-v-59f508e2="" href="/groups/create" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Create group</span>
|
||||
<!----></span>
|
||||
</a></div>
|
||||
<transition-stub data-v-59f508e2="" name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
<section data-v-59f508e2="" class="text-center not-found">
|
||||
<div data-v-59f508e2="" class="">
|
||||
<div data-v-59f508e2="" class="">
|
||||
<div data-v-59f508e2="" class="text-center prose dark:prose-invert max-w-full">
|
||||
<p data-v-59f508e2="">You are not part of any group. Do you wish to <a data-v-59f508e2="" href="/groups/create" class="">create a group</a> or <a data-v-59f508e2="" href="/search?contentType=GROUPS" class="">explore the groups</a>?</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>"
|
||||
`;
|
||||
@@ -0,0 +1,17 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`SettingsView > Show simple 1`] = `
|
||||
"<div class="container mx-auto" preferredusername="my-group">
|
||||
<h1 class="">Settings</h1>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<aside class="sm:max-w-xs flex-1 min-w-[320px]">
|
||||
<ul>
|
||||
<setting-menu-section-stub title="Settings" to="[object Object]"></setting-menu-section-stub>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="flex-1">
|
||||
<router-view-stub name="default"></router-view-stub>
|
||||
</div>
|
||||
</div>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,203 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`TimelineView > Show simple 1`] = `
|
||||
"<div data-v-4ef926d4="" class="container mx-auto section">
|
||||
<!--v-if-->
|
||||
<section data-v-4ef926d4="" class="timeline">
|
||||
<div data-v-4ef926d4="" data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label data-v-4ef926d4="" class="o-radio o-radio--checked" data-oruga="radio" role="radio" aria-checked="true"><input class="pr-4 o-radio__input o-radio__input--checked" type="radio" data-oruga-input="radio" autocomplete="off"><span class="o-radio__label"><span data-v-4ef926d4="" aria-hidden="true" class="material-design-icon timeline-text-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="24" height="24" viewBox="0 0 24 24"><path d="M4 2V8H2V2H4M2 22H4V16H2V22M5 12C5 10.9 4.11 10 3 10C1.9 10 1 10.9 1 12C1 13.11 1.9 14 3 14C4.11 14 5 13.11 5 12M24 6V18C24 19.11 23.11 20 22 20H10C8.9 20 8 19.11 8 18V14L6 12L8 10V6C8 4.89 8.9 4 10 4H22C23.11 4 24 4.89 24 6M19 13H11V15H19V13M21 9H11V11H21V9Z"><!--v-if--></path></svg></span> All activities</span></label><label data-v-4ef926d4="" class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input class="pr-4 o-radio__input" type="radio" data-oruga-input="radio" autocomplete="off" value="MEMBER"><span class="o-radio__label"><span data-v-4ef926d4="" class="o-icon" data-oruga="icon"><i class="mdi mdi-account-multiple-plus mdi-24px"></i></span> Members</span></label><label data-v-4ef926d4="" class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input class="pr-4 o-radio__input" type="radio" data-oruga-input="radio" autocomplete="off" value="GROUP"><span class="o-radio__label"><span data-v-4ef926d4="" class="o-icon" data-oruga="icon"><i class="mdi mdi-cog mdi-24px"></i></span> Settings</span></label><label data-v-4ef926d4="" class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input class="pr-4 o-radio__input" type="radio" data-oruga-input="radio" autocomplete="off" value="EVENT"><span class="o-radio__label"><span data-v-4ef926d4="" class="o-icon" data-oruga="icon"><i class="mdi mdi-calendar mdi-24px"></i></span> Events</span></label><label data-v-4ef926d4="" class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input class="pr-4 o-radio__input" type="radio" data-oruga-input="radio" autocomplete="off" value="POST"><span class="o-radio__label"><span data-v-4ef926d4="" class="o-icon" data-oruga="icon"><i class="mdi mdi-bullhorn mdi-24px"></i></span> Posts</span></label><label data-v-4ef926d4="" class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input class="pr-4 o-radio__input" type="radio" data-oruga-input="radio" autocomplete="off" value="DISCUSSION"><span class="o-radio__label"><span data-v-4ef926d4="" class="o-icon" data-oruga="icon"><i class="mdi mdi-chat mdi-24px"></i></span> Discussions</span></label><label data-v-4ef926d4="" class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="RESOURCE"><span class="o-radio__label"><span data-v-4ef926d4="" class="o-icon" data-oruga="icon"><i class="mdi mdi-link mdi-24px"></i></span> Resources</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-v-4ef926d4="" data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label data-v-4ef926d4="" class="o-radio o-radio--checked" data-oruga="radio" role="radio" aria-checked="true"><input class="pr-4 o-radio__input o-radio__input--checked" type="radio" data-oruga-input="radio" autocomplete="off"><span class="o-radio__label"><span data-v-4ef926d4="" aria-hidden="true" class="material-design-icon timeline-text-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="24" height="24" viewBox="0 0 24 24"><path d="M4 2V8H2V2H4M2 22H4V16H2V22M5 12C5 10.9 4.11 10 3 10C1.9 10 1 10.9 1 12C1 13.11 1.9 14 3 14C4.11 14 5 13.11 5 12M24 6V18C24 19.11 23.11 20 22 20H10C8.9 20 8 19.11 8 18V14L6 12L8 10V6C8 4.89 8.9 4 10 4H22C23.11 4 24 4.89 24 6M19 13H11V15H19V13M21 9H11V11H21V9Z"><!--v-if--></path></svg></span> All activities</span></label><label data-v-4ef926d4="" class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input class="pr-4 o-radio__input" type="radio" data-oruga-input="radio" autocomplete="off" value="SELF"><span class="o-radio__label"><span data-v-4ef926d4="" class="o-icon" data-oruga="icon"><i class="mdi mdi-account mdi-24px"></i></span> From yourself</span></label><label data-v-4ef926d4="" class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input class="pr-4 o-radio__input" type="radio" data-oruga-input="radio" autocomplete="off" value="BY"><span class="o-radio__label"><span data-v-4ef926d4="" class="o-icon" data-oruga="icon"><i class="mdi mdi-account-multiple mdi-24px"></i></span> By others</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<transition-group-stub data-v-4ef926d4="" name="timeline-list" tag="div" appear="false" persisted="false" css="true">
|
||||
<div data-v-4ef926d4="" class="day">
|
||||
<div data-v-4ef926d4="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 48px; width: 300px;"></div>
|
||||
</div>
|
||||
<ul data-v-4ef926d4="" class="before:opacity-10">
|
||||
<li data-v-4ef926d4="">
|
||||
<div data-v-56a583cf="" data-v-4ef926d4="" class="activity-item"><span data-v-56a583cf=""><div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left"><div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 32px; width: 32px; border-radius: 50%;"></div></div></span>
|
||||
<div data-v-56a583cf="" class="subject">
|
||||
<div data-v-56a583cf="" class="prose dark:prose-invert">
|
||||
<p data-v-56a583cf="">
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left datetime">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li data-v-4ef926d4="">
|
||||
<div data-v-56a583cf="" data-v-4ef926d4="" class="activity-item"><span data-v-56a583cf=""><div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left"><div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 32px; width: 32px; border-radius: 50%;"></div></div></span>
|
||||
<div data-v-56a583cf="" class="subject">
|
||||
<div data-v-56a583cf="" class="prose dark:prose-invert">
|
||||
<p data-v-56a583cf="">
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left datetime">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li data-v-4ef926d4="">
|
||||
<div data-v-56a583cf="" data-v-4ef926d4="" class="activity-item"><span data-v-56a583cf=""><div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left"><div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 32px; width: 32px; border-radius: 50%;"></div></div></span>
|
||||
<div data-v-56a583cf="" class="subject">
|
||||
<div data-v-56a583cf="" class="prose dark:prose-invert">
|
||||
<p data-v-56a583cf="">
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left datetime">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li data-v-4ef926d4="">
|
||||
<div data-v-56a583cf="" data-v-4ef926d4="" class="activity-item"><span data-v-56a583cf=""><div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left"><div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 32px; width: 32px; border-radius: 50%;"></div></div></span>
|
||||
<div data-v-56a583cf="" class="subject">
|
||||
<div data-v-56a583cf="" class="prose dark:prose-invert">
|
||||
<p data-v-56a583cf="">
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left datetime">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li data-v-4ef926d4="">
|
||||
<div data-v-56a583cf="" data-v-4ef926d4="" class="activity-item"><span data-v-56a583cf=""><div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left"><div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 32px; width: 32px; border-radius: 50%;"></div></div></span>
|
||||
<div data-v-56a583cf="" class="subject">
|
||||
<div data-v-56a583cf="" class="prose dark:prose-invert">
|
||||
<p data-v-56a583cf="">
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left datetime">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div data-v-4ef926d4="" class="day">
|
||||
<div data-v-4ef926d4="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 48px; width: 300px;"></div>
|
||||
</div>
|
||||
<ul data-v-4ef926d4="" class="before:opacity-10">
|
||||
<li data-v-4ef926d4="">
|
||||
<div data-v-56a583cf="" data-v-4ef926d4="" class="activity-item"><span data-v-56a583cf=""><div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left"><div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 32px; width: 32px; border-radius: 50%;"></div></div></span>
|
||||
<div data-v-56a583cf="" class="subject">
|
||||
<div data-v-56a583cf="" class="prose dark:prose-invert">
|
||||
<p data-v-56a583cf="">
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left datetime">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li data-v-4ef926d4="">
|
||||
<div data-v-56a583cf="" data-v-4ef926d4="" class="activity-item"><span data-v-56a583cf=""><div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left"><div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 32px; width: 32px; border-radius: 50%;"></div></div></span>
|
||||
<div data-v-56a583cf="" class="subject">
|
||||
<div data-v-56a583cf="" class="prose dark:prose-invert">
|
||||
<p data-v-56a583cf="">
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left datetime">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li data-v-4ef926d4="">
|
||||
<div data-v-56a583cf="" data-v-4ef926d4="" class="activity-item"><span data-v-56a583cf=""><div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left"><div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 32px; width: 32px; border-radius: 50%;"></div></div></span>
|
||||
<div data-v-56a583cf="" class="subject">
|
||||
<div data-v-56a583cf="" class="prose dark:prose-invert">
|
||||
<p data-v-56a583cf="">
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left datetime">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li data-v-4ef926d4="">
|
||||
<div data-v-56a583cf="" data-v-4ef926d4="" class="activity-item"><span data-v-56a583cf=""><div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left"><div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 32px; width: 32px; border-radius: 50%;"></div></div></span>
|
||||
<div data-v-56a583cf="" class="subject">
|
||||
<div data-v-56a583cf="" class="prose dark:prose-invert">
|
||||
<p data-v-56a583cf="">
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left datetime">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li data-v-4ef926d4="">
|
||||
<div data-v-56a583cf="" data-v-4ef926d4="" class="activity-item"><span data-v-56a583cf=""><div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left"><div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated" style="height: 32px; width: 32px; border-radius: 50%;"></div></div></span>
|
||||
<div data-v-56a583cf="" class="subject">
|
||||
<div data-v-56a583cf="" class="prose dark:prose-invert">
|
||||
<p data-v-56a583cf="">
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
<div data-v-56a583cf="" data-oruga="skeleton" class="o-sklt o-sklt--left datetime">
|
||||
<div class="o-sklt__item o-sklt__item--rounded o-sklt__item--animated"></div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</transition-group-stub>
|
||||
<!---->
|
||||
<!---->
|
||||
<div data-v-4ef926d4="" class="observer"></div>
|
||||
<!--v-if-->
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
122
tests/unit/specs/views/User/PasswordReset.spec.ts
Normal file
122
tests/unit/specs/views/User/PasswordReset.spec.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import PasswordReset from "@/views/User/PasswordReset.vue";
|
||||
import { createMockClient, RequestHandler } from "mock-apollo-client";
|
||||
import { RESET_PASSWORD } from "@/graphql/auth";
|
||||
import { resetPasswordResponseMock } from "../../mocks/auth";
|
||||
import RouteName from "@/router/name";
|
||||
import flushPromises from "flush-promises";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { DefaultApolloClient } from "@vue/apollo-composable";
|
||||
import Oruga from "@oruga-ui/oruga-next";
|
||||
import {
|
||||
VueRouterMock,
|
||||
createRouterMock,
|
||||
injectRouterMock,
|
||||
} from "vue-router-mock";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
config.plugins.VueWrapper.install(VueRouterMock);
|
||||
|
||||
let requestHandlers: Record<string, RequestHandler>;
|
||||
|
||||
const generateWrapper = (
|
||||
customRequestHandlers: Record<string, RequestHandler> = {},
|
||||
customMocks = {}
|
||||
) => {
|
||||
const mockClient = createMockClient();
|
||||
|
||||
requestHandlers = {
|
||||
resetPasswordMutationHandler: vi
|
||||
.fn()
|
||||
.mockResolvedValue(resetPasswordResponseMock),
|
||||
...customRequestHandlers,
|
||||
};
|
||||
|
||||
mockClient.setRequestHandler(
|
||||
RESET_PASSWORD,
|
||||
requestHandlers.resetPasswordMutationHandler
|
||||
);
|
||||
|
||||
return mount(PasswordReset, {
|
||||
props: {
|
||||
token: "some-token",
|
||||
},
|
||||
global: {
|
||||
stubs: ["router-link", "router-view"],
|
||||
mocks: {
|
||||
...customMocks,
|
||||
},
|
||||
provide: {
|
||||
[DefaultApolloClient]: mockClient,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("Reset page", () => {
|
||||
const router = createRouterMock({
|
||||
spy: {
|
||||
create: (fn) => vi.fn(fn),
|
||||
reset: (spy) => spy.mockReset(),
|
||||
},
|
||||
});
|
||||
beforeEach(() => {
|
||||
// inject it globally to ensure `useRoute()`, `$route`, etc work
|
||||
// properly and give you access to test specific functions
|
||||
injectRouterMock(router);
|
||||
});
|
||||
|
||||
it("renders correctly", () => {
|
||||
const wrapper = generateWrapper();
|
||||
expect(wrapper.router).toBe(router);
|
||||
expect(wrapper.findAll('input[type="password"').length).toBe(2);
|
||||
const labels = wrapper.findAll("label");
|
||||
expect(labels.length).toBe(2);
|
||||
expect(labels.at(0).text()).toBe("Password");
|
||||
expect(labels.at(1).text()).toBe("Password (confirmation)");
|
||||
});
|
||||
|
||||
it("shows error if token is invalid", async () => {
|
||||
const wrapper = generateWrapper({
|
||||
resetPasswordMutationHandler: vi.fn().mockResolvedValue({
|
||||
errors: [{ message: "The token you provided is invalid." }],
|
||||
}),
|
||||
});
|
||||
|
||||
wrapper
|
||||
.findAll('input[type="password"')
|
||||
.forEach((inputField) => inputField.setValue("my password"));
|
||||
wrapper.find("form").trigger("submit");
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
expect(requestHandlers.resetPasswordMutationHandler).toBeCalledTimes(1);
|
||||
expect(requestHandlers.resetPasswordMutationHandler).toBeCalledWith({
|
||||
password: "my password",
|
||||
token: "some-token",
|
||||
});
|
||||
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.find(".o-notification--danger").text()).toContain(
|
||||
"The token you provided is invalid"
|
||||
);
|
||||
});
|
||||
|
||||
it("redirects to homepage if token is valid", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
|
||||
wrapper
|
||||
.findAll('input[type="password"')
|
||||
.forEach((inputField) => inputField.setValue("my password"));
|
||||
await wrapper.find("form").trigger("submit");
|
||||
|
||||
expect(requestHandlers.resetPasswordMutationHandler).toBeCalledTimes(1);
|
||||
expect(requestHandlers.resetPasswordMutationHandler).toBeCalledWith({
|
||||
password: "my password",
|
||||
token: "some-token",
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.router.push).toHaveBeenCalledWith({ name: RouteName.LOGIN });
|
||||
});
|
||||
});
|
||||
185
tests/unit/specs/views/User/RegisterView.spec.ts
Normal file
185
tests/unit/specs/views/User/RegisterView.spec.ts
Normal file
@@ -0,0 +1,185 @@
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import RegisterView from "@/views/User/RegisterView.vue";
|
||||
import { createMockClient, RequestHandler } from "mock-apollo-client";
|
||||
import flushPromises from "flush-promises";
|
||||
import { configMock } from "../../mocks/config";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
import { CREATE_USER } from "@/graphql/user";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { DefaultApolloClient } from "@vue/apollo-composable";
|
||||
import Oruga from "@oruga-ui/oruga-next";
|
||||
import {
|
||||
VueRouterMock,
|
||||
createRouterMock,
|
||||
injectRouterMock,
|
||||
} from "vue-router-mock";
|
||||
import { nullMock } from "../../common";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
config.plugins.VueWrapper.install(VueRouterMock);
|
||||
|
||||
let requestHandlers: Record<string, RequestHandler>;
|
||||
|
||||
const generateWrapper = (
|
||||
customRegModeration: boolean = false,
|
||||
customRequestHandlers: Record<string, RequestHandler> = {}
|
||||
) => {
|
||||
const mockClient = createMockClient();
|
||||
|
||||
const config_value = {
|
||||
...configMock,
|
||||
};
|
||||
if (customRegModeration) {
|
||||
config_value.data.config.registrationsModeration = true;
|
||||
}
|
||||
|
||||
requestHandlers = {
|
||||
configQueryHandler: vi.fn().mockResolvedValue(config_value),
|
||||
createUserHandler: vi.fn().mockResolvedValue(nullMock),
|
||||
...customRequestHandlers,
|
||||
};
|
||||
|
||||
mockClient.setRequestHandler(CONFIG, requestHandlers.configQueryHandler);
|
||||
mockClient.setRequestHandler(CREATE_USER, requestHandlers.createUserHandler);
|
||||
|
||||
return mount(RegisterView, {
|
||||
global: {
|
||||
stubs: ["router-link", "router-view"],
|
||||
provide: {
|
||||
[DefaultApolloClient]: mockClient,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("Register page", () => {
|
||||
const router = createRouterMock({
|
||||
spy: {
|
||||
create: (fn) => vi.fn(fn),
|
||||
reset: (spy) => spy.mockReset(),
|
||||
},
|
||||
});
|
||||
beforeEach(() => {
|
||||
// inject it globally to ensure `useRoute()`, `$route`, etc work
|
||||
// properly and give you access to test specific functions
|
||||
injectRouterMock(router);
|
||||
});
|
||||
|
||||
it("register without moderation", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
expect(wrapper.router).toBe(router);
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(wrapper.find("form").exists()).toBe(true);
|
||||
wrapper.find('form input[type="email"]').setValue("some@email.tld");
|
||||
wrapper.find('form input[type="password"]').setValue("somepassword");
|
||||
wrapper.find("form").trigger("submit");
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(requestHandlers.createUserHandler).toHaveBeenCalledWith({
|
||||
email: "some@email.tld",
|
||||
locale: "en_US",
|
||||
moderation: "",
|
||||
password: "somepassword",
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.find("form").exists()).toBe(false);
|
||||
});
|
||||
|
||||
it("shows error without moderation email", async () => {
|
||||
const wrapper = generateWrapper(false, {
|
||||
createUserHandler: vi.fn().mockResolvedValue({
|
||||
errors: [{ field: "email", message: ["Bad email."] }],
|
||||
}),
|
||||
});
|
||||
expect(wrapper.find("form").exists()).toBe(true);
|
||||
wrapper.find('form input[type="email"]').setValue("some@email.tld");
|
||||
wrapper.find('form input[type="password"]').setValue("somepassword");
|
||||
wrapper.find("form").trigger("submit");
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(requestHandlers.createUserHandler).toBeCalledTimes(1);
|
||||
expect(requestHandlers.createUserHandler).toHaveBeenCalledWith({
|
||||
email: "some@email.tld",
|
||||
locale: "en_US",
|
||||
moderation: "",
|
||||
password: "somepassword",
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.find("form").exists()).toBe(true);
|
||||
expect(wrapper.find(".o-field__message-danger").text()).toContain(
|
||||
"Bad email."
|
||||
);
|
||||
});
|
||||
|
||||
it("shows error without moderation password", async () => {
|
||||
const wrapper = generateWrapper(false, {
|
||||
createUserHandler: vi.fn().mockResolvedValue({
|
||||
errors: [{ field: "password", message: ["Bad password."] }],
|
||||
}),
|
||||
});
|
||||
expect(wrapper.find("form").exists()).toBe(true);
|
||||
wrapper.find('form input[type="email"]').setValue("some@email.tld");
|
||||
wrapper.find('form input[type="password"]').setValue("somepassword");
|
||||
wrapper.find("form").trigger("submit");
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(requestHandlers.createUserHandler).toBeCalledTimes(1);
|
||||
expect(requestHandlers.createUserHandler).toHaveBeenCalledWith({
|
||||
email: "some@email.tld",
|
||||
locale: "en_US",
|
||||
moderation: "",
|
||||
password: "somepassword",
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.find("form").exists()).toBe(true);
|
||||
expect(wrapper.find(".o-field__message-danger").text()).toContain(
|
||||
"Bad password."
|
||||
);
|
||||
});
|
||||
|
||||
it("register with moderation", async () => {
|
||||
const wrapper = generateWrapper(true);
|
||||
expect(wrapper.router).toBe(router);
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(wrapper.find("form").exists()).toBe(true);
|
||||
wrapper.find('form input[type="email"]').setValue("some@email.tld");
|
||||
wrapper.find('form input[type="password"]').setValue("somepassword");
|
||||
wrapper.find("form .o-input__textarea").setValue("text for moderation");
|
||||
wrapper.find("form").trigger("submit");
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(requestHandlers.createUserHandler).toHaveBeenCalledWith({
|
||||
email: "some@email.tld",
|
||||
locale: "en_US",
|
||||
moderation: "text for moderation",
|
||||
password: "somepassword",
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.find("form").exists()).toBe(false);
|
||||
});
|
||||
|
||||
it("shows error with moderation", async () => {
|
||||
const wrapper = generateWrapper(true, {
|
||||
createUserHandler: vi.fn().mockResolvedValue({
|
||||
errors: [{ field: null, message: ["Bad moderation."] }],
|
||||
}),
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.find("form").exists()).toBe(true);
|
||||
wrapper.find('form input[type="email"]').setValue("some@email.tld");
|
||||
wrapper.find('form input[type="password"]').setValue("somepassword");
|
||||
wrapper.find("form .o-input__textarea").setValue("text for moderation");
|
||||
wrapper.find("form").trigger("submit");
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(requestHandlers.createUserHandler).toBeCalledTimes(1);
|
||||
expect(requestHandlers.createUserHandler).toHaveBeenCalledWith({
|
||||
email: "some@email.tld",
|
||||
locale: "en_US",
|
||||
moderation: "text for moderation",
|
||||
password: "somepassword",
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.find("form").exists()).toBe(true);
|
||||
expect(wrapper.find(".o-field__message-danger").text()).toContain(
|
||||
"Bad moderation."
|
||||
);
|
||||
});
|
||||
});
|
||||
118
tests/unit/specs/views/User/ValidateUser.spec.ts
Normal file
118
tests/unit/specs/views/User/ValidateUser.spec.ts
Normal file
@@ -0,0 +1,118 @@
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import ValidateUser from "@/views/User/ValidateUser.vue";
|
||||
import { createMockClient, RequestHandler } from "mock-apollo-client";
|
||||
import flushPromises from "flush-promises";
|
||||
import { VALIDATE_USER, UPDATE_CURRENT_USER_CLIENT } from "@/graphql/user";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { DefaultApolloClient } from "@vue/apollo-composable";
|
||||
import Oruga from "@oruga-ui/oruga-next";
|
||||
import {
|
||||
VueRouterMock,
|
||||
createRouterMock,
|
||||
injectRouterMock,
|
||||
} from "vue-router-mock";
|
||||
import { nullMock } from "../../common";
|
||||
import * as auth_mod from "@/utils/auth.ts";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
config.plugins.VueWrapper.install(VueRouterMock);
|
||||
|
||||
vi.spyOn(auth_mod, "saveTokenData");
|
||||
vi.spyOn(auth_mod, "saveUserData");
|
||||
|
||||
let requestHandlers: Record<string, RequestHandler>;
|
||||
|
||||
const validateUserMock = {
|
||||
data: {
|
||||
validateUser: {
|
||||
accessToken: "aaaaaaa",
|
||||
refreshToken: "zzzzzzz",
|
||||
user: {
|
||||
id: "123",
|
||||
email: "truc@machin.com",
|
||||
role: "USER",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const generateWrapper = (moderate: boolean = false) => {
|
||||
const mockClient = createMockClient();
|
||||
const validate_user = {
|
||||
...validateUserMock,
|
||||
};
|
||||
if (moderate) {
|
||||
validate_user.data.validateUser.user.role = "PENDING";
|
||||
}
|
||||
requestHandlers = {
|
||||
validateUserHandler: vi.fn().mockResolvedValue(validateUserMock),
|
||||
updateUserHandler: vi.fn().mockResolvedValue(nullMock),
|
||||
};
|
||||
|
||||
mockClient.setRequestHandler(
|
||||
VALIDATE_USER,
|
||||
requestHandlers.validateUserHandler
|
||||
);
|
||||
mockClient.setRequestHandler(
|
||||
UPDATE_CURRENT_USER_CLIENT,
|
||||
requestHandlers.updateUserHandler
|
||||
);
|
||||
|
||||
const wrapper = mount(ValidateUser, {
|
||||
props: {
|
||||
token: "123456789",
|
||||
},
|
||||
global: {
|
||||
stubs: ["router-link", "router-view"],
|
||||
provide: {
|
||||
[DefaultApolloClient]: mockClient,
|
||||
},
|
||||
},
|
||||
});
|
||||
wrapper.router.push.mockReset();
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
describe("Validate user page", () => {
|
||||
const router = createRouterMock({
|
||||
spy: {
|
||||
create: (fn) => vi.fn(fn),
|
||||
reset: (spy) => spy.mockReset(),
|
||||
},
|
||||
});
|
||||
beforeEach(() => {
|
||||
// inject it globally to ensure `useRoute()`, `$route`, etc work
|
||||
// properly and give you access to test specific functions
|
||||
injectRouterMock(router);
|
||||
});
|
||||
|
||||
it("simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
expect(wrapper.router).toBe(router);
|
||||
await flushPromises();
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.validateUserHandler).toBeCalledTimes(1);
|
||||
expect(requestHandlers.validateUserHandler).toHaveBeenCalledWith({
|
||||
token: "123456789",
|
||||
});
|
||||
// expect(wrapper.router.replace).toHaveBeenCalledWith({
|
||||
// name: RouteName.CREATE_IDENTITY,
|
||||
// });
|
||||
// expect(requestHandlers.updateUserHandler).toBeCalledTimes(1);
|
||||
});
|
||||
|
||||
it("moderate", async () => {
|
||||
const wrapper = generateWrapper(true);
|
||||
expect(wrapper.router).toBe(router);
|
||||
await flushPromises();
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.validateUserHandler).toBeCalledTimes(1);
|
||||
expect(requestHandlers.validateUserHandler).toHaveBeenCalledWith({
|
||||
token: "123456789",
|
||||
});
|
||||
expect(requestHandlers.updateUserHandler).toBeCalledTimes(0);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,166 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`Register page > register with moderation 1`] = `
|
||||
"<div class="container mx-auto py-6">
|
||||
<section class="">
|
||||
<h1>Register an account on Mobilizon!</h1>
|
||||
<p><b>Mobilizon</b> is an instance of the <a href="https://mobilizon.org" target="_blank" class="out">Mobilizon</a> software.</p>
|
||||
</section>
|
||||
<section class="flex flex-wrap gap-6">
|
||||
<div class="">
|
||||
<div class="my-4">
|
||||
<h2 class="text-xl">Why create an account?</h2>
|
||||
<div class="prose dark:prose-invert">
|
||||
<ul>
|
||||
<li>To create and manage your events</li>
|
||||
<li>To create and manage multiples identities from a same account</li>
|
||||
<li>To register for an event by choosing one of your identities</li>
|
||||
<li>To create or join an group and start organizing with other people</li>
|
||||
<li>To follow groups and be informed of their latest events</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false" class="out block my-4"></router-link-stub>
|
||||
<hr role="presentation">
|
||||
<div class="my-4">
|
||||
<h2 class="text-xl">About Mobilizon</h2>
|
||||
<div class="prose dark:prose-invert">Mobilizon.fr est l'instance Mobilizon de Framasoft.</div>
|
||||
<p>Please read the <router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false" class="out"></router-link-stub> published by <b>Mobilizon</b>'s administrators.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<!--v-if-->
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
<form>
|
||||
<div data-oruga="field" class="o-field"><label for="email" class="o-field__label">Email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded"><input aria-required="true" required="" id="email" data-oruga-input="email" type="email" class="o-input" autocomplete="off">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field"><label for="password" class="o-field__label">Password</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded o-input__wrapper--has-icon-right"><input aria-required="true" required="" minlength="6" id="password" data-oruga-input="password" type="password" class="o-input o-input--iconspace-right" autocomplete="off">
|
||||
<!----><span class="o-icon o-icon--clickable o-input__icon-right" data-oruga="icon"><i class="mdi mdi-eye mdi-24px"></i></span>
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field"><label for="moderation" class="o-field__label">Registration is subject to moderation, indicate your motivation.</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded"><textarea aria-required="true" required="" id="moderation" data-oruga-input="textarea" class="o-input o-input__textarea"></textarea>
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div class="flex items-start mb-6 mt-2">
|
||||
<div class="flex items-center h-5"><input type="checkbox" id="accept_rules_terms" class="w-4 h-4 bg-gray-50 rounded border border-gray-300 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800" required=""></div><label for="accept_rules_terms" class="ml-2 text-gray-900 dark:text-gray-300"><span>I agree to the <router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false" class="out"></router-link-stub> and <router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false" class="out"></router-link-stub></span></label>
|
||||
</div>
|
||||
<p><button type="submit" class="o-btn o-btn--large o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Create an account</span>
|
||||
<!----></span>
|
||||
</button></p>
|
||||
<p class="my-6">
|
||||
<router-link-stub class="o-btn o-btn--text" role="button" data-oruga="button" to="[object Object]"></router-link-stub>
|
||||
<router-link-stub class="o-btn o-btn--text" role="button" data-oruga="button" to="[object Object]"></router-link-stub>
|
||||
</p>
|
||||
<hr role="presentation">
|
||||
<!--v-if-->
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`Register page > register without moderation 1`] = `
|
||||
"<div class="container mx-auto py-6">
|
||||
<section class="">
|
||||
<h1>Register an account on Mobilizon!</h1>
|
||||
<p><b>Mobilizon</b> is an instance of the <a href="https://mobilizon.org" target="_blank" class="out">Mobilizon</a> software.</p>
|
||||
</section>
|
||||
<section class="flex flex-wrap gap-6">
|
||||
<div class="">
|
||||
<div class="my-4">
|
||||
<h2 class="text-xl">Why create an account?</h2>
|
||||
<div class="prose dark:prose-invert">
|
||||
<ul>
|
||||
<li>To create and manage your events</li>
|
||||
<li>To create and manage multiples identities from a same account</li>
|
||||
<li>To register for an event by choosing one of your identities</li>
|
||||
<li>To create or join an group and start organizing with other people</li>
|
||||
<li>To follow groups and be informed of their latest events</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false" class="out block my-4"></router-link-stub>
|
||||
<hr role="presentation">
|
||||
<div class="my-4">
|
||||
<h2 class="text-xl">About Mobilizon</h2>
|
||||
<div class="prose dark:prose-invert">Mobilizon.fr est l'instance Mobilizon de Framasoft.</div>
|
||||
<p>Please read the <router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false" class="out"></router-link-stub> published by <b>Mobilizon</b>'s administrators.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<!--v-if-->
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
<form>
|
||||
<div data-oruga="field" class="o-field"><label for="email" class="o-field__label">Email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded"><input aria-required="true" required="" id="email" data-oruga-input="email" type="email" class="o-input" autocomplete="off">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field"><label for="password" class="o-field__label">Password</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded o-input__wrapper--has-icon-right"><input aria-required="true" required="" minlength="6" id="password" data-oruga-input="password" type="password" class="o-input o-input--iconspace-right" autocomplete="off">
|
||||
<!----><span class="o-icon o-icon--clickable o-input__icon-right" data-oruga="icon"><i class="mdi mdi-eye mdi-24px"></i></span>
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<!--v-if-->
|
||||
<div class="flex items-start mb-6 mt-2">
|
||||
<div class="flex items-center h-5"><input type="checkbox" id="accept_rules_terms" class="w-4 h-4 bg-gray-50 rounded border border-gray-300 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800" required=""></div><label for="accept_rules_terms" class="ml-2 text-gray-900 dark:text-gray-300"><span>I agree to the <router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false" class="out"></router-link-stub> and <router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false" class="out"></router-link-stub></span></label>
|
||||
</div>
|
||||
<p><button type="submit" class="o-btn o-btn--large o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Create an account</span>
|
||||
<!----></span>
|
||||
</button></p>
|
||||
<p class="my-6">
|
||||
<router-link-stub class="o-btn o-btn--text" role="button" data-oruga="button" to="[object Object]"></router-link-stub>
|
||||
<router-link-stub class="o-btn o-btn--text" role="button" data-oruga="button" to="[object Object]"></router-link-stub>
|
||||
</p>
|
||||
<hr role="presentation">
|
||||
<!--v-if-->
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,16 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`Validate user page > moderate 1`] = `
|
||||
"<section class="container mx-auto">
|
||||
<div>
|
||||
<h1 class="title">Your account has been validated</h1>
|
||||
<h2 class="title">A moderator will take care of your request.</h2>
|
||||
</div>
|
||||
</section>"
|
||||
`;
|
||||
|
||||
exports[`Validate user page > simple 1`] = `
|
||||
"<section class="container mx-auto">
|
||||
<h1 class="title">Your account is being validated</h1>
|
||||
</section>"
|
||||
`;
|
||||
@@ -0,0 +1,9 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`EmailValidate > Show simple 1`] = `
|
||||
"<section class="container mx-auto">
|
||||
<div>
|
||||
<h1 class="title">Your email has been changed</h1>
|
||||
</div>
|
||||
</section>"
|
||||
`;
|
||||
@@ -0,0 +1,3 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`ProviderValidation > Show simple 1`] = `"<p>Redirecting in progress…</p>"`;
|
||||
@@ -0,0 +1,54 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`ResendConfirmation > Show simple 1`] = `
|
||||
"<section class="container mx-auto pt-4 max-w-2xl">
|
||||
<h1>Resend confirmation email</h1>
|
||||
<!--v-if-->
|
||||
<form>
|
||||
<div data-oruga="field" class="o-field"><label for="emailAddress" class="o-field__label">Email address</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded"><input aria-required="true" required="" id="emailAddress" data-oruga-input="email" type="email" class="o-input" autocomplete="off">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<p class="flex flex-wrap gap-1 mt-2"><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Send the confirmation email again</span>
|
||||
<!----></span>
|
||||
</button><a href="/login" class="o-btn o-btn--primary o-btn--outlined-primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Cancel</span>
|
||||
<!----></span>
|
||||
</a></p>
|
||||
</form>
|
||||
</section>"
|
||||
`;
|
||||
|
||||
exports[`ResendConfirmation > Show simple 2`] = `
|
||||
"<section class="container mx-auto pt-4 max-w-2xl">
|
||||
<h1>Resend confirmation email</h1>
|
||||
<!--v-if-->
|
||||
<div>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<article title="Success" class="o-notification o-notification--success o-notification--top" data-oruga="notification">
|
||||
<!---->
|
||||
<div class="o-notification__wrapper">
|
||||
<!---->
|
||||
<div class="o-notification__content">If an account with this email exists, we just sent another confirmation email to some@email.tld</div>
|
||||
</div>
|
||||
</article>
|
||||
</transition-stub>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<article class="mt-2 o-notification o-notification--info o-notification--top" data-oruga="notification">
|
||||
<!---->
|
||||
<div class="o-notification__wrapper">
|
||||
<!---->
|
||||
<div class="o-notification__content">Please check your spam folder if you didn't receive the email.</div>
|
||||
</div>
|
||||
</article>
|
||||
</transition-stub>
|
||||
</div>
|
||||
</section>"
|
||||
`;
|
||||
@@ -0,0 +1,54 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`SendPasswordReset > Show simple 1`] = `
|
||||
"<section class="container mx-auto">
|
||||
<h1>Forgot your password?</h1>
|
||||
<p>Enter your email address below, and we'll email you instructions on how to change your password.</p>
|
||||
<form>
|
||||
<div data-oruga="field" class="o-field o-field--filled"><label class="o-field__label" for="">Email address</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded"><input aria-required="true" required="" id="" data-oruga-input="email" type="email" class="o-input" autocomplete="off">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<p class="my-4 flex gap-2"><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Submit</span>
|
||||
<!----></span>
|
||||
</button><a href="/login" class="o-btn o-btn--text" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Cancel</span>
|
||||
<!----></span>
|
||||
</a></p>
|
||||
</form>
|
||||
</section>"
|
||||
`;
|
||||
|
||||
exports[`SendPasswordReset > Show simple 2`] = `
|
||||
"<section class="container mx-auto">
|
||||
<h1>Forgot your password?</h1>
|
||||
<p>Enter your email address below, and we'll email you instructions on how to change your password.</p>
|
||||
<div>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<article class="my-2 o-notification o-notification--success o-notification--top" title="Success" data-oruga="notification">
|
||||
<!---->
|
||||
<div class="o-notification__wrapper">
|
||||
<!---->
|
||||
<div class="o-notification__content">We just sent an email to some@email.tld</div>
|
||||
</div>
|
||||
</article>
|
||||
</transition-stub>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<article class="my-2 o-notification o-notification--info o-notification--top" data-oruga="notification">
|
||||
<!---->
|
||||
<div class="o-notification__wrapper">
|
||||
<!---->
|
||||
<div class="o-notification__content">Please check your spam folder if you didn't receive the email.</div>
|
||||
</div>
|
||||
</article>
|
||||
</transition-stub>
|
||||
</div>
|
||||
</section>"
|
||||
`;
|
||||
@@ -0,0 +1,37 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`SettingsOnboard > Show simple - step 1 1`] = `
|
||||
"<div data-v-68ff875c="" class="container mx-auto">
|
||||
<h1 data-v-68ff875c="" class="title">Let's define a few settings</h1>
|
||||
<o-steps-stub data-v-68ff875c="" modelvalue="0" vertical="false" iconprev="chevron-left" iconnext="chevron-right" hasnavigation="false" destroyonhide="false" animated="true" animation="slide-next,slide-prev,slide-down,slide-up" animateinitially="false" labelposition="bottom" rounded="true"></o-steps-stub>
|
||||
<section data-v-68ff875c="" class="has-text-centered section buttons">
|
||||
<o-button-stub data-v-68ff875c="" tag="router-link" rounded="false" expanded="false" disabled="true" outlined="true" loading="false" inverted="false" nativetype="button" role="button" iconboth="false" to="[object Object]"></o-button-stub>
|
||||
<o-button-stub data-v-68ff875c="" tag="router-link" variant="success" rounded="false" expanded="false" disabled="false" outlined="true" loading="false" inverted="false" nativetype="button" role="button" iconboth="false" to="[object Object]"></o-button-stub>
|
||||
<!--v-if-->
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`SettingsOnboard > Show simple - step 2 1`] = `
|
||||
"<div data-v-68ff875c="" class="container mx-auto">
|
||||
<h1 data-v-68ff875c="" class="title">Let's define a few settings</h1>
|
||||
<o-steps-stub data-v-68ff875c="" modelvalue="1" vertical="false" iconprev="chevron-left" iconnext="chevron-right" hasnavigation="false" destroyonhide="false" animated="true" animation="slide-next,slide-prev,slide-down,slide-up" animateinitially="false" labelposition="bottom" rounded="true"></o-steps-stub>
|
||||
<section data-v-68ff875c="" class="has-text-centered section buttons">
|
||||
<o-button-stub data-v-68ff875c="" tag="router-link" rounded="false" expanded="false" disabled="false" outlined="true" loading="false" inverted="false" nativetype="button" role="button" iconboth="false" to="[object Object]"></o-button-stub>
|
||||
<o-button-stub data-v-68ff875c="" tag="router-link" variant="success" rounded="false" expanded="false" disabled="false" outlined="true" loading="false" inverted="false" nativetype="button" role="button" iconboth="false" to="[object Object]"></o-button-stub>
|
||||
<!--v-if-->
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`SettingsOnboard > Show simple - step 3 1`] = `
|
||||
"<div data-v-68ff875c="" class="container mx-auto">
|
||||
<h1 data-v-68ff875c="" class="title">Let's define a few settings</h1>
|
||||
<o-steps-stub data-v-68ff875c="" modelvalue="2" vertical="false" iconprev="chevron-left" iconnext="chevron-right" hasnavigation="false" destroyonhide="false" animated="true" animation="slide-next,slide-prev,slide-down,slide-up" animateinitially="false" labelposition="bottom" rounded="true"></o-steps-stub>
|
||||
<section data-v-68ff875c="" class="has-text-centered section buttons">
|
||||
<o-button-stub data-v-68ff875c="" tag="router-link" rounded="false" expanded="false" disabled="false" outlined="true" loading="false" inverted="false" nativetype="button" role="button" iconboth="false" to="[object Object]"></o-button-stub>
|
||||
<!--v-if-->
|
||||
<o-button-stub data-v-68ff875c="" tag="router-link" variant="success" size="big" rounded="false" expanded="false" disabled="false" outlined="false" loading="false" inverted="false" nativetype="button" role="button" iconboth="false" to="[object Object]"></o-button-stub>
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
59
tests/unit/specs/views/User/emailValidate.spec.ts
Normal file
59
tests/unit/specs/views/User/emailValidate.spec.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import EmailValidate from "@/views/User/EmailValidate.vue";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { VALIDATE_EMAIL } from "@/graphql/user";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const email_mock = {
|
||||
data: {
|
||||
id: "987654",
|
||||
},
|
||||
};
|
||||
|
||||
const generateWrapper = (mock_email = {}) => {
|
||||
const global_data = getMockClient([[VALIDATE_EMAIL, mock_email]]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(EmailValidate, {
|
||||
props: {
|
||||
token: "azerty123456789",
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("EmailValidate", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper(email_mock);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
token: "azerty123456789",
|
||||
});
|
||||
});
|
||||
});
|
||||
201
tests/unit/specs/views/User/login.spec.ts
Normal file
201
tests/unit/specs/views/User/login.spec.ts
Normal file
@@ -0,0 +1,201 @@
|
||||
import { config, mount, VueWrapper } from "@vue/test-utils";
|
||||
import Login from "@/views/User/LoginView.vue";
|
||||
import {
|
||||
createMockClient,
|
||||
MockApolloClient,
|
||||
RequestHandler,
|
||||
} from "mock-apollo-client";
|
||||
import buildCurrentUserResolver from "@/apollo/user";
|
||||
import { loginMock as loginConfigMock } from "../../mocks/config";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
import {
|
||||
loginMock,
|
||||
loginResponseMock,
|
||||
nullIdentityMock,
|
||||
} from "../../mocks/auth";
|
||||
import { LOGIN } from "@/graphql/auth";
|
||||
import {
|
||||
CURRENT_USER_CLIENT,
|
||||
LOGGED_USER_LOCATION,
|
||||
UPDATE_CURRENT_USER_CLIENT,
|
||||
} from "@/graphql/user";
|
||||
import { ICurrentUser } from "@/types/current-user.model";
|
||||
import flushPromises from "flush-promises";
|
||||
import RouteName from "@/router/name";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { DefaultApolloClient } from "@vue/apollo-composable";
|
||||
import Oruga from "@oruga-ui/oruga-next";
|
||||
import { cache } from "@/apollo/memory";
|
||||
import {
|
||||
VueRouterMock,
|
||||
createRouterMock,
|
||||
injectRouterMock,
|
||||
getRouter,
|
||||
} from "vue-router-mock";
|
||||
import { IDENTITIES } from "@/graphql/actor";
|
||||
import { nullMock } from "../../common";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
config.plugins.VueWrapper.install(VueRouterMock);
|
||||
|
||||
describe("Render login form", () => {
|
||||
let wrapper: VueWrapper;
|
||||
let mockClient: MockApolloClient | null;
|
||||
let requestHandlers: Record<string, RequestHandler>;
|
||||
|
||||
const router = createRouterMock({
|
||||
spy: {
|
||||
create: (fn) => vi.fn(fn),
|
||||
reset: (spy) => spy.mockReset(),
|
||||
},
|
||||
});
|
||||
beforeEach(() => {
|
||||
// inject it globally to ensure `useRoute()`, `$route`, etc work
|
||||
// properly and give you access to test specific functions
|
||||
injectRouterMock(router);
|
||||
});
|
||||
|
||||
const generateWrapper = (
|
||||
handlers: Record<string, unknown> = {},
|
||||
customProps: Record<string, unknown> = {},
|
||||
customMocks: Record<string, unknown> = {}
|
||||
) => {
|
||||
mockClient = createMockClient({
|
||||
cache,
|
||||
resolvers: buildCurrentUserResolver(cache),
|
||||
});
|
||||
|
||||
requestHandlers = {
|
||||
configQueryHandler: vi.fn().mockResolvedValue(loginConfigMock),
|
||||
loginMutationHandler: vi.fn().mockResolvedValue(loginResponseMock),
|
||||
identity: vi.fn().mockResolvedValue(nullIdentityMock),
|
||||
mockhdl: vi.fn().mockResolvedValue(nullMock),
|
||||
...handlers,
|
||||
};
|
||||
mockClient.setRequestHandler(CONFIG, requestHandlers.configQueryHandler);
|
||||
mockClient.setRequestHandler(LOGIN, requestHandlers.loginMutationHandler);
|
||||
mockClient.setRequestHandler(IDENTITIES, requestHandlers.identity);
|
||||
mockClient.setRequestHandler(LOGGED_USER_LOCATION, requestHandlers.mockhdl);
|
||||
mockClient.setRequestHandler(
|
||||
UPDATE_CURRENT_USER_CLIENT,
|
||||
requestHandlers.mockhdl
|
||||
);
|
||||
|
||||
wrapper = mount(Login, {
|
||||
props: {
|
||||
...customProps,
|
||||
},
|
||||
mocks: {
|
||||
...customMocks,
|
||||
},
|
||||
stubs: ["router-link", "router-view"],
|
||||
global: {
|
||||
provide: {
|
||||
[DefaultApolloClient]: mockClient,
|
||||
},
|
||||
},
|
||||
});
|
||||
wrapper.router.push.mockReset();
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
wrapper?.unmount();
|
||||
cache.reset();
|
||||
mockClient = null;
|
||||
});
|
||||
|
||||
it("requires email and password to be filled", async () => {
|
||||
generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
expect(requestHandlers.configQueryHandler).toHaveBeenCalled();
|
||||
wrapper.find('form input[type="email"]').setValue("");
|
||||
wrapper.find('form input[type="password"]').setValue("");
|
||||
wrapper.find('form button[type="submit"]').trigger("click");
|
||||
const form = wrapper.find("form");
|
||||
expect(form.exists()).toBe(true);
|
||||
const formElement = form.element as HTMLFormElement;
|
||||
expect(formElement.checkValidity()).toBe(false);
|
||||
});
|
||||
|
||||
it("renders and submits the login form", async () => {
|
||||
generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
expect(requestHandlers.configQueryHandler).toHaveBeenCalled();
|
||||
wrapper.find('form input[type="email"]').setValue("some@email.tld");
|
||||
wrapper.find('form input[type="password"]').setValue("somepassword");
|
||||
wrapper.find("form").trigger("submit");
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(requestHandlers.loginMutationHandler).toHaveBeenCalledWith({
|
||||
...loginMock,
|
||||
});
|
||||
await flushPromises();
|
||||
const currentUser = mockClient?.cache.readQuery<{
|
||||
currentUser: ICurrentUser;
|
||||
}>({
|
||||
query: CURRENT_USER_CLIENT,
|
||||
})?.currentUser;
|
||||
|
||||
await flushPromises();
|
||||
expect(currentUser?.email).toBe("some@email.tld");
|
||||
expect(currentUser?.id).toBe("1");
|
||||
await flushPromises();
|
||||
expect(wrapper.router.replace).toHaveBeenCalledWith({
|
||||
name: RouteName.HOME,
|
||||
});
|
||||
});
|
||||
|
||||
it("handles a login error", async () => {
|
||||
generateWrapper({
|
||||
loginMutationHandler: vi.fn().mockResolvedValue({
|
||||
errors: [
|
||||
{
|
||||
message:
|
||||
'"Impossible to authenticate, either your email or password are invalid."',
|
||||
},
|
||||
],
|
||||
}),
|
||||
});
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
expect(requestHandlers.configQueryHandler).toHaveBeenCalled();
|
||||
wrapper.find('form input[type="email"]').setValue("some@email.tld");
|
||||
wrapper.find('form input[type="password"]').setValue("somepassword");
|
||||
wrapper.find("form").trigger("submit");
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(requestHandlers.loginMutationHandler).toHaveBeenCalledWith({
|
||||
...loginMock,
|
||||
});
|
||||
await flushPromises();
|
||||
expect(wrapper.find(".o-notification--danger").text()).toContain(
|
||||
"Impossible to authenticate, either your email or password are invalid."
|
||||
);
|
||||
expect(wrapper.router.push).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("handles redirection after login", async () => {
|
||||
generateWrapper();
|
||||
getRouter().setQuery({ redirect: "/about/instance" });
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
|
||||
wrapper.find('form input[type="email"]').setValue("some@email.tld");
|
||||
wrapper.find('form input[type="password"]').setValue("somepassword");
|
||||
wrapper.find("form").trigger("submit");
|
||||
await flushPromises();
|
||||
expect(wrapper.router.push).toHaveBeenCalledWith("/about/instance");
|
||||
});
|
||||
});
|
||||
72
tests/unit/specs/views/User/providerValidation.spec.ts
Normal file
72
tests/unit/specs/views/User/providerValidation.spec.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { beforeEach, describe, it, expect, vi } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import ProviderValidation from "@/views/User/ProviderValidation.vue";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { UPDATE_CURRENT_USER_CLIENT, LOGGED_USER } from "@/graphql/user";
|
||||
|
||||
vi.mock("@/utils/html", () => {
|
||||
return {
|
||||
getValueFromMeta: (name: string) => name,
|
||||
escapeHtml: (html: string) => html,
|
||||
};
|
||||
});
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const logged_mock = {
|
||||
data: {
|
||||
loggedUser: {
|
||||
__typename: "User",
|
||||
defaultActor: {
|
||||
__typename: "Person",
|
||||
id: "1",
|
||||
unreadConversationsCount: 0,
|
||||
},
|
||||
id: "1",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const generateWrapper = (mock_logged = {}) => {
|
||||
const global_data = getMockClient([
|
||||
[LOGGED_USER, mock_logged],
|
||||
UPDATE_CURRENT_USER_CLIENT,
|
||||
]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(ProviderValidation, {
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("ProviderValidation", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper(logged_mock);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({});
|
||||
});
|
||||
});
|
||||
57
tests/unit/specs/views/User/resendConfirmation.spec.ts
Normal file
57
tests/unit/specs/views/User/resendConfirmation.spec.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import ResendConfirmation from "@/views/User/ResendConfirmation.vue";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { RESEND_CONFIRMATION_EMAIL } from "@/graphql/auth";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = () => {
|
||||
const global_data = getMockClient([RESEND_CONFIRMATION_EMAIL]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(ResendConfirmation, {
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("ResendConfirmation", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(0);
|
||||
|
||||
wrapper.find('form input[type="email"]').setValue("some@email.tld");
|
||||
wrapper.find("form").trigger("submit");
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
email: "some@email.tld",
|
||||
});
|
||||
});
|
||||
});
|
||||
59
tests/unit/specs/views/User/sendPasswordReset.spec.ts
Normal file
59
tests/unit/specs/views/User/sendPasswordReset.spec.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import SendPasswordReset from "@/views/User/SendPasswordReset.vue";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { SEND_RESET_PASSWORD } from "@/graphql/auth";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = () => {
|
||||
const global_data = getMockClient([SEND_RESET_PASSWORD]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(SendPasswordReset, {
|
||||
props: {
|
||||
email: "some@email.tld",
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("SendPasswordReset", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(0);
|
||||
|
||||
wrapper.find("form").trigger("submit");
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
email: "some@email.tld",
|
||||
});
|
||||
});
|
||||
});
|
||||
73
tests/unit/specs/views/User/settingsOnboard.spec.ts
Normal file
73
tests/unit/specs/views/User/settingsOnboard.spec.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import SettingsOnboard from "@/views/User/SettingsOnboard.vue";
|
||||
import { config, shallowMount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { USER_SETTINGS } from "@/graphql/user";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const settings_mock = {
|
||||
data: {},
|
||||
};
|
||||
|
||||
const generateWrapper = (mock_settings = {}, step) => {
|
||||
const global_data = getMockClient([[USER_SETTINGS, mock_settings]]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return shallowMount(SettingsOnboard, {
|
||||
props: {
|
||||
step: step,
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("SettingsOnboard", () => {
|
||||
it("Show simple - step 1", async () => {
|
||||
const wrapper = generateWrapper(settings_mock, 1);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({});
|
||||
});
|
||||
|
||||
it("Show simple - step 2", async () => {
|
||||
const wrapper = generateWrapper(settings_mock, 2);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({});
|
||||
});
|
||||
|
||||
it("Show simple - step 3", async () => {
|
||||
const wrapper = generateWrapper(settings_mock, 3);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,256 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`AdminGroupProfile > Show simple 1`] = `
|
||||
"<div class="section">
|
||||
<breadcrumbs-nav links="[object Object],[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<div><a href="/@group_name@domain" class="mx-auto max-w-sm block mb-2">
|
||||
<div data-v-b0ff4ece="" class="bg-white dark:bg-mbz-purple rounded-lg flex space-x-4 items-center flex-col p-4 shadow-md sm:p-8 pb-10 w-80">
|
||||
<div data-v-b0ff4ece="" class="flex pl-2"><span data-v-b0ff4ece="" class="ltr:-mr-0.5 rtl:-ml-0.5 material-design-icon account-circle-icon ltr:-mr-0.5 rtl:-ml-0.5" aria-hidden="true" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="48" height="48" viewBox="0 0 24 24"><path d="M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"><!--v-if--></path></svg></span></div>
|
||||
<div data-v-b0ff4ece="" class="text-center overflow-hidden w-full">
|
||||
<h5 data-v-b0ff4ece="" class="text-xl font-medium violet-title tracking-tight text-gray-900 dark:text-gray-200 whitespace-pre-line line-clamp-2">Group name</h5>
|
||||
<p data-v-b0ff4ece="" class="text-gray-500 dark:text-gray-200 truncate"><span data-v-b0ff4ece="" dir="ltr">@group_name@domain</span></p>
|
||||
<div data-v-b0ff4ece="" class="only-first-child line-clamp-10"></div>
|
||||
<!--v-if-->
|
||||
</div>
|
||||
<!--v-if-->
|
||||
</div>
|
||||
<!-- <div
|
||||
class="p-4 bg-white rounded-lg shadow-md sm:p-8 flex items-center space-x-4"
|
||||
dir="auto"
|
||||
>
|
||||
<div class="flex-shrink-0">
|
||||
<figure class="w-12 h-12" v-if="actor.avatar">
|
||||
<img
|
||||
class="rounded-lg"
|
||||
:src="actor.avatar.url"
|
||||
alt=""
|
||||
width="48"
|
||||
height="48"
|
||||
/>
|
||||
</figure>
|
||||
<o-icon
|
||||
v-else
|
||||
size="large"
|
||||
icon="account-circle"
|
||||
class="ltr:-mr-0.5 rtl:-ml-0.5"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 min-w-0">
|
||||
<h5 class="text-xl font-medium violet-title tracking-tight text-gray-900">
|
||||
{{ displayName(actor) }}
|
||||
</h5>
|
||||
<p class="text-gray-500 truncate" v-if="actor.name">
|
||||
<span dir="ltr">@{{ usernameWithDomain(actor) }}</span>
|
||||
</p>
|
||||
<div
|
||||
v-if="full"
|
||||
class="line-clamp-3"
|
||||
:class="{ limit: limit }"
|
||||
v-html="actor.summary"
|
||||
/>
|
||||
</div>
|
||||
</div> -->
|
||||
</a></div>
|
||||
<table class="table w-full">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td>Active</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Domain</td>
|
||||
<td>domain</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Uploaded media size</td>
|
||||
<td>0 octet</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="flex gap-1"><button type="button" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Suspend</span>
|
||||
<!----></span>
|
||||
</button>
|
||||
<!--v-if--><button type="button" class="o-btn o-btn--primary o-btn--outlined-primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Refresh profile</span>
|
||||
<!----></span>
|
||||
</button>
|
||||
</div>
|
||||
<section>
|
||||
<h2>1 members</h2>
|
||||
<div class="o-table__root" data-oruga="table">
|
||||
<div style="display: none;"><span data-id="1" data-oruga="table-column">Member <!----></span><span data-id="2" data-oruga="table-column">Role <!----></span><span data-id="3" data-oruga="table-column">Date <!----></span></div>
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-table__wrapper">
|
||||
<table class="o-table">
|
||||
<!---->
|
||||
<thead>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th" draggable="false"><span>Member <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Role <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Date <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<!---->
|
||||
<!---->
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" data-label="Member">
|
||||
<article class="flex gap-1">
|
||||
<div class="flex-none"><a href="/settings/admin/profiles/6548012" class="no-underline"><span aria-hidden="true" class="material-design-icon account-circle-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="48" height="48" viewBox="0 0 24 24"><path d="M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"><!--v-if--></path></svg></span></a></div>
|
||||
<div>
|
||||
<div class="prose dark:prose-invert"><a href="/settings/admin/profiles/6548012" class="no-underline">member #1</a><br><a href="/settings/admin/profiles/6548012" class="no-underline">@member_1</a></div>
|
||||
</div>
|
||||
</article>
|
||||
</td>
|
||||
<td class="o-table__td" data-label="Role"><span data-v-6955ca87="" class="rounded-md truncate text-sm text-black px-2 py-1 bg-purple-3 dark:text-violet-3">Administrator</span></td>
|
||||
<td class="o-table__td" data-label="Date"><span class="has-text-centered">Sunday, June 13, 2021<br>9:24 AM</span></td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<!---->
|
||||
</tbody>
|
||||
<!---->
|
||||
</table>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</div>
|
||||
<div class="o-table__pagination" per-page="10" total="1" rounded="false" size="small" simple="false" aria-next-label="Next page" aria-previous-label="Previous page" aria-page-label="Page" aria-current-label="Current page">
|
||||
<div></div>
|
||||
<div>
|
||||
<nav class="o-pag o-pag--right o-pag--small" data-oruga="pagination"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next o-pag__link--disabled" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<li class="o-pag__item"><button role="button" tabindex="0" class="o-pag__link o-pag__link--current" aria-label="Current page, Page 1." aria-current="true">1</button></li>
|
||||
<!---->
|
||||
<!---->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2>30410 organized events</h2>
|
||||
<div class="o-table__root" data-oruga="table">
|
||||
<div style="display: none;"><span data-id="1" data-oruga="table-column">Title <!----></span><span data-id="2" data-oruga="table-column">Begins on <!----></span></div>
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-table__wrapper">
|
||||
<table class="o-table o-table--table__empty">
|
||||
<!---->
|
||||
<thead>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th" draggable="false"><span>Title <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Begins on <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<!---->
|
||||
<!---->
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="flex flex-col items-center mt-20 mb-10" role="note"><span class="o-icon" data-oruga="icon"><i class="mdi mdi-account-group 48"></i></span>
|
||||
<h2 class="mb-3">
|
||||
<!-- @slot Mandatory title -->No organized events found
|
||||
</h2>
|
||||
<p class="" style="display: none;">
|
||||
<!-- @slot Optional description -->
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<!---->
|
||||
</table>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</div>
|
||||
<div class="o-table__pagination" per-page="10" total="30410" rounded="false" size="small" simple="false" aria-next-label="Next page" aria-previous-label="Previous page" aria-page-label="Page" aria-current-label="Current page">
|
||||
<div></div>
|
||||
<div>
|
||||
<nav class="o-pag o-pag--right o-pag--small" data-oruga="pagination"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<li class="o-pag__item"><button role="button" tabindex="0" class="o-pag__link o-pag__link--current" aria-label="Current page, Page 1." aria-current="true">1</button></li>
|
||||
<li class="o-pag__item"><button role="button" tabindex="0" class="o-pag__link" aria-label="Page 2." aria-current="false">2</button></li>
|
||||
<li class="o-pag__item"><span class="o-pag__ellipsis">…</span></li>
|
||||
<li class="o-pag__item"><button role="button" tabindex="0" class="o-pag__link" aria-label="Page 3041." aria-current="false">3041</button></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<h2>0 posts</h2>
|
||||
<div class="o-table__root" data-oruga="table">
|
||||
<div style="display: none;"><span data-id="1" data-oruga="table-column">Title <!----></span><span data-id="2" data-oruga="table-column">Publication date <!----></span></div>
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-table__wrapper">
|
||||
<table class="o-table o-table--table__empty">
|
||||
<!---->
|
||||
<thead>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th" draggable="false"><span>Title <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Publication date <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<!---->
|
||||
<!---->
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="flex flex-col items-center mt-20 mb-10" role="note"><span class="o-icon" data-oruga="icon"><i class="mdi mdi-bullhorn 48"></i></span>
|
||||
<h2 class="mb-3">
|
||||
<!-- @slot Mandatory title -->No posts found
|
||||
</h2>
|
||||
<p class="" style="display: none;">
|
||||
<!-- @slot Optional description -->
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<!---->
|
||||
</table>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</div>
|
||||
<div class="o-table__pagination" per-page="10" total="0" rounded="false" size="small" simple="false" aria-next-label="Next page" aria-previous-label="Previous page" aria-page-label="Page" aria-current-label="Current page">
|
||||
<div></div>
|
||||
<div>
|
||||
<nav class="o-pag o-pag--right o-pag--small" data-oruga="pagination"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next o-pag__link--disabled" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,258 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`AdminProfile > Show simple 1`] = `
|
||||
"<div class="section">
|
||||
<breadcrumbs-nav links="[object Object],[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<div class="flex justify-center">
|
||||
<div data-v-b0ff4ece="" class="bg-white dark:bg-mbz-purple rounded-lg flex space-x-4 items-center flex-col p-4 shadow-md sm:p-8 pb-10 w-80">
|
||||
<div data-v-b0ff4ece="" class="flex pl-2"><span data-v-b0ff4ece="" class="ltr:-mr-0.5 rtl:-ml-0.5 material-design-icon account-circle-icon ltr:-mr-0.5 rtl:-ml-0.5" aria-hidden="true" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="48" height="48" viewBox="0 0 24 24"><path d="M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z"><!--v-if--></path></svg></span></div>
|
||||
<div data-v-b0ff4ece="" class="text-center overflow-hidden w-full">
|
||||
<h5 data-v-b0ff4ece="" class="text-xl font-medium violet-title tracking-tight text-gray-900 dark:text-gray-200 whitespace-pre-line line-clamp-2">CurrentPerson</h5>
|
||||
<p data-v-b0ff4ece="" class="text-gray-500 dark:text-gray-200 truncate"><span data-v-b0ff4ece="" dir="ltr">@current</span></p>
|
||||
<!--v-if-->
|
||||
<div data-v-b0ff4ece="" class="only-first-child line-clamp-10"></div>
|
||||
</div>
|
||||
<div data-v-b0ff4ece="" class="flex pr-2"><a data-v-b0ff4ece="" href="/conversations?newMessage=true&personMentions=current" class=""><span data-v-b0ff4ece="" aria-hidden="true" class="material-design-icon email-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20,8L12,13L4,8V6L12,11L20,6M20,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6C22,4.89 21.1,4 20,4Z"><!--v-if--></path></svg></span></a></div>
|
||||
</div>
|
||||
<!-- <div
|
||||
class="p-4 bg-white rounded-lg shadow-md sm:p-8 flex items-center space-x-4"
|
||||
dir="auto"
|
||||
>
|
||||
<div class="flex-shrink-0">
|
||||
<figure class="w-12 h-12" v-if="actor.avatar">
|
||||
<img
|
||||
class="rounded-lg"
|
||||
:src="actor.avatar.url"
|
||||
alt=""
|
||||
width="48"
|
||||
height="48"
|
||||
/>
|
||||
</figure>
|
||||
<o-icon
|
||||
v-else
|
||||
size="large"
|
||||
icon="account-circle"
|
||||
class="ltr:-mr-0.5 rtl:-ml-0.5"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 min-w-0">
|
||||
<h5 class="text-xl font-medium violet-title tracking-tight text-gray-900">
|
||||
{{ displayName(actor) }}
|
||||
</h5>
|
||||
<p class="text-gray-500 truncate" v-if="actor.name">
|
||||
<span dir="ltr">@{{ usernameWithDomain(actor) }}</span>
|
||||
</p>
|
||||
<div
|
||||
v-if="full"
|
||||
class="line-clamp-3"
|
||||
:class="{ limit: limit }"
|
||||
v-html="actor.summary"
|
||||
/>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<section class="mt-4 mb-3">
|
||||
<h2 class="">Details</h2>
|
||||
<div class="flex flex-col">
|
||||
<div class="overflow-x-auto sm:-mx-6 lg:-mx-8">
|
||||
<div class="inline-block py-2 min-w-full sm:px-2 lg:px-8">
|
||||
<div class="overflow-hidden shadow-md sm:rounded-lg">
|
||||
<table class="min-w-full">
|
||||
<tbody>
|
||||
<tr class="odd:bg-white dark:odd:bg-zinc-800 even:bg-gray-50 dark:even:bg-zinc-700 border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap">Status</td>
|
||||
<td class="py-4 px-2 text-sm text-gray-500 dark:text-gray-200 whitespace-nowrap">Active</td>
|
||||
</tr>
|
||||
<tr class="odd:bg-white dark:odd:bg-zinc-800 even:bg-gray-50 dark:even:bg-zinc-700 border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap">Domain</td>
|
||||
<td class="py-4 px-2 text-sm text-gray-500 dark:text-gray-200 whitespace-nowrap">Local</td>
|
||||
</tr>
|
||||
<tr class="odd:bg-white dark:odd:bg-zinc-800 even:bg-gray-50 dark:even:bg-zinc-700 border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap">Uploaded media size</td>
|
||||
<td class="py-4 px-2 text-sm text-gray-500 dark:text-gray-200 whitespace-nowrap">0 octet</td>
|
||||
</tr>
|
||||
<tr class="odd:bg-white dark:odd:bg-zinc-800 even:bg-gray-50 dark:even:bg-zinc-700 border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap">User</td>
|
||||
<td class="py-4 px-2 text-sm text-gray-500 dark:text-gray-200 whitespace-nowrap"><a href="/settings/admin/users/1" class="">current@mobilizon.test</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="mt-4 mb-3">
|
||||
<h2 class="">Actions</h2>
|
||||
<p></p>
|
||||
<div class="p-4 mb-4 text-sm text-blue-700 bg-blue-100 rounded-lg" role="alert">This profile is located on this instance, so you need to <a href="/settings/admin/users/1" class="underline">access the corresponding account</a> to ban it.</div>
|
||||
</section>
|
||||
<section class="mt-4 mb-3">
|
||||
<h2 class="">Organized events</h2>
|
||||
<div class="o-table__root" data-oruga="table">
|
||||
<div style="display: none;"><span data-id="1" data-oruga="table-column">Begins on <!----></span><span data-id="2" data-oruga="table-column">Title <!----></span></div>
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-table__wrapper">
|
||||
<table class="o-table o-table--table__empty">
|
||||
<!---->
|
||||
<thead>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th" draggable="false"><span>Begins on <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Title <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<!---->
|
||||
<!---->
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="flex flex-col items-center mt-20 mb-10" role="note"><span class="o-icon" data-oruga="icon"><i class="mdi mdi-account-group 48"></i></span>
|
||||
<h2 class="mb-3">
|
||||
<!-- @slot Mandatory title -->No organized events listed
|
||||
</h2>
|
||||
<p class="" style="display: none;">
|
||||
<!-- @slot Optional description -->
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<!---->
|
||||
</table>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</div>
|
||||
<div class="o-table__pagination" per-page="10" total="0" rounded="false" size="small" simple="false" aria-next-label="Next page" aria-previous-label="Previous page" aria-page-label="Page" aria-current-label="Current page">
|
||||
<div></div>
|
||||
<div>
|
||||
<nav class="o-pag o-pag--right o-pag--small" data-oruga="pagination"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next o-pag__link--disabled" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="mt-4 mb-3">
|
||||
<h2 class="">Participations</h2>
|
||||
<div class="o-table__root" data-oruga="table">
|
||||
<div style="display: none;"><span data-id="1" data-oruga="table-column">Begins on <!----></span><span data-id="2" data-oruga="table-column">Title <!----></span></div>
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-table__wrapper">
|
||||
<table class="o-table o-table--table__empty">
|
||||
<!---->
|
||||
<thead>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th" draggable="false"><span>Begins on <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Title <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<!---->
|
||||
<!---->
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="flex flex-col items-center mt-20 mb-10" role="note"><span class="o-icon" data-oruga="icon"><i class="mdi mdi-account-group 48"></i></span>
|
||||
<h2 class="mb-3">
|
||||
<!-- @slot Mandatory title -->No participations listed
|
||||
</h2>
|
||||
<p class="" style="display: none;">
|
||||
<!-- @slot Optional description -->
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<!---->
|
||||
</table>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</div>
|
||||
<div class="o-table__pagination" per-page="10" total="0" rounded="false" size="small" simple="false" aria-next-label="Next page" aria-previous-label="Previous page" aria-page-label="Page" aria-current-label="Current page">
|
||||
<div></div>
|
||||
<div>
|
||||
<nav class="o-pag o-pag--right o-pag--small" data-oruga="pagination"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next o-pag__link--disabled" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="mt-4 mb-3">
|
||||
<h2 class="">Memberships</h2>
|
||||
<div class="o-table__root" data-oruga="table">
|
||||
<div style="display: none;"><span data-id="1" data-oruga="table-column">Group <!----></span><span data-id="2" data-oruga="table-column">Role <!----></span><span data-id="3" data-oruga="table-column">Date <!----></span></div>
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-table__wrapper">
|
||||
<table class="o-table o-table--table__empty">
|
||||
<!---->
|
||||
<thead>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th" draggable="false"><span>Group <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Role <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Date <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<!---->
|
||||
<!---->
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="flex flex-col items-center mt-20 mb-10" role="note"><span class="o-icon" data-oruga="icon"><i class="mdi mdi-account-group 48"></i></span>
|
||||
<h2 class="mb-3">
|
||||
<!-- @slot Mandatory title -->No memberships found
|
||||
</h2>
|
||||
<p class="" style="display: none;">
|
||||
<!-- @slot Optional description -->
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<!---->
|
||||
</table>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</div>
|
||||
<div class="o-table__pagination" per-page="10" total="0" rounded="false" size="small" simple="false" aria-next-label="Next page" aria-previous-label="Previous page" aria-page-label="Page" aria-current-label="Current page">
|
||||
<div></div>
|
||||
<div>
|
||||
<nav class="o-pag o-pag--right o-pag--small" data-oruga="pagination"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next o-pag__link--disabled" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,798 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`UsersView > Ban user 1`] = `
|
||||
"<div>
|
||||
<breadcrumbs-nav links="[object Object],[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<section>
|
||||
<h2 class="text-lg font-bold mb-3">Details</h2>
|
||||
<div class="flex flex-col">
|
||||
<div class="overflow-x-auto">
|
||||
<div class="inline-block py-2 min-w-full sm:px-2">
|
||||
<div class="overflow-hidden shadow-md sm:rounded-lg">
|
||||
<table class="table w-full">
|
||||
<tbody>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Email</td>
|
||||
<td class="py-4 px-2 align-middle">truc@mobilizon.test</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex flex flex-col items-start gap-2"><button type="button" class="o-btn o-btn--small o-btn--text" role="button" data-oruga="button"><span class="o-btn__wrapper"><span class="o-icon o-icon--small o-btn__icon o-btn__icon-left" data-oruga="icon"><i class="mdi mdi-pencil"></i></span><span class="o-btn__label">Change email</span>
|
||||
<!----></span>
|
||||
</button>
|
||||
<router-link-stub class="o-btn o-btn--small o-btn--text" role="button" data-oruga="button" to="[object Object]"></router-link-stub>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Language</td>
|
||||
<td class="py-4 px-2 align-middle">French</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Role</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap"><span class="bg-blue-100 text-blue-800 text-sm font-medium mr-2 px-2.5 py-0.5 rounded">User</span></td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex items-center"><button type="button" class="o-btn o-btn--small o-btn--text" role="button" data-oruga="button"><span class="o-btn__wrapper"><span class="o-icon o-icon--small o-btn__icon o-btn__icon-left" data-oruga="icon"><i class="mdi mdi-chevron-double-up"></i></span><span class="o-btn__label">Change role</span>
|
||||
<!----></span>
|
||||
</button></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Login status</td>
|
||||
<td class="py-4 px-2 align-middle">Activated</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Confirmed</td>
|
||||
<td class="py-4 px-2 align-middle">Saturday, August 30, 2025 at 11:56 AM</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex items-center">
|
||||
<!--v-if-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Last sign-in</td>
|
||||
<td class="py-4 px-2 align-middle">Unknown</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Last IP adress</td>
|
||||
<td class="py-4 px-2 align-middle">Unknown</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Total number of participations</td>
|
||||
<td class="py-4 px-2 align-middle">14</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Uploaded media total size</td>
|
||||
<td class="py-4 px-2 align-middle">6,76 mégaoctets</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="my-4">
|
||||
<h2 class="text-lg font-bold mb-3">Profiles</h2>
|
||||
<div class="flex flex-wrap justify-center sm:justify-start gap-4">
|
||||
<router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false"></router-link-stub>
|
||||
</div>
|
||||
</section>
|
||||
<section class="my-4">
|
||||
<h2 class="text-lg font-bold mb-3">Actions</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<!--v-if-->
|
||||
<td>
|
||||
<div class="buttons"><button type="button" class="o-btn o-btn--danger" role="button" data-oruga="button" id="deleteAccount"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Ban</span>
|
||||
<!----></span>
|
||||
</button></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<div class="" style="width: auto;">
|
||||
<header class="">
|
||||
<h2>Change user email</h2>
|
||||
</header>
|
||||
<section class="">
|
||||
<div data-oruga="field" class="o-field o-field--filled"><label class="o-field__label" for="">Previous email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper"><input id="" data-oruga-input="email" type="email" class="o-input o-input--disabled" autocomplete="off" disabled="">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field"><label class="o-field__label" for="">New email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper"><input required="" id="" data-oruga-input="email" type="email" class="o-input" autocomplete="off" placeholder="new@email.com">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label>
|
||||
</section>
|
||||
<footer class="mt-2 flex gap-2"><button type="button" class="o-btn o-btn--outlined" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Change email</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</div>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div has-modal-card="" close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<header>
|
||||
<h2>Change user role</h2>
|
||||
</header>
|
||||
<section>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="ADMINISTRATOR"><span class="o-radio__label">Administrator</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="MODERATOR"><span class="o-radio__label">Moderator</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio o-radio--checked" data-oruga="radio" role="radio" aria-checked="true"><input type="radio" data-oruga-input="radio" class="o-radio__input o-radio__input--checked" autocomplete="off" value="USER"><span class="o-radio__label">User</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label>
|
||||
</section>
|
||||
<footer class="mt-2 flex gap-2"><button type="button" class="o-btn o-btn--outlined" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Change role</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div has-modal-card="" close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<header>
|
||||
<h2>Confirm user</h2>
|
||||
</header>
|
||||
<section><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label></section>
|
||||
<footer><button type="button" class="o-btn" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Confirm user</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`UsersView > Show moderate list 1`] = `
|
||||
"<div>
|
||||
<breadcrumbs-nav links="[object Object],[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<section>
|
||||
<h2 class="text-lg font-bold mb-3">Details</h2>
|
||||
<div class="flex flex-col">
|
||||
<div class="overflow-x-auto">
|
||||
<div class="inline-block py-2 min-w-full sm:px-2">
|
||||
<div class="overflow-hidden shadow-md sm:rounded-lg">
|
||||
<table class="table w-full">
|
||||
<tbody>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Email</td>
|
||||
<td class="py-4 px-2 align-middle">truc@mobilizon.test</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex flex flex-col items-start gap-2">
|
||||
<!--v-if-->
|
||||
<router-link-stub class="o-btn o-btn--small o-btn--text" role="button" data-oruga="button" to="[object Object]"></router-link-stub>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Language</td>
|
||||
<td class="py-4 px-2 align-middle">French</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Role</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap"><span class="bg-orange-100 text-orange-800 text-sm font-medium mr-2 px-2.5 py-0.5 rounded">Pending</span></td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex items-center">
|
||||
<!--v-if-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Moderation</td>
|
||||
<td class="py-4 px-2 align-middle">moderation text</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Confirmed</td>
|
||||
<td class="py-4 px-2 align-middle">Saturday, August 30, 2025 at 11:56 AM</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex items-center">
|
||||
<!--v-if-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Last sign-in</td>
|
||||
<td class="py-4 px-2 align-middle">Unknown</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Last IP adress</td>
|
||||
<td class="py-4 px-2 align-middle">Unknown</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!--v-if-->
|
||||
<section class="my-4">
|
||||
<h2 class="text-lg font-bold mb-3">Actions</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="buttons"><button type="button" class="o-btn o-btn--success" role="button" data-oruga="button" id="acceptAccount"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Accept</span>
|
||||
<!----></span>
|
||||
</button></div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="buttons"><button type="button" class="o-btn o-btn--danger" role="button" data-oruga="button" id="deleteAccount"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Ban</span>
|
||||
<!----></span>
|
||||
</button></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<div class="" style="width: auto;">
|
||||
<header class="">
|
||||
<h2>Change user email</h2>
|
||||
</header>
|
||||
<section class="">
|
||||
<div data-oruga="field" class="o-field o-field--filled"><label class="o-field__label" for="">Previous email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper"><input id="" data-oruga-input="email" type="email" class="o-input o-input--disabled" autocomplete="off" disabled="">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field"><label class="o-field__label" for="">New email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper"><input required="" id="" data-oruga-input="email" type="email" class="o-input" autocomplete="off" placeholder="new@email.com">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label>
|
||||
</section>
|
||||
<footer class="mt-2 flex gap-2"><button type="button" class="o-btn o-btn--outlined" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Change email</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</div>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div has-modal-card="" close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<header>
|
||||
<h2>Change user role</h2>
|
||||
</header>
|
||||
<section>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="ADMINISTRATOR"><span class="o-radio__label">Administrator</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="MODERATOR"><span class="o-radio__label">Moderator</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="USER"><span class="o-radio__label">User</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label>
|
||||
</section>
|
||||
<footer class="mt-2 flex gap-2"><button type="button" class="o-btn o-btn--outlined" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Change role</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div has-modal-card="" close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<header>
|
||||
<h2>Confirm user</h2>
|
||||
</header>
|
||||
<section><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label></section>
|
||||
<footer><button type="button" class="o-btn" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Confirm user</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`UsersView > Show simple list 1`] = `
|
||||
"<div>
|
||||
<breadcrumbs-nav links="[object Object],[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<section>
|
||||
<h2 class="text-lg font-bold mb-3">Details</h2>
|
||||
<div class="flex flex-col">
|
||||
<div class="overflow-x-auto">
|
||||
<div class="inline-block py-2 min-w-full sm:px-2">
|
||||
<div class="overflow-hidden shadow-md sm:rounded-lg">
|
||||
<table class="table w-full">
|
||||
<tbody>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Email</td>
|
||||
<td class="py-4 px-2 align-middle">truc@mobilizon.test</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex flex flex-col items-start gap-2"><button type="button" class="o-btn o-btn--small o-btn--text" role="button" data-oruga="button"><span class="o-btn__wrapper"><span class="o-icon o-icon--small o-btn__icon o-btn__icon-left" data-oruga="icon"><i class="mdi mdi-pencil"></i></span><span class="o-btn__label">Change email</span>
|
||||
<!----></span>
|
||||
</button>
|
||||
<router-link-stub class="o-btn o-btn--small o-btn--text" role="button" data-oruga="button" to="[object Object]"></router-link-stub>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Language</td>
|
||||
<td class="py-4 px-2 align-middle">French</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Role</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap"><span class="bg-blue-100 text-blue-800 text-sm font-medium mr-2 px-2.5 py-0.5 rounded">User</span></td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex items-center"><button type="button" class="o-btn o-btn--small o-btn--text" role="button" data-oruga="button"><span class="o-btn__wrapper"><span class="o-icon o-icon--small o-btn__icon o-btn__icon-left" data-oruga="icon"><i class="mdi mdi-chevron-double-up"></i></span><span class="o-btn__label">Change role</span>
|
||||
<!----></span>
|
||||
</button></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Login status</td>
|
||||
<td class="py-4 px-2 align-middle">Activated</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Confirmed</td>
|
||||
<td class="py-4 px-2 align-middle">Saturday, August 30, 2025 at 11:56 AM</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex items-center">
|
||||
<!--v-if-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Last sign-in</td>
|
||||
<td class="py-4 px-2 align-middle">Unknown</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Last IP adress</td>
|
||||
<td class="py-4 px-2 align-middle">Unknown</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Total number of participations</td>
|
||||
<td class="py-4 px-2 align-middle">14</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Uploaded media total size</td>
|
||||
<td class="py-4 px-2 align-middle">6,76 mégaoctets</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="my-4">
|
||||
<h2 class="text-lg font-bold mb-3">Profiles</h2>
|
||||
<div class="flex flex-wrap justify-center sm:justify-start gap-4">
|
||||
<router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false"></router-link-stub>
|
||||
</div>
|
||||
</section>
|
||||
<section class="my-4">
|
||||
<h2 class="text-lg font-bold mb-3">Actions</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<!--v-if-->
|
||||
<td>
|
||||
<div class="buttons"><button type="button" class="o-btn o-btn--danger" role="button" data-oruga="button" id="deleteAccount"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Ban</span>
|
||||
<!----></span>
|
||||
</button></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<div class="" style="width: auto;">
|
||||
<header class="">
|
||||
<h2>Change user email</h2>
|
||||
</header>
|
||||
<section class="">
|
||||
<div data-oruga="field" class="o-field o-field--filled"><label class="o-field__label" for="">Previous email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper"><input id="" data-oruga-input="email" type="email" class="o-input o-input--disabled" autocomplete="off" disabled="">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field"><label class="o-field__label" for="">New email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper"><input required="" id="" data-oruga-input="email" type="email" class="o-input" autocomplete="off" placeholder="new@email.com">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label>
|
||||
</section>
|
||||
<footer class="mt-2 flex gap-2"><button type="button" class="o-btn o-btn--outlined" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Change email</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</div>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div has-modal-card="" close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<header>
|
||||
<h2>Change user role</h2>
|
||||
</header>
|
||||
<section>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="ADMINISTRATOR"><span class="o-radio__label">Administrator</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="MODERATOR"><span class="o-radio__label">Moderator</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio o-radio--checked" data-oruga="radio" role="radio" aria-checked="true"><input type="radio" data-oruga-input="radio" class="o-radio__input o-radio__input--checked" autocomplete="off" value="USER"><span class="o-radio__label">User</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label>
|
||||
</section>
|
||||
<footer class="mt-2 flex gap-2"><button type="button" class="o-btn o-btn--outlined" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Change role</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div has-modal-card="" close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<header>
|
||||
<h2>Confirm user</h2>
|
||||
</header>
|
||||
<section><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label></section>
|
||||
<footer><button type="button" class="o-btn" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Confirm user</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`UsersView > Unban user 1`] = `
|
||||
"<div>
|
||||
<breadcrumbs-nav links="[object Object],[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<section>
|
||||
<h2 class="text-lg font-bold mb-3">Details</h2>
|
||||
<div class="flex flex-col">
|
||||
<div class="overflow-x-auto">
|
||||
<div class="inline-block py-2 min-w-full sm:px-2">
|
||||
<div class="overflow-hidden shadow-md sm:rounded-lg">
|
||||
<table class="table w-full">
|
||||
<tbody>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Email</td>
|
||||
<td class="py-4 px-2 align-middle">truc@mobilizon.test</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex flex flex-col items-start gap-2">
|
||||
<!--v-if-->
|
||||
<router-link-stub class="o-btn o-btn--small o-btn--text" role="button" data-oruga="button" to="[object Object]"></router-link-stub>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Language</td>
|
||||
<td class="py-4 px-2 align-middle">French</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Role</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap"><span class="bg-blue-100 text-blue-800 text-sm font-medium mr-2 px-2.5 py-0.5 rounded">User</span></td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex items-center">
|
||||
<!--v-if-->
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Login status</td>
|
||||
<td class="py-4 px-2 align-middle">Disabled</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Confirmed</td>
|
||||
<td class="py-4 px-2 align-middle">Saturday, August 30, 2025 at 11:56 AM</td>
|
||||
<td class="py-4 px-2 whitespace-nowrap flex items-center"><button type="button" class="o-btn o-btn--small o-btn--text" role="button" data-oruga="button"><span class="o-btn__wrapper"><span class="o-icon o-icon--small o-btn__icon o-btn__icon-left" data-oruga="icon"><i class="mdi mdi-check"></i></span><span class="o-btn__label">Confirm user</span>
|
||||
<!----></span>
|
||||
</button></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Last sign-in</td>
|
||||
<td class="py-4 px-2 align-middle">Unknown</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Last IP adress</td>
|
||||
<td class="py-4 px-2 align-middle">Unknown</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Total number of participations</td>
|
||||
<td class="py-4 px-2 align-middle">14</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="border-b">
|
||||
<td class="py-4 px-2 whitespace-nowrap align-middle">Uploaded media total size</td>
|
||||
<td class="py-4 px-2 align-middle">6,76 mégaoctets</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="my-4">
|
||||
<h2 class="text-lg font-bold mb-3">Profiles</h2>
|
||||
<div class="flex flex-wrap justify-center sm:justify-start gap-4">
|
||||
<router-link-stub to="[object Object]" replace="false" custom="false" ariacurrentvalue="page" viewtransition="false"></router-link-stub>
|
||||
</div>
|
||||
</section>
|
||||
<section class="my-4">
|
||||
<h2 class="text-lg font-bold mb-3">Actions</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<!--v-if-->
|
||||
<td>
|
||||
<div>
|
||||
<div class="p-4 mb-4 text-sm text-red-700 bg-red-100 rounded-lg" role="alert">The user has been banned</div><button type="button" class="o-btn o-btn--danger" role="button" data-oruga="button" id="unbanAccount"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Unban</span>
|
||||
<!----></span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<div class="" style="width: auto;">
|
||||
<header class="">
|
||||
<h2>Change user email</h2>
|
||||
</header>
|
||||
<section class="">
|
||||
<div data-oruga="field" class="o-field o-field--filled"><label class="o-field__label" for="">Previous email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper"><input id="" data-oruga-input="email" type="email" class="o-input o-input--disabled" autocomplete="off" disabled="">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field"><label class="o-field__label" for="">New email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-oruga="input" class="o-input__wrapper"><input required="" id="" data-oruga-input="email" type="email" class="o-input" autocomplete="off" placeholder="new@email.com">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label>
|
||||
</section>
|
||||
<footer class="mt-2 flex gap-2"><button type="button" class="o-btn o-btn--outlined" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Change email</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</div>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div has-modal-card="" close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<header>
|
||||
<h2>Change user role</h2>
|
||||
</header>
|
||||
<section>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="ADMINISTRATOR"><span class="o-radio__label">Administrator</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="MODERATOR"><span class="o-radio__label">Moderator</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label class="o-radio o-radio--checked" data-oruga="radio" role="radio" aria-checked="true"><input type="radio" data-oruga-input="radio" class="o-radio__input o-radio__input--checked" autocomplete="off" value="USER"><span class="o-radio__label">User</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label>
|
||||
</section>
|
||||
<footer class="mt-2 flex gap-2"><button type="button" class="o-btn o-btn--outlined" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Change role</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
<!--teleport start-->
|
||||
<transition-stub name="zoom-out" appear="false" persisted="false" css="true">
|
||||
<div has-modal-card="" close-button-aria-label="Close" aria-modal="false" data-oruga="modal" class="o-modal" tabindex="-1" role="dialog" aria-label="Edit user email" style="display: none;">
|
||||
<div class="o-modal__overlay" tabindex="-1" aria-hidden="true"></div>
|
||||
<div class="o-modal__content" style="max-width: 960px;">
|
||||
<form>
|
||||
<header>
|
||||
<h2>Confirm user</h2>
|
||||
</header>
|
||||
<section><label class="o-chk o-chk--checked" data-oruga="checkbox" role="checkbox" aria-checked="true"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input o-chk__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Notify the user of the change</span></label></section>
|
||||
<footer><button type="button" class="o-btn" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Close</span>
|
||||
<!----></span>
|
||||
</button><button type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Confirm user</span>
|
||||
<!----></span>
|
||||
</button></footer>
|
||||
</form><span class="o-icon o-icon--clickable o-icon--medium o-modal__close" data-oruga="icon" style="display: none;"><i class="mdi mdi-close mdi-36px"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</transition-stub>
|
||||
<!--teleport end-->
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,28 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`Dashboard > Show simple 1`] = `
|
||||
"<div>
|
||||
<breadcrumbs-nav links="[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<section>
|
||||
<h1>Administration</h1>
|
||||
<div class="grid grid-cols-1 lg:grid-rows-2 lg:grid-flow-col gap-x-4 items-stretch">
|
||||
<number-dashboard-tile-stub number="340"></number-dashboard-tile-stub>
|
||||
<linked-number-dashboard-tile-stub subtitle="Groups" to="[object Object]" number="67"></linked-number-dashboard-tile-stub>
|
||||
<linked-number-dashboard-tile-stub subtitle="Users" to="[object Object]" number="220"></linked-number-dashboard-tile-stub>
|
||||
<linked-number-dashboard-tile-stub subtitle="Opened reports" to="[object Object]" number="9"></linked-number-dashboard-tile-stub>
|
||||
<linked-number-dashboard-tile-stub subtitle="Instances following you" to="[object Object]" number="12"></linked-number-dashboard-tile-stub>
|
||||
<linked-number-dashboard-tile-stub subtitle="Instances you follow" to="[object Object]" number="35"></linked-number-dashboard-tile-stub>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<div>
|
||||
<h2>Last published event</h2>
|
||||
<event-card-stub event="[object Object]" mode="column"></event-card-stub>
|
||||
</div>
|
||||
<div>
|
||||
<h2>Last group created</h2>
|
||||
<group-card-stub group="[object Object]" showsummary="true" isremotegroup="false" isloggedin="true" mode="column"></group-card-stub>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,122 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`GroupProfiles > Show simple 1`] = `
|
||||
"<div data-v-0a4382af="">
|
||||
<breadcrumbs-nav data-v-0a4382af="" links="[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<!--v-if-->
|
||||
<div data-v-0a4382af="">
|
||||
<div data-v-0a4382af="" class="flex gap-2"><label data-v-0a4382af="" class="o-switch o-switch--right" data-oruga="switch" role="switch" aria-checked="true"><input type="checkbox" role="switch" data-oruga-input="switch" class="o-switch__input o-switch__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-switch__check o-switch__check--checked o-switch--rounded"><span class="o-switch__check-switch o-switch--rounded"></span></span><span class="o-switch__label">Local</span></label><label data-v-0a4382af="" class="o-switch o-switch--right" data-oruga="switch" role="switch" aria-checked="false"><input type="checkbox" role="switch" data-oruga-input="switch" class="o-switch__input" autocomplete="off" true-value="true" false-value="false"><span class="o-switch__check o-switch--rounded"><span class="o-switch__check-switch o-switch--rounded"></span></span><span class="o-switch__label">Suspended</span></label></div>
|
||||
<div data-v-0a4382af="" class="o-table__root" data-oruga="table">
|
||||
<div style="display: none;"><span data-v-0a4382af="" data-id="1" data-oruga="table-column">Username <!----></span><span data-v-0a4382af="" data-id="2" data-oruga="table-column">Domain <!----></span></div>
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-table__wrapper">
|
||||
<table class="o-table">
|
||||
<!---->
|
||||
<thead>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th" draggable="false"><span>Username <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Domain <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th"><span><div data-v-0a4382af="" data-oruga="input" class="o-input__wrapper"><input aria-label="Filter" id="" data-oruga-input="text" type="text" class="o-input o-input--iconspace-left" autocomplete="off" placeholder="Filter"><span class="o-icon o-input__icon-left" data-oruga="icon"><i class="mdi mdi-magnify mdi-24px"></i></span>
|
||||
<!---->
|
||||
<!---->
|
||||
</div></span></th>
|
||||
<th class="o-table__th"><span><div data-v-0a4382af="" data-oruga="input" class="o-input__wrapper"><input aria-label="Filter" id="" data-oruga-input="text" type="text" class="o-input o-input--iconspace-left" autocomplete="off" placeholder="Filter"><span class="o-icon o-input__icon-left" data-oruga="icon"><i class="mdi mdi-magnify mdi-24px"></i></span>
|
||||
<!---->
|
||||
<!---->
|
||||
</div></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<!---->
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" data-label="Username"><a data-v-0a4382af="" href="/settings/admin/groups/1125368" class="profile">
|
||||
<article data-v-0a4382af="" class="flex gap-1"><span data-v-0a4382af="" aria-hidden="true" class="material-design-icon account-group-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="48" height="48" viewBox="0 0 24 24"><path d="M12,5.5A3.5,3.5 0 0,1 15.5,9A3.5,3.5 0 0,1 12,12.5A3.5,3.5 0 0,1 8.5,9A3.5,3.5 0 0,1 12,5.5M5,8C5.56,8 6.08,8.15 6.53,8.42C6.38,9.85 6.8,11.27 7.66,12.38C7.16,13.34 6.16,14 5,14A3,3 0 0,1 2,11A3,3 0 0,1 5,8M19,8A3,3 0 0,1 22,11A3,3 0 0,1 19,14C17.84,14 16.84,13.34 16.34,12.38C17.2,11.27 17.62,9.85 17.47,8.42C17.92,8.15 18.44,8 19,8M5.5,18.25C5.5,16.18 8.41,14.5 12,14.5C15.59,14.5 18.5,16.18 18.5,18.25V20H5.5V18.25M0,20V18.5C0,17.11 1.89,15.94 4.45,15.6C3.86,16.28 3.5,17.22 3.5,18.25V20H0M24,20H20.5V18.25C20.5,17.22 20.14,16.28 19.55,15.6C22.11,15.94 24,17.11 24,18.5V20Z"><!--v-if--></path></svg></span>
|
||||
<div data-v-0a4382af="" class="">
|
||||
<div data-v-0a4382af="" class="prose dark:prose-invert">
|
||||
<p data-v-0a4382af="" class="font-bold mb-0">Group #1</p><span data-v-0a4382af="" class="text-sm">@group1</span>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</a></td>
|
||||
<td class="o-table__td" data-label="Domain"></td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" data-label="Username"><a data-v-0a4382af="" href="/settings/admin/groups/175368" class="profile">
|
||||
<article data-v-0a4382af="" class="flex gap-1"><span data-v-0a4382af="" aria-hidden="true" class="material-design-icon account-group-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="48" height="48" viewBox="0 0 24 24"><path d="M12,5.5A3.5,3.5 0 0,1 15.5,9A3.5,3.5 0 0,1 12,12.5A3.5,3.5 0 0,1 8.5,9A3.5,3.5 0 0,1 12,5.5M5,8C5.56,8 6.08,8.15 6.53,8.42C6.38,9.85 6.8,11.27 7.66,12.38C7.16,13.34 6.16,14 5,14A3,3 0 0,1 2,11A3,3 0 0,1 5,8M19,8A3,3 0 0,1 22,11A3,3 0 0,1 19,14C17.84,14 16.84,13.34 16.34,12.38C17.2,11.27 17.62,9.85 17.47,8.42C17.92,8.15 18.44,8 19,8M5.5,18.25C5.5,16.18 8.41,14.5 12,14.5C15.59,14.5 18.5,16.18 18.5,18.25V20H5.5V18.25M0,20V18.5C0,17.11 1.89,15.94 4.45,15.6C3.86,16.28 3.5,17.22 3.5,18.25V20H0M24,20H20.5V18.25C20.5,17.22 20.14,16.28 19.55,15.6C22.11,15.94 24,17.11 24,18.5V20Z"><!--v-if--></path></svg></span>
|
||||
<div data-v-0a4382af="" class="">
|
||||
<div data-v-0a4382af="" class="prose dark:prose-invert">
|
||||
<p data-v-0a4382af="" class="font-bold mb-0">Group #4</p><span data-v-0a4382af="" class="text-sm">@group4</span>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</a></td>
|
||||
<td class="o-table__td" data-label="Domain"></td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" data-label="Username"><a data-v-0a4382af="" href="/settings/admin/groups/1126368" class="profile">
|
||||
<article data-v-0a4382af="" class="flex gap-1"><span data-v-0a4382af="" aria-hidden="true" class="material-design-icon account-group-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="48" height="48" viewBox="0 0 24 24"><path d="M12,5.5A3.5,3.5 0 0,1 15.5,9A3.5,3.5 0 0,1 12,12.5A3.5,3.5 0 0,1 8.5,9A3.5,3.5 0 0,1 12,5.5M5,8C5.56,8 6.08,8.15 6.53,8.42C6.38,9.85 6.8,11.27 7.66,12.38C7.16,13.34 6.16,14 5,14A3,3 0 0,1 2,11A3,3 0 0,1 5,8M19,8A3,3 0 0,1 22,11A3,3 0 0,1 19,14C17.84,14 16.84,13.34 16.34,12.38C17.2,11.27 17.62,9.85 17.47,8.42C17.92,8.15 18.44,8 19,8M5.5,18.25C5.5,16.18 8.41,14.5 12,14.5C15.59,14.5 18.5,16.18 18.5,18.25V20H5.5V18.25M0,20V18.5C0,17.11 1.89,15.94 4.45,15.6C3.86,16.28 3.5,17.22 3.5,18.25V20H0M24,20H20.5V18.25C20.5,17.22 20.14,16.28 19.55,15.6C22.11,15.94 24,17.11 24,18.5V20Z"><!--v-if--></path></svg></span>
|
||||
<div data-v-0a4382af="" class="">
|
||||
<div data-v-0a4382af="" class="prose dark:prose-invert">
|
||||
<p data-v-0a4382af="" class="font-bold mb-0">Group #2</p><span data-v-0a4382af="" class="text-sm">@group2</span>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</a></td>
|
||||
<td class="o-table__td" data-label="Domain"></td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<!---->
|
||||
</tbody>
|
||||
<!---->
|
||||
</table>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</div>
|
||||
<div class="o-table__pagination" per-page="10" total="3" rounded="false" size="small" simple="false" aria-next-label="Next page" aria-previous-label="Previous page" aria-page-label="Page" aria-current-label="Current page">
|
||||
<div></div>
|
||||
<div>
|
||||
<nav class="o-pag o-pag--right o-pag--small" data-oruga="pagination"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next o-pag__link--disabled" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<li class="o-pag__item"><button role="button" tabindex="0" class="o-pag__link o-pag__link--current" aria-label="Current page, Page 1." aria-current="true">1</button></li>
|
||||
<!---->
|
||||
<!---->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,33 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`InstanceView > Show simple 1`] = `
|
||||
"<div>
|
||||
<breadcrumbs-nav links="[object Object],[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<section class="flex flex-wrap md:flex-nowrap items-center justify-between gap-4">
|
||||
<div>
|
||||
<h2 class="text-4xl font-bold">Mobilizon</h2>
|
||||
<p class="text-slate-700 dark:text-slate-400 my-4">Mobilizon for test</p>Software details: <span class="capitalize">Mobilizon - 5.2.0</span>
|
||||
</div><a class="o-btn mx-auto md:mx-0" role="button" data-oruga="button" href="https://mobilizon.test" target="_blank" rel="noopener noreferrer"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Visit mobilizon.test</span><span class="o-icon o-btn__icon o-btn__icon-right" data-oruga="icon"><i class="mdi mdi-open-in-new mdi-24px"></i></span></span></a>
|
||||
</section>
|
||||
<section>
|
||||
<div class="grid md:grid-cols-2 xl:grid-cols-4 gap-2 content-center text-center mt-2">
|
||||
<div class="bg-zinc-50 dark:bg-mbz-purple-500 rounded-xl p-8"><a href="/settings/admin/profiles?domain=mobilizon.test" class=""><span class="mb-4 text-xl font-semibold block">5</span><span class="text-sm block">Profiles</span></a></div>
|
||||
<div class="bg-gray-50 dark:bg-mbz-purple-500 rounded-xl p-8"><a href="/settings/admin/groups?domain=mobilizon.test" class=""><span class="mb-4 text-xl font-semibold block">1</span><span class="text-sm block">Groups</span></a></div>
|
||||
<div class="bg-zinc-50 dark:bg-mbz-purple-500 rounded-xl p-8"><span class="mb-4 text-xl font-semibold block">0</span><span class="text-sm block">Followings</span></div>
|
||||
<div class="bg-zinc-50 dark:bg-mbz-purple-500 rounded-xl p-8"><span class="mb-4 text-xl font-semibold block">0</span><span class="text-sm block">Followers</span></div>
|
||||
<div class="bg-zinc-50 dark:bg-mbz-purple-500 rounded-xl p-8"><a href="/moderation/reports?domain=mobilizon.test" class=""><span class="mb-4 text-xl font-semibold block">1</span><span class="text-sm block">Reports</span></a></div>
|
||||
<div class="bg-zinc-50 dark:bg-mbz-purple-500 rounded-xl p-8"><span class="mb-4 font-semibold block">2,81 mégaoctets</span><span class="text-sm block">Uploaded media size</span></div>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div class="mt-3 grid xl:grid-cols-2 gap-4">
|
||||
<div class="border bg-white dark:bg-mbz-purple-500 dark:border-mbz-purple-700 p-6 shadow-md rounded-md flex flex-col gap-2 justify-center"><button class="bg-primary hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 focus:ring-offset-gray-50 text-white hover:text-white font-semibold h-12 px-6 rounded-lg w-full flex items-center justify-center sm:w-auto">Follow instance</button></div>
|
||||
<div class="border bg-white dark:bg-mbz-purple-500 dark:border-mbz-purple-700 p-6 shadow-md rounded-md flex flex-col gap-2 justify-center">
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
<p>This instance doesn't follow yours.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,119 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`InstancesView > Show simple 1`] = `
|
||||
"<div data-v-364450c8="">
|
||||
<breadcrumbs-nav data-v-364450c8="" links="[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<section data-v-364450c8="">
|
||||
<h1 data-v-364450c8="" class="title">Instances</h1>
|
||||
<form data-v-364450c8="" class="my-4">
|
||||
<div data-v-364450c8="" data-oruga="field" class="o-field o-field--horizontal">
|
||||
<div class="o-field__horizontal-label"><label for="newRelayAddress" class="o-field__label">Follow a new instance</label></div>
|
||||
<div class="o-field__horizontal-body">
|
||||
<div data-oruga="field" class="o-field">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field">
|
||||
<div data-v-364450c8="" data-oruga="field" class="o-field" expanded="" size="large">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--grouped-multiline o-field--grouped">
|
||||
<p data-v-364450c8="" class="control">
|
||||
<div data-v-364450c8="" data-oruga="input" class="o-input__wrapper"><input id="newRelayAddress" data-oruga-input="text" type="text" class="o-input" autocomplete="off" placeholder="Ex: mobilizon.fr">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</p>
|
||||
<p data-v-364450c8="" class="control"><button data-v-364450c8="" type="submit" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Add an instance</span>
|
||||
<!----></span>
|
||||
</button>
|
||||
<transition-stub data-v-364450c8="" name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="o-field__message"></p>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</form>
|
||||
<div data-v-364450c8="" class="flex flex-wrap gap-2">
|
||||
<div data-v-364450c8="" data-oruga="field" class="o-field"><label class="o-field__label">Follow status</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons"><label data-v-364450c8="" class="o-radio o-radio--checked" data-oruga="radio" role="radio" aria-checked="true"><input type="radio" data-oruga-input="radio" class="o-radio__input o-radio__input--checked" autocomplete="off" value="ALL"><span class="o-radio__label">All</span></label><label data-v-364450c8="" class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="FOLLOWING"><span class="o-radio__label">Following</span></label><label data-v-364450c8="" class="o-radio" data-oruga="radio" role="radio" aria-checked="false"><input type="radio" data-oruga-input="radio" class="o-radio__input" autocomplete="off" value="FOLLOWED"><span class="o-radio__label">Followed</span></label></div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-v-364450c8="" data-oruga="field" class="o-field flex-auto"><label for="domain-filter" class="o-field__label">Domain or instance name</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-v-364450c8="" data-oruga="input" class="o-input__wrapper"><input id="domain-filter" data-oruga-input="text" type="text" class="o-input" autocomplete="off" placeholder="mobilizon-instance.tld">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
<div data-v-364450c8="" class="my-3"><a data-v-364450c8="" href="/settings/admin/instances/mobilizon.test" class="min-w-0 flex items-center mb-2 rounded bg-mbz-yellow-alt-300 hover:bg-mbz-yellow-alt-200 dark:bg-mbz-purple-600 dark:hover:bg-mbz-purple-700 p-4 flex-wrap md:flex-nowrap justify-center gap-x-2 gap-y-3">
|
||||
<div data-v-364450c8="" class="flex-1 overflow-hidden flex items-center gap-1"><img data-v-364450c8="" class="w-12" src="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='60'%20height='60'%3e%3cpath%20style='opacity:0;fill:%23fea72b;fill-opacity:1;stroke:none;stroke-opacity:0'%20d='M-5.801-6.164h72.69v72.871h-72.69z'%20/%3e%3cg%20data-name='Calque%202'%3e%3cg%20data-name='header'%3e%3cpath%20d='M26.58%2027.06q0%208-4.26%2012.3a12.21%2012.21%200%200%201-9%203.42%2012.21%2012.21%200%200%201-9-3.42Q0%2035.1%200%2027.06q0-8.04%204.26-12.3a12.21%2012.21%200%200%201%209-3.42%2012.21%2012.21%200%200%201%209%203.42q4.32%204.24%204.32%2012.3zM13.29%2017q-5.67%200-5.67%2010.06t5.67%2010.08q5.71%200%205.71-10.08T13.29%2017z'%20style='fill:%233a384c;fill-opacity:1'%20transform='translate(14.627%205.256)%20scale(1.15671)'%20/%3e%3cpath%20d='M9%206.78a7.37%207.37%200%200%201-.6-3%207.37%207.37%200%200%201%20.6-3A8.09%208.09%200%200%201%2012.83%200a7.05%207.05%200%200%201%203.69.84%207.37%207.37%200%200%201%20.6%203%207.37%207.37%200%200%201-.6%203%207.46%207.46%200%200%201-3.87.84A6.49%206.49%200%200%201%209%206.78z'%20style='fill:%23fff'%20transform='translate(14.627%205.256)%20scale(1.15671)'%20/%3e%3c/g%3e%3c/g%3e%3c/svg%3e" alt="">
|
||||
<div data-v-364450c8="" class="">
|
||||
<h3 data-v-364450c8="" class="text-lg truncate font-bold line-clamp-1 text-slate-800 dark:text-slate-100">Mobilizon</h3>
|
||||
<div data-v-364450c8="">
|
||||
<div data-v-364450c8="" class="flex flex-wrap gap-x-2 gap-y-1">
|
||||
<p data-v-364450c8="" class="min-w-0 inline-flex gap-1 truncate text-slate-700 dark:text-slate-300"><span data-v-364450c8="" class="o-icon" data-oruga="icon"><i class="mdi mdi-web mdi-24px"></i></span><span data-v-364450c8="">mobilizon.test</span></p>
|
||||
<p data-v-364450c8="" class="capitalize text-slate-700 dark:text-slate-300 inline-flex gap-1"><span data-v-364450c8="" class="o-icon" data-oruga="icon"><i class="mdi mdi-server mdi-24px"></i></span> Mobilizon</p>
|
||||
</div>
|
||||
<div data-v-364450c8="">
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-v-364450c8="" class="flex-none flex gap-3 ltr:ml-3 rtl:mr-3">
|
||||
<p data-v-364450c8="" class="flex flex-col text-center"><span data-v-364450c8="" class="text-xl">20</span><span data-v-364450c8="" class="text-sm">Events</span></p>
|
||||
<p data-v-364450c8="" class="flex flex-col text-center"><span data-v-364450c8="" class="text-xl">5</span><span data-v-364450c8="" class="text-sm">Profiles</span></p>
|
||||
</div>
|
||||
</a><a data-v-364450c8="" href="/settings/admin/instances/agenda.test" class="min-w-0 flex items-center mb-2 rounded bg-mbz-yellow-alt-300 hover:bg-mbz-yellow-alt-200 dark:bg-mbz-purple-600 dark:hover:bg-mbz-purple-700 p-4 flex-wrap md:flex-nowrap justify-center gap-x-2 gap-y-3">
|
||||
<div data-v-364450c8="" class="flex-1 overflow-hidden flex items-center gap-1"><img data-v-364450c8="" class="w-8 mx-2" src="/img/gancio.png" alt="">
|
||||
<div data-v-364450c8="" class="">
|
||||
<h3 data-v-364450c8="" class="text-lg truncate font-bold line-clamp-1 text-slate-800 dark:text-slate-100">Agenda de Crémeaux</h3>
|
||||
<div data-v-364450c8="">
|
||||
<div data-v-364450c8="" class="flex flex-wrap gap-x-2 gap-y-1">
|
||||
<p data-v-364450c8="" class="min-w-0 inline-flex gap-1 truncate text-slate-700 dark:text-slate-300"><span data-v-364450c8="" class="o-icon" data-oruga="icon"><i class="mdi mdi-web mdi-24px"></i></span><span data-v-364450c8="">agenda.test</span></p>
|
||||
<p data-v-364450c8="" class="capitalize text-slate-700 dark:text-slate-300 inline-flex gap-1"><span data-v-364450c8="" class="o-icon" data-oruga="icon"><i class="mdi mdi-server mdi-24px"></i></span> gancio</p>
|
||||
</div>
|
||||
<div data-v-364450c8="">
|
||||
<p data-v-364450c8="" class="inline-flex gap-1 text-slate-700 dark:text-slate-300"><span data-v-364450c8="" class="o-icon" data-oruga="icon"><i class="mdi mdi-inbox-arrow-down mdi-24px"></i></span> Followed</p>
|
||||
<!--v-if-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-v-364450c8="" class="flex-none flex gap-3 ltr:ml-3 rtl:mr-3">
|
||||
<p data-v-364450c8="" class="flex flex-col text-center"><span data-v-364450c8="" class="text-xl">4</span><span data-v-364450c8="" class="text-sm">Events</span></p>
|
||||
<p data-v-364450c8="" class="flex flex-col text-center"><span data-v-364450c8="" class="text-xl">0</span><span data-v-364450c8="" class="text-sm">Profiles</span></p>
|
||||
</div>
|
||||
</a>
|
||||
<nav data-v-364450c8="" class="o-pag o-pag--right" data-oruga="pagination" style="display: none;"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next o-pag__link--disabled" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<li class="o-pag__item"><button role="button" tabindex="0" class="o-pag__link o-pag__link--current" aria-label="Current page, Page 1." aria-current="true">1</button></li>
|
||||
<!---->
|
||||
<!---->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</section>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,115 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`ProfilesView > Show simple 1`] = `
|
||||
"<div data-v-7a3be82f="">
|
||||
<breadcrumbs-nav data-v-7a3be82f="" links="[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<div data-v-7a3be82f="">
|
||||
<div data-v-7a3be82f="" class="flex gap-2"><label data-v-7a3be82f="" class="o-switch o-switch--right" data-oruga="switch" role="switch" aria-checked="true"><input type="checkbox" role="switch" data-oruga-input="switch" class="o-switch__input o-switch__input--checked" autocomplete="off" true-value="true" false-value="false"><span class="o-switch__check o-switch__check--checked o-switch--rounded"><span class="o-switch__check-switch o-switch--rounded"></span></span><span class="o-switch__label">Local</span></label><label data-v-7a3be82f="" class="o-switch o-switch--right" data-oruga="switch" role="switch" aria-checked="false"><input type="checkbox" role="switch" data-oruga-input="switch" class="o-switch__input" autocomplete="off" true-value="true" false-value="false"><span class="o-switch__check o-switch--rounded"><span class="o-switch__check-switch o-switch--rounded"></span></span><span class="o-switch__label">Suspended</span></label></div>
|
||||
<div data-v-7a3be82f="" class="o-table__root" data-oruga="table">
|
||||
<div style="display: none;"><span data-v-7a3be82f="" data-id="1" data-oruga="table-column">Username <!----></span><span data-v-7a3be82f="" data-id="2" data-oruga="table-column">Domain <!----></span></div>
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-table__wrapper">
|
||||
<table class="o-table">
|
||||
<!---->
|
||||
<thead>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th" draggable="false"><span>Username <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Domain <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th"><span><div data-v-7a3be82f="" data-oruga="input" class="o-input__wrapper"><input aria-label="Filter" id="" data-oruga-input="text" type="text" class="o-input o-input--iconspace-left" autocomplete="off" placeholder="Filter"><span class="o-icon o-input__icon-left" data-oruga="icon"><i class="mdi mdi-magnify mdi-24px"></i></span>
|
||||
<!---->
|
||||
<!---->
|
||||
</div></span></th>
|
||||
<th class="o-table__th"><span><div data-v-7a3be82f="" data-oruga="input" class="o-input__wrapper"><input aria-label="Filter" id="" data-oruga-input="text" type="text" class="o-input o-input--iconspace-left" autocomplete="off" placeholder="Filter"><span class="o-icon o-input__icon-left" data-oruga="icon"><i class="mdi mdi-magnify mdi-24px"></i></span>
|
||||
<!---->
|
||||
<!---->
|
||||
</div></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<!---->
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" data-label="Username"><a data-v-7a3be82f="" href="/settings/admin/profiles/1" class="profile">
|
||||
<article data-v-7a3be82f="" class="flex gap-2"><span data-v-7a3be82f="" aria-hidden="true" class="material-design-icon account-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="48" height="48" viewBox="0 0 24 24"><path d="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"><!--v-if--></path></svg></span>
|
||||
<div data-v-7a3be82f="" class="">
|
||||
<div data-v-7a3be82f="" class="prose dark:prose-invert"><strong data-v-7a3be82f="">Mobilizon Anonymous Actor</strong><br data-v-7a3be82f=""><small data-v-7a3be82f="">@anonymous</small></div>
|
||||
</div>
|
||||
</article>
|
||||
</a></td>
|
||||
<td class="o-table__td" data-label="Domain"></td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" data-label="Username"><a data-v-7a3be82f="" href="/settings/admin/profiles/2" class="profile">
|
||||
<article data-v-7a3be82f="" class="flex gap-2"><span data-v-7a3be82f="" aria-hidden="true" class="material-design-icon account-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="48" height="48" viewBox="0 0 24 24"><path d="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"><!--v-if--></path></svg></span>
|
||||
<div data-v-7a3be82f="" class="">
|
||||
<div data-v-7a3be82f="" class="prose dark:prose-invert"><strong data-v-7a3be82f="">Mobilizon</strong><br data-v-7a3be82f=""><small data-v-7a3be82f="">@mobilizon</small></div>
|
||||
</div>
|
||||
</article>
|
||||
</a></td>
|
||||
<td class="o-table__td" data-label="Domain"></td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" data-label="Username"><a data-v-7a3be82f="" href="/settings/admin/profiles/109687" class="profile">
|
||||
<article data-v-7a3be82f="" class="flex gap-2"><span data-v-7a3be82f="" aria-hidden="true" class="material-design-icon account-icon" role="img"><svg fill="currentColor" class="material-design-icon__svg" width="48" height="48" viewBox="0 0 24 24"><path d="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"><!--v-if--></path></svg></span>
|
||||
<div data-v-7a3be82f="" class="">
|
||||
<div data-v-7a3be82f="" class="prose dark:prose-invert"><strong data-v-7a3be82f="">Example</strong><br data-v-7a3be82f=""><small data-v-7a3be82f="">@example</small></div>
|
||||
</div>
|
||||
</article>
|
||||
</a></td>
|
||||
<td class="o-table__td" data-label="Domain"></td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<!---->
|
||||
</tbody>
|
||||
<!---->
|
||||
</table>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</div>
|
||||
<div class="o-table__pagination" per-page="10" total="3" rounded="false" size="small" simple="false" aria-next-label="Next page" aria-previous-label="Previous page" aria-page-label="Page" aria-current-label="Current page">
|
||||
<div></div>
|
||||
<div>
|
||||
<nav class="o-pag o-pag--right o-pag--small" data-oruga="pagination"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next o-pag__link--disabled" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<li class="o-pag__item"><button role="button" tabindex="0" class="o-pag__link o-pag__link--current" aria-label="Current page, Page 1." aria-current="true">1</button></li>
|
||||
<!---->
|
||||
<!---->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>"
|
||||
`;
|
||||
128
tests/unit/specs/views/admin/__snapshots__/settings.spec.ts.snap
Normal file
128
tests/unit/specs/views/admin/__snapshots__/settings.spec.ts.snap
Normal file
@@ -0,0 +1,128 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`SettingsView > Show and save settings 1`] = `
|
||||
"<div data-v-a8bb2abf="">
|
||||
<breadcrumbs-nav data-v-a8bb2abf="" links="[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<div data-v-a8bb2abf="">
|
||||
<form data-v-a8bb2abf="">
|
||||
<section data-v-a8bb2abf="" class="mt-4 mb-4 p-4 border rounded shadow-sm bg-white">
|
||||
<h2 data-v-a8bb2abf="">Informations</h2>
|
||||
<o-field data-v-a8bb2abf="" label="Instance Name" label-for="instance-name">
|
||||
<o-input data-v-a8bb2abf="" modelvalue="Mobilizon.test" id="instance-name" expanded=""></o-input>
|
||||
</o-field>
|
||||
<div data-v-a8bb2abf="" class="field flex flex-col"><label data-v-a8bb2abf="" for="instance-description">Instance Short Description</label><small data-v-a8bb2abf="">Displayed on homepage and meta tags. Describe what Mobilizon is and what makes this instance special in a single paragraph.</small>
|
||||
<o-input data-v-a8bb2abf="" type="textarea" modelvalue="Welcome to Mobilizon" rows="2" id="instance-description"></o-input>
|
||||
</div>
|
||||
<div data-v-a8bb2abf="" class="field flex flex-col"><label data-v-a8bb2abf="" for="instance-long-description">Instance Long Description</label><small data-v-a8bb2abf="">A place to explain who you are and the things that set your instance apart. You can use HTML tags.</small>
|
||||
<o-input data-v-a8bb2abf="" type="textarea" modelvalue="Mobilizon instance." rows="4" id="instance-long-description"></o-input>
|
||||
</div>
|
||||
<div data-v-a8bb2abf="" class="field flex flex-col"><label data-v-a8bb2abf="" for="instance-slogan">Instance Slogan</label><small data-v-a8bb2abf="">A short tagline for your instance homepage. Defaults to "Gather ⋅ Organize ⋅ Mobilize"</small>
|
||||
<o-input data-v-a8bb2abf="" modelvalue="Long life to Mobilizon" placeholder="Gather ⋅ Organize ⋅ Mobilize" id="instance-slogan"></o-input>
|
||||
</div>
|
||||
<div data-v-a8bb2abf="" class="field flex flex-col"><label data-v-a8bb2abf="" for="instance-contact">Contact</label><small data-v-a8bb2abf="">Can be an email or a link, or just plain text.</small>
|
||||
<o-input data-v-a8bb2abf="" modelvalue="info@mobilizon.test" id="instance-contact"></o-input>
|
||||
</div>
|
||||
</section>
|
||||
<section data-v-a8bb2abf="" class="mt-4 mb-4 p-4 border rounded shadow-sm bg-white">
|
||||
<h2 data-v-a8bb2abf="">Pictures</h2><label data-v-a8bb2abf="" class="field flex flex-col">
|
||||
<p data-v-a8bb2abf="">Logo</p><small data-v-a8bb2abf="">Logo of the instance. Defaults to the upstream Mobilizon logo.</small>
|
||||
<picture-upload-stub data-v-a8bb2abf="" textfallback="Logo" accept="image/gif,image/png,image/jpeg,image/webp" maxsize="10485760"></picture-upload-stub>
|
||||
</label><label data-v-a8bb2abf="" class="field flex flex-col">
|
||||
<p data-v-a8bb2abf="">Favicon</p><small data-v-a8bb2abf="">Browser tab icon and PWA icon of the instance. Defaults to the upstream Mobilizon icon.</small>
|
||||
<picture-upload-stub data-v-a8bb2abf="" textfallback="Favicon" accept="image/gif,image/png,image/jpeg,image/webp" maxsize="10485760"></picture-upload-stub>
|
||||
</label><label data-v-a8bb2abf="" class="field flex flex-col">
|
||||
<p data-v-a8bb2abf="">Default Picture</p><small data-v-a8bb2abf="">Default picture when an event or group doesn't have one.</small>
|
||||
<picture-upload-stub data-v-a8bb2abf="" textfallback="Default Picture" accept="image/gif,image/png,image/jpeg,image/webp" maxsize="10485760"></picture-upload-stub>
|
||||
</label>
|
||||
</section>
|
||||
<section data-v-a8bb2abf="" class="mt-4 mb-4 p-4 border rounded shadow-sm bg-white">
|
||||
<h2 data-v-a8bb2abf="">Options</h2>
|
||||
<o-field data-v-a8bb2abf="" label="Allow registrations">
|
||||
<fieldset data-v-a8bb2abf="">
|
||||
<o-field data-v-a8bb2abf="">
|
||||
<o-radio data-v-a8bb2abf="" modelvalue="OPEN" name="registrationsModeType" native-value="CLOSE">Registration is closed.</o-radio>
|
||||
</o-field>
|
||||
<o-field data-v-a8bb2abf="">
|
||||
<o-radio data-v-a8bb2abf="" modelvalue="OPEN" name="registrationsModeType" native-value="OPEN">Registration is allowed, anyone can register.</o-radio>
|
||||
</o-field>
|
||||
<o-field data-v-a8bb2abf="">
|
||||
<o-radio data-v-a8bb2abf="" modelvalue="OPEN" name="registrationsModeType" native-value="MODERATED">Registration is moderated, new user must be validated.</o-radio>
|
||||
</o-field>
|
||||
</fieldset>
|
||||
</o-field>
|
||||
<div data-v-a8bb2abf="" class="field flex flex-col"><label data-v-a8bb2abf="" for="instance-languages">Instance languages</label><small data-v-a8bb2abf="">Main languages you/your moderators speak</small>
|
||||
<o-taginput data-v-a8bb2abf="" modelvalue="" data="" allow-autocomplete="" open-on-focus="true" field="name" icon="label" placeholder="Select languages" id="instance-languages"></o-taginput>
|
||||
</div>
|
||||
</section>
|
||||
<section data-v-a8bb2abf="" class="mt-4 mb-4 p-4 border rounded shadow-sm bg-white">
|
||||
<h2 data-v-a8bb2abf="">Policies</h2>
|
||||
<div data-v-a8bb2abf="" class="field flex flex-col"><label data-v-a8bb2abf="" for="instance-rules">Instance Rules</label><small data-v-a8bb2abf="">A place for your code of conduct, rules or guidelines. You can use HTML tags.</small>
|
||||
<o-input data-v-a8bb2abf="" type="textarea" id="instance-rules"></o-input>
|
||||
</div>
|
||||
<o-field data-v-a8bb2abf="" label="Instance Terms Source">
|
||||
<div data-v-a8bb2abf="">
|
||||
<div data-v-a8bb2abf="">
|
||||
<fieldset data-v-a8bb2abf="">
|
||||
<legend data-v-a8bb2abf="">Choose the source of the instance's Terms</legend>
|
||||
<o-field data-v-a8bb2abf="">
|
||||
<o-radio data-v-a8bb2abf="" modelvalue="DEFAULT" name="instanceTermsType" native-value="DEFAULT">Default Mobilizon terms</o-radio>
|
||||
</o-field>
|
||||
<o-field data-v-a8bb2abf="">
|
||||
<o-radio data-v-a8bb2abf="" modelvalue="DEFAULT" name="instanceTermsType" native-value="URL">Custom URL</o-radio>
|
||||
</o-field>
|
||||
<o-field data-v-a8bb2abf="">
|
||||
<o-radio data-v-a8bb2abf="" modelvalue="DEFAULT" name="instanceTermsType" native-value="CUSTOM">Custom text</o-radio>
|
||||
</o-field>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div data-v-a8bb2abf="">
|
||||
<o-notification data-v-a8bb2abf="" class="bg-slate-700"><b data-v-a8bb2abf="">Default</b>
|
||||
<i18n-t-stub data-v-a8bb2abf="" tag="p" keypath="The {default_terms} will be used. They will be translated in the user's language." scope="parent" class="prose dark:prose-invert"></i18n-t-stub><b data-v-a8bb2abf="">NOTE! The default terms have not been checked over by a lawyer and thus are unlikely to provide full legal protection for all situations for an instance admin using them. They are also not specific to all countries and jurisdictions. If you are unsure, please check with a lawyer.</b>
|
||||
</o-notification>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
</div>
|
||||
</div>
|
||||
</o-field>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
<o-field data-v-a8bb2abf="" label="Instance Privacy Policy Source">
|
||||
<div data-v-a8bb2abf="">
|
||||
<div data-v-a8bb2abf="">
|
||||
<fieldset data-v-a8bb2abf="">
|
||||
<legend data-v-a8bb2abf="">Choose the source of the instance's Privacy Policy</legend>
|
||||
<o-field data-v-a8bb2abf="">
|
||||
<o-radio data-v-a8bb2abf="" modelvalue="DEFAULT" name="instancePrivacyType" native-value="DEFAULT">Default Mobilizon privacy policy</o-radio>
|
||||
</o-field>
|
||||
<o-field data-v-a8bb2abf="">
|
||||
<o-radio data-v-a8bb2abf="" modelvalue="DEFAULT" name="instancePrivacyType" native-value="URL">Custom URL</o-radio>
|
||||
</o-field>
|
||||
<o-field data-v-a8bb2abf="">
|
||||
<o-radio data-v-a8bb2abf="" modelvalue="DEFAULT" name="instancePrivacyType" native-value="CUSTOM">Custom text</o-radio>
|
||||
</o-field>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div data-v-a8bb2abf="">
|
||||
<div data-v-a8bb2abf="" class="notification"><b data-v-a8bb2abf="">Default</b>
|
||||
<i18n-t-stub data-v-a8bb2abf="" tag="p" keypath="The {default_privacy_policy} will be used. They will be translated in the user's language." scope="parent" class="prose dark:prose-invert"></i18n-t-stub>
|
||||
</div>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
</div>
|
||||
</div>
|
||||
</o-field>
|
||||
<!--v-if-->
|
||||
<!--v-if-->
|
||||
</section>
|
||||
<section data-v-a8bb2abf="" class="mt-4 mb-4 p-4 border rounded shadow-sm bg-white">
|
||||
<h2 data-v-a8bb2abf="">External links</h2><small data-v-a8bb2abf="">This section lets you add links to external websites to the menu.</small>
|
||||
<o-field data-v-a8bb2abf="">
|
||||
<o-button data-v-a8bb2abf="" label="Add a new link"></o-button>
|
||||
</o-field>
|
||||
<!--v-if-->
|
||||
</section>
|
||||
<o-button data-v-a8bb2abf="" native-type="submit" variant="primary">Save instance settings</o-button>
|
||||
</form>
|
||||
</div>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,229 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`UsersView > Show list with moderation 1`] = `
|
||||
"<div data-v-01123d3b="">
|
||||
<breadcrumbs-nav data-v-01123d3b="" links="[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<div data-v-01123d3b="">
|
||||
<form data-v-01123d3b="">
|
||||
<div data-v-01123d3b="" data-oruga="field" class="o-field mb-5">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--grouped-multiline o-field--grouped">
|
||||
<p data-v-01123d3b="" class="control mb-3 m-auto"><label data-v-01123d3b="" class="o-chk" data-oruga="checkbox" role="checkbox" aria-checked="false"><input type="checkbox" data-oruga-input="checkbox" class="o-chk__input" autocomplete="off" true-value="true" false-value="false"><span class="o-chk__label">Users pending for moderation</span></label></p>
|
||||
<div data-v-01123d3b="" data-oruga="field" class="o-field" expanded=""><label class="o-field__label" for="">Email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-v-01123d3b="" data-oruga="input" class="o-input__wrapper"><input trap-focus="" id="" data-oruga-input="text" type="text" class="o-input o-input--iconspace-left" autocomplete="off"><span class="o-icon o-input__icon-left" data-oruga="icon"><i class="mdi mdi-email mdi-24px"></i></span>
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-v-01123d3b="" data-oruga="field" class="o-field" expanded=""><label class="o-field__label" for="">IP Address</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-v-01123d3b="" data-oruga="input" class="o-input__wrapper"><input id="" data-oruga-input="text" type="text" class="o-input o-input--iconspace-left" autocomplete="off"><span class="o-icon o-input__icon-left" data-oruga="icon"><i class="mdi mdi-web mdi-24px"></i></span>
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<p data-v-01123d3b="" class="control self-end mb-0"><button data-v-01123d3b="" type="button" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Filter</span>
|
||||
<!----></span>
|
||||
</button></p>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</form>
|
||||
<div data-v-01123d3b="" class="o-table__root" data-oruga="table">
|
||||
<div style="display: none;"><span data-v-01123d3b="" data-id="1" data-oruga="table-column"> <!----></span><span data-v-01123d3b="" data-id="2" data-oruga="table-column">Email <!----></span><span data-v-01123d3b="" data-id="3" data-oruga="table-column" centered="true">Last seen on <!----></span><span data-v-01123d3b="" data-id="4" data-oruga="table-column" centered="true">Language <!----></span></div>
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-table__wrapper">
|
||||
<table class="o-table">
|
||||
<!---->
|
||||
<thead>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th" style="width: 40px;" draggable="false"><span> <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Email <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Last seen on <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Language <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<!---->
|
||||
<!---->
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" style="width: 40px;">6</td>
|
||||
<td class="o-table__td" data-label="Email"><a data-v-01123d3b="" href="/settings/admin/users/6" class="">truc@mobilizon.test</a></td>
|
||||
<td class="o-table__td" data-label="Last seen on"><time data-v-01123d3b="">Thursday, January 1, 1970 at 1:00 AM</time></td>
|
||||
<td class="o-table__td" data-label="Language">English</td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" style="width: 40px;">1</td>
|
||||
<td class="o-table__td" data-label="Email"><a data-v-01123d3b="" href="/settings/admin/users/1" class="">admin@mobilizon.test</a></td>
|
||||
<td class="o-table__td" data-label="Last seen on"><time data-v-01123d3b="" datetime="2025-09-11T16:10:03Z">Thursday, September 11, 2025 at 6:10 PM</time></td>
|
||||
<td class="o-table__td" data-label="Language">English</td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<!---->
|
||||
</tbody>
|
||||
<!---->
|
||||
</table>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</div>
|
||||
<div class="o-table__pagination" per-page="10" total="2" rounded="false" size="small" simple="false" aria-next-label="Next page" aria-previous-label="Previous page" aria-page-label="Page" aria-current-label="Current page">
|
||||
<div></div>
|
||||
<div>
|
||||
<nav class="o-pag o-pag--right o-pag--small" data-oruga="pagination"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next o-pag__link--disabled" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<li class="o-pag__item"><button role="button" tabindex="0" class="o-pag__link o-pag__link--current" aria-label="Current page, Page 1." aria-current="true">1</button></li>
|
||||
<!---->
|
||||
<!---->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`UsersView > Show simple list 1`] = `
|
||||
"<div data-v-01123d3b="">
|
||||
<breadcrumbs-nav data-v-01123d3b="" links="[object Object],[object Object]"></breadcrumbs-nav>
|
||||
<div data-v-01123d3b="">
|
||||
<form data-v-01123d3b="">
|
||||
<div data-v-01123d3b="" data-oruga="field" class="o-field mb-5">
|
||||
<!---->
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--grouped-multiline o-field--grouped">
|
||||
<!--v-if-->
|
||||
<div data-v-01123d3b="" data-oruga="field" class="o-field" expanded=""><label class="o-field__label" for="">Email</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-v-01123d3b="" data-oruga="input" class="o-input__wrapper"><input trap-focus="" id="" data-oruga-input="text" type="text" class="o-input o-input--iconspace-left" autocomplete="off"><span class="o-icon o-input__icon-left" data-oruga="icon"><i class="mdi mdi-email mdi-24px"></i></span>
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<div data-v-01123d3b="" data-oruga="field" class="o-field" expanded=""><label class="o-field__label" for="">IP Address</label>
|
||||
<div class="o-field__body">
|
||||
<div class="o-field o-field--addons">
|
||||
<div data-v-01123d3b="" data-oruga="input" class="o-input__wrapper"><input id="" data-oruga-input="text" type="text" class="o-input o-input--iconspace-left" autocomplete="off"><span class="o-icon o-input__icon-left" data-oruga="icon"><i class="mdi mdi-web mdi-24px"></i></span>
|
||||
<!---->
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
<p data-v-01123d3b="" class="control self-end mb-0"><button data-v-01123d3b="" type="button" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Filter</span>
|
||||
<!----></span>
|
||||
</button></p>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</form>
|
||||
<div data-v-01123d3b="" class="o-table__root" data-oruga="table">
|
||||
<div style="display: none;"><span data-v-01123d3b="" data-id="1" data-oruga="table-column"> <!----></span><span data-v-01123d3b="" data-id="2" data-oruga="table-column">Email <!----></span><span data-v-01123d3b="" data-id="3" data-oruga="table-column" centered="true">Last seen on <!----></span><span data-v-01123d3b="" data-id="4" data-oruga="table-column" centered="true">Language <!----></span></div>
|
||||
<!---->
|
||||
<!---->
|
||||
<div class="o-table__wrapper">
|
||||
<table class="o-table">
|
||||
<!---->
|
||||
<thead>
|
||||
<tr>
|
||||
<!---->
|
||||
<!---->
|
||||
<th class="o-table__th" style="width: 40px;" draggable="false"><span> <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Email <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Last seen on <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<th class="o-table__th" draggable="false"><span>Language <span class="o-table__th__sort-icon" style="display: none;"><span class="o-icon o-icon--small" data-oruga="icon"><i class="mdi mdi-arrow-up"></i></span></span></span></th>
|
||||
<!---->
|
||||
</tr>
|
||||
<!---->
|
||||
<!---->
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" style="width: 40px;">6</td>
|
||||
<td class="o-table__td" data-label="Email"><a data-v-01123d3b="" href="/settings/admin/users/6" class="">truc@mobilizon.test</a></td>
|
||||
<td class="o-table__td" data-label="Last seen on"><time data-v-01123d3b="">Thursday, January 1, 1970 at 1:00 AM</time></td>
|
||||
<td class="o-table__td" data-label="Language">English</td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<tr class="" draggable="false">
|
||||
<!---->
|
||||
<!---->
|
||||
<td class="o-table__td" style="width: 40px;">1</td>
|
||||
<td class="o-table__td" data-label="Email"><a data-v-01123d3b="" href="/settings/admin/users/1" class="">admin@mobilizon.test</a></td>
|
||||
<td class="o-table__td" data-label="Last seen on"><time data-v-01123d3b="" datetime="2025-09-11T16:10:03Z">Thursday, September 11, 2025 at 6:10 PM</time></td>
|
||||
<td class="o-table__td" data-label="Language">English</td>
|
||||
<!---->
|
||||
</tr>
|
||||
<transition-stub name="slide" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
<!---->
|
||||
<!---->
|
||||
</tbody>
|
||||
<!---->
|
||||
</table>
|
||||
<transition-stub name="fade" appear="false" persisted="false" css="true">
|
||||
<!---->
|
||||
</transition-stub>
|
||||
</div>
|
||||
<div class="o-table__pagination" per-page="10" total="2" rounded="false" size="small" simple="false" aria-next-label="Next page" aria-previous-label="Previous page" aria-page-label="Page" aria-current-label="Current page">
|
||||
<div></div>
|
||||
<div>
|
||||
<nav class="o-pag o-pag--right o-pag--small" data-oruga="pagination"><button role="button" tabindex="0" class="o-pag__link o-pag__previous o-pag__link--disabled" aria-label="Previous page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-left mdi-24px"></i></span></button><button role="button" tabindex="0" class="o-pag__link o-pag__next o-pag__link--disabled" aria-label="Next page" aria-current="false"><span class="o-icon" data-oruga="icon" aria-hidden="true"><i class="mdi mdi-chevron-right mdi-24px"></i></span></button>
|
||||
<ul class="o-pag__list">
|
||||
<!---->
|
||||
<!---->
|
||||
<li class="o-pag__item"><button role="button" tabindex="0" class="o-pag__link o-pag__link--current" aria-label="Current page, Page 1." aria-current="true">1</button></li>
|
||||
<!---->
|
||||
<!---->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>"
|
||||
`;
|
||||
150
tests/unit/specs/views/admin/adminGroupProfile.spec.ts
Normal file
150
tests/unit/specs/views/admin/adminGroupProfile.spec.ts
Normal file
@@ -0,0 +1,150 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { GET_GROUP, REFRESH_PROFILE } from "@/graphql/group";
|
||||
import { SUSPEND_PROFILE, UNSUSPEND_PROFILE } from "@/graphql/actor";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import AdminGroupProfile from "@/views/Admin/AdminGroupProfile.vue";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { dialogPlugin } from "@/plugins/dialog";
|
||||
import { notifierPlugin } from "@/plugins/notifier";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
config.global.plugins.push(dialogPlugin);
|
||||
config.global.plugins.push(notifierPlugin);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const generateWrapper = (group_mock: any = {}) => {
|
||||
const global_data = getMockClient([
|
||||
[GET_GROUP, group_mock],
|
||||
REFRESH_PROFILE,
|
||||
SUSPEND_PROFILE,
|
||||
UNSUSPEND_PROFILE,
|
||||
]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(AdminGroupProfile, {
|
||||
props: {
|
||||
id: "123456",
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const group_mock = {
|
||||
data: {
|
||||
getGroup: {
|
||||
__typename: "Group",
|
||||
avatar: null,
|
||||
banner: null,
|
||||
domain: "domain",
|
||||
id: "1125368",
|
||||
manuallyApprovesFollowers: false,
|
||||
mediaSize: 0,
|
||||
members: {
|
||||
__typename: "PaginatedMemberList",
|
||||
elements: [
|
||||
{
|
||||
__typename: "Member",
|
||||
actor: {
|
||||
__typename: "Person",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "6548012",
|
||||
name: "member #1",
|
||||
preferredUsername: "member_1",
|
||||
summary: "member #1",
|
||||
type: "PERSON",
|
||||
url: "https://mobilizon.test/@member_1",
|
||||
},
|
||||
id: "3d70f3c8-050f-49dd-b7fe-9bb4398225c8",
|
||||
insertedAt: "2021-06-13T09:24:47",
|
||||
role: "ADMINISTRATOR",
|
||||
},
|
||||
],
|
||||
total: 1,
|
||||
},
|
||||
name: "Group name",
|
||||
openness: "INVITE_ONLY",
|
||||
organizedEvents: {
|
||||
__typename: "PaginatedEventList",
|
||||
elements: [],
|
||||
total: 30410,
|
||||
},
|
||||
physicalAddress: null,
|
||||
posts: {
|
||||
__typename: "PaginatedPostList",
|
||||
elements: [],
|
||||
total: 0,
|
||||
},
|
||||
preferredUsername: "group_name",
|
||||
resources: {
|
||||
__typename: "PaginatedResourceList",
|
||||
elements: [],
|
||||
total: 0,
|
||||
},
|
||||
summary: null,
|
||||
suspended: false,
|
||||
todoLists: {
|
||||
__typename: "PaginatedTodoListList",
|
||||
elements: [],
|
||||
total: 0,
|
||||
},
|
||||
type: "GROUP",
|
||||
url: "https://mobilizon.test/@group_name",
|
||||
visibility: "PUBLIC",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
describe("AdminGroupProfile", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper(group_mock);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_2).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_3).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
id: "123456",
|
||||
membersLimit: 10,
|
||||
membersPage: 1,
|
||||
organizedEventsLimit: 10,
|
||||
organizedEventsPage: 1,
|
||||
postsLimit: 10,
|
||||
postsPage: 1,
|
||||
});
|
||||
|
||||
wrapper.find('button[type="button"]').trigger("click");
|
||||
await flushPromises();
|
||||
wrapper.vm.suspendProfile({ id: "12346" });
|
||||
await flushPromises();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_2).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_3).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_2).toHaveBeenCalledWith({
|
||||
id: "12346",
|
||||
});
|
||||
});
|
||||
});
|
||||
114
tests/unit/specs/views/admin/adminProfile.spec.ts
Normal file
114
tests/unit/specs/views/admin/adminProfile.spec.ts
Normal file
@@ -0,0 +1,114 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import AdminProfile from "@/views/Admin/AdminProfile.vue";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import {
|
||||
GET_PERSON,
|
||||
SUSPEND_PROFILE,
|
||||
UNSUSPEND_PROFILE,
|
||||
} from "@/graphql/actor";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const person_mock = {
|
||||
data: {
|
||||
person: {
|
||||
__typename: "Person",
|
||||
avatar: null,
|
||||
banner: null,
|
||||
domain: null,
|
||||
feedTokens: [
|
||||
{
|
||||
__typename: "FeedToken",
|
||||
token: "Se4rSUMzeX8KMC4bz7Yybq",
|
||||
},
|
||||
],
|
||||
id: "2",
|
||||
mediaSize: 0,
|
||||
memberships: {
|
||||
__typename: "PaginatedMemberList",
|
||||
elements: [],
|
||||
total: 0,
|
||||
},
|
||||
name: "CurrentPerson",
|
||||
organizedEvents: {
|
||||
__typename: "PaginatedEventList",
|
||||
elements: [],
|
||||
total: 0,
|
||||
},
|
||||
participations: {
|
||||
__typename: "PaginatedParticipantList",
|
||||
elements: [],
|
||||
total: 0,
|
||||
},
|
||||
preferredUsername: "current",
|
||||
summary: null,
|
||||
suspended: false,
|
||||
type: "PERSON",
|
||||
url: "https://mobilizon.test/@current",
|
||||
user: {
|
||||
__typename: "User",
|
||||
email: "current@mobilizon.test",
|
||||
id: "1",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const generateWrapper = (mock_person: any = {}) => {
|
||||
const global_data = getMockClient([
|
||||
[GET_PERSON, mock_person],
|
||||
SUSPEND_PROFILE,
|
||||
UNSUSPEND_PROFILE,
|
||||
]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(AdminProfile, {
|
||||
props: {
|
||||
id: "987654",
|
||||
},
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("AdminProfile", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper(person_mock);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_2).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
actorId: "987654",
|
||||
membershipsLimit: 10,
|
||||
membershipsPage: 1,
|
||||
organizedEventsLimit: 10,
|
||||
organizedEventsPage: 1,
|
||||
participationLimit: 10,
|
||||
participationsPage: 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
269
tests/unit/specs/views/admin/adminUsersProfileView.spec.ts
Normal file
269
tests/unit/specs/views/admin/adminUsersProfileView.spec.ts
Normal file
@@ -0,0 +1,269 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { DefaultApolloClient } from "@vue/apollo-composable";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import buildCurrentUserResolver from "@/apollo/user";
|
||||
import flushPromises from "flush-promises";
|
||||
import { cache } from "@/apollo/memory";
|
||||
import {
|
||||
createMockClient,
|
||||
MockApolloClient,
|
||||
RequestHandler,
|
||||
} from "mock-apollo-client";
|
||||
import AdminUserProfile from "@/views/Admin/AdminUserProfile.vue";
|
||||
import {
|
||||
DELETE_ACCOUNT_AS_MODERATOR,
|
||||
GET_USER,
|
||||
UNBAN_ACCOUNT_AS_MODERATOR,
|
||||
} from "@/graphql/user";
|
||||
import { ADMIN_UPDATE_USER, LANGUAGES_CODES } from "@/graphql/admin";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import { htmlRemoveId, nullMock } from "../../common";
|
||||
import {
|
||||
createRouterMock,
|
||||
injectRouterMock,
|
||||
VueRouterMock,
|
||||
} from "vue-router-mock";
|
||||
|
||||
let mockClient: MockApolloClient | null;
|
||||
let requestHandlers: Record<string, RequestHandler>;
|
||||
|
||||
const languageCodeMock = {
|
||||
data: {
|
||||
languages: [
|
||||
{
|
||||
__typename: "Language",
|
||||
code: "fr",
|
||||
name: "French",
|
||||
},
|
||||
{
|
||||
__typename: "Language",
|
||||
code: "en",
|
||||
name: "English",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const getUserMock = {
|
||||
data: {
|
||||
user: {
|
||||
__typename: "User",
|
||||
actors: [
|
||||
{
|
||||
__typename: "Person",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "11371",
|
||||
name: "Truc",
|
||||
preferredUsername: "truc",
|
||||
summary: null,
|
||||
type: "PERSON",
|
||||
url: "http://mobilizon.test/@truc",
|
||||
},
|
||||
],
|
||||
moderation: "moderation text",
|
||||
confirmedAt: "2025-08-30T09:56:59Z",
|
||||
currentSignInAt: null,
|
||||
currentSignInIp: null,
|
||||
disabled: false,
|
||||
email: "truc@mobilizon.test",
|
||||
id: "1234",
|
||||
lastSignInAt: "2025-08-28T12:33:03Z",
|
||||
lastSignInIp: "176.171.166.30",
|
||||
locale: "fr",
|
||||
mediaSize: 7093555,
|
||||
participations: {
|
||||
__typename: "PaginatedParticipantList",
|
||||
total: 14,
|
||||
},
|
||||
role: "USER",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// A copy of the user that is banned
|
||||
const getUserMockBan = structuredClone(getUserMock);
|
||||
getUserMockBan.data.user.disabled = true;
|
||||
|
||||
const getModerateMock = {
|
||||
data: {
|
||||
user: {
|
||||
__typename: "User",
|
||||
actors: [
|
||||
{
|
||||
__typename: "Person",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "11371",
|
||||
name: "Truc",
|
||||
preferredUsername: "truc",
|
||||
summary: null,
|
||||
type: "PERSON",
|
||||
url: "http://mobilizon.test/@truc",
|
||||
},
|
||||
],
|
||||
moderation: "moderation text",
|
||||
confirmedAt: "2025-08-30T09:56:59Z",
|
||||
currentSignInAt: null,
|
||||
currentSignInIp: null,
|
||||
disabled: false,
|
||||
email: "truc@mobilizon.test",
|
||||
id: "1234",
|
||||
lastSignInAt: "2025-08-28T12:33:03Z",
|
||||
lastSignInIp: "176.171.166.30",
|
||||
locale: "fr",
|
||||
mediaSize: 7093555,
|
||||
participations: {
|
||||
__typename: "PaginatedParticipantList",
|
||||
total: 14,
|
||||
},
|
||||
role: "PENDING",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
config.plugins.VueWrapper.install(VueRouterMock);
|
||||
|
||||
describe("UsersView", () => {
|
||||
const router = createRouterMock({
|
||||
spy: {
|
||||
create: (fn) => vi.fn(fn),
|
||||
reset: (spy) => spy.mockReset(),
|
||||
},
|
||||
});
|
||||
beforeEach(async () => {
|
||||
// await router.isReady();
|
||||
injectRouterMock(router);
|
||||
});
|
||||
|
||||
const generateWrapper = (currentUserMock = getUserMock) => {
|
||||
mockClient = createMockClient({
|
||||
cache,
|
||||
resolvers: buildCurrentUserResolver(cache),
|
||||
});
|
||||
requestHandlers = {
|
||||
languagecode: vi.fn().mockResolvedValue(languageCodeMock),
|
||||
get_user: vi.fn().mockResolvedValue(currentUserMock),
|
||||
update_user: vi.fn().mockResolvedValue(nullMock),
|
||||
ban_user: vi.fn().mockResolvedValue(nullMock),
|
||||
unban_user: vi.fn().mockResolvedValue(nullMock),
|
||||
};
|
||||
mockClient.setRequestHandler(LANGUAGES_CODES, requestHandlers.languagecode);
|
||||
mockClient.setRequestHandler(GET_USER, requestHandlers.get_user);
|
||||
mockClient.setRequestHandler(
|
||||
ADMIN_UPDATE_USER,
|
||||
requestHandlers.update_user
|
||||
);
|
||||
mockClient.setRequestHandler(
|
||||
DELETE_ACCOUNT_AS_MODERATOR,
|
||||
requestHandlers.ban_user
|
||||
);
|
||||
mockClient.setRequestHandler(
|
||||
UNBAN_ACCOUNT_AS_MODERATOR,
|
||||
requestHandlers.unban_user
|
||||
);
|
||||
|
||||
const wrapper = mount(AdminUserProfile, {
|
||||
props: { id: "1234" },
|
||||
stubs: ["router-link", "router-view"],
|
||||
global: {
|
||||
provide: {
|
||||
[DefaultApolloClient]: mockClient,
|
||||
},
|
||||
},
|
||||
});
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
it("Show simple list", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.languagecode).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.get_user).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.update_user).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it("Show moderate list", async () => {
|
||||
const wrapper = generateWrapper(getModerateMock);
|
||||
expect(wrapper.router).toBe(router);
|
||||
wrapper.router.push.mockReset();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.languagecode).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.get_user).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.update_user).toHaveBeenCalledTimes(0);
|
||||
const btn = wrapper.find("#acceptAccount");
|
||||
expect(btn.exists()).toBe(true);
|
||||
btn.trigger("click");
|
||||
await flushPromises();
|
||||
expect(requestHandlers.languagecode).toHaveBeenCalledTimes(0);
|
||||
// The user is refreshed after the update
|
||||
expect(requestHandlers.get_user).toHaveBeenCalledTimes(2);
|
||||
expect(requestHandlers.update_user).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.update_user).toHaveBeenCalledWith({
|
||||
id: "1234",
|
||||
notify: true,
|
||||
role: "USER",
|
||||
});
|
||||
});
|
||||
|
||||
it("Ban user", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.get_user).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.ban_user).toHaveBeenCalledTimes(0);
|
||||
|
||||
// Find ban button
|
||||
const btn = wrapper.find("#deleteAccount");
|
||||
expect(btn.exists()).toBe(true);
|
||||
btn.trigger("click");
|
||||
|
||||
// TODO The definitive button "Ban the account" is in a dialog pop-up outside of the component
|
||||
// Sadly, we can't access this pop-up and click on the button to fully test
|
||||
/*
|
||||
// ban_user has been called
|
||||
expect(requestHandlers.ban_user).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.get_user).toHaveBeenCalledTimes(2);
|
||||
expect(requestHandlers.ban_user).toHaveBeenCalledWith({
|
||||
userId: "1234",
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
it("Unban user", async () => {
|
||||
const wrapper = generateWrapper(getUserMockBan);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.get_user).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.ban_user).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.unban_user).toHaveBeenCalledTimes(0);
|
||||
|
||||
// Find ban button
|
||||
const btn = wrapper.find("#unbanAccount");
|
||||
expect(btn.exists()).toBe(true);
|
||||
btn.trigger("click");
|
||||
|
||||
// TODO The definitive button "Unban the account" is in a dialog pop-up outside of the component
|
||||
// Sadly, we can't access this pop-up and click on the button to fully test
|
||||
/*
|
||||
// unban_user has been called
|
||||
expect(requestHandlers.get_user).toHaveBeenCalledTimes(2);
|
||||
expect(requestHandlers.ban_user).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.unban_user).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.ban_user).toHaveBeenCalledWith({
|
||||
userId: "1234",
|
||||
});
|
||||
*/
|
||||
});
|
||||
});
|
||||
129
tests/unit/specs/views/admin/dashboard.spec.ts
Normal file
129
tests/unit/specs/views/admin/dashboard.spec.ts
Normal file
@@ -0,0 +1,129 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import DashboardView from "@/views/Admin/DashboardView.vue";
|
||||
import { config, shallowMount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { DASHBOARD } from "@/graphql/admin";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const dashboard_mock = {
|
||||
data: {
|
||||
dashboard: {
|
||||
__typename: "Dashboard",
|
||||
lastGroupCreated: {
|
||||
__typename: "Group",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "1125368",
|
||||
name: "lastGroup",
|
||||
preferredUsername: "lastgroup",
|
||||
summary: null,
|
||||
type: "GROUP",
|
||||
url: "https://mobilizon.test/@lastGroup",
|
||||
},
|
||||
lastPublicEventPublished: {
|
||||
__typename: "Event",
|
||||
attributedTo: {
|
||||
__typename: "Group",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "1125368",
|
||||
name: "lastGroup",
|
||||
preferredUsername: "lastgroup",
|
||||
summary: null,
|
||||
type: "GROUP",
|
||||
url: "https://mobilizon.test/@lastGroup",
|
||||
},
|
||||
beginsOn: "2026-04-28T15:00:00Z",
|
||||
id: "2675674",
|
||||
options: {
|
||||
__typename: "EventOptions",
|
||||
anonymousParticipation: false,
|
||||
attendees: null,
|
||||
commentModeration: "CLOSED",
|
||||
hideNumberOfParticipants: false,
|
||||
hideOrganizerWhenGroupEvent: false,
|
||||
isOnline: false,
|
||||
maximumAttendeeCapacity: null,
|
||||
offers: [],
|
||||
participationConditions: null,
|
||||
program: null,
|
||||
remainingAttendeeCapacity: null,
|
||||
showEndTime: true,
|
||||
showParticipationPrice: null,
|
||||
showRemainingAttendeeCapacity: null,
|
||||
showStartTime: true,
|
||||
timezone: "Europe/Paris",
|
||||
},
|
||||
organizerActor: {
|
||||
__typename: "Person",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "109687",
|
||||
name: "organizer",
|
||||
preferredUsername: "organizer",
|
||||
summary: "Organizer",
|
||||
type: "PERSON",
|
||||
url: "https://mobilizion.test/@organizer",
|
||||
},
|
||||
picture: {
|
||||
__typename: "Media",
|
||||
alt: null,
|
||||
url: "https://mobilizion.test/media/f57a2cfc8c959b0dafc94c0eed74ad8f7050844ce1c9147fcdb58dd2ac709cde.webp?name=Market.webp",
|
||||
uuid: "1416f0ff-826d-44ba-94c7-e81b29095f87",
|
||||
},
|
||||
title: "Last event very nice",
|
||||
uuid: "76600bf1-b870-4577-9941-1072ebdcd753",
|
||||
},
|
||||
numberOfComments: 5,
|
||||
numberOfConfirmedParticipationsToLocalEvents: 23,
|
||||
numberOfEvents: 340,
|
||||
numberOfFollowers: 12,
|
||||
numberOfFollowings: 35,
|
||||
numberOfGroups: 67,
|
||||
numberOfReports: 9,
|
||||
numberOfUsers: 220,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const generateWrapper = (mock_dashboard = {}) => {
|
||||
const global_data = getMockClient([[DASHBOARD, mock_dashboard]]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return shallowMount(DashboardView, {
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("Dashboard", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper(dashboard_mock);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({});
|
||||
});
|
||||
});
|
||||
122
tests/unit/specs/views/admin/groupProfiles.spec.ts
Normal file
122
tests/unit/specs/views/admin/groupProfiles.spec.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import GroupProfiles from "@/views/Admin/GroupProfiles.vue";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { LIST_GROUPS } from "@/graphql/group";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const groups_mock = {
|
||||
data: {
|
||||
groups: {
|
||||
__typename: "PaginatedGroupList",
|
||||
elements: [
|
||||
{
|
||||
__typename: "Group",
|
||||
avatar: null,
|
||||
banner: null,
|
||||
domain: null,
|
||||
id: "1125368",
|
||||
name: "Group #1",
|
||||
organizedEvents: {
|
||||
__typename: "PaginatedEventList",
|
||||
elements: [],
|
||||
total: 0,
|
||||
},
|
||||
preferredUsername: "group1",
|
||||
summary: null,
|
||||
suspended: false,
|
||||
type: "GROUP",
|
||||
url: "https://mobilizon.test/@group1",
|
||||
},
|
||||
{
|
||||
__typename: "Group",
|
||||
avatar: null,
|
||||
banner: null,
|
||||
domain: null,
|
||||
id: "175368",
|
||||
name: "Group #4",
|
||||
organizedEvents: {
|
||||
__typename: "PaginatedEventList",
|
||||
elements: [],
|
||||
total: 0,
|
||||
},
|
||||
preferredUsername: "group4",
|
||||
summary: null,
|
||||
suspended: false,
|
||||
type: "GROUP",
|
||||
url: "https://mobilizon.test/@group4",
|
||||
},
|
||||
{
|
||||
__typename: "Group",
|
||||
avatar: null,
|
||||
banner: null,
|
||||
domain: null,
|
||||
id: "1126368",
|
||||
name: "Group #2",
|
||||
organizedEvents: {
|
||||
__typename: "PaginatedEventList",
|
||||
elements: [],
|
||||
total: 0,
|
||||
},
|
||||
preferredUsername: "group2",
|
||||
summary: null,
|
||||
suspended: false,
|
||||
type: "GROUP",
|
||||
url: "https://mobilizon.test/@group2",
|
||||
},
|
||||
],
|
||||
total: 3,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const generateWrapper = (mock_groups = {}) => {
|
||||
const global_data = getMockClient([[LIST_GROUPS, mock_groups]]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(GroupProfiles, {
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("GroupProfiles", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper(groups_mock);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
domain: "",
|
||||
limit: 10,
|
||||
local: true,
|
||||
name: "",
|
||||
page: 1,
|
||||
preferredUsername: "",
|
||||
suspended: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
88
tests/unit/specs/views/admin/instanceView.spec.ts
Normal file
88
tests/unit/specs/views/admin/instanceView.spec.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import {
|
||||
ACCEPT_RELAY,
|
||||
ADD_INSTANCE,
|
||||
INSTANCE,
|
||||
REJECT_RELAY,
|
||||
REMOVE_RELAY,
|
||||
} from "@/graphql/admin";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import InstanceView from "@/views/Admin/InstanceView.vue";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const instance_mock = {
|
||||
data: {
|
||||
instance: {
|
||||
__typename: "Instance",
|
||||
domain: "mobilizon.test",
|
||||
eventCount: 20,
|
||||
followedStatus: "NONE",
|
||||
followerStatus: "NONE",
|
||||
followersCount: 0,
|
||||
followingsCount: 0,
|
||||
groupCount: 1,
|
||||
hasRelay: true,
|
||||
instanceDescription: "Mobilizon for test",
|
||||
instanceName: "Mobilizon",
|
||||
mediaSize: 2951695,
|
||||
personCount: 5,
|
||||
relayAddress: "relay@mobilizon.test",
|
||||
reportsCount: 1,
|
||||
software: "Mobilizon",
|
||||
softwareVersion: "5.2.0",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const generateWrapper = (mock_instance = {}) => {
|
||||
const global_data = getMockClient([
|
||||
ACCEPT_RELAY,
|
||||
ADD_INSTANCE,
|
||||
[INSTANCE, mock_instance],
|
||||
REJECT_RELAY,
|
||||
REMOVE_RELAY,
|
||||
]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(InstanceView, {
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("InstanceView", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper(instance_mock);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_2).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_3).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_4).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_2).toHaveBeenCalledWith({});
|
||||
});
|
||||
});
|
||||
106
tests/unit/specs/views/admin/instancesView.spec.ts
Normal file
106
tests/unit/specs/views/admin/instancesView.spec.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import InstancesView from "@/views/Admin/InstancesView.vue";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { ADD_INSTANCE, INSTANCES } from "@/graphql/admin";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const instances_mock = {
|
||||
data: {
|
||||
instances: {
|
||||
__typename: "PaginatedInstanceList",
|
||||
elements: [
|
||||
{
|
||||
__typename: "Instance",
|
||||
domain: "mobilizon.test",
|
||||
eventCount: 20,
|
||||
followedStatus: "NONE",
|
||||
followerStatus: "NONE",
|
||||
followersCount: 0,
|
||||
followingsCount: 0,
|
||||
groupCount: 1,
|
||||
hasRelay: true,
|
||||
instanceDescription: "Mobilizon for test.",
|
||||
instanceName: "Mobilizon",
|
||||
mediaSize: 2951695,
|
||||
personCount: 5,
|
||||
relayAddress: "relay@mobilizon.test",
|
||||
reportsCount: 1,
|
||||
software: "Mobilizon",
|
||||
softwareVersion: "5.2.0",
|
||||
},
|
||||
{
|
||||
__typename: "Instance",
|
||||
domain: "agenda.test",
|
||||
eventCount: 4,
|
||||
followedStatus: "APPROVED",
|
||||
followerStatus: "NONE",
|
||||
followersCount: 0,
|
||||
followingsCount: 12,
|
||||
groupCount: 0,
|
||||
hasRelay: true,
|
||||
instanceDescription: "agenda gancio",
|
||||
instanceName: "Agenda de Crémeaux",
|
||||
mediaSize: 3774456,
|
||||
personCount: 0,
|
||||
relayAddress: "events@agenda.test",
|
||||
reportsCount: 0,
|
||||
software: "gancio",
|
||||
softwareVersion: "1.27.0",
|
||||
},
|
||||
],
|
||||
total: 2,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const generateWrapper = (mock_instances = {}) => {
|
||||
const global_data = getMockClient([
|
||||
ADD_INSTANCE,
|
||||
[INSTANCES, mock_instances],
|
||||
]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(InstancesView, {
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("InstancesView", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper(instances_mock);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(0);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_1).toHaveBeenCalledWith({
|
||||
filterDomain: "",
|
||||
filterFollowStatus: "ALL",
|
||||
limit: 10,
|
||||
page: 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
101
tests/unit/specs/views/admin/profilesView.spec.ts
Normal file
101
tests/unit/specs/views/admin/profilesView.spec.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import { beforeEach, describe, it, expect } from "vitest";
|
||||
import { enUS } from "date-fns/locale";
|
||||
import { routes } from "@/router";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { getMockClient, requestHandlers } from "../../mocks/client";
|
||||
import ProfilesView from "@/views/Admin/ProfilesView.vue";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import flushPromises from "flush-promises";
|
||||
import { LIST_PROFILES } from "@/graphql/actor";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
let router: Router;
|
||||
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
const profiles_mock = {
|
||||
data: {
|
||||
persons: {
|
||||
__typename: "PaginatedPersonList",
|
||||
elements: [
|
||||
{
|
||||
__typename: "Person",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "1",
|
||||
name: "Mobilizon Anonymous Actor",
|
||||
preferredUsername: "anonymous",
|
||||
summary: "A fake person for anonymous participations",
|
||||
type: "PERSON",
|
||||
url: "https://mobilizion.test/@anonymous",
|
||||
},
|
||||
{
|
||||
__typename: "Person",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "2",
|
||||
name: "Mobilizon",
|
||||
preferredUsername: "mobilizon",
|
||||
summary: null,
|
||||
type: "PERSON",
|
||||
url: "https://mobilizion.test/@mobilizon",
|
||||
},
|
||||
{
|
||||
__typename: "Person",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "109687",
|
||||
name: "Example",
|
||||
preferredUsername: "example",
|
||||
summary: "Profile for example",
|
||||
type: "PERSON",
|
||||
url: "https://mobilizion.test/@example",
|
||||
},
|
||||
],
|
||||
total: 3,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const generateWrapper = (mock_profiles = {}) => {
|
||||
const global_data = getMockClient([[LIST_PROFILES, mock_profiles]]);
|
||||
global_data.provide.dateFnsLocale = enUS;
|
||||
global_data.plugins = [router];
|
||||
return mount(ProfilesView, {
|
||||
global: {
|
||||
...global_data,
|
||||
stubs: {
|
||||
RouterLink: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("ProfilesView", () => {
|
||||
it("Show simple", async () => {
|
||||
const wrapper = generateWrapper(profiles_mock);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.handle_0).toHaveBeenCalledWith({
|
||||
domain: "",
|
||||
limit: 10,
|
||||
local: true,
|
||||
name: "",
|
||||
page: 1,
|
||||
preferredUsername: "",
|
||||
suspended: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
176
tests/unit/specs/views/admin/settings.spec.ts
Normal file
176
tests/unit/specs/views/admin/settings.spec.ts
Normal file
@@ -0,0 +1,176 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { DefaultApolloClient } from "@vue/apollo-composable";
|
||||
import { shallowMount } from "@vue/test-utils";
|
||||
import buildCurrentUserResolver from "@/apollo/user";
|
||||
import flushPromises from "flush-promises";
|
||||
import { cache } from "@/apollo/memory";
|
||||
import {
|
||||
createMockClient,
|
||||
MockApolloClient,
|
||||
RequestHandler,
|
||||
} from "mock-apollo-client";
|
||||
import SettingsView from "@/views/Admin/SettingsView.vue";
|
||||
import { nullMock } from "../../common";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
import {
|
||||
ADMIN_SETTINGS,
|
||||
SAVE_ADMIN_SETTINGS,
|
||||
LANGUAGES,
|
||||
} from "@/graphql/admin";
|
||||
|
||||
let mockClient: MockApolloClient | null;
|
||||
let requestHandlers: Record<string, RequestHandler>;
|
||||
|
||||
const languageMock = {
|
||||
data: {
|
||||
languages: [
|
||||
{
|
||||
__typename: "Language",
|
||||
code: "es",
|
||||
name: "Spanish",
|
||||
},
|
||||
{
|
||||
__typename: "Language",
|
||||
code: "fr-FR",
|
||||
name: "Français",
|
||||
},
|
||||
{
|
||||
__typename: "Language",
|
||||
code: "en-EN",
|
||||
name: "English",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const settingMock = {
|
||||
data: {
|
||||
adminSettings: {
|
||||
__typename: "AdminSettings",
|
||||
contact: "info@mobilizon.test",
|
||||
defaultPicture: null,
|
||||
instanceDescription: "Welcome to Mobilizon",
|
||||
instanceFavicon: null,
|
||||
instanceLanguages: ["fr"],
|
||||
instanceLogo: null,
|
||||
instanceLongDescription: "Mobilizon instance.",
|
||||
instanceName: "Mobilizon.test",
|
||||
instancePrivacyPolicy: '<p class="message-body">Privacy policy</p>',
|
||||
instancePrivacyPolicyType: "DEFAULT",
|
||||
instancePrivacyPolicyUrl: null,
|
||||
instanceRules: null,
|
||||
instanceSlogan: "Long life to Mobilizon",
|
||||
instanceTerms: '<p class="message-body">Rulls and terms</p>',
|
||||
instanceTermsType: "DEFAULT",
|
||||
instanceTermsUrl: null,
|
||||
primaryColor: null,
|
||||
registrationsOpen: true,
|
||||
registrationsModeration: false,
|
||||
secondaryColor: null,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const generateWrapper = () => {
|
||||
mockClient = createMockClient({
|
||||
cache,
|
||||
resolvers: buildCurrentUserResolver(cache),
|
||||
});
|
||||
requestHandlers = {
|
||||
config: vi.fn().mockResolvedValue(nullMock),
|
||||
settings: vi.fn().mockResolvedValue(settingMock),
|
||||
save_settings: vi.fn().mockResolvedValue(nullMock),
|
||||
languages: vi.fn().mockResolvedValue(languageMock),
|
||||
};
|
||||
mockClient.setRequestHandler(CONFIG, requestHandlers.config);
|
||||
mockClient.setRequestHandler(ADMIN_SETTINGS, requestHandlers.settings);
|
||||
mockClient.setRequestHandler(
|
||||
SAVE_ADMIN_SETTINGS,
|
||||
requestHandlers.save_settings
|
||||
);
|
||||
mockClient.setRequestHandler(LANGUAGES, requestHandlers.languages);
|
||||
|
||||
return shallowMount(SettingsView, {
|
||||
props: {},
|
||||
global: {
|
||||
provide: {
|
||||
[DefaultApolloClient]: mockClient,
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
describe("SettingsView", () => {
|
||||
it("Show and save settings", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
expect(requestHandlers.config).toHaveBeenCalled();
|
||||
expect(requestHandlers.languages).toHaveBeenCalled();
|
||||
expect(requestHandlers.settings).toHaveBeenCalled();
|
||||
expect(requestHandlers.save_settings).toHaveBeenCalledTimes(0);
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
|
||||
expect(wrapper.find("#instance-description").attributes("modelvalue")).toBe(
|
||||
"Welcome to Mobilizon"
|
||||
);
|
||||
expect(wrapper.find("#instance-contact").attributes("modelvalue")).toBe(
|
||||
"info@mobilizon.test"
|
||||
);
|
||||
const radiolist1 = wrapper
|
||||
.findAll('o-radio[name="registrationsModeType"]')
|
||||
.filter(
|
||||
(radio) =>
|
||||
radio.attributes("modelvalue") == radio.attributes("native-value")
|
||||
);
|
||||
expect(radiolist1.length).toBe(1);
|
||||
expect(radiolist1[0].text()).toBe(
|
||||
"Registration is allowed, anyone can register."
|
||||
);
|
||||
|
||||
wrapper.vm.settingsToWrite.instanceDescription = "Best Mobilizon";
|
||||
wrapper.vm.settingsToWrite.contact = "some@email.tld";
|
||||
wrapper.vm.settingsToWrite.registrationsOpen = false;
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(wrapper.find("#instance-description").attributes("modelvalue")).toBe(
|
||||
"Best Mobilizon"
|
||||
);
|
||||
expect(wrapper.find("#instance-contact").attributes("modelvalue")).toBe(
|
||||
"some@email.tld"
|
||||
);
|
||||
const radiolist2 = wrapper
|
||||
.findAll('o-radio[name="registrationsModeType"]')
|
||||
.filter(
|
||||
(radio) =>
|
||||
radio.attributes("modelvalue") == radio.attributes("native-value")
|
||||
);
|
||||
expect(radiolist2.length).toBe(1);
|
||||
expect(radiolist2[0].text()).toBe("Registration is closed.");
|
||||
wrapper.find("form").trigger("submit");
|
||||
expect(requestHandlers.save_settings).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.save_settings).toBeCalledWith({
|
||||
...settingMock.data.adminSettings,
|
||||
contact: "some@email.tld",
|
||||
instanceDescription: "Best Mobilizon",
|
||||
registrationsOpen: false,
|
||||
defaultPicture: {},
|
||||
instanceFavicon: {},
|
||||
instanceLogo: {},
|
||||
});
|
||||
|
||||
wrapper.vm.settingsToWrite.registrationsOpen = true;
|
||||
wrapper.vm.settingsToWrite.registrationsModeration = true;
|
||||
await wrapper.vm.$nextTick();
|
||||
const radiolist3 = wrapper
|
||||
.findAll('o-radio[name="registrationsModeType"]')
|
||||
.filter(
|
||||
(radio) =>
|
||||
radio.attributes("modelvalue") == radio.attributes("native-value")
|
||||
);
|
||||
expect(radiolist3.length).toBe(1);
|
||||
expect(radiolist3[0].text()).toBe(
|
||||
"Registration is moderated, new user must be validated."
|
||||
);
|
||||
});
|
||||
});
|
||||
197
tests/unit/specs/views/admin/usersView.spec.ts
Normal file
197
tests/unit/specs/views/admin/usersView.spec.ts
Normal file
@@ -0,0 +1,197 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { DefaultApolloClient } from "@vue/apollo-composable";
|
||||
import { config, mount } from "@vue/test-utils";
|
||||
import buildCurrentUserResolver from "@/apollo/user";
|
||||
import flushPromises from "flush-promises";
|
||||
import { cache } from "@/apollo/memory";
|
||||
import {
|
||||
createMockClient,
|
||||
MockApolloClient,
|
||||
RequestHandler,
|
||||
} from "mock-apollo-client";
|
||||
import UsersView from "@/views/Admin/UsersView.vue";
|
||||
import { LIST_USERS } from "@/graphql/user";
|
||||
import { LANGUAGES_CODES } from "@/graphql/admin";
|
||||
import { createRouter, createWebHistory, Router } from "vue-router";
|
||||
import { routes } from "@/router";
|
||||
import { Oruga } from "@oruga-ui/oruga-next";
|
||||
import { htmlRemoveId } from "../../common";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
|
||||
let router: Router;
|
||||
|
||||
let mockClient: MockApolloClient | null;
|
||||
let requestHandlers: Record<string, RequestHandler>;
|
||||
|
||||
const languageCodeMock = {
|
||||
data: {
|
||||
languages: [
|
||||
{
|
||||
__typename: "Language",
|
||||
code: "fr",
|
||||
name: "French",
|
||||
},
|
||||
{
|
||||
__typename: "Language",
|
||||
code: "en",
|
||||
name: "English",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const listUsersMock = {
|
||||
data: {
|
||||
users: {
|
||||
__typename: "Users",
|
||||
elements: [
|
||||
{
|
||||
__typename: "User",
|
||||
actors: [
|
||||
{
|
||||
__typename: "Person",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "11371",
|
||||
name: "Truc",
|
||||
preferredUsername: "truc",
|
||||
summary: null,
|
||||
type: "PERSON",
|
||||
url: "http://mobilizon.test/@truc",
|
||||
},
|
||||
],
|
||||
confirmedAt: "2025-08-30T09:56:59Z",
|
||||
currentSignInAt: null,
|
||||
currentSignInIp: null,
|
||||
disabled: false,
|
||||
email: "truc@mobilizon.test",
|
||||
id: "6",
|
||||
locale: "en",
|
||||
settings: null,
|
||||
},
|
||||
{
|
||||
__typename: "User",
|
||||
actors: [
|
||||
{
|
||||
__typename: "Person",
|
||||
avatar: null,
|
||||
domain: null,
|
||||
id: "1",
|
||||
name: "Administrator",
|
||||
preferredUsername: "administrator",
|
||||
summary: null,
|
||||
type: "PERSON",
|
||||
url: "https://mobilizon.test/@administrator",
|
||||
},
|
||||
],
|
||||
confirmedAt: "2025-06-04T16:19:48Z",
|
||||
currentSignInAt: "2025-09-11T16:10:03Z",
|
||||
currentSignInIp: "127.0.0.1",
|
||||
disabled: false,
|
||||
email: "admin@mobilizon.test",
|
||||
id: "1",
|
||||
locale: "en",
|
||||
settings: {
|
||||
__typename: "UserSettings",
|
||||
timezone: "Europe/Paris",
|
||||
},
|
||||
},
|
||||
],
|
||||
total: 2,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
|
||||
const generateWrapper = (currentModeration = false) => {
|
||||
mockClient = createMockClient({
|
||||
cache,
|
||||
resolvers: buildCurrentUserResolver(cache),
|
||||
});
|
||||
requestHandlers = {
|
||||
config: vi.fn().mockResolvedValue({
|
||||
data: {
|
||||
config: {
|
||||
registrationsModeration: currentModeration,
|
||||
},
|
||||
},
|
||||
}),
|
||||
languagecode: vi.fn().mockResolvedValue(languageCodeMock),
|
||||
list_users: vi.fn().mockResolvedValue(listUsersMock),
|
||||
};
|
||||
mockClient.setRequestHandler(CONFIG, requestHandlers.config);
|
||||
mockClient.setRequestHandler(LANGUAGES_CODES, requestHandlers.languagecode);
|
||||
mockClient.setRequestHandler(LIST_USERS, requestHandlers.list_users);
|
||||
|
||||
const wrapper = mount(UsersView, {
|
||||
props: {},
|
||||
stubs: ["router-link", "router-view"],
|
||||
global: {
|
||||
provide: {
|
||||
[DefaultApolloClient]: mockClient,
|
||||
},
|
||||
plugins: [router],
|
||||
},
|
||||
});
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
describe("UsersView", () => {
|
||||
beforeEach(async () => {
|
||||
router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: routes,
|
||||
});
|
||||
|
||||
// await router.isReady();
|
||||
});
|
||||
|
||||
it("Show simple list", async () => {
|
||||
const wrapper = generateWrapper();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
expect(requestHandlers.languagecode).toHaveBeenCalledTimes(2);
|
||||
expect(requestHandlers.list_users).toHaveBeenCalledTimes(1);
|
||||
expect(requestHandlers.list_users).toHaveBeenCalledWith({
|
||||
currentSignInIp: "",
|
||||
email: "",
|
||||
limit: 10,
|
||||
page: 1,
|
||||
pendingUser: false,
|
||||
});
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("Show list with moderation", async () => {
|
||||
const wrapper = generateWrapper(true);
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.exists()).toBe(true);
|
||||
expect(wrapper.vm.pendingFieldValue).toBe(false);
|
||||
expect(requestHandlers.languagecode).toHaveBeenCalledTimes(0);
|
||||
expect(htmlRemoveId(wrapper.html())).toMatchSnapshot();
|
||||
|
||||
wrapper.vm.pendingFieldValue = true;
|
||||
//wrapper.find('input[type="checkbox"]').trigger("change");
|
||||
wrapper.find('input[type="text"]').setValue("@email.tld");
|
||||
wrapper.find('button[type="button"]').trigger("click");
|
||||
await flushPromises();
|
||||
expect(requestHandlers.list_users).toHaveBeenCalledTimes(2);
|
||||
expect(requestHandlers.list_users).toHaveBeenNthCalledWith(1, {
|
||||
currentSignInIp: "",
|
||||
email: "@email.tld",
|
||||
limit: 10,
|
||||
page: 1,
|
||||
pendingUser: false,
|
||||
});
|
||||
expect(requestHandlers.list_users).toHaveBeenNthCalledWith(2, {
|
||||
currentSignInIp: "",
|
||||
email: "@email.tld",
|
||||
limit: 10,
|
||||
page: 1,
|
||||
pendingUser: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user