当前位置: 首页>>代码示例>>PHP>>正文


PHP NodeElement::getParent方法代码示例

本文整理汇总了PHP中Behat\Mink\Element\NodeElement::getParent方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeElement::getParent方法的具体用法?PHP NodeElement::getParent怎么用?PHP NodeElement::getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Behat\Mink\Element\NodeElement的用法示例。


在下文中一共展示了NodeElement::getParent方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reverseControls

 private static function reverseControls(NodeElement $content, dTable $dt)
 {
     $wrap = $content->getParent();
     self::reverseHeader($wrap, $dt);
     self::reverseFooter($wrap, $dt);
 }
开发者ID:dafik,项目名称:cc-tests-reverse,代码行数:6,代码来源:DataTable.php

示例2: findParentByClass

 /**
  * Returns the closest parent element having a specific class attribute.
  *
  * @param  NodeElement $el
  * @param  String  $class
  * @return Element|null
  */
 protected function findParentByClass(NodeElement $el, $class)
 {
     $container = $el->getParent();
     while ($container && $container->getTagName() != 'body') {
         if ($container->isVisible() && in_array($class, explode(' ', $container->getAttribute('class')))) {
             return $container;
         }
         $container = $container->getParent();
     }
     return null;
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:18,代码来源:CmsUiContext.php

示例3: isReplyOfComment

 /**
  * @param NodeElement $reply
  * @param NodeElement $comment
  *
  * @return bool
  */
 public function isReplyOfComment(NodeElement $reply, NodeElement $comment)
 {
     return $reply->getParent()->getText() === $comment->getParent()->getText();
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:10,代码来源:Edit.php

示例4: fillSelectField

 /**
  * Fills a select element with $value, identified by its $label.
  *
  * @param NodeElement $label
  * @param string      $value
  */
 protected function fillSelectField(NodeElement $label, $value)
 {
     $field = $label->getParent()->find('css', 'select');
     $field->selectOption($value);
 }
开发者ID:pierallard,项目名称:pim-community-dev,代码行数:11,代码来源:Form.php

示例5: get_field_node_type

 /**
  * Recursive method to find the field type.
  *
  * Depending on the field the felement class node is in a level or in another. We
  * look recursively for a parent node with a 'felement' class to find the field type.
  *
  * @param NodeElement $fieldnode The current node.
  * @param Session $session The behat browser session
  * @return mixed A NodeElement if we continue looking for the element type and String or false when we are done.
  */
 protected static function get_field_node_type(NodeElement $fieldnode, Session $session)
 {
     // Special handling for availability field which requires custom JavaScript.
     if ($fieldnode->getAttribute('name') === 'availabilityconditionsjson') {
         return 'availability';
     }
     if ($fieldnode->getTagName() == 'html') {
         return false;
     }
     // If the type is explictly set on the element pointed to by the label - use it.
     if ($type = $fieldnode->getParent()->getAttribute('data-fieldtype')) {
         if ($type == 'tags') {
             return 'autocomplete';
         }
         return $type;
     }
     // We look for a parent node with 'felement' class.
     if ($class = $fieldnode->getParent()->getAttribute('class')) {
         if (strstr($class, 'felement') != false) {
             // Remove 'felement f' from class value.
             return substr($class, 10);
         }
         // Stop propagation through the DOM, if it does not have a felement is not part of a moodle form.
         if (strstr($class, 'fcontainer') != false) {
             return false;
         }
     }
     return self::get_field_node_type($fieldnode->getParent(), $session);
 }
开发者ID:janeklb,项目名称:moodle,代码行数:39,代码来源:behat_field_manager.php

示例6: get_field_node_type

 /**
  * Recursive method to find the field type.
  *
  * Depending on the field the felement class node is in a level or in another. We
  * look recursively for a parent node with a 'felement' class to find the field type.
  *
  * @param NodeElement $fieldnode The current node.
  * @param Session $session The behat browser session
  * @return mixed A NodeElement if we continue looking for the element type and String or false when we are done.
  */
 protected static function get_field_node_type(NodeElement $fieldnode, Session $session)
 {
     // We look for a parent node with 'felement' class.
     if ($class = $fieldnode->getParent()->getAttribute('class')) {
         if (strstr($class, 'felement') != false) {
             // Remove 'felement f' from class value.
             return substr($class, 10);
         }
         // Stop propagation through the DOM, if it does not have a felement is not part of a moodle form.
         if (strstr($class, 'fcontainer') != false) {
             return false;
         }
     }
     return self::get_field_node_type($fieldnode->getParent(), $session);
 }
开发者ID:helenagarcia90,项目名称:moodle,代码行数:25,代码来源:behat_field_manager.php

示例7: testGetParent

 public function testGetParent()
 {
     $node = new NodeElement('elem', $this->session);
     $parent = $this->getMockBuilder('Behat\\Mink\\Element\\NodeElement')->disableOriginalConstructor()->getMock();
     $this->driver->expects($this->once())->method('find')->with('elem/..')->will($this->returnValue(array($parent)));
     $this->selectors->expects($this->once())->method('selectorToXpath')->with('xpath', '..')->will($this->returnValue('..'));
     $this->assertSame($parent, $node->getParent());
 }
开发者ID:jordi12100,项目名称:Mink,代码行数:8,代码来源:NodeElementTest.php

示例8: toggleResource

 /**
  * @param NodeElement $resource
  */
 public function toggleResource(NodeElement $resource)
 {
     $groupTitleElement = $this->spin(function () use($resource) {
         return $resource->getParent()->getParent()->getParent()->find('css', 'h3');
     }, 'Group title not found for resource.');
     $groupTitle = $groupTitleElement->getHtml();
     $this->navigateToGroup($groupTitle);
     $this->spin(function () use($resource) {
         return $resource->isVisible();
     }, sprintf('Resource is not visible on the group %s.', $groupTitle));
     $resource->click();
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:15,代码来源:PermissionDecorator.php

示例9: get_node_type

    /**
     * Recursive method to find the field type.
     *
     * Depending on the field the felement class node is a level or in another. We
     * look recursively for a parent node with a 'felement' class to find the field type.
     *
     * @throws ExpectationException
     * @param NodeElement $fieldnode The current node
     * @param string $locator Just to send an exception that makes sense for the user
     * @return mixed String or NodeElement depending if we have reached the felement node
     */
    protected function get_node_type(NodeElement $fieldnode, $locator) {

        // We look for a parent node with 'felement' class.
        if ($class = $fieldnode->getParent()->getAttribute('class')) {

            if (strstr($class, 'felement') != false) {
                // Remove 'felement f' from class value.
                return substr($class, 10);
            }

            // Stop propagation through the DOM, something went wrong!.
            if (strstr($class, 'fcontainer') != false) {
                throw new ExpectationException('No field type for ' . $locator . ' found, ensure the field exists', $this->getSession());
            }
        }

        return $this->get_node_type($fieldnode->getParent(), $locator);
    }
开发者ID:Burick,项目名称:moodle,代码行数:29,代码来源:behat_forms.php

示例10: fillTextField

 /**
  * Fills a text field element with $value, identified by its container or label.
  *
  * @param NodeElement $fieldContainerOrLabel
  * @param string      $value
  */
 protected function fillTextField(NodeElement $fieldContainerOrLabel, $value)
 {
     $field = $fieldContainerOrLabel->find('css', 'div.field-input input');
     // no field found, we're using a label
     if (!$field) {
         $field = $fieldContainerOrLabel->getParent()->getParent()->find('css', 'div.field-input input');
     }
     if (!$field) {
         $field = $fieldContainerOrLabel->getParent()->find('css', 'div.controls input');
     }
     $field->setValue($value);
     $this->getSession()->executeScript('$(\'.field-input input[type="text"]\').trigger(\'change\');');
 }
开发者ID:mm999,项目名称:pim-community-dev,代码行数:19,代码来源:ProductEditForm.php

示例11: fillTextField

 /**
  * Fills a text field element with $value, identified by its container or label.
  *
  * @param NodeElement $fieldContainerOrLabel
  * @param string      $value
  *
  * @throws ElementNotFoundException
  */
 protected function fillTextField(NodeElement $fieldContainerOrLabel, $value)
 {
     $field = $fieldContainerOrLabel->find('css', 'div.field-input input');
     // no field found, we're using a label
     if (!$field) {
         $field = $fieldContainerOrLabel->getParent()->getParent()->find('css', 'div.field-input input');
     }
     if (!$field) {
         $field = $fieldContainerOrLabel->getParent()->find('css', 'div.controls input');
     }
     if (null === $field) {
         throw new ElementNotFoundException(sprintf('No text field can be found from "%s".', $fieldContainerOrLabel->getText()));
     }
     $field->setValue($value);
     $this->getSession()->executeScript('$(\'.field-input input[type="text"]\').trigger(\'change\');');
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:24,代码来源:ProductEditForm.php

示例12: get_field_node_type

 /**
  * Recursive method to find the field type.
  *
  * Depending on the field the felement class node is in a level or in another. We
  * look recursively for a parent node with a 'felement' class to find the field type.
  *
  * @param NodeElement $fieldnode The current node.
  * @param Session $session The behat browser session
  * @return mixed A NodeElement if we continue looking for the element type and String or false when we are done.
  */
 protected static function get_field_node_type(NodeElement $fieldnode, Session $session)
 {
     // Special handling for availability field which requires custom JavaScript.
     if ($fieldnode->getAttribute('name') === 'availabilityconditionsjson') {
         return 'availability';
     }
     // We look for a parent node with 'felement' class.
     if ($class = $fieldnode->getParent()->getAttribute('class')) {
         if (strstr($class, 'felement') != false) {
             // Remove 'felement f' from class value.
             return substr($class, 10);
         }
         // Stop propagation through the DOM, if it does not have a felement is not part of a moodle form.
         if (strstr($class, 'fcontainer') != false) {
             return false;
         }
     }
     return self::get_field_node_type($fieldnode->getParent(), $session);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:29,代码来源:behat_field_manager.php


注:本文中的Behat\Mink\Element\NodeElement::getParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。