diff options
author | Revanshu Paliwal <revanshu.paliwal@sonarsource.com> | 2023-07-14 16:50:17 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-07-21 20:03:16 +0000 |
commit | a7cd1d6bf47e1e2966e3029bd28badf74c2af46b (patch) | |
tree | 5fbb424fbced3458ef540b1545a0b5cd91929dc0 /server/sonar-web/config/jest | |
parent | 106e5141332a4d11dd055941394d4a8b4bc83f10 (diff) | |
download | sonarqube-a7cd1d6bf47e1e2966e3029bd28badf74c2af46b.tar.gz sonarqube-a7cd1d6bf47e1e2966e3029bd28badf74c2af46b.zip |
SONAR-19906 Migrating github action tutorial page to MIUI
Diffstat (limited to 'server/sonar-web/config/jest')
-rw-r--r-- | server/sonar-web/config/jest/SetupTestEnvironment.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/sonar-web/config/jest/SetupTestEnvironment.ts b/server/sonar-web/config/jest/SetupTestEnvironment.ts index 54350855106..a10eb5dd7e3 100644 --- a/server/sonar-web/config/jest/SetupTestEnvironment.ts +++ b/server/sonar-web/config/jest/SetupTestEnvironment.ts @@ -21,6 +21,12 @@ import React from 'react'; (window as any).React = React; +const MockObserver = { + observe: jest.fn(), + unobserve: jest.fn(), + disconnect: jest.fn(), +}; + const content = document.createElement('div'); content.id = 'content'; document.documentElement.appendChild(content); @@ -37,3 +43,10 @@ jest.mock('../../src/main/js/helpers/l10n', () => ({ translateWithParameters: (messageKey: string, ...parameters: Array<string | number>) => [messageKey, ...parameters].join('.'), })); + +const MockIntersectionObserverEntries = [{ isIntersecting: true }]; + +(window as any).IntersectionObserver = jest.fn().mockImplementation((callback) => { + callback(MockIntersectionObserverEntries, MockObserver); + return MockObserver; +}); |