Gazebo_simulation-Frontend/node_modules/@testing-library/dom/dist/get-node-text.js
2020-12-21 10:29:31 -05:00

17 lines
539 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getNodeText = getNodeText;
// Constant node.nodeType for text nodes, see:
// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType#Node_type_constants
const TEXT_NODE = 3;
function getNodeText(node) {
if (node.matches('input[type=submit], input[type=button]')) {
return node.value;
}
return Array.from(node.childNodes).filter(child => child.nodeType === TEXT_NODE && Boolean(child.textContent)).map(c => c.textContent).join('');
}