Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test page for CPM filterlist #248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions features/autoconsent/filterlist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Cookie consent notice banner (Filterlist)</title>

<script src='./filterlist.js' defer></script>
</head>
<body>
<p><a href="/index.html">[Home]</a></p>

<p>Tests for filterlist-based hiding of cookie banners.</P>

<div id="privacy-test-page-cmp-test-banner-filterlist">
This is a fake cookie banner that should be hidden by filterlist.
</div>

</body>
</html>
20 changes: 20 additions & 0 deletions features/autoconsent/filterlist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const acceptButton = document.createElement('button');
acceptButton.innerText = 'Accept all';
acceptButton.id = 'accept-all';
const banner = document.quesrySelector('#privacy-test-page-cmp-test-banner-filterlist');
banner.appendChild(acceptButton);
acceptButton.addEventListener('click', (ev) => {
ev.target.innerText = 'Accept was clicked!';
window.results.results.push('accept_button_clicked');
});

setTimeout(() => {
if (window.getComputedStyle(banner).opacity === '0') {
window.results.results.push('banner_hidden');
}
}, 500);

window.results = {
page: 'autoconsent-filterlist',
results: []
};
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ <h2>Browser Features</h2>
<li><a href="./features/fonts.html">Fonts</a></li>
<li><a href="./features/autoconsent/">Cookie consent popups</a></li>
<li><a href="./features/autoconsent/banner.html">Cookie consent notice banners</a></li>
<li><a href="./features/autoconsent/filterlist.html">Cookie consent notice banners (filterlist)</a></li>
<li><a href="./features/navigator-interface.html">Navigator Interface</a></li>
<li><a href="./features/js-alerts.html">JS alerts and Hanging</a></li>
<li><a href="./features/local-storage.html">Local storage</a></li>
Expand Down
Loading