Przeglądaj źródła

adds some jsdocs style function comments

version-14
tunde 8 lat temu
rodzic
commit
a0e95877f6
1 zmienionych plików z 25 dodań i 0 usunięć
  1. +25
    -0
      frappe/tests/ui/data/test_lib.js

+ 25
- 0
frappe/tests/ui/data/test_lib.js Wyświetl plik

@@ -140,6 +140,12 @@ frappe.tests = {
// Method to check the visibility of an element // Method to check the visibility of an element
return $(`${tag}:contains("${text}")`).is(`:visible`); return $(`${tag}:contains("${text}")`).is(`:visible`);
}, },
/**
* Clicks a button on a form.
* @param {String} text - The button's text
* @return {frappe.timeout}
* @throws will throw an exception if a matching visible button is not found
*/
click_button: function(text) { click_button: function(text) {
let element = $(`.btn:contains("${text}"):visible`); let element = $(`.btn:contains("${text}"):visible`);
if(!element.length) { if(!element.length) {
@@ -148,6 +154,12 @@ frappe.tests = {
element.click(); element.click();
return frappe.timeout(0.5); return frappe.timeout(0.5);
}, },
/**
* Clicks a link on a form.
* @param {String} text - The text of the link to be clicked
* @return {frappe.timeout}
* @throws will throw an exception if a link with the given text is not found
*/
click_link: function(text) { click_link: function(text) {
let element = $(`a:contains("${text}"):visible`); let element = $(`a:contains("${text}"):visible`);
if(!element.length) { if(!element.length) {
@@ -156,6 +168,13 @@ frappe.tests = {
element.get(0).click(); element.get(0).click();
return frappe.timeout(0.5); return frappe.timeout(0.5);
}, },
/**
* Sets the given control to the value given.
* @param {String} fieldname - The Doctype's field name
* @param {String} value - The value the control should be changed to
* @return {frappe.timeout}
* @throws will throw an exception if the field is not found or is not visible
*/
set_control: function(fieldname, value) { set_control: function(fieldname, value) {
let control = $(`.form-control[data-fieldname="${fieldname}"]:visible`); let control = $(`.form-control[data-fieldname="${fieldname}"]:visible`);
if(!control.length) { if(!control.length) {
@@ -164,6 +183,12 @@ frappe.tests = {
control.val(value).trigger('change'); control.val(value).trigger('change');
return frappe.timeout(0.5); return frappe.timeout(0.5);
}, },
/**
* Checks if given field is disabled.
* @param {String} fieldname - The Doctype field name
* @return {Boolean} true if condition is met
* @throws will throw an exception if the field is not found or is not a form control
*/
is_disabled_field: function(fieldname){ is_disabled_field: function(fieldname){
let control = $(`.form-control[data-fieldname="${fieldname}"]:disabled`); let control = $(`.form-control[data-fieldname="${fieldname}"]:disabled`);
if(!control.length) { if(!control.length) {


Ładowanie…
Anuluj
Zapisz