Вопрос

I want to test that a double click on a list item in my page opens the corresponding item for editing.

Here's the structure of my page:

<ul class="list">
  <li class="item" ondblclick="jQuery(this).find('.edit-button').click();">
    ...some content...
  </li>
</ul>

I have the following geb page defining the items using a geb moduleList of ListItem modules:

class ListPage extends Page {
  static content = {
    items { moduleList ListItem, $("li.item") }
  }
  ...
}

In the ListItem module I want to access the root li element to trigger the double click on it.

How can I access the li in the ListItem module?

The correct jQuery selector would probably be $(this) but in the module this point to the module instance and not to the root element.

Это было полезно?

Решение

After posting my question I recognized a related question providing the answer.

$() refers to the root element of a geb module.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top