Example #1
0
 public function testHasAttribute()
 {
     $node = new NodeElement('input_tag', $this->session);
     $this->driver->expects($this->exactly(2))->method('getAttribute')->with('input_tag', 'href')->will($this->onConsecutiveCalls(null, 'http://...'));
     $this->assertFalse($node->hasAttribute('href'));
     $this->assertTrue($node->hasAttribute('href'));
 }
Example #2
0
 /**
  * Verifies if the element has 'special' configuration on a attribute (default -> style)
  *
  * @param \Behat\Mink\Element\NodeElement $el The element that we want to test
  * @param string $characteristic Verify a specific characteristic from attribute
  * @param string $attribute Verify a specific attribute
  *
  * @return boolean
  */
 public function isElementEmphasized(NodeElement $el, $characteristic = null, $attribute = "style")
 {
     // verify it has the attribute we're looking for
     if (!$el->hasAttribute($attribute)) {
         return false;
     }
     // get the attribute
     $attr = $el->getAttribute($attribute);
     // check if want to test specific characteristic and if it is present
     if (!empty($characteristic) && strpos($attr, $characteristic) === false) {
         return false;
     }
     // if we're here it is emphasized
     return true;
 }