Skip to content

Commit

Permalink
fix: isCrossSiteTrackingEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Mask committed May 24, 2022
1 parent b5a8cf8 commit 1d4ef3c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,5 @@ export function isApplePaySupported() : boolean {
}

export function isCrossSiteTrackingEnabled(expectedCookieKey : string) : boolean {
return document.cookie.indexOf(expectedCookieKey) !== -1;
return window.document.cookie.indexOf(expectedCookieKey) === -1;
}
1 change: 1 addition & 0 deletions test/tests/device/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ import './isSFVC';
import './isSFVCorSafari';
import './isApplePaySupported';
import './isTablet';
import './isCrossSiteTrackingEnabled';
4 changes: 2 additions & 2 deletions test/tests/device/isCrossSiteTrackingEnabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { isCrossSiteTrackingEnabled } from '../../../src/device';

describe('isCrossSiteTrackingEnabled', () => {
it('should return false when expected cookies are present', () => {
document.cookie = 'enforce_policy=ccpa';
window.document.cookie = 'enforce_policy=ccpa';

const bool = isCrossSiteTrackingEnabled('enforce_policy');
if (bool) {
Expand All @@ -13,7 +13,7 @@ describe('isCrossSiteTrackingEnabled', () => {
});

it('should return true when expected cookies are not present', () => {
document.cookie = '';
window.document.cookie = 'enforce_policy=ccpa;expires=Thu, 21 Sep 1979 00:00:01 UTC;';

const bool = isCrossSiteTrackingEnabled('enforce_policy');
if (!bool) {
Expand Down

0 comments on commit 1d4ef3c

Please # to comment.