Kill off enzyme in preference of react testing library (#10255)
This commit is contained in:
parent
394bffbae4
commit
bda54a8b20
7 changed files with 123 additions and 447 deletions
|
@ -186,7 +186,7 @@ class EmojiPicker extends React.Component<IProps, IState> {
|
|||
private onChangeFilter = (filter: string): void => {
|
||||
const lcFilter = filter.toLowerCase().trim(); // filter is case insensitive
|
||||
for (const cat of this.categories) {
|
||||
let emojis;
|
||||
let emojis: IEmoji[];
|
||||
// If the new filter string includes the old filter string, we don't have to re-filter the whole dataset.
|
||||
if (lcFilter.includes(this.state.filter)) {
|
||||
emojis = this.memoizedDataByCategory[cat.id];
|
||||
|
|
|
@ -43,6 +43,8 @@ interface IState {
|
|||
export default class MLocationBody extends React.Component<IBodyProps, IState> {
|
||||
public static contextType = MatrixClientContext;
|
||||
public context!: React.ContextType<typeof MatrixClientContext>;
|
||||
|
||||
private unmounted = false;
|
||||
private mapId: string;
|
||||
private reconnectedListener: ClientEventHandlerMap[ClientEvent.Sync];
|
||||
|
||||
|
@ -80,11 +82,15 @@ export default class MLocationBody extends React.Component<IBodyProps, IState> {
|
|||
};
|
||||
|
||||
private onError = (error: Error): void => {
|
||||
if (this.unmounted) return;
|
||||
this.setState({ error });
|
||||
// Unregister first in case we already had it registered
|
||||
this.context.off(ClientEvent.Sync, this.reconnectedListener);
|
||||
this.context.on(ClientEvent.Sync, this.reconnectedListener);
|
||||
};
|
||||
|
||||
public componentWillUnmount(): void {
|
||||
this.unmounted = true;
|
||||
this.context.off(ClientEvent.Sync, this.reconnectedListener);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue