mCaptcha/templates/setUpTests.ts

112 lines
2.9 KiB
TypeScript
Raw Normal View History

2021-05-06 11:18:28 +03:00
/*
2022-01-08 19:46:05 +03:00
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
2021-05-06 11:18:28 +03:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/** get login form HTML */
2021-10-08 12:54:29 +03:00
export const getLoginFormHtml = (): string =>
2021-05-06 11:18:28 +03: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 12:54:29 +03:00
export const getRegistrationFormHtml = (): string => `
2021-05-06 11:18:28 +03: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 12:54:29 +03:00
export const mockAlert = (): void => {
2021-05-06 11:18:28 +03:00
delete window.alert;
window.alert = (x: any) => console.log(x);
};