@c15t/react 0.0.1-rc.10
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/LICENSE.md +595 -0
- package/README.md +55 -0
- package/dist/components/consent-manager-dialog/__tests__/styles.spec.cjs +223 -0
- package/dist/components/consent-manager-dialog/__tests__/styles.spec.d.ts +2 -0
- package/dist/components/consent-manager-dialog/__tests__/styles.spec.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/__tests__/styles.spec.js +188 -0
- package/dist/components/consent-manager-dialog/__tests__/utils.cjs +68 -0
- package/dist/components/consent-manager-dialog/__tests__/utils.d.ts +13 -0
- package/dist/components/consent-manager-dialog/__tests__/utils.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/__tests__/utils.js +34 -0
- package/dist/components/consent-manager-dialog/atoms/dialog-card.cjs +154 -0
- package/dist/components/consent-manager-dialog/atoms/dialog-card.d.ts +90 -0
- package/dist/components/consent-manager-dialog/atoms/dialog-card.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/atoms/dialog-card.js +95 -0
- package/dist/components/consent-manager-dialog/atoms/overlay.cjs +86 -0
- package/dist/components/consent-manager-dialog/atoms/overlay.d.ts +71 -0
- package/dist/components/consent-manager-dialog/atoms/overlay.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/atoms/overlay.js +37 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.cjs +148 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.d.ts +40 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.js +100 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.module.cjs +50 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.module.js +16 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog_module.css +202 -0
- package/dist/components/consent-manager-dialog/index.cjs +51 -0
- package/dist/components/consent-manager-dialog/index.d.ts +4 -0
- package/dist/components/consent-manager-dialog/index.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/index.js +18 -0
- package/dist/components/consent-manager-dialog/theme.cjs +19 -0
- package/dist/components/consent-manager-dialog/theme.d.ts +19 -0
- package/dist/components/consent-manager-dialog/theme.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/theme.js +0 -0
- package/dist/components/consent-manager-widget/__tests__/styles.spec.cjs +228 -0
- package/dist/components/consent-manager-widget/__tests__/styles.spec.d.ts +2 -0
- package/dist/components/consent-manager-widget/__tests__/styles.spec.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/__tests__/styles.spec.js +193 -0
- package/dist/components/consent-manager-widget/__tests__/utils.cjs +68 -0
- package/dist/components/consent-manager-widget/__tests__/utils.d.ts +13 -0
- package/dist/components/consent-manager-widget/__tests__/utils.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/__tests__/utils.js +34 -0
- package/dist/components/consent-manager-widget/atoms/accordion.cjs +169 -0
- package/dist/components/consent-manager-widget/atoms/accordion.d.ts +57 -0
- package/dist/components/consent-manager-widget/atoms/accordion.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/atoms/accordion.js +106 -0
- package/dist/components/consent-manager-widget/atoms/button.cjs +93 -0
- package/dist/components/consent-manager-widget/atoms/button.d.ts +27 -0
- package/dist/components/consent-manager-widget/atoms/button.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/atoms/button.js +52 -0
- package/dist/components/consent-manager-widget/atoms/footer.cjs +74 -0
- package/dist/components/consent-manager-widget/atoms/footer.d.ts +15 -0
- package/dist/components/consent-manager-widget/atoms/footer.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/atoms/footer.js +23 -0
- package/dist/components/consent-manager-widget/atoms/logo.cjs +101 -0
- package/dist/components/consent-manager-widget/atoms/logo.d.ts +8 -0
- package/dist/components/consent-manager-widget/atoms/logo.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/atoms/logo.js +67 -0
- package/dist/components/consent-manager-widget/atoms/root.cjs +60 -0
- package/dist/components/consent-manager-widget/atoms/root.d.ts +82 -0
- package/dist/components/consent-manager-widget/atoms/root.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/atoms/root.js +25 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.cjs +96 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.d.ts +44 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.js +62 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.module.cjs +61 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.module.js +27 -0
- package/dist/components/consent-manager-widget/consent-manager-widget_module.css +337 -0
- package/dist/components/consent-manager-widget/index.cjs +69 -0
- package/dist/components/consent-manager-widget/index.d.ts +11 -0
- package/dist/components/consent-manager-widget/index.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/index.js +36 -0
- package/dist/components/consent-manager-widget/theme.cjs +19 -0
- package/dist/components/consent-manager-widget/theme.d.ts +50 -0
- package/dist/components/consent-manager-widget/theme.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/theme.js +0 -0
- package/dist/components/consent-manager-widget/types.cjs +19 -0
- package/dist/components/consent-manager-widget/types.d.ts +18 -0
- package/dist/components/consent-manager-widget/types.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/types.js +0 -0
- package/dist/components/cookie-banner/__tests__/styles.spec.cjs +241 -0
- package/dist/components/cookie-banner/__tests__/styles.spec.d.ts +2 -0
- package/dist/components/cookie-banner/__tests__/styles.spec.d.ts.map +1 -0
- package/dist/components/cookie-banner/__tests__/styles.spec.js +206 -0
- package/dist/components/cookie-banner/__tests__/utils.cjs +67 -0
- package/dist/components/cookie-banner/__tests__/utils.d.ts +13 -0
- package/dist/components/cookie-banner/__tests__/utils.d.ts.map +1 -0
- package/dist/components/cookie-banner/__tests__/utils.js +33 -0
- package/dist/components/cookie-banner/atoms/overlay.cjs +89 -0
- package/dist/components/cookie-banner/atoms/overlay.d.ts +46 -0
- package/dist/components/cookie-banner/atoms/overlay.d.ts.map +1 -0
- package/dist/components/cookie-banner/atoms/overlay.js +40 -0
- package/dist/components/cookie-banner/atoms/root.cjs +132 -0
- package/dist/components/cookie-banner/atoms/root.d.ts +93 -0
- package/dist/components/cookie-banner/atoms/root.d.ts.map +1 -0
- package/dist/components/cookie-banner/atoms/root.js +83 -0
- package/dist/components/cookie-banner/components.cjs +186 -0
- package/dist/components/cookie-banner/components.d.ts +136 -0
- package/dist/components/cookie-banner/components.d.ts.map +1 -0
- package/dist/components/cookie-banner/components.js +121 -0
- package/dist/components/cookie-banner/cookie-banner.cjs +100 -0
- package/dist/components/cookie-banner/cookie-banner.d.ts +144 -0
- package/dist/components/cookie-banner/cookie-banner.d.ts.map +1 -0
- package/dist/components/cookie-banner/cookie-banner.js +66 -0
- package/dist/components/cookie-banner/cookie-banner.module.cjs +55 -0
- package/dist/components/cookie-banner/cookie-banner.module.js +21 -0
- package/dist/components/cookie-banner/cookie-banner_module.css +224 -0
- package/dist/components/cookie-banner/error-boundary.cjs +68 -0
- package/dist/components/cookie-banner/error-boundary.d.ts +56 -0
- package/dist/components/cookie-banner/error-boundary.d.ts.map +1 -0
- package/dist/components/cookie-banner/error-boundary.js +34 -0
- package/dist/components/cookie-banner/index.cjs +59 -0
- package/dist/components/cookie-banner/index.d.ts +52 -0
- package/dist/components/cookie-banner/index.d.ts.map +1 -0
- package/dist/components/cookie-banner/index.js +26 -0
- package/dist/components/cookie-banner/theme.cjs +19 -0
- package/dist/components/cookie-banner/theme.d.ts +71 -0
- package/dist/components/cookie-banner/theme.d.ts.map +1 -0
- package/dist/components/cookie-banner/theme.js +0 -0
- package/dist/components/shared/libs/polymorphic.cjs +19 -0
- package/dist/components/shared/libs/polymorphic.d.ts +15 -0
- package/dist/components/shared/libs/polymorphic.d.ts.map +1 -0
- package/dist/components/shared/libs/polymorphic.js +0 -0
- package/dist/components/shared/libs/recursive-clone-children.cjs +49 -0
- package/dist/components/shared/libs/recursive-clone-children.d.ts +14 -0
- package/dist/components/shared/libs/recursive-clone-children.d.ts.map +1 -0
- package/dist/components/shared/libs/recursive-clone-children.js +15 -0
- package/dist/components/shared/primitives/box.cjs +54 -0
- package/dist/components/shared/primitives/box.d.ts +47 -0
- package/dist/components/shared/primitives/box.d.ts.map +1 -0
- package/dist/components/shared/primitives/box.js +20 -0
- package/dist/components/shared/primitives/button.cjs +96 -0
- package/dist/components/shared/primitives/button.d.ts +207 -0
- package/dist/components/shared/primitives/button.d.ts.map +1 -0
- package/dist/components/shared/primitives/button.js +62 -0
- package/dist/components/shared/primitives/button.types.cjs +19 -0
- package/dist/components/shared/primitives/button.types.d.ts +35 -0
- package/dist/components/shared/primitives/button.types.d.ts.map +1 -0
- package/dist/components/shared/primitives/button.types.js +0 -0
- package/dist/components/shared/ui/accordion/accordion.cjs +219 -0
- package/dist/components/shared/ui/accordion/accordion.d.ts +44 -0
- package/dist/components/shared/ui/accordion/accordion.d.ts.map +1 -0
- package/dist/components/shared/ui/accordion/accordion.js +165 -0
- package/dist/components/shared/ui/accordion/accordion.module.cjs +49 -0
- package/dist/components/shared/ui/accordion/accordion.module.js +15 -0
- package/dist/components/shared/ui/accordion/accordion.types.cjs +19 -0
- package/dist/components/shared/ui/accordion/accordion.types.d.ts +74 -0
- package/dist/components/shared/ui/accordion/accordion.types.d.ts.map +1 -0
- package/dist/components/shared/ui/accordion/accordion.types.js +0 -0
- package/dist/components/shared/ui/accordion/accordion_module.css +197 -0
- package/dist/components/shared/ui/accordion/index.cjs +76 -0
- package/dist/components/shared/ui/accordion/index.d.ts +3 -0
- package/dist/components/shared/ui/accordion/index.d.ts.map +1 -0
- package/dist/components/shared/ui/accordion/index.js +2 -0
- package/dist/components/shared/ui/button/button.cjs +199 -0
- package/dist/components/shared/ui/button/button.d.ts +444 -0
- package/dist/components/shared/ui/button/button.d.ts.map +1 -0
- package/dist/components/shared/ui/button/button.js +149 -0
- package/dist/components/shared/ui/button/button.module.cjs +65 -0
- package/dist/components/shared/ui/button/button.module.js +31 -0
- package/dist/components/shared/ui/button/button.types.cjs +19 -0
- package/dist/components/shared/ui/button/button.types.d.ts +45 -0
- package/dist/components/shared/ui/button/button.types.d.ts.map +1 -0
- package/dist/components/shared/ui/button/button.types.js +0 -0
- package/dist/components/shared/ui/button/button_module.css +247 -0
- package/dist/components/shared/ui/button/index.cjs +76 -0
- package/dist/components/shared/ui/button/index.d.ts +3 -0
- package/dist/components/shared/ui/button/index.d.ts.map +1 -0
- package/dist/components/shared/ui/button/index.js +2 -0
- package/dist/components/shared/ui/icon.cjs +57 -0
- package/dist/components/shared/ui/icon.d.ts +8 -0
- package/dist/components/shared/ui/icon.d.ts.map +1 -0
- package/dist/components/shared/ui/icon.js +23 -0
- package/dist/components/shared/ui/logo.cjs +101 -0
- package/dist/components/shared/ui/logo.d.ts +8 -0
- package/dist/components/shared/ui/logo.d.ts.map +1 -0
- package/dist/components/shared/ui/logo.js +67 -0
- package/dist/components/shared/ui/switch/index.cjs +76 -0
- package/dist/components/shared/ui/switch/index.d.ts +3 -0
- package/dist/components/shared/ui/switch/index.d.ts.map +1 -0
- package/dist/components/shared/ui/switch/index.js +2 -0
- package/dist/components/shared/ui/switch/switch.cjs +95 -0
- package/dist/components/shared/ui/switch/switch.d.ts +24 -0
- package/dist/components/shared/ui/switch/switch.d.ts.map +1 -0
- package/dist/components/shared/ui/switch/switch.js +47 -0
- package/dist/components/shared/ui/switch/switch.module.cjs +45 -0
- package/dist/components/shared/ui/switch/switch.module.js +11 -0
- package/dist/components/shared/ui/switch/switch.types.cjs +19 -0
- package/dist/components/shared/ui/switch/switch.types.d.ts +34 -0
- package/dist/components/shared/ui/switch/switch.types.d.ts.map +1 -0
- package/dist/components/shared/ui/switch/switch.types.js +0 -0
- package/dist/components/shared/ui/switch/switch_module.css +183 -0
- package/dist/context/consent-manager-context.cjs +38 -0
- package/dist/context/consent-manager-context.d.ts +13 -0
- package/dist/context/consent-manager-context.d.ts.map +1 -0
- package/dist/context/consent-manager-context.js +4 -0
- package/dist/context/theme-context.cjs +40 -0
- package/dist/context/theme-context.d.ts +102 -0
- package/dist/context/theme-context.d.ts.map +1 -0
- package/dist/context/theme-context.js +5 -0
- package/dist/hooks/index.cjs +94 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-consent-manager.cjs +45 -0
- package/dist/hooks/use-consent-manager.d.ts +61 -0
- package/dist/hooks/use-consent-manager.d.ts.map +1 -0
- package/dist/hooks/use-consent-manager.js +11 -0
- package/dist/hooks/use-focus-trap.cjs +76 -0
- package/dist/hooks/use-focus-trap.d.ts +15 -0
- package/dist/hooks/use-focus-trap.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap.js +42 -0
- package/dist/hooks/use-scroll-lock.cjs +55 -0
- package/dist/hooks/use-scroll-lock.d.ts +26 -0
- package/dist/hooks/use-scroll-lock.d.ts.map +1 -0
- package/dist/hooks/use-scroll-lock.js +21 -0
- package/dist/hooks/use-theme.cjs +56 -0
- package/dist/hooks/use-theme.d.ts +2 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/hooks/use-theme.js +22 -0
- package/dist/hooks/use-translations.cjs +58 -0
- package/dist/hooks/use-translations.d.ts +29 -0
- package/dist/hooks/use-translations.d.ts.map +1 -0
- package/dist/hooks/use-translations.js +24 -0
- package/dist/index.cjs +101 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/providers/consent-manager-provider.cjs +110 -0
- package/dist/providers/consent-manager-provider.d.ts +16 -0
- package/dist/providers/consent-manager-provider.d.ts.map +1 -0
- package/dist/providers/consent-manager-provider.js +76 -0
- package/dist/types/consent-manager.cjs +19 -0
- package/dist/types/consent-manager.d.ts +120 -0
- package/dist/types/consent-manager.d.ts.map +1 -0
- package/dist/types/consent-manager.js +0 -0
- package/dist/types/theme/index.cjs +76 -0
- package/dist/types/theme/index.d.ts +3 -0
- package/dist/types/theme/index.d.ts.map +1 -0
- package/dist/types/theme/index.js +2 -0
- package/dist/types/theme/style-keys.cjs +19 -0
- package/dist/types/theme/style-keys.d.ts +14 -0
- package/dist/types/theme/style-keys.d.ts.map +1 -0
- package/dist/types/theme/style-keys.js +0 -0
- package/dist/types/theme/style-types.cjs +19 -0
- package/dist/types/theme/style-types.d.ts +34 -0
- package/dist/types/theme/style-types.d.ts.map +1 -0
- package/dist/types/theme/style-types.js +0 -0
- package/dist/utils/cn.cjs +55 -0
- package/dist/utils/cn.d.ts +11 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +6 -0
- package/dist/utils/merge-styles.cjs +62 -0
- package/dist/utils/merge-styles.d.ts +11 -0
- package/dist/utils/merge-styles.d.ts.map +1 -0
- package/dist/utils/merge-styles.js +28 -0
- package/dist/utils/translations.cjs +86 -0
- package/dist/utils/translations.d.ts +14 -0
- package/dist/utils/translations.d.ts.map +1 -0
- package/dist/utils/translations.js +50 -0
- package/dist/utils/use-styles.cjs +95 -0
- package/dist/utils/use-styles.d.ts +32 -0
- package/dist/utils/use-styles.d.ts.map +1 -0
- package/dist/utils/use-styles.js +61 -0
- package/package.json +90 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ThemeValue } from '../../types/theme';
|
|
2
|
+
import type { ConsentManagerWidgetTheme } from '../consent-manager-widget/theme';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration object for styling different parts of the ConsentManagerWidget component.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type ConsentManagerDialogTheme = Partial<{
|
|
8
|
+
/** @remarks Styles for the root container element */
|
|
9
|
+
dialog: ThemeValue;
|
|
10
|
+
/** @remarks Styles for the root container element */
|
|
11
|
+
'dialog.root': ThemeValue;
|
|
12
|
+
'dialog.header': ThemeValue;
|
|
13
|
+
'dialog.title': ThemeValue;
|
|
14
|
+
'dialog.description': ThemeValue;
|
|
15
|
+
'dialog.content': ThemeValue;
|
|
16
|
+
'dialog.footer': ThemeValue;
|
|
17
|
+
'dialog.overlay': ThemeValue;
|
|
18
|
+
} & ConsentManagerWidgetTheme>;
|
|
19
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/components/consent-manager-dialog/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC9C;IACC,qDAAqD;IACrD,MAAM,EAAE,UAAU,CAAC;IACnB,qDAAqD;IACrD,aAAa,EAAE,UAAU,CAAC;IAC1B,eAAe,EAAE,UAAU,CAAC;IAC5B,cAAc,EAAE,UAAU,CAAC;IAC3B,oBAAoB,EAAE,UAAU,CAAC;IACjC,gBAAgB,EAAE,UAAU,CAAC;IAC7B,eAAe,EAAE,UAAU,CAAC;IAC5B,gBAAgB,EAAE,UAAU,CAAC;CAC7B,GAAG,yBAAyB,CAC7B,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = function(module) {
|
|
5
|
+
var getter = module && module.__esModule ? function() {
|
|
6
|
+
return module['default'];
|
|
7
|
+
} : function() {
|
|
8
|
+
return module;
|
|
9
|
+
};
|
|
10
|
+
__webpack_require__.d(getter, {
|
|
11
|
+
a: getter
|
|
12
|
+
});
|
|
13
|
+
return getter;
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
18
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: definition[key]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = function(obj, prop) {
|
|
26
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
var __webpack_exports__ = {};
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const external_vitest_namespaceObject = require("vitest");
|
|
32
|
+
const external_consent_manager_widget_cjs_namespaceObject = require("../consent-manager-widget.cjs");
|
|
33
|
+
const external_utils_cjs_namespaceObject = require("./utils.cjs");
|
|
34
|
+
var external_utils_cjs_default = /*#__PURE__*/ __webpack_require__.n(external_utils_cjs_namespaceObject);
|
|
35
|
+
const ALL_COMPONENTS = [
|
|
36
|
+
{
|
|
37
|
+
testId: 'consent-manager-widget-root',
|
|
38
|
+
themeKey: 'widget.root',
|
|
39
|
+
styles: 'custom-root'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
testId: 'consent-manager-widget-footer',
|
|
43
|
+
themeKey: 'widget.footer',
|
|
44
|
+
styles: 'custom-footer'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
testId: 'consent-manager-widget-footer-sub-group',
|
|
48
|
+
themeKey: 'widget.footer.sub-group',
|
|
49
|
+
styles: 'custom-footer-sub-group'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
testId: 'consent-manager-widget-reject-button',
|
|
53
|
+
themeKey: 'widget.footer.reject-button',
|
|
54
|
+
styles: 'custom-reject-button'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
testId: 'consent-manager-widget-footer-accept-button',
|
|
58
|
+
themeKey: 'widget.footer.accept-button',
|
|
59
|
+
styles: 'custom-accept-button'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
testId: 'consent-manager-widget-footer-save-button',
|
|
63
|
+
themeKey: 'widget.footer.save-button',
|
|
64
|
+
styles: 'custom-save-button'
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
testId: 'consent-manager-widget-accordion-trigger-marketing',
|
|
68
|
+
themeKey: 'widget.accordion.trigger',
|
|
69
|
+
styles: 'custom-accordion-trigger'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
testId: 'consent-manager-widget-accordion-trigger-inner-marketing',
|
|
73
|
+
themeKey: 'widget.accordion.trigger-inner',
|
|
74
|
+
styles: 'custom-accordion-trigger-inner'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
testId: 'consent-manager-widget-accordion-content-marketing',
|
|
78
|
+
themeKey: 'widget.accordion.content',
|
|
79
|
+
styles: 'custom-accordion-content'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
testId: 'consent-manager-widget-switch-marketing',
|
|
83
|
+
themeKey: 'widget.switch',
|
|
84
|
+
styles: 'custom-switch'
|
|
85
|
+
}
|
|
86
|
+
];
|
|
87
|
+
(0, external_vitest_namespaceObject.test)('Theme prop applies string classnames to all components', async ()=>{
|
|
88
|
+
const test = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_consent_manager_widget_cjs_namespaceObject.ConsentManagerWidget, {
|
|
89
|
+
theme: ALL_COMPONENTS.reduce((acc, { themeKey, styles })=>{
|
|
90
|
+
acc[themeKey] = styles;
|
|
91
|
+
return acc;
|
|
92
|
+
}, {})
|
|
93
|
+
});
|
|
94
|
+
await external_utils_cjs_default()({
|
|
95
|
+
component: test,
|
|
96
|
+
testCases: ALL_COMPONENTS.map(({ testId, styles })=>({
|
|
97
|
+
testId,
|
|
98
|
+
styles
|
|
99
|
+
}))
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
(0, external_vitest_namespaceObject.test)('Theme prop supports object format with className and style for all components', async ()=>{
|
|
103
|
+
const style = {
|
|
104
|
+
backgroundColor: '#ffffff',
|
|
105
|
+
padding: '20px',
|
|
106
|
+
border: '1px solid #000000'
|
|
107
|
+
};
|
|
108
|
+
const testCases = ALL_COMPONENTS.map(({ testId, themeKey, styles })=>({
|
|
109
|
+
testId,
|
|
110
|
+
themeKey,
|
|
111
|
+
className: styles,
|
|
112
|
+
style
|
|
113
|
+
}));
|
|
114
|
+
const test = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_consent_manager_widget_cjs_namespaceObject.ConsentManagerWidget, {
|
|
115
|
+
theme: testCases.reduce((acc, { themeKey, className, style })=>{
|
|
116
|
+
acc[themeKey] = {
|
|
117
|
+
className,
|
|
118
|
+
style
|
|
119
|
+
};
|
|
120
|
+
return acc;
|
|
121
|
+
}, {})
|
|
122
|
+
});
|
|
123
|
+
await external_utils_cjs_default()({
|
|
124
|
+
component: test,
|
|
125
|
+
testCases: testCases.map(({ testId, className, style })=>({
|
|
126
|
+
testId,
|
|
127
|
+
styles: {
|
|
128
|
+
className,
|
|
129
|
+
style
|
|
130
|
+
}
|
|
131
|
+
}))
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
(0, external_vitest_namespaceObject.test)('No style prop removes default styles but keeps custom classNames', async ()=>{
|
|
135
|
+
const test = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_consent_manager_widget_cjs_namespaceObject.ConsentManagerWidget, {
|
|
136
|
+
noStyle: true,
|
|
137
|
+
theme: ALL_COMPONENTS.reduce((acc, { themeKey, styles })=>{
|
|
138
|
+
acc[themeKey] = styles;
|
|
139
|
+
return acc;
|
|
140
|
+
}, {})
|
|
141
|
+
});
|
|
142
|
+
await external_utils_cjs_default()({
|
|
143
|
+
component: test,
|
|
144
|
+
testCases: ALL_COMPONENTS.map(({ testId, styles })=>({
|
|
145
|
+
testId,
|
|
146
|
+
styles
|
|
147
|
+
})),
|
|
148
|
+
noStyle: true
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
(0, external_vitest_namespaceObject.test)('Theme prop handles mixed format (string and object) correctly', async ()=>{
|
|
152
|
+
const mixedTheme = {
|
|
153
|
+
'widget.root': {
|
|
154
|
+
className: 'custom-root',
|
|
155
|
+
style: {
|
|
156
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
157
|
+
padding: '16px'
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
'widget.accordion.trigger': 'custom-accordion-trigger'
|
|
161
|
+
};
|
|
162
|
+
const test = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_consent_manager_widget_cjs_namespaceObject.ConsentManagerWidget, {
|
|
163
|
+
theme: mixedTheme
|
|
164
|
+
});
|
|
165
|
+
await external_utils_cjs_default()({
|
|
166
|
+
component: test,
|
|
167
|
+
testCases: [
|
|
168
|
+
{
|
|
169
|
+
testId: 'consent-manager-widget-root',
|
|
170
|
+
styles: {
|
|
171
|
+
className: 'custom-root',
|
|
172
|
+
style: {
|
|
173
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
174
|
+
padding: '16px'
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
testId: 'consent-manager-widget-accordion-trigger-marketing',
|
|
180
|
+
styles: 'custom-accordion-trigger'
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
(0, external_vitest_namespaceObject.test)('Theme prop handles edge cases gracefully', async ()=>{
|
|
186
|
+
const edgeCaseTheme = {
|
|
187
|
+
'widget.root': '',
|
|
188
|
+
'widget.accordion': '',
|
|
189
|
+
'widget.footer': {
|
|
190
|
+
className: '',
|
|
191
|
+
style: {
|
|
192
|
+
margin: '0',
|
|
193
|
+
padding: '0'
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const test = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_consent_manager_widget_cjs_namespaceObject.ConsentManagerWidget, {
|
|
198
|
+
theme: edgeCaseTheme
|
|
199
|
+
});
|
|
200
|
+
await external_utils_cjs_default()({
|
|
201
|
+
component: test,
|
|
202
|
+
testCases: [
|
|
203
|
+
{
|
|
204
|
+
testId: 'consent-manager-widget-root',
|
|
205
|
+
styles: ''
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
testId: 'consent-manager-widget-accordion',
|
|
209
|
+
styles: ''
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
testId: 'consent-manager-widget-footer',
|
|
213
|
+
styles: {
|
|
214
|
+
className: '',
|
|
215
|
+
style: {
|
|
216
|
+
margin: '0',
|
|
217
|
+
padding: '0'
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
var __webpack_export_target__ = exports;
|
|
225
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
226
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
227
|
+
value: true
|
|
228
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.spec.d.ts","sourceRoot":"","sources":["../../../../src/components/consent-manager-widget/__tests__/styles.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vitest__ from "vitest";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__consent_manager_widget_js_ec34d749__ from "../consent-manager-widget.js";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
|
|
5
|
+
const ALL_COMPONENTS = [
|
|
6
|
+
{
|
|
7
|
+
testId: 'consent-manager-widget-root',
|
|
8
|
+
themeKey: 'widget.root',
|
|
9
|
+
styles: 'custom-root'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
testId: 'consent-manager-widget-footer',
|
|
13
|
+
themeKey: 'widget.footer',
|
|
14
|
+
styles: 'custom-footer'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
testId: 'consent-manager-widget-footer-sub-group',
|
|
18
|
+
themeKey: 'widget.footer.sub-group',
|
|
19
|
+
styles: 'custom-footer-sub-group'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
testId: 'consent-manager-widget-reject-button',
|
|
23
|
+
themeKey: 'widget.footer.reject-button',
|
|
24
|
+
styles: 'custom-reject-button'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
testId: 'consent-manager-widget-footer-accept-button',
|
|
28
|
+
themeKey: 'widget.footer.accept-button',
|
|
29
|
+
styles: 'custom-accept-button'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
testId: 'consent-manager-widget-footer-save-button',
|
|
33
|
+
themeKey: 'widget.footer.save-button',
|
|
34
|
+
styles: 'custom-save-button'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
testId: 'consent-manager-widget-accordion-trigger-marketing',
|
|
38
|
+
themeKey: 'widget.accordion.trigger',
|
|
39
|
+
styles: 'custom-accordion-trigger'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
testId: 'consent-manager-widget-accordion-trigger-inner-marketing',
|
|
43
|
+
themeKey: 'widget.accordion.trigger-inner',
|
|
44
|
+
styles: 'custom-accordion-trigger-inner'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
testId: 'consent-manager-widget-accordion-content-marketing',
|
|
48
|
+
themeKey: 'widget.accordion.content',
|
|
49
|
+
styles: 'custom-accordion-content'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
testId: 'consent-manager-widget-switch-marketing',
|
|
53
|
+
themeKey: 'widget.switch',
|
|
54
|
+
styles: 'custom-switch'
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.test)('Theme prop applies string classnames to all components', async ()=>{
|
|
58
|
+
const test = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__consent_manager_widget_js_ec34d749__.ConsentManagerWidget, {
|
|
59
|
+
theme: ALL_COMPONENTS.reduce((acc, { themeKey, styles })=>{
|
|
60
|
+
acc[themeKey] = styles;
|
|
61
|
+
return acc;
|
|
62
|
+
}, {})
|
|
63
|
+
});
|
|
64
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__["default"])({
|
|
65
|
+
component: test,
|
|
66
|
+
testCases: ALL_COMPONENTS.map(({ testId, styles })=>({
|
|
67
|
+
testId,
|
|
68
|
+
styles
|
|
69
|
+
}))
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.test)('Theme prop supports object format with className and style for all components', async ()=>{
|
|
73
|
+
const style = {
|
|
74
|
+
backgroundColor: '#ffffff',
|
|
75
|
+
padding: '20px',
|
|
76
|
+
border: '1px solid #000000'
|
|
77
|
+
};
|
|
78
|
+
const testCases = ALL_COMPONENTS.map(({ testId, themeKey, styles })=>({
|
|
79
|
+
testId,
|
|
80
|
+
themeKey,
|
|
81
|
+
className: styles,
|
|
82
|
+
style
|
|
83
|
+
}));
|
|
84
|
+
const test = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__consent_manager_widget_js_ec34d749__.ConsentManagerWidget, {
|
|
85
|
+
theme: testCases.reduce((acc, { themeKey, className, style })=>{
|
|
86
|
+
acc[themeKey] = {
|
|
87
|
+
className,
|
|
88
|
+
style
|
|
89
|
+
};
|
|
90
|
+
return acc;
|
|
91
|
+
}, {})
|
|
92
|
+
});
|
|
93
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__["default"])({
|
|
94
|
+
component: test,
|
|
95
|
+
testCases: testCases.map(({ testId, className, style })=>({
|
|
96
|
+
testId,
|
|
97
|
+
styles: {
|
|
98
|
+
className,
|
|
99
|
+
style
|
|
100
|
+
}
|
|
101
|
+
}))
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.test)('No style prop removes default styles but keeps custom classNames', async ()=>{
|
|
105
|
+
const test = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__consent_manager_widget_js_ec34d749__.ConsentManagerWidget, {
|
|
106
|
+
noStyle: true,
|
|
107
|
+
theme: ALL_COMPONENTS.reduce((acc, { themeKey, styles })=>{
|
|
108
|
+
acc[themeKey] = styles;
|
|
109
|
+
return acc;
|
|
110
|
+
}, {})
|
|
111
|
+
});
|
|
112
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__["default"])({
|
|
113
|
+
component: test,
|
|
114
|
+
testCases: ALL_COMPONENTS.map(({ testId, styles })=>({
|
|
115
|
+
testId,
|
|
116
|
+
styles
|
|
117
|
+
})),
|
|
118
|
+
noStyle: true
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.test)('Theme prop handles mixed format (string and object) correctly', async ()=>{
|
|
122
|
+
const mixedTheme = {
|
|
123
|
+
'widget.root': {
|
|
124
|
+
className: 'custom-root',
|
|
125
|
+
style: {
|
|
126
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
127
|
+
padding: '16px'
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
'widget.accordion.trigger': 'custom-accordion-trigger'
|
|
131
|
+
};
|
|
132
|
+
const test = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__consent_manager_widget_js_ec34d749__.ConsentManagerWidget, {
|
|
133
|
+
theme: mixedTheme
|
|
134
|
+
});
|
|
135
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__["default"])({
|
|
136
|
+
component: test,
|
|
137
|
+
testCases: [
|
|
138
|
+
{
|
|
139
|
+
testId: 'consent-manager-widget-root',
|
|
140
|
+
styles: {
|
|
141
|
+
className: 'custom-root',
|
|
142
|
+
style: {
|
|
143
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
144
|
+
padding: '16px'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
testId: 'consent-manager-widget-accordion-trigger-marketing',
|
|
150
|
+
styles: 'custom-accordion-trigger'
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vitest__.test)('Theme prop handles edge cases gracefully', async ()=>{
|
|
156
|
+
const edgeCaseTheme = {
|
|
157
|
+
'widget.root': '',
|
|
158
|
+
'widget.accordion': '',
|
|
159
|
+
'widget.footer': {
|
|
160
|
+
className: '',
|
|
161
|
+
style: {
|
|
162
|
+
margin: '0',
|
|
163
|
+
padding: '0'
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const test = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__consent_manager_widget_js_ec34d749__.ConsentManagerWidget, {
|
|
168
|
+
theme: edgeCaseTheme
|
|
169
|
+
});
|
|
170
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__["default"])({
|
|
171
|
+
component: test,
|
|
172
|
+
testCases: [
|
|
173
|
+
{
|
|
174
|
+
testId: 'consent-manager-widget-root',
|
|
175
|
+
styles: ''
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
testId: 'consent-manager-widget-accordion',
|
|
179
|
+
styles: ''
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
testId: 'consent-manager-widget-footer',
|
|
183
|
+
styles: {
|
|
184
|
+
className: '',
|
|
185
|
+
style: {
|
|
186
|
+
margin: '0',
|
|
187
|
+
padding: '0'
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
});
|
|
193
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = function(obj, prop) {
|
|
13
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.r = function(exports1) {
|
|
18
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
19
|
+
value: 'Module'
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
22
|
+
value: true
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
var __webpack_exports__ = {};
|
|
27
|
+
__webpack_require__.r(__webpack_exports__);
|
|
28
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
29
|
+
default: ()=>utils_rslib_entry_
|
|
30
|
+
});
|
|
31
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
|
+
const external_vitest_namespaceObject = require("vitest");
|
|
33
|
+
const external_vitest_browser_react_namespaceObject = require("vitest-browser-react");
|
|
34
|
+
const consent_manager_provider_cjs_namespaceObject = require("../../../providers/consent-manager-provider.cjs");
|
|
35
|
+
async function testComponentStyles({ component, testCases, noStyle = false }) {
|
|
36
|
+
const { getByTestId } = (0, external_vitest_browser_react_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(consent_manager_provider_cjs_namespaceObject.ConsentManagerProvider, {
|
|
37
|
+
noStyle: noStyle,
|
|
38
|
+
children: component
|
|
39
|
+
}));
|
|
40
|
+
for (const { testId, styles } of testCases){
|
|
41
|
+
const element = getByTestId(testId);
|
|
42
|
+
if ('string' == typeof styles || styles?.className) {
|
|
43
|
+
const classNames = 'string' == typeof styles ? styles : styles?.className;
|
|
44
|
+
if (classNames) await external_vitest_namespaceObject.expect.element(element).toHaveClass(classNames, {
|
|
45
|
+
exact: noStyle
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if ('object' == typeof styles && styles?.style) {
|
|
49
|
+
const styleEntries = Object.entries(styles.style).map(([key, value])=>{
|
|
50
|
+
const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
51
|
+
return [
|
|
52
|
+
cssKey,
|
|
53
|
+
value
|
|
54
|
+
];
|
|
55
|
+
});
|
|
56
|
+
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
57
|
+
for (const [property, value] of styleEntries)await external_vitest_namespaceObject.expect.element(element).toHaveStyle({
|
|
58
|
+
[property]: value
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const utils_rslib_entry_ = testComponentStyles;
|
|
64
|
+
var __webpack_export_target__ = exports;
|
|
65
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
66
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
67
|
+
value: true
|
|
68
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ThemeValue } from '../../../types/theme';
|
|
3
|
+
interface ComponentStyles {
|
|
4
|
+
component: ReactNode;
|
|
5
|
+
testCases: {
|
|
6
|
+
testId: string;
|
|
7
|
+
styles: string | ThemeValue;
|
|
8
|
+
}[];
|
|
9
|
+
noStyle?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare function testComponentStyles({ component, testCases, noStyle, }: ComponentStyles): Promise<void>;
|
|
12
|
+
export default testComponentStyles;
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/consent-manager-widget/__tests__/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,UAAU,eAAe;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;KAC5B,EAAE,CAAC;IACJ,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,iBAAe,mBAAmB,CAAC,EAClC,SAAS,EACT,SAAS,EACT,OAAe,GACf,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA0CjC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vitest__ from "vitest";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vitest_browser_react_6a851916__ from "vitest-browser-react";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__providers_consent_manager_provider_js_47c65d87__ from "../../../providers/consent-manager-provider.js";
|
|
5
|
+
async function testComponentStyles({ component, testCases, noStyle = false }) {
|
|
6
|
+
const { getByTestId } = (0, __WEBPACK_EXTERNAL_MODULE_vitest_browser_react_6a851916__.render)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(__WEBPACK_EXTERNAL_MODULE__providers_consent_manager_provider_js_47c65d87__.ConsentManagerProvider, {
|
|
7
|
+
noStyle: noStyle,
|
|
8
|
+
children: component
|
|
9
|
+
}));
|
|
10
|
+
for (const { testId, styles } of testCases){
|
|
11
|
+
const element = getByTestId(testId);
|
|
12
|
+
if ('string' == typeof styles || styles?.className) {
|
|
13
|
+
const classNames = 'string' == typeof styles ? styles : styles?.className;
|
|
14
|
+
if (classNames) await __WEBPACK_EXTERNAL_MODULE_vitest__.expect.element(element).toHaveClass(classNames, {
|
|
15
|
+
exact: noStyle
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if ('object' == typeof styles && styles?.style) {
|
|
19
|
+
const styleEntries = Object.entries(styles.style).map(([key, value])=>{
|
|
20
|
+
const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
21
|
+
return [
|
|
22
|
+
cssKey,
|
|
23
|
+
value
|
|
24
|
+
];
|
|
25
|
+
});
|
|
26
|
+
await new Promise((resolve)=>setTimeout(resolve, 100));
|
|
27
|
+
for (const [property, value] of styleEntries)await __WEBPACK_EXTERNAL_MODULE_vitest__.expect.element(element).toHaveStyle({
|
|
28
|
+
[property]: value
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const utils_rslib_entry_ = testComponentStyles;
|
|
34
|
+
export { utils_rslib_entry_ as default };
|