1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/point_of_sale/static/tests/tours/helpers/NumpadTourMethods.js
2024-12-10 09:04:09 +07:00

20 lines
835 B
JavaScript

/** @odoo-module */
const buttonTriger = (buttonValue) => `div.numpad.row button.col:contains("${buttonValue}")`;
export const click = (buttonValue, options = {}) => ({
content: `click numpad button: ${buttonValue}`,
trigger: buttonTriger(buttonValue),
// here we couldn't simply use the jquery `:contains` selector because it
// would match (for ex) the button with the value "+10" when we want to click the
// button with the value "1". Here we need to match the exact value.
run: () => {
[...$(buttonTriger(buttonValue))].filter((el) => el.innerHTML == buttonValue)[0]?.click();
},
mobile: options.mobile,
});
export const isActive = (buttonValue) => ({
content: `check if --${buttonValue}-- mode is activated`,
trigger: `${buttonTriger(buttonValue)}.active`,
isCheck: true,
});