mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-18 18:18:23 -05:00
Some checks are pending
API / build (push) Waiting to run
Server CI / Compute Go Version (push) Waiting to run
Server CI / Check mocks (push) Blocked by required conditions
Server CI / Check go mod tidy (push) Blocked by required conditions
Server CI / check-style (push) Blocked by required conditions
Server CI / Check serialization methods for hot structs (push) Blocked by required conditions
Server CI / Vet API (push) Blocked by required conditions
Server CI / Check migration files (push) Blocked by required conditions
Server CI / Generate email templates (push) Blocked by required conditions
Server CI / Check store layers (push) Blocked by required conditions
Server CI / Check mmctl docs (push) Blocked by required conditions
Server CI / Postgres with binary parameters (push) Blocked by required conditions
Server CI / Postgres (push) Blocked by required conditions
Server CI / Postgres (FIPS) (push) Blocked by required conditions
Server CI / Generate Test Coverage (push) Blocked by required conditions
Server CI / Run mmctl tests (push) Blocked by required conditions
Server CI / Run mmctl tests (FIPS) (push) Blocked by required conditions
Server CI / Build mattermost server app (push) Blocked by required conditions
Web App CI / check-lint (push) Waiting to run
Web App CI / check-i18n (push) Blocked by required conditions
Web App CI / check-types (push) Blocked by required conditions
Web App CI / test (platform) (push) Blocked by required conditions
Web App CI / test (mattermost-redux) (push) Blocked by required conditions
Web App CI / test (channels shard 1/4) (push) Blocked by required conditions
Web App CI / test (channels shard 2/4) (push) Blocked by required conditions
Web App CI / test (channels shard 3/4) (push) Blocked by required conditions
Web App CI / test (channels shard 4/4) (push) Blocked by required conditions
Web App CI / upload-coverage (push) Blocked by required conditions
Web App CI / build (push) Blocked by required conditions
* chore: upgrade to node 24 and dependencies mainly with babel, webpack and jest * fix components tests, make trial modal passed on all node 20-24 * fix cache for platform packages * updated test --------- Co-authored-by: Mattermost Build <build@mattermost.com>
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React from 'react';
|
|
|
|
import {fireEvent, render} from 'tests/react_testing_utils';
|
|
|
|
import Scrollbars from './scrollbars';
|
|
|
|
const originalGetComputedStyle = window.getComputedStyle;
|
|
beforeAll(() => {
|
|
window.getComputedStyle = (elt: Element, pseudoElt?: string | null) => {
|
|
if (pseudoElt) {
|
|
// Return an empty CSSStyleDeclaration-like object for pseudo elements
|
|
return {} as CSSStyleDeclaration;
|
|
}
|
|
return originalGetComputedStyle(elt);
|
|
};
|
|
});
|
|
|
|
afterAll(() => {
|
|
window.getComputedStyle = originalGetComputedStyle;
|
|
});
|
|
|
|
describe('Scrollbars', () => {
|
|
test('should attach scroll handler to the correct element', () => {
|
|
const onScroll = jest.fn();
|
|
|
|
render(
|
|
<Scrollbars onScroll={onScroll}>
|
|
{'This is some content in a scrollable area'}
|
|
</Scrollbars>,
|
|
);
|
|
|
|
// Ideally, we'd actually scroll the content of the element, but jsdom doesn't implement scroll events
|
|
fireEvent.scroll(document.querySelector('.simplebar-content-wrapper')!);
|
|
|
|
expect(onScroll).toHaveBeenCalled();
|
|
});
|
|
|
|
test('should attach ref to the correct element', () => {
|
|
let scrollElement;
|
|
render(
|
|
<Scrollbars
|
|
ref={(element) => {
|
|
scrollElement = element;
|
|
}}
|
|
>
|
|
<div/>
|
|
</Scrollbars>,
|
|
);
|
|
|
|
expect(scrollElement).toBe(document.querySelector('.simplebar-content-wrapper'));
|
|
});
|
|
});
|