@storybook/addon-a11y 6.4.0-beta.2 → 6.4.0-beta.23
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/README.md +1 -1
- package/dist/cjs/a11yRunner.js +138 -47
- package/dist/esm/a11yRunner.js +111 -42
- package/dist/modern/a11yRunner.js +10 -8
- package/dist/ts3.4/components/Report/Item.d.ts +1 -0
- package/dist/ts3.9/components/Report/Item.d.ts +1 -0
- package/package.json +10 -10
package/README.md
CHANGED
package/dist/cjs/a11yRunner.js
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.weak-map.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.string.iterator.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.array.iterator.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.symbol.js");
|
|
16
|
+
|
|
17
|
+
require("core-js/modules/es.symbol.description.js");
|
|
18
|
+
|
|
19
|
+
require("core-js/modules/es.symbol.iterator.js");
|
|
20
|
+
|
|
3
21
|
require("core-js/modules/es.promise.js");
|
|
4
22
|
|
|
5
23
|
require("core-js/modules/es.object.to-string.js");
|
|
@@ -8,14 +26,16 @@ require("regenerator-runtime/runtime.js");
|
|
|
8
26
|
|
|
9
27
|
var _global = _interopRequireDefault(require("global"));
|
|
10
28
|
|
|
11
|
-
var _axeCore = _interopRequireDefault(require("axe-core"));
|
|
12
|
-
|
|
13
29
|
var _addons = require("@storybook/addons");
|
|
14
30
|
|
|
15
31
|
var _constants = require("./constants");
|
|
16
32
|
|
|
17
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
34
|
|
|
35
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
36
|
+
|
|
37
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
38
|
+
|
|
19
39
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
20
40
|
|
|
21
41
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -36,7 +56,7 @@ var activeStoryId;
|
|
|
36
56
|
|
|
37
57
|
var getElement = function getElement() {
|
|
38
58
|
var storyRoot = document.getElementById('story-root');
|
|
39
|
-
return storyRoot ? storyRoot.
|
|
59
|
+
return storyRoot ? storyRoot.childNodes : document.getElementById('root');
|
|
40
60
|
};
|
|
41
61
|
/**
|
|
42
62
|
* Handle A11yContext events.
|
|
@@ -44,47 +64,84 @@ var getElement = function getElement() {
|
|
|
44
64
|
*/
|
|
45
65
|
|
|
46
66
|
|
|
47
|
-
var handleRequest = function
|
|
48
|
-
var _getParams = getParams(storyId),
|
|
49
|
-
manual = _getParams.manual;
|
|
50
|
-
|
|
51
|
-
if (!manual) {
|
|
52
|
-
run(storyId);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
var run = /*#__PURE__*/function () {
|
|
67
|
+
var handleRequest = /*#__PURE__*/function () {
|
|
57
68
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(storyId) {
|
|
58
|
-
var
|
|
69
|
+
var _yield$getParams, manual;
|
|
59
70
|
|
|
60
71
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
61
72
|
while (1) {
|
|
62
73
|
switch (_context.prev = _context.next) {
|
|
74
|
+
case 0:
|
|
75
|
+
_context.next = 2;
|
|
76
|
+
return getParams(storyId);
|
|
77
|
+
|
|
78
|
+
case 2:
|
|
79
|
+
_yield$getParams = _context.sent;
|
|
80
|
+
manual = _yield$getParams.manual;
|
|
81
|
+
|
|
82
|
+
if (manual) {
|
|
83
|
+
_context.next = 7;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_context.next = 7;
|
|
88
|
+
return run(storyId);
|
|
89
|
+
|
|
90
|
+
case 7:
|
|
91
|
+
case "end":
|
|
92
|
+
return _context.stop();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}, _callee);
|
|
96
|
+
}));
|
|
97
|
+
|
|
98
|
+
return function handleRequest(_x) {
|
|
99
|
+
return _ref.apply(this, arguments);
|
|
100
|
+
};
|
|
101
|
+
}();
|
|
102
|
+
|
|
103
|
+
var run = /*#__PURE__*/function () {
|
|
104
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(storyId) {
|
|
105
|
+
var input, axe, _input$element, element, config, _input$options, options, result;
|
|
106
|
+
|
|
107
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
108
|
+
while (1) {
|
|
109
|
+
switch (_context2.prev = _context2.next) {
|
|
63
110
|
case 0:
|
|
64
111
|
activeStoryId = storyId;
|
|
65
|
-
|
|
66
|
-
|
|
112
|
+
_context2.prev = 1;
|
|
113
|
+
_context2.next = 4;
|
|
114
|
+
return getParams(storyId);
|
|
115
|
+
|
|
116
|
+
case 4:
|
|
117
|
+
input = _context2.sent;
|
|
67
118
|
|
|
68
119
|
if (active) {
|
|
69
|
-
|
|
120
|
+
_context2.next = 18;
|
|
70
121
|
break;
|
|
71
122
|
}
|
|
72
123
|
|
|
73
124
|
active = true;
|
|
74
125
|
channel.emit(_constants.EVENTS.RUNNING);
|
|
75
|
-
|
|
126
|
+
_context2.next = 10;
|
|
127
|
+
return Promise.resolve().then(function () {
|
|
128
|
+
return _interopRequireWildcard(require('axe-core'));
|
|
129
|
+
});
|
|
76
130
|
|
|
77
|
-
|
|
131
|
+
case 10:
|
|
132
|
+
axe = _context2.sent;
|
|
133
|
+
_input$element = input.element, element = _input$element === void 0 ? getElement() : _input$element, config = input.config, _input$options = input.options, options = _input$options === void 0 ? {} : _input$options;
|
|
134
|
+
axe.reset();
|
|
78
135
|
|
|
79
136
|
if (config) {
|
|
80
|
-
|
|
137
|
+
axe.configure(config);
|
|
81
138
|
}
|
|
82
139
|
|
|
83
|
-
|
|
84
|
-
return
|
|
140
|
+
_context2.next = 16;
|
|
141
|
+
return axe.run(element, options);
|
|
85
142
|
|
|
86
|
-
case
|
|
87
|
-
result =
|
|
143
|
+
case 16:
|
|
144
|
+
result = _context2.sent;
|
|
88
145
|
|
|
89
146
|
// It's possible that we requested a new run on a different story.
|
|
90
147
|
// Unfortunately, axe doesn't support a cancel method to abort current run.
|
|
@@ -97,46 +154,80 @@ var run = /*#__PURE__*/function () {
|
|
|
97
154
|
run(activeStoryId);
|
|
98
155
|
}
|
|
99
156
|
|
|
100
|
-
case
|
|
101
|
-
|
|
157
|
+
case 18:
|
|
158
|
+
_context2.next = 23;
|
|
102
159
|
break;
|
|
103
160
|
|
|
104
|
-
case
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
channel.emit(_constants.EVENTS.ERROR,
|
|
161
|
+
case 20:
|
|
162
|
+
_context2.prev = 20;
|
|
163
|
+
_context2.t0 = _context2["catch"](1);
|
|
164
|
+
channel.emit(_constants.EVENTS.ERROR, _context2.t0);
|
|
108
165
|
|
|
109
|
-
case
|
|
110
|
-
|
|
166
|
+
case 23:
|
|
167
|
+
_context2.prev = 23;
|
|
111
168
|
active = false;
|
|
112
|
-
return
|
|
169
|
+
return _context2.finish(23);
|
|
113
170
|
|
|
114
|
-
case
|
|
171
|
+
case 26:
|
|
115
172
|
case "end":
|
|
116
|
-
return
|
|
173
|
+
return _context2.stop();
|
|
117
174
|
}
|
|
118
175
|
}
|
|
119
|
-
},
|
|
176
|
+
}, _callee2, null, [[1, 20, 23, 26]]);
|
|
120
177
|
}));
|
|
121
178
|
|
|
122
|
-
return function run(
|
|
123
|
-
return
|
|
179
|
+
return function run(_x2) {
|
|
180
|
+
return _ref2.apply(this, arguments);
|
|
124
181
|
};
|
|
125
182
|
}();
|
|
126
183
|
/** Returns story parameters or default ones. */
|
|
127
184
|
|
|
128
185
|
|
|
129
|
-
var getParams = function
|
|
130
|
-
var
|
|
131
|
-
|
|
186
|
+
var getParams = /*#__PURE__*/function () {
|
|
187
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(storyId) {
|
|
188
|
+
var _ref4, parameters;
|
|
132
189
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
190
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
191
|
+
while (1) {
|
|
192
|
+
switch (_context3.prev = _context3.next) {
|
|
193
|
+
case 0:
|
|
194
|
+
_context3.next = 2;
|
|
195
|
+
return globalWindow.__STORYBOOK_STORY_STORE__.loadStory({
|
|
196
|
+
storyId: storyId
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
case 2:
|
|
200
|
+
_context3.t0 = _context3.sent;
|
|
201
|
+
|
|
202
|
+
if (_context3.t0) {
|
|
203
|
+
_context3.next = 5;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
_context3.t0 = {};
|
|
208
|
+
|
|
209
|
+
case 5:
|
|
210
|
+
_ref4 = _context3.t0;
|
|
211
|
+
parameters = _ref4.parameters;
|
|
212
|
+
return _context3.abrupt("return", parameters.a11y || {
|
|
213
|
+
config: {},
|
|
214
|
+
options: {
|
|
215
|
+
restoreScroll: true
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
case 8:
|
|
220
|
+
case "end":
|
|
221
|
+
return _context3.stop();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}, _callee3);
|
|
225
|
+
}));
|
|
226
|
+
|
|
227
|
+
return function getParams(_x3) {
|
|
228
|
+
return _ref3.apply(this, arguments);
|
|
138
229
|
};
|
|
139
|
-
};
|
|
230
|
+
}();
|
|
140
231
|
|
|
141
232
|
channel.on(_constants.EVENTS.REQUEST, handleRequest);
|
|
142
233
|
channel.on(_constants.EVENTS.MANUAL, run);
|
package/dist/esm/a11yRunner.js
CHANGED
|
@@ -7,7 +7,6 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
7
7
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
8
|
|
|
9
9
|
import global from 'global';
|
|
10
|
-
import axe from 'axe-core';
|
|
11
10
|
import { addons } from '@storybook/addons';
|
|
12
11
|
import { EVENTS } from './constants';
|
|
13
12
|
var document = global.document,
|
|
@@ -25,7 +24,7 @@ var activeStoryId;
|
|
|
25
24
|
|
|
26
25
|
var getElement = function getElement() {
|
|
27
26
|
var storyRoot = document.getElementById('story-root');
|
|
28
|
-
return storyRoot ? storyRoot.
|
|
27
|
+
return storyRoot ? storyRoot.childNodes : document.getElementById('root');
|
|
29
28
|
};
|
|
30
29
|
/**
|
|
31
30
|
* Handle A11yContext events.
|
|
@@ -33,34 +32,70 @@ var getElement = function getElement() {
|
|
|
33
32
|
*/
|
|
34
33
|
|
|
35
34
|
|
|
36
|
-
var handleRequest = function
|
|
37
|
-
var _getParams = getParams(storyId),
|
|
38
|
-
manual = _getParams.manual;
|
|
39
|
-
|
|
40
|
-
if (!manual) {
|
|
41
|
-
run(storyId);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
var run = /*#__PURE__*/function () {
|
|
35
|
+
var handleRequest = /*#__PURE__*/function () {
|
|
46
36
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(storyId) {
|
|
47
|
-
var
|
|
37
|
+
var _yield$getParams, manual;
|
|
48
38
|
|
|
49
39
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
50
40
|
while (1) {
|
|
51
41
|
switch (_context.prev = _context.next) {
|
|
42
|
+
case 0:
|
|
43
|
+
_context.next = 2;
|
|
44
|
+
return getParams(storyId);
|
|
45
|
+
|
|
46
|
+
case 2:
|
|
47
|
+
_yield$getParams = _context.sent;
|
|
48
|
+
manual = _yield$getParams.manual;
|
|
49
|
+
|
|
50
|
+
if (manual) {
|
|
51
|
+
_context.next = 7;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_context.next = 7;
|
|
56
|
+
return run(storyId);
|
|
57
|
+
|
|
58
|
+
case 7:
|
|
59
|
+
case "end":
|
|
60
|
+
return _context.stop();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, _callee);
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
return function handleRequest(_x) {
|
|
67
|
+
return _ref.apply(this, arguments);
|
|
68
|
+
};
|
|
69
|
+
}();
|
|
70
|
+
|
|
71
|
+
var run = /*#__PURE__*/function () {
|
|
72
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(storyId) {
|
|
73
|
+
var input, axe, _input$element, element, config, _input$options, options, result;
|
|
74
|
+
|
|
75
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
76
|
+
while (1) {
|
|
77
|
+
switch (_context2.prev = _context2.next) {
|
|
52
78
|
case 0:
|
|
53
79
|
activeStoryId = storyId;
|
|
54
|
-
|
|
55
|
-
|
|
80
|
+
_context2.prev = 1;
|
|
81
|
+
_context2.next = 4;
|
|
82
|
+
return getParams(storyId);
|
|
83
|
+
|
|
84
|
+
case 4:
|
|
85
|
+
input = _context2.sent;
|
|
56
86
|
|
|
57
87
|
if (active) {
|
|
58
|
-
|
|
88
|
+
_context2.next = 18;
|
|
59
89
|
break;
|
|
60
90
|
}
|
|
61
91
|
|
|
62
92
|
active = true;
|
|
63
93
|
channel.emit(EVENTS.RUNNING);
|
|
94
|
+
_context2.next = 10;
|
|
95
|
+
return import('axe-core');
|
|
96
|
+
|
|
97
|
+
case 10:
|
|
98
|
+
axe = _context2.sent;
|
|
64
99
|
_input$element = input.element, element = _input$element === void 0 ? getElement() : _input$element, config = input.config, _input$options = input.options, options = _input$options === void 0 ? {} : _input$options;
|
|
65
100
|
axe.reset();
|
|
66
101
|
|
|
@@ -68,11 +103,11 @@ var run = /*#__PURE__*/function () {
|
|
|
68
103
|
axe.configure(config);
|
|
69
104
|
}
|
|
70
105
|
|
|
71
|
-
|
|
106
|
+
_context2.next = 16;
|
|
72
107
|
return axe.run(element, options);
|
|
73
108
|
|
|
74
|
-
case
|
|
75
|
-
result =
|
|
109
|
+
case 16:
|
|
110
|
+
result = _context2.sent;
|
|
76
111
|
|
|
77
112
|
// It's possible that we requested a new run on a different story.
|
|
78
113
|
// Unfortunately, axe doesn't support a cancel method to abort current run.
|
|
@@ -85,46 +120,80 @@ var run = /*#__PURE__*/function () {
|
|
|
85
120
|
run(activeStoryId);
|
|
86
121
|
}
|
|
87
122
|
|
|
88
|
-
case
|
|
89
|
-
|
|
123
|
+
case 18:
|
|
124
|
+
_context2.next = 23;
|
|
90
125
|
break;
|
|
91
126
|
|
|
92
|
-
case
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
channel.emit(EVENTS.ERROR,
|
|
127
|
+
case 20:
|
|
128
|
+
_context2.prev = 20;
|
|
129
|
+
_context2.t0 = _context2["catch"](1);
|
|
130
|
+
channel.emit(EVENTS.ERROR, _context2.t0);
|
|
96
131
|
|
|
97
|
-
case
|
|
98
|
-
|
|
132
|
+
case 23:
|
|
133
|
+
_context2.prev = 23;
|
|
99
134
|
active = false;
|
|
100
|
-
return
|
|
135
|
+
return _context2.finish(23);
|
|
101
136
|
|
|
102
|
-
case
|
|
137
|
+
case 26:
|
|
103
138
|
case "end":
|
|
104
|
-
return
|
|
139
|
+
return _context2.stop();
|
|
105
140
|
}
|
|
106
141
|
}
|
|
107
|
-
},
|
|
142
|
+
}, _callee2, null, [[1, 20, 23, 26]]);
|
|
108
143
|
}));
|
|
109
144
|
|
|
110
|
-
return function run(
|
|
111
|
-
return
|
|
145
|
+
return function run(_x2) {
|
|
146
|
+
return _ref2.apply(this, arguments);
|
|
112
147
|
};
|
|
113
148
|
}();
|
|
114
149
|
/** Returns story parameters or default ones. */
|
|
115
150
|
|
|
116
151
|
|
|
117
|
-
var getParams = function
|
|
118
|
-
var
|
|
119
|
-
|
|
152
|
+
var getParams = /*#__PURE__*/function () {
|
|
153
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(storyId) {
|
|
154
|
+
var _ref4, parameters;
|
|
155
|
+
|
|
156
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
157
|
+
while (1) {
|
|
158
|
+
switch (_context3.prev = _context3.next) {
|
|
159
|
+
case 0:
|
|
160
|
+
_context3.next = 2;
|
|
161
|
+
return globalWindow.__STORYBOOK_STORY_STORE__.loadStory({
|
|
162
|
+
storyId: storyId
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
case 2:
|
|
166
|
+
_context3.t0 = _context3.sent;
|
|
120
167
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
168
|
+
if (_context3.t0) {
|
|
169
|
+
_context3.next = 5;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
_context3.t0 = {};
|
|
174
|
+
|
|
175
|
+
case 5:
|
|
176
|
+
_ref4 = _context3.t0;
|
|
177
|
+
parameters = _ref4.parameters;
|
|
178
|
+
return _context3.abrupt("return", parameters.a11y || {
|
|
179
|
+
config: {},
|
|
180
|
+
options: {
|
|
181
|
+
restoreScroll: true
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
case 8:
|
|
186
|
+
case "end":
|
|
187
|
+
return _context3.stop();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}, _callee3);
|
|
191
|
+
}));
|
|
192
|
+
|
|
193
|
+
return function getParams(_x3) {
|
|
194
|
+
return _ref3.apply(this, arguments);
|
|
126
195
|
};
|
|
127
|
-
};
|
|
196
|
+
}();
|
|
128
197
|
|
|
129
198
|
channel.on(EVENTS.REQUEST, handleRequest);
|
|
130
199
|
channel.on(EVENTS.MANUAL, run);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import global from 'global';
|
|
2
|
-
import axe from 'axe-core';
|
|
3
2
|
import { addons } from '@storybook/addons';
|
|
4
3
|
import { EVENTS } from './constants';
|
|
5
4
|
const {
|
|
@@ -19,7 +18,7 @@ let activeStoryId;
|
|
|
19
18
|
|
|
20
19
|
const getElement = () => {
|
|
21
20
|
const storyRoot = document.getElementById('story-root');
|
|
22
|
-
return storyRoot ? storyRoot.
|
|
21
|
+
return storyRoot ? storyRoot.childNodes : document.getElementById('root');
|
|
23
22
|
};
|
|
24
23
|
/**
|
|
25
24
|
* Handle A11yContext events.
|
|
@@ -27,13 +26,13 @@ const getElement = () => {
|
|
|
27
26
|
*/
|
|
28
27
|
|
|
29
28
|
|
|
30
|
-
const handleRequest = storyId => {
|
|
29
|
+
const handleRequest = async storyId => {
|
|
31
30
|
const {
|
|
32
31
|
manual
|
|
33
|
-
} = getParams(storyId);
|
|
32
|
+
} = await getParams(storyId);
|
|
34
33
|
|
|
35
34
|
if (!manual) {
|
|
36
|
-
run(storyId);
|
|
35
|
+
await run(storyId);
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
38
|
|
|
@@ -41,11 +40,12 @@ const run = async storyId => {
|
|
|
41
40
|
activeStoryId = storyId;
|
|
42
41
|
|
|
43
42
|
try {
|
|
44
|
-
const input = getParams(storyId);
|
|
43
|
+
const input = await getParams(storyId);
|
|
45
44
|
|
|
46
45
|
if (!active) {
|
|
47
46
|
active = true;
|
|
48
47
|
channel.emit(EVENTS.RUNNING);
|
|
48
|
+
const axe = await import('axe-core');
|
|
49
49
|
const {
|
|
50
50
|
element = getElement(),
|
|
51
51
|
config,
|
|
@@ -78,10 +78,12 @@ const run = async storyId => {
|
|
|
78
78
|
/** Returns story parameters or default ones. */
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
const getParams = storyId => {
|
|
81
|
+
const getParams = async storyId => {
|
|
82
82
|
const {
|
|
83
83
|
parameters
|
|
84
|
-
} = globalWindow.__STORYBOOK_STORY_STORE__.
|
|
84
|
+
} = (await globalWindow.__STORYBOOK_STORY_STORE__.loadStory({
|
|
85
|
+
storyId
|
|
86
|
+
})) || {};
|
|
85
87
|
return parameters.a11y || {
|
|
86
88
|
config: {},
|
|
87
89
|
options: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-a11y",
|
|
3
|
-
"version": "6.4.0-beta.
|
|
3
|
+
"version": "6.4.0-beta.23",
|
|
4
4
|
"description": "Test component compliance with web accessibility standards",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"a11y",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"prepare": "node ../../scripts/prepare.js"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@storybook/addons": "6.4.0-beta.
|
|
49
|
-
"@storybook/api": "6.4.0-beta.
|
|
50
|
-
"@storybook/channels": "6.4.0-beta.
|
|
51
|
-
"@storybook/client-logger": "6.4.0-beta.
|
|
52
|
-
"@storybook/components": "6.4.0-beta.
|
|
53
|
-
"@storybook/core-events": "6.4.0-beta.
|
|
54
|
-
"@storybook/csf": "0.0.2--canary.
|
|
55
|
-
"@storybook/theming": "6.4.0-beta.
|
|
48
|
+
"@storybook/addons": "6.4.0-beta.23",
|
|
49
|
+
"@storybook/api": "6.4.0-beta.23",
|
|
50
|
+
"@storybook/channels": "6.4.0-beta.23",
|
|
51
|
+
"@storybook/client-logger": "6.4.0-beta.23",
|
|
52
|
+
"@storybook/components": "6.4.0-beta.23",
|
|
53
|
+
"@storybook/core-events": "6.4.0-beta.23",
|
|
54
|
+
"@storybook/csf": "0.0.2--canary.87bc651.0",
|
|
55
|
+
"@storybook/theming": "6.4.0-beta.23",
|
|
56
56
|
"axe-core": "^4.2.0",
|
|
57
57
|
"core-js": "^3.8.2",
|
|
58
58
|
"global": "^4.4.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "34dd760d275faabff6855b84bb64bb69adc1ec1a",
|
|
85
85
|
"sbmodern": "dist/modern/index.js",
|
|
86
86
|
"storybook": {
|
|
87
87
|
"displayName": "Accessibility",
|