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>
7 lines
227 B
JavaScript
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;
|
|
}
|