anu-verzum 1.23.1 → 1.23.2
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
CHANGED
package/dist/core/domUtils.js
CHANGED
|
@@ -46,7 +46,7 @@ const updateDomProperties = (dom, prevProps, nextProps, isSvgElement = false) =>
|
|
|
46
46
|
dom.setAttribute(name, nextProps[name]);
|
|
47
47
|
}
|
|
48
48
|
} else {
|
|
49
|
-
if (name.includes('
|
|
49
|
+
if (name.includes('-') || name === 'role') {
|
|
50
50
|
dom.setAttribute(name, nextProps[name]);
|
|
51
51
|
} else {
|
|
52
52
|
el[name] = nextProps[name];
|
|
@@ -157,6 +157,35 @@ describe('waitFor', () => {
|
|
|
157
157
|
})).rejects.toThrow();
|
|
158
158
|
});
|
|
159
159
|
});
|
|
160
|
+
describe('data-* attributes', () => {
|
|
161
|
+
test('data-testid is set as an HTML attribute', () => {
|
|
162
|
+
const el = _index.default.createElement('div', {
|
|
163
|
+
'data-testid': 'my-box'
|
|
164
|
+
});
|
|
165
|
+
const {
|
|
166
|
+
container
|
|
167
|
+
} = (0, _index2.render)(el);
|
|
168
|
+
expect(container.querySelector('[data-testid="my-box"]')).not.toBeNull();
|
|
169
|
+
});
|
|
170
|
+
test('getByTestId finds element with data-testid', () => {
|
|
171
|
+
const el = _index.default.createElement('div', {
|
|
172
|
+
'data-testid': 'target'
|
|
173
|
+
}, _index.default.createElement('span', {}, 'inside'));
|
|
174
|
+
const {
|
|
175
|
+
getByTestId
|
|
176
|
+
} = (0, _index2.render)(el);
|
|
177
|
+
expect(getByTestId('target')).toBeDefined();
|
|
178
|
+
});
|
|
179
|
+
test('arbitrary data-* attribute is set as an HTML attribute', () => {
|
|
180
|
+
const el = _index.default.createElement('div', {
|
|
181
|
+
'data-custom': 'value'
|
|
182
|
+
});
|
|
183
|
+
const {
|
|
184
|
+
container
|
|
185
|
+
} = (0, _index2.render)(el);
|
|
186
|
+
expect(container.querySelector('[data-custom="value"]')).not.toBeNull();
|
|
187
|
+
});
|
|
188
|
+
});
|
|
160
189
|
describe('createPortal', () => {
|
|
161
190
|
let portalContainer;
|
|
162
191
|
beforeEach(() => {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createByTestIdQueries = void 0;
|
|
7
7
|
var _queryBuilder = require("./queryBuilder");
|
|
8
|
-
const queryAllByTestId = (container, id) => Array.from(container.querySelectorAll(
|
|
8
|
+
const queryAllByTestId = (container, id) => Array.from(container.querySelectorAll('[data-testid]')).filter(el => el.getAttribute('data-testid') === id);
|
|
9
9
|
const queryByTestId = (container, id) => queryAllByTestId(container, id)[0] ?? null;
|
|
10
10
|
const createByTestIdQueries = (container, id) => (0, _queryBuilder.buildQueryVariants)(`ByTestId("${id}")`, container, c => queryByTestId(c, id), c => queryAllByTestId(c, id));
|
|
11
11
|
exports.createByTestIdQueries = createByTestIdQueries;
|
package/package.json
CHANGED