Skip to content

Commit

Permalink
Merge pull request #1298 from Bynder/issue/mention-input-props-and-tests
Browse files Browse the repository at this point in the history
fix ReactMentions props and fix tests that stop local linting
  • Loading branch information
AmeeMorris authored Sep 19, 2023
2 parents af0525d + 36e776f commit 37aae4c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/ColField/tests/ColField.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, render, fireEvent } from "@testing-library/react";
// @ts-expect-error TS(2307): Cannot find module 'lib/ColField/ColField' or its ... Remove this comment to see the full error message
import ColField from "lib/ColField/ColField";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, render, fireEvent } from "@testing-library/react";
import { InputConfirmationModal } from "lib";
import React from "react";
Expand Down
1 change: 1 addition & 0 deletions lib/PillInput/tests/PillInput.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import { afterEach, describe, expect, it } from "vitest";
import { render, fireEvent, cleanup } from "@testing-library/react";
import { PillInput } from "../PillInput/PillInput";

Expand Down
2 changes: 1 addition & 1 deletion lib/SelectionBar/specs/SelectionBar.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { afterEach, describe, expect, it } from "vitest";
import { cleanup, render } from "@testing-library/react";
// @ts-expect-error TS(2307): Cannot find module 'lib/SelectionBar' or its corre... Remove this comment to see the full error message
import SelectionBar from "lib/SelectionBar";
Expand Down
2 changes: 1 addition & 1 deletion lib/Windowing/tests/Windowing.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { render, fireEvent, waitFor } from "@testing-library/react";
import React from "react";
import { Windowing } from "../..";
Expand Down
6 changes: 3 additions & 3 deletions lib/src/modules/input/InputWithMentions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function InputWithMentions({
const removeMentionMarkup = (newVal: any) => {
const pattern = /(?:@\[\w+\])+/gi;
return newVal.replace(pattern, (match: any) => {
const mention = match.replace(/\]|\[/g, "");
const mention = match.replace(/\]|\[|\(\d+\)/g, "");
return mention;
});
};
Expand Down Expand Up @@ -77,8 +77,6 @@ export function InputWithMentions({
className="mentions-input"
value={inputValue}
onChange={handleChange}
markup="@[__display__]"
displayTransform={(id: any, display: any) => `@${display}`}
suggestionsPortalHost={mentionsPortalRef.current}
onFocus={() => setHasFocus(true)}
onBlur={() => setHasFocus(false)}
Expand All @@ -89,6 +87,8 @@ export function InputWithMentions({
onAdd={onMention}
data={(search: any) => searchForUsers(search)}
appendSpaceOnAdd
displayTransform={(id: any, display: any) => `@${display}`}
markup="@[__display__]"
renderSuggestion={(suggestion: any) => (
<Avatar url={suggestion.avatar} initials={suggestion.initials}>
<AvatarInformation
Expand Down

0 comments on commit 37aae4c

Please sign in to comment.