cookie-consent-js
Advanced tools
Comparing version 2.0.6 to 2.0.7
{ | ||
"name": "cookie-consent-js", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "A simple dialog and framework to handle the EU law (as written by EuGH, 1.10.2019 – C-673/17) about cookies in a website.", | ||
@@ -5,0 +5,0 @@ "main": "src/cookie-consent.js", |
@@ -11,3 +11,3 @@ /** | ||
removeCookie("cookie-consent-tracking-allowed") | ||
if(document.getElementById("cookieConsentModal")) { | ||
if (document.getElementById("cookieConsentModal")) { | ||
document.getElementById("cookieConsentModal").remove() | ||
@@ -21,4 +21,9 @@ } | ||
// noinspection JSUnusedLocalSymbols | ||
var cookieConsent = new CookieConsent() | ||
assert.true(document.getElementById("cookieConsentModal") !== null) | ||
const cookieConsent = new CookieConsent({ | ||
contentUrl: "../cookie-consent-content", | ||
postSelectionCallback: () => { | ||
assert.true(document.getElementById("cookieConsentModal") !== null) | ||
} | ||
}) | ||
}) | ||
@@ -28,25 +33,44 @@ it('Should not display a dialog if autoShowModal is false', function () { | ||
// noinspection JSUnusedLocalSymbols | ||
var cookieConsent = new CookieConsent({autoShowModal: false}) | ||
assert.equals(document.getElementById("cookieConsentModal"), null) | ||
const cookieConsent = new CookieConsent({ | ||
contentUrl: "../cookie-consent-content", | ||
autoShowModal: false, | ||
postSelectionCallback: () => { | ||
assert.equals(document.getElementById("cookieConsentModal"), null) | ||
} | ||
}) | ||
}) | ||
it('Should display the dialog on reset()', function() { | ||
it('Should display the dialog on reset()', function () { | ||
beforeEach() | ||
var cookieConsent = new CookieConsent({autoShowModal: false}) | ||
assert.equals(document.getElementById("cookieConsentModal"), null) | ||
cookieConsent.reset() | ||
assert.true(document.getElementById("cookieConsentModal") !== null) | ||
const cookieConsent = new CookieConsent({ | ||
contentUrl: "../cookie-consent-content", | ||
autoShowModal: false, | ||
postSelectionCallback: () => { | ||
assert.equals(document.getElementById("cookieConsentModal"), null) | ||
cookieConsent.reset() | ||
assert.true(document.getElementById("cookieConsentModal") !== null) | ||
} | ||
}) | ||
}) | ||
it('Should write a cookie if accepted', function() { | ||
it('Should write a cookie if accepted', function () { | ||
beforeEach() | ||
var cookieConsent = new CookieConsent() | ||
assert.equals(cookieConsent.trackingAllowed(), false) | ||
document.getElementById("cookieConsentModal").querySelector(".btn-accept-all").click() | ||
assert.equals(cookieConsent.trackingAllowed(), true) | ||
const cookieConsent = new CookieConsent({ | ||
contentUrl: "../cookie-consent-content", | ||
postSelectionCallback: () => { | ||
assert.equals(cookieConsent.trackingAllowed(), false) | ||
document.getElementById("cookieConsentModal").querySelector(".btn-accept-all").click() | ||
assert.equals(cookieConsent.trackingAllowed(), true) | ||
} | ||
}) | ||
}) | ||
it('Should write a cookie if not accepted', function() { | ||
it('Should write a cookie if not accepted', function () { | ||
beforeEach() | ||
var cookieConsent = new CookieConsent() | ||
assert.equals(cookieConsent.trackingAllowed(), false) | ||
document.getElementById("cookieConsentModal").querySelector(".btn-accept-necessary").click() | ||
assert.equals(cookieConsent.trackingAllowed(), false) | ||
const cookieConsent = new CookieConsent({ | ||
contentUrl: "../cookie-consent-content", | ||
postSelectionCallback: () => { | ||
assert.equals(cookieConsent.trackingAllowed(), false) | ||
document.getElementById("cookieConsentModal").querySelector(".btn-accept-necessary").click() | ||
assert.equals(cookieConsent.trackingAllowed(), false) | ||
} | ||
}) | ||
}) | ||
@@ -65,2 +89,3 @@ }) | ||
*/ | ||
/* | ||
@@ -85,2 +110,2 @@ function getCookie(name) { | ||
document.cookie = name + '=; Path=/; SameSite=Strict; Expires=Thu, 01 Jan 1970 00:00:01 GMT;' | ||
} | ||
} |
59099
421