Files
odoo_source/addons/project/static/tests/project_test_utils.js
T
Xavier BOL (xbo) 8d46e54c96 [IMP] project: externalize getFirstElementForXpath in test utils file
Before this commit, the `getFirstElementForXpath` function is used in
the unit test for the burndown chart. This function is used to select a
HTMLELement with xpath expression and could be used outside the unit
test of the burndown chart.

This commit externalizes this function in a project test utils JS file
to use this function in another unit tests file if needed.

task-2924268

closes odoo/odoo#97574

Related: odoo/enterprise#30173
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-08-25 19:57:32 +02:00

7 lines
227 B
JavaScript

/** @odoo-module */
export function getFirstElementForXpath(target, xpath) {
const xPathResult = document.evaluate(xpath, target, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
return xPathResult.singleNodeValue;
}