@kindly/react-chat 2.38.0 → 2.38.3
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/.storybook/main.js +7 -3
- package/.storybook/preview.js +5 -0
- package/.storybook/test-runner.js +38 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +11 -2
- package/stories/screens.stories/Chat.stories.jsx +108 -7
- package/stories/screens.stories/PushGreeting.stories.jsx +82 -0
package/.storybook/main.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
|
|
1
3
|
const path = require('path');
|
|
4
|
+
|
|
2
5
|
const webpack = require('webpack');
|
|
3
6
|
|
|
4
7
|
const envConfig = require('../../../config');
|
|
5
|
-
const envVars = envConfig['local'];
|
|
6
8
|
|
|
7
|
-
const
|
|
9
|
+
const envVars = envConfig.local;
|
|
8
10
|
|
|
11
|
+
const SETTINGS_HOST = 'https://example.com/mockme';
|
|
9
12
|
|
|
10
13
|
module.exports = {
|
|
11
14
|
stories: [
|
|
@@ -19,6 +22,7 @@ module.exports = {
|
|
|
19
22
|
'@storybook/addon-essentials',
|
|
20
23
|
'@storybook/addon-interactions',
|
|
21
24
|
'storybook-addon-mock/register',
|
|
25
|
+
'@storybook/addon-a11y',
|
|
22
26
|
],
|
|
23
27
|
framework: '@storybook/react',
|
|
24
28
|
/* Modify the default storybook webpack config to our needs */
|
|
@@ -69,4 +73,4 @@ module.exports = {
|
|
|
69
73
|
],
|
|
70
74
|
};
|
|
71
75
|
},
|
|
72
|
-
};
|
|
76
|
+
};
|
package/.storybook/preview.js
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
const { getStoryContext } = require('@storybook/test-runner');
|
|
3
|
+
const { injectAxe, checkA11y } = require('axe-playwright');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* See https://storybook.js.org/docs/react/writing-tests/test-runner#test-hook-api-experimental
|
|
7
|
+
* to learn more about the test-runner hooks API.
|
|
8
|
+
*/
|
|
9
|
+
module.exports = {
|
|
10
|
+
async preRender(page) {
|
|
11
|
+
await injectAxe(page);
|
|
12
|
+
},
|
|
13
|
+
async postRender(page, context) {
|
|
14
|
+
const storyContext = await getStoryContext(page, context);
|
|
15
|
+
// Do not test a11y for stories that disable a11y
|
|
16
|
+
if (storyContext.parameters?.a11y?.disable) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
await page.waitForLoadState('domcontentloaded');
|
|
21
|
+
await new Promise((resolve) => {
|
|
22
|
+
setTimeout(resolve, 1000);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
await checkA11y(page, '#root', {
|
|
26
|
+
detailedReport: true,
|
|
27
|
+
detailedReportOptions: {
|
|
28
|
+
html: true,
|
|
29
|
+
},
|
|
30
|
+
axeOptions: {
|
|
31
|
+
rules: storyContext.parameters?.a11y?.config.rules.reduce(
|
|
32
|
+
(previousValue, currentValue) => ({ ...previousValue, [currentValue.id]: currentValue }),
|
|
33
|
+
{},
|
|
34
|
+
),
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
};
|