mCaptcha/templates/setUpTests.ts

100 lines
2.3 KiB
TypeScript
Raw Permalink Normal View History

// Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
2021-05-06 08:18:28 +00:00
/** get login form HTML */
2021-10-08 09:54:29 +00:00
export const getLoginFormHtml = (): string =>
2021-05-06 08:18:28 +00:00
`
<form method="POST" action="/something" id="form">
<label class="form__in-group" for="username"
>Username
<input
class="form__in-field"
id="username"
type="text"
name="username"
required=""
autofocus="true"
/>
</label>
<label for="password" class="form__in-group"
>Password
<input
class="form__in-field"
type="password"
id="password"
name="password"
required=""
/>
<!--
<a class="form__pw-recovery" -href="/recovert/password"
>Forgot password?</a
>
-->
</label>
<input type="submit" class="form__submit-button" value="Sign in" />
</form>
`;
/** get registration form HTML */
2021-10-08 09:54:29 +00:00
export const getRegistrationFormHtml = (): string => `
2021-05-06 08:18:28 +00:00
<form method="POST" action="/api/v1/signup" class="form__box" id="form">
<label class="form__in-group" for="username"
>Username
<input
class="form__in-field"
id="username"
type="text"
name="username"
id="username"
required
autofocus="true"
/>
</label>
<label class="form__in-group" for="username"
>Email(optional)
<input
class="form__in-field"
id="email"
type="email"
name="email"
id="email"
/>
</label>
<label for="password" class="form__in-group"
>Password
<input
class="form__in-field"
type="password"
id="password"
name="password"
id="password"
required
/>
</label>
<label for="password" class="form__in-group"
>Re-enter Password
<input
class="form__in-field"
type="password"
id="password-check"
name="password-check"
id="password-check"
required
/>
</label>
<input type="submit" class="form__submit-button" value="Sign up" />
</form>
`;
2021-10-08 09:54:29 +00:00
export const mockAlert = (): void => {
2021-05-06 08:18:28 +00:00
delete window.alert;
window.alert = (x: any) => console.log(x);
};