mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-23 09:29:14 -04:00
Revert "Merge pull request #3238 from alphagov/cookies-update"
This reverts commiteec4bec761, reversing changes made to64480e2fff.
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
const helpers = require('./support/helpers');
|
||||
|
||||
beforeAll(() => {
|
||||
|
||||
require('../../app/assets/javascripts/govuk/cookie-functions.js');
|
||||
require('../../app/assets/javascripts/consent.js');
|
||||
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
||||
require('./support/teardown.js');
|
||||
|
||||
});
|
||||
|
||||
describe("Cookie consent", () => {
|
||||
|
||||
describe("hasConsentFor", () => {
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
// remove cookie set by tests
|
||||
helpers.deleteCookie('cookies_policy');
|
||||
|
||||
});
|
||||
|
||||
test("If there is no consent cookie, return false", () => {
|
||||
|
||||
expect(window.GOVUK.hasConsentFor('analytics')).toBe(false);
|
||||
|
||||
});
|
||||
|
||||
describe("If a consent cookie is set", () => {
|
||||
|
||||
test("If the category is not saved in the cookie, return false", () => {
|
||||
|
||||
window.GOVUK.setConsentCookie({ 'usage': true });
|
||||
|
||||
expect(window.GOVUK.hasConsentFor('analytics')).toBe(false);
|
||||
|
||||
});
|
||||
|
||||
test("If the category is saved in the cookie, return its value", () => {
|
||||
|
||||
window.GOVUK.setConsentCookie({ 'analytics': true });
|
||||
|
||||
expect(window.GOVUK.hasConsentFor('analytics')).toBe(true);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user