@duckduckgo/autoconsent 16.12.0 → 16.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import generateCMPTests from '../playwright/runner';
2
+
3
+ generateCMPTests('unive-nl', ['https://www.unive.nl/', 'https://rechtshulp.unive.nl/dossier-aanvullen', 'https://mijn.unive.nl/']);
@@ -108,5 +108,15 @@
108
108
  <button>Reject All</button>
109
109
  <button>Deny</button>
110
110
  </div>
111
+
112
+ <div id="popup-age-gate" class="popup" role="dialog">
113
+ <h2>Age verification &amp; content rules</h2>
114
+ <p>
115
+ This section may contain adult oriented material of a graphic and sexual nature. This material is INTENDED ONLY FOR PERSONS
116
+ OVER 18 YEARS OF AGE. This site uses cookies for logins, ads and other normal site function.
117
+ </p>
118
+ <button>I accept</button>
119
+ <button>I reject</button>
120
+ </div>
111
121
  </body>
112
122
  </html>
@@ -50,6 +50,14 @@ describe('getActionablePopups', () => {
50
50
 
51
51
  expect(popups.length).to.equal(0);
52
52
  });
53
+
54
+ it('ignores age-verification popup that incidentally mentions cookies', () => {
55
+ showPopup('popup-age-gate');
56
+
57
+ const popups = getActionablePopups();
58
+
59
+ expect(popups.length).to.equal(0);
60
+ });
53
61
  });
54
62
 
55
63
  describe('tier button candidates', () => {
@@ -8,6 +8,7 @@ import {
8
8
  excludeContainers,
9
9
  getButtonData,
10
10
  isDialogLikeElement,
11
+ isExcludedPopup,
11
12
  } from '../../lib/heuristics';
12
13
  import { ButtonData } from '../../lib/types';
13
14
 
@@ -61,6 +62,43 @@ describe('checkHeuristicPatterns', () => {
61
62
  });
62
63
  });
63
64
 
65
+ describe('isExcludedPopup', () => {
66
+ it('flags doublelist-style age verification popups', () => {
67
+ // Real-world text from the doublelist.com age gate (listings page)
68
+ const text =
69
+ 'Age verification & content rules This section may contain adult oriented material of a graphic and sexual nature, ' +
70
+ 'and could be viewed objectionable to some persons. This material is INTENDED ONLY FOR PERSONS OVER 18 YEARS OF AGE. ' +
71
+ 'This site uses cookies for logins, ads and other normal site function. I accept I reject';
72
+ expect(isExcludedPopup(text)).to.be.true;
73
+ });
74
+
75
+ it('flags popups headed "Age verification"', () => {
76
+ expect(isExcludedPopup('Age verification\nYou must confirm your age to continue.')).to.be.true;
77
+ });
78
+
79
+ it('flags "must be 18 or older" disclaimers', () => {
80
+ expect(isExcludedPopup('You must be 18 years or older to enter this site.')).to.be.true;
81
+ });
82
+
83
+ it('flags "I am 18+" age gates', () => {
84
+ expect(isExcludedPopup('Confirm your age to continue. I am 18+ I am under 18')).to.be.true;
85
+ });
86
+
87
+ it('flags adult-content disclaimers', () => {
88
+ expect(isExcludedPopup('This website contains adult oriented material. Please confirm to enter.')).to.be.true;
89
+ expect(isExcludedPopup('Adult-only website. You must be 21 or older to enter.')).to.be.true;
90
+ expect(isExcludedPopup('Adult website ahead.')).to.be.true;
91
+ });
92
+
93
+ it('does not flag a normal cookie consent popup', () => {
94
+ expect(isExcludedPopup('We use cookies to enhance your experience. Accept All Reject All')).to.be.false;
95
+ });
96
+
97
+ it('does not flag empty strings', () => {
98
+ expect(isExcludedPopup('')).to.be.false;
99
+ });
100
+ });
101
+
64
102
  describe('cleanButtonText', () => {
65
103
  it('converts to lowercase', () => {
66
104
  expect(cleanButtonText('REJECT ALL')).to.equal('reject all');