public function testHasClass()
 {
     $node = new NodeElement('input_tag', $this->session);
     $this->session->getDriver()->expects($this->exactly(6))->method('getAttribute')->with('input_tag', 'class')->will($this->returnValue('class1 class2'));
     $this->assertTrue($node->hasClass('class1'));
     $this->assertTrue($node->hasClass('class2'));
     $this->assertFalse($node->hasClass('class3'));
 }
 public function __construct(NodeElement $node, Session $session)
 {
     if (!$node->hasClass(self::NOTICE_CLASS)) {
         throw new \InvalidArgumentException(sprintf('Provided node does not have class %s', self::NOTICE_CLASS));
     }
     parent::__construct($node->getXpath(), $session);
 }
Example #3
0
 public function testHasClassWithoutArgument()
 {
     $node = new NodeElement('input_tag', $this->session);
     $this->driver->expects($this->once())->method('getAttribute')->with('input_tag', 'class')->will($this->returnValue(null));
     $this->assertFalse($node->hasClass('class3'));
 }
Example #4
0
 /**
  * @param NodeElement $element
  *
  * @return NodeElement
  *
  * @throws ElementNotFoundException
  */
 private function getValidatedField(NodeElement $element)
 {
     while (null !== $element && !$element->hasClass('field')) {
         $element = $element->getParent();
     }
     return $element;
 }