Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
@@ -364,7 +364,9 @@ describe("calendar Availability search", () => {
|
|||||||
renderWithProviders(<CalendarTestWrapper />, preloadedState)
|
renderWithProviders(<CalendarTestWrapper />, preloadedState)
|
||||||
);
|
);
|
||||||
|
|
||||||
const input = screen.getByPlaceholderText("peopleSearch.placeholder");
|
const input = screen.getByPlaceholderText(
|
||||||
|
"peopleSearch.availabilityPlaceholder"
|
||||||
|
);
|
||||||
act(() => {
|
act(() => {
|
||||||
userEvent.type(input, "New");
|
userEvent.type(input, "New");
|
||||||
});
|
});
|
||||||
@@ -394,14 +396,16 @@ describe("calendar Availability search", () => {
|
|||||||
renderWithProviders(<CalendarTestWrapper />, preloadedState)
|
renderWithProviders(<CalendarTestWrapper />, preloadedState)
|
||||||
);
|
);
|
||||||
|
|
||||||
const input = screen.getByPlaceholderText("peopleSearch.placeholder");
|
const input = screen.getByPlaceholderText(
|
||||||
|
"peopleSearch.availabilityPlaceholder"
|
||||||
|
);
|
||||||
await act(async () => userEvent.type(input, "Alice"));
|
await act(async () => userEvent.type(input, "Alice"));
|
||||||
|
|
||||||
const option = await screen.findByText("Alice");
|
const option = await screen.findByText("Alice");
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
fireEvent.click(option);
|
fireEvent.click(option);
|
||||||
});
|
});
|
||||||
expect(spy).not.toHaveBeenCalledWith();
|
expect(spy).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("open window with attendees filled after temp search on create event button click", async () => {
|
it("open window with attendees filled after temp search on create event button click", async () => {
|
||||||
@@ -423,7 +427,9 @@ describe("calendar Availability search", () => {
|
|||||||
renderWithProviders(<CalendarTestWrapper />, preloadedState)
|
renderWithProviders(<CalendarTestWrapper />, preloadedState)
|
||||||
);
|
);
|
||||||
|
|
||||||
const input = screen.getByPlaceholderText("peopleSearch.placeholder");
|
const input = screen.getByPlaceholderText(
|
||||||
|
"peopleSearch.availabilityPlaceholder"
|
||||||
|
);
|
||||||
await act(async () => userEvent.type(input, "New"));
|
await act(async () => userEvent.type(input, "New"));
|
||||||
|
|
||||||
const option = await screen.findByText("New User");
|
const option = await screen.findByText("New User");
|
||||||
@@ -462,7 +468,9 @@ describe("calendar Availability search", () => {
|
|||||||
renderWithProviders(<CalendarTestWrapper />, preloadedState)
|
renderWithProviders(<CalendarTestWrapper />, preloadedState)
|
||||||
);
|
);
|
||||||
|
|
||||||
const input = screen.getByPlaceholderText("peopleSearch.placeholder");
|
const input = screen.getByPlaceholderText(
|
||||||
|
"peopleSearch.availabilityPlaceholder"
|
||||||
|
);
|
||||||
await act(async () => userEvent.type(input, "New"));
|
await act(async () => userEvent.type(input, "New"));
|
||||||
|
|
||||||
const option = await screen.findByText("New User");
|
const option = await screen.findByText("New User");
|
||||||
|
|||||||
@@ -29,13 +29,15 @@ export function PeopleSearch({
|
|||||||
disabled,
|
disabled,
|
||||||
freeSolo,
|
freeSolo,
|
||||||
onToggleEventPreview,
|
onToggleEventPreview,
|
||||||
|
placeholder,
|
||||||
}: {
|
}: {
|
||||||
selectedUsers: User[];
|
selectedUsers: User[];
|
||||||
onChange: Function;
|
onChange: Function;
|
||||||
objectTypes: string[];
|
objectTypes: string[];
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
freeSolo?: boolean;
|
freeSolo?: boolean;
|
||||||
onToggleEventPreview?: Function;
|
onToggleEventPreview?: () => void;
|
||||||
|
placeholder?: string;
|
||||||
}) {
|
}) {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const [query, setQuery] = useState("");
|
const [query, setQuery] = useState("");
|
||||||
@@ -51,6 +53,8 @@ export function PeopleSearch({
|
|||||||
const [snackbarMessage, setSnackbarMessage] = useState("");
|
const [snackbarMessage, setSnackbarMessage] = useState("");
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const searchPlaceholder = placeholder ?? t("peopleSearch.placeholder");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
|
|
||||||
@@ -149,7 +153,7 @@ export function PeopleSearch({
|
|||||||
{...params}
|
{...params}
|
||||||
error={!!inputError}
|
error={!!inputError}
|
||||||
helperText={inputError}
|
helperText={inputError}
|
||||||
placeholder={t("peopleSearch.placeholder")}
|
placeholder={searchPlaceholder}
|
||||||
label=""
|
label=""
|
||||||
inputProps={{
|
inputProps={{
|
||||||
...params.inputProps,
|
...params.inputProps,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
|
import { useI18n } from "twake-i18n";
|
||||||
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
import { useAppDispatch, useAppSelector } from "../../app/hooks";
|
||||||
import {
|
import {
|
||||||
getTempCalendarsListAsync,
|
getTempCalendarsListAsync,
|
||||||
@@ -30,6 +31,7 @@ export function TempCalendarsInput({
|
|||||||
useAppSelector((state) => state.calendars.templist) ?? {};
|
useAppSelector((state) => state.calendars.templist) ?? {};
|
||||||
const calendars = useAppSelector((state) => state.calendars.list);
|
const calendars = useAppSelector((state) => state.calendars.list);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
const prevUsersRef = useRef<User[]>([]);
|
const prevUsersRef = useRef<User[]>([]);
|
||||||
const userColorsRef = useRef(new Map<string, string>());
|
const userColorsRef = useRef(new Map<string, string>());
|
||||||
@@ -102,6 +104,7 @@ export function TempCalendarsInput({
|
|||||||
selectedUsers={tempUsers}
|
selectedUsers={tempUsers}
|
||||||
onChange={handleUserChange}
|
onChange={handleUserChange}
|
||||||
onToggleEventPreview={handleToggleEventPreview}
|
onToggleEventPreview={handleToggleEventPreview}
|
||||||
|
placeholder={t("peopleSearch.availabilityPlaceholder")}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,6 +169,7 @@
|
|||||||
"peopleSearch": {
|
"peopleSearch": {
|
||||||
"label": "Start typing a name or email",
|
"label": "Start typing a name or email",
|
||||||
"placeholder": "Start typing a name or email",
|
"placeholder": "Start typing a name or email",
|
||||||
|
"availabilityPlaceholder": "Check availability",
|
||||||
"invalidEmail": "%{email} is not a valid email address",
|
"invalidEmail": "%{email} is not a valid email address",
|
||||||
"searchError": "Unable to fetch contacts right now. Please try again.",
|
"searchError": "Unable to fetch contacts right now. Please try again.",
|
||||||
"noResults": "No results",
|
"noResults": "No results",
|
||||||
|
|||||||
@@ -169,6 +169,7 @@
|
|||||||
"peopleSearch": {
|
"peopleSearch": {
|
||||||
"label": "Commencez à saisir un nom ou un e-mail",
|
"label": "Commencez à saisir un nom ou un e-mail",
|
||||||
"placeholder": "Commencez à saisir un nom ou un e-mail",
|
"placeholder": "Commencez à saisir un nom ou un e-mail",
|
||||||
|
"availabilityPlaceholder": "Vérifier la disponibilité",
|
||||||
"invalidEmail": "%{email} n'est pas une adresse e-mail valide",
|
"invalidEmail": "%{email} n'est pas une adresse e-mail valide",
|
||||||
"searchError": "Impossible de récupérer les contacts pour le moment. Veuillez réessayer.",
|
"searchError": "Impossible de récupérer les contacts pour le moment. Veuillez réessayer.",
|
||||||
"noResults": "Aucun résultat",
|
"noResults": "Aucun résultat",
|
||||||
|
|||||||
@@ -169,6 +169,7 @@
|
|||||||
"peopleSearch": {
|
"peopleSearch": {
|
||||||
"label": "Поиск по имени или email",
|
"label": "Поиск по имени или email",
|
||||||
"placeholder": "Введите имя или email",
|
"placeholder": "Введите имя или email",
|
||||||
|
"availabilityPlaceholder": "Проверить наличие мест",
|
||||||
"invalidEmail": "%{email} — некорректный адрес",
|
"invalidEmail": "%{email} — некорректный адрес",
|
||||||
"searchError": "Не удалось загрузить контакты. Попробуйте ещё раз.",
|
"searchError": "Не удалось загрузить контакты. Попробуйте ещё раз.",
|
||||||
"noResults": "Нет результатов",
|
"noResults": "Нет результатов",
|
||||||
|
|||||||
@@ -169,6 +169,7 @@
|
|||||||
"peopleSearch": {
|
"peopleSearch": {
|
||||||
"label": "Nhập tên hoặc email",
|
"label": "Nhập tên hoặc email",
|
||||||
"placeholder": "Nhập tên hoặc email",
|
"placeholder": "Nhập tên hoặc email",
|
||||||
|
"availabilityPlaceholder": "Kiểm tra tình trạng phòng trống",
|
||||||
"invalidEmail": "%{email} không phải địa chỉ email hợp lệ",
|
"invalidEmail": "%{email} không phải địa chỉ email hợp lệ",
|
||||||
"searchError": "Không thể lấy danh bạ. Vui lòng thử lại.",
|
"searchError": "Không thể lấy danh bạ. Vui lòng thử lại.",
|
||||||
"noResults": "Không có kết quả",
|
"noResults": "Không có kết quả",
|
||||||
|
|||||||
Reference in New Issue
Block a user