Skip to content

Commit 2cf313f

Browse files
vishalshrm539Sharma
andauthored
Updated Storybook to 8 and moved common PCore mocks (#484)
* Updated Storybook to 8 and moved coomon PCore mocks * Spacing issue * Fix package-lock * Changed extension of pcoreMock file and updated DXCB to 0.242.16 * Fixed package.lock --------- Co-authored-by: Sharma <[email protected]>
1 parent 53d9d22 commit 2cf313f

File tree

6 files changed

+8245
-10616
lines changed

6 files changed

+8245
-10616
lines changed

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// Use default npmjs registry for the SDKs
22
registry = https://registry.npmjs.org/
33
# Turn off messages such as > [email protected] list and > dx-component-builder-sdk list
4-
loglevel=silent
4+
loglevel=notice

.storybook/main.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ import path from 'path';
33

44
const config: StorybookConfig = {
55
stories: ['../src/**/*.mdx', '../src/app/_components/custom-sdk/**/*.stories.@(js|jsx|ts|tsx)'],
6-
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions'],
6+
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions', '@chromatic-com/storybook'],
77
framework: {
88
name: '@storybook/angular',
99
options: {}
1010
},
11-
features: {
12-
storyStoreV7: false
13-
},
1411
docs: {
1512
autodocs: 'tag'
1613
},

.storybook/preview.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { provideAnimations } from '@angular/platform-browser/animations';
22
import { AngularPConnectService, getSdkComponentMap } from '@pega/angular-sdk-components';
33
import { Preview, applicationConfig } from '@storybook/angular';
4+
import setPCoreMocks from '../__mocks__/pcoreMocks';
5+
6+
setPCoreMocks();
47

58
getSdkComponentMap();
69

@@ -33,7 +36,6 @@ const preview: Preview = {
3336
})
3437
],
3538
parameters: {
36-
actions: { argTypesRegex: '^on[A-Z].*' },
3739
controls: {
3840
matchers: {
3941
color: /(background|color)$/i,

__mocks__/pcoreMocks.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export default function setPCoreMocks() {
2+
if (!window.PCore) {
3+
window.PCore = {} as any;
4+
}
5+
6+
window.PCore.getEnvironmentInfo = () => {
7+
return {
8+
getUseLocale: () => 'en-GB',
9+
getLocale: () => 'en-GB',
10+
getTimeZone: () => ''
11+
} as any;
12+
};
13+
14+
window.PCore.getLocaleUtils = () => {
15+
return {
16+
getLocaleValue: (value: any) => value
17+
} as any;
18+
};
19+
20+
window.PCore.getConstants = (): any => {
21+
return {
22+
CASE_INFO: {
23+
INSTRUCTIONS: ''
24+
}
25+
};
26+
};
27+
}

0 commit comments

Comments
 (0)