-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove global Google Analytics and simplify privacy package. (#824)
* Remove global Google Analytics and mock in dev mode. * Move analytics to react-ga component, use GA4 id. * Refactor privacy system. Use js-cookie lib. Simpler helpers for isAnalyticsEnabled, isFirstTime and theme preferences. * Fix typo breaking tests on GH. * Update cypress tests for isFirstTime cookie value. Fix typo breaking tests on GH.
- Loading branch information
1 parent
8788975
commit 6b0f760
Showing
28 changed files
with
397 additions
and
513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
import * as Privacy from '../../privacy/Privacy' | ||
import {setPrivacy} from './PrivacyControl' | ||
|
||
|
||
describe('PrivacyControl tests', () => { | ||
test('sets privacy settings correctly', () => { | ||
// Test setting privacy to disabled | ||
setPrivacy(true) | ||
expect(Privacy.isPrivacySocialEnabled()).toBe(false) | ||
// Test setting privacy to enabled | ||
setPrivacy(false) | ||
expect(Privacy.isPrivacySocialEnabled()).toBe(true) | ||
import React from 'react' | ||
import {fireEvent, render} from '@testing-library/react' | ||
import * as Analytics from '../../privacy/analytics' | ||
import PrivacyControl from './PrivacyControl' | ||
|
||
|
||
describe('PrivacyControl', () => { | ||
test('toggle sets analytics cookie correctly', () => { | ||
expect(Analytics.isAllowed()).toBe(true) | ||
|
||
const {getByRole} = render(<PrivacyControl/>) | ||
const enableAnalyticsToggle = getByRole('checkbox') | ||
expect(enableAnalyticsToggle).toBeInTheDocument() | ||
|
||
fireEvent.click(enableAnalyticsToggle) | ||
expect(Analytics.isAllowed()).toBe(false) | ||
|
||
fireEvent.click(enableAnalyticsToggle) | ||
expect(Analytics.isAllowed()).toBe(true) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.