Skip to content

Commit

Permalink
Add a test page for CPM filterlist
Browse files Browse the repository at this point in the history
  • Loading branch information
muodov committed Dec 6, 2024
1 parent 7359c84 commit eb7e5f2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
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

0 comments on commit eb7e5f2

Please sign in to comment.