@duckduckgo/autoconsent 16.27.0 → 16.28.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.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +21 -0
- package/dist/addon-firefox/compact-rules.json +1 -1
- package/dist/addon-firefox/content.bundle.js +26 -1
- package/dist/addon-firefox/manifest.json +1 -1
- package/dist/addon-firefox/rule-index.json +1 -1
- package/dist/addon-firefox/rules.json +1 -1
- package/dist/addon-mv3/compact-rules.json +1 -1
- package/dist/addon-mv3/content.bundle.js +26 -1
- package/dist/addon-mv3/manifest.json +1 -1
- package/dist/addon-mv3/rule-index.json +1 -1
- package/dist/addon-mv3/rules.json +1 -1
- package/dist/autoconsent.cjs.js +26 -1
- package/dist/autoconsent.esm.js +26 -1
- package/dist/autoconsent.playwright.js +26 -1
- package/dist/autoconsent.standalone.js +27 -2
- package/dist/types/cmps/base.d.ts +1 -0
- package/dist/types/dom-actions.d.ts +1 -0
- package/dist/types/rules.d.ts +6 -2
- package/dist/types/utils.d.ts +1 -0
- package/docs/rule-syntax.md +14 -0
- package/lib/cmps/base.ts +7 -0
- package/lib/dom-actions.ts +7 -1
- package/lib/rules.ts +9 -2
- package/lib/utils.ts +16 -0
- package/package.json +1 -1
- package/rules/autoconsent/amazon-pay.json +13 -0
- package/rules/autoconsent/bbva.json +12 -0
- package/rules/autoconsent/deliveroo.json +15 -0
- package/rules/autoconsent/ebay.json +34 -0
- package/rules/autoconsent/theguardian.com.json +13 -3
- package/rules/autoconsent/wpconsent.json +30 -0
- package/rules/compact-rules.json +1 -1
- package/rules/rule-index.json +1 -1
- package/rules/rules.json +1 -1
- package/tests/amazon-pay.spec.ts +3 -0
- package/tests/bbva.spec.ts +4 -0
- package/tests/deliveroo.spec.ts +3 -0
- package/tests/wpconsent.spec.ts +5 -0
- package/tests-wtr/dom-actions/dom-actions.stylesheet.html +13 -0
- package/tests-wtr/dom-actions/dom-actions.stylesheet.ts +26 -0
- package/tests-wtr/utils/append-stylesheet-rule.html +11 -0
- package/tests-wtr/utils/append-stylesheet-rule.test.ts +29 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { expect } from '@esm-bundle/chai';
|
|
2
|
+
import { instantiateDomActions } from './utils';
|
|
3
|
+
|
|
4
|
+
describe('stylesheet', () => {
|
|
5
|
+
const domActions = instantiateDomActions();
|
|
6
|
+
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
document.getElementById('autoconsent-css-rules')?.remove();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('appends a stylesheet rule', () => {
|
|
12
|
+
const result = domActions.stylesheet('.locked body { position: static !important; }', 'test-scroll-unlock');
|
|
13
|
+
expect(result).to.be.true;
|
|
14
|
+
const styleEl = document.getElementById('autoconsent-css-rules');
|
|
15
|
+
expect(styleEl?.textContent).to.include('position: static !important');
|
|
16
|
+
expect(styleEl?.textContent).to.include('/* autoconsent:test-scroll-unlock */');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('does not duplicate rules with the same stylesheetId', () => {
|
|
20
|
+
domActions.stylesheet('.locked body { position: static !important; }', 'test-scroll-unlock');
|
|
21
|
+
const result = domActions.stylesheet('.locked body { position: static !important; }', 'test-scroll-unlock');
|
|
22
|
+
expect(result).to.be.true;
|
|
23
|
+
const styleEl = document.getElementById('autoconsent-css-rules');
|
|
24
|
+
expect(styleEl?.textContent?.match(/test-scroll-unlock/g)?.length).to.equal(1);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { expect } from '@esm-bundle/chai';
|
|
2
|
+
import { appendStylesheetRule } from '../../lib/utils';
|
|
3
|
+
|
|
4
|
+
describe('appendStylesheetRule', () => {
|
|
5
|
+
let styleEl: HTMLStyleElement;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
styleEl = document.createElement('style');
|
|
9
|
+
document.head.appendChild(styleEl);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
styleEl.remove();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('appends a CSS rule to the stylesheet', () => {
|
|
17
|
+
const result = appendStylesheetRule(styleEl, 'html.locked body { overflow: auto !important; }', 'scroll-unlock');
|
|
18
|
+
expect(result).to.be.true;
|
|
19
|
+
expect(styleEl.innerText).to.include('overflow: auto !important');
|
|
20
|
+
expect(styleEl.innerText).to.include('/* autoconsent:scroll-unlock */');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('is idempotent when called with the same marker', () => {
|
|
24
|
+
appendStylesheetRule(styleEl, 'html.locked body { overflow: auto !important; }', 'scroll-unlock');
|
|
25
|
+
const lengthAfterFirst = styleEl.innerText.length;
|
|
26
|
+
appendStylesheetRule(styleEl, 'html.locked body { overflow: auto !important; }', 'scroll-unlock');
|
|
27
|
+
expect(styleEl.innerText.length).to.equal(lengthAfterFirst);
|
|
28
|
+
});
|
|
29
|
+
});
|