Render third party cookies in the management component

Set cookie duration to 365 days based on the AEPD's cookie usage guidelines.

Note from the document: "Cookies with a duration of up to 24 months are
considered acceptable as long as they are periodically updated."
Reference: https://www.aepd.es/guias/guia-cookies.pdf
This commit is contained in:
taitus
2024-12-09 16:28:02 +01:00
parent dc54fda71b
commit 7407c386a6
10 changed files with 155 additions and 19 deletions

View File

@@ -22,6 +22,7 @@ describe Layout::CookiesConsent::ManagementComponent do
expect(page).to have_link "More information about cookies", href: "/cookies_policy"
expect(page).to have_css "h3", text: "Essential cookies"
expect(page).to have_css ".switch-input[type='checkbox'][name='essential_cookies'][disabled][checked]"
expect(page).to have_css "h3", text: "Third party cookies"
expect(page).to have_button "Accept all"
expect(page).to have_button "Accept essential cookies"
end

View File

@@ -0,0 +1,23 @@
require "rails_helper"
describe Layout::CookiesConsent::VendorsComponent do
before { Setting["feature.cookies_consent"] = true }
it "is not rendered when there are no vendors" do
render_inline Layout::CookiesConsent::VendorsComponent.new
expect(page).not_to be_rendered
end
it "renders vendors content when there are vendors" do
create(:cookies_vendor, name: "Vendor cookie", cookie: "third_party")
render_inline Layout::CookiesConsent::VendorsComponent.new
expect(page).to be_rendered
expect(page).to have_content "Third party cookies"
expect(page).to have_content "Vendor cookie"
expect(page).to have_css ".switch-input[type='checkbox'][name='third_party']"
expect(page).to have_button "Save preferences"
end
end