focalboard/webapp/src/testUtils.tsx
Harshil Sharma 578b91fd2e
Fixed comments not displaying in readonly view (#820)
* Fixed comments not displaying in readonly view

* FIxed some tests

* Updated tests

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
2021-08-05 18:52:15 +05:30

25 lines
678 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {IntlProvider} from 'react-intl'
import React from 'react'
export const wrapIntl = (children: any) => <IntlProvider locale='en'>{children}</IntlProvider>
export function mockDOM(): void {
window.focus = jest.fn()
document.createRange = () => {
const range = new Range()
range.getBoundingClientRect = jest.fn()
range.getClientRects = () => {
return {
item: () => null,
length: 0,
[Symbol.iterator]: jest.fn(),
}
}
return range
}
}