UNPKG

tia

Version:

Time is All (logs driven test engine with ExtJs support)

143 lines 4.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const form_field_base_1 = require("./form-field-base"); const tia_extjs_query_1 = require("../tia-extjs-query"); const compName = 'CheckBox'; /** * gT.eC.checkbox.a or gT.eC.checkbox.actions */ class CheckBoxActions extends form_field_base_1.FormFieldBaseActions { /** * Clicks on input checkbox element if checkbox is not checked. */ static async check(tEQ, idForLog, enableLog) { return gT.e.q.wrap({ tEQ, compName, idForLog, act: async () => { const { checked, id } = await tia_extjs_query_1.queryAndAction({ tEQ, action: 'return { checked: cmp.getRawValue(), id: cmpInfo.constProps.inputId };', idForLog, enableLog: false, }); if (!checked) { await gT.s.uA.clickById(id, false); } }, actionDesc: 'Check', enableLog, }); } /** * Clicks on input checkbox element if checkbox is checked. */ static async uncheck(tEQ, idForLog, enableLog) { return gT.e.q.wrap({ tEQ, compName, idForLog, act: async () => { const { checked, id } = await tia_extjs_query_1.queryAndAction({ tEQ, action: 'return { checked: cmp.getRawValue(), id: cmpInfo.constProps.inputId };', idForLog, enableLog: false, }); if (checked) { await gT.s.uA.clickById(id, false); } }, actionDesc: 'Uncheck', enableLog, }); } /** * Sets checkbox to checked state using ExtJs API. */ static async checkByEJ(tEQ, idForLog, enableLog) { return gT.e.q.wrap({ tEQ, compName, idForLog, act: async () => { await tia_extjs_query_1.queryAndAction({ tEQ, action: 'cmp.setValue(true);', idForLog, enableLog: false, }); }, actionDesc: 'Check by EJ', enableLog, }); } /** * Sets checkbox to unchecked state using ExtJs API. */ static async uncheckByEJ(tEQ, idForLog, enableLog) { return gT.e.q.wrap({ tEQ, compName, idForLog, act: async () => { await tia_extjs_query_1.queryAndAction({ tEQ, action: 'cmp.setValue(false);', idForLog, enableLog: false, }); }, actionDesc: 'Uncheck by EJ', enableLog, }); } } CheckBoxActions.compName = compName; exports.CheckBoxActions = CheckBoxActions; /** * gT.eC.checkbox.c or gT.eC.checkbox.checks */ class CheckBoxChecks extends form_field_base_1.FormFieldBaseChecks { } CheckBoxChecks.compName = compName; exports.CheckBoxChecks = CheckBoxChecks; /** * gT.eC.checkbox.g or gT.eC.checkbox.grabs */ class CheckBoxGrabs extends form_field_base_1.FormFieldBaseGrabs { /** * Returns 'checked' or 'unchecked'. */ static async rawValue(tEQ, idForLog) { return await gT.eC.formFieldBase.g.rawValue(tEQ, idForLog, val => `${val ? 'checked' : 'unchecked'}`); } } CheckBoxGrabs.compName = compName; exports.CheckBoxGrabs = CheckBoxGrabs; /** * gT.eC.checkbox.l or gT.eC.checkbox.logs */ class CheckBoxLogs extends form_field_base_1.FormFieldBaseLogs { /** * Prints 'checked' or 'unchecked'. */ static async rawValue(tEQ, idForLog) { await gT.eC.formFieldBase.l.rawValue(tEQ, idForLog, val => `${val ? 'checked' : 'unchecked'}`); } } CheckBoxLogs.compName = compName; exports.CheckBoxLogs = CheckBoxLogs; class CheckBoxAPI { } CheckBoxAPI.a = CheckBoxActions; CheckBoxAPI.actions = CheckBoxActions; CheckBoxAPI.c = CheckBoxChecks; CheckBoxAPI.checks = CheckBoxChecks; CheckBoxAPI.g = CheckBoxGrabs; CheckBoxAPI.grabs = CheckBoxGrabs; CheckBoxAPI.l = CheckBoxLogs; CheckBoxAPI.logs = CheckBoxLogs; exports.CheckBoxAPI = CheckBoxAPI; //# sourceMappingURL=checkbox.js.map