3 namespace Zumba\GastonJS\Tests;
7 * Class BrowserElementAttributesTest
8 * @package Zumba\GastonJS\Tests
10 class BrowserElementAttributesTest extends BrowserCommandsTestCase {
12 public function testAttributes() {
13 $this->visitUrl($this->getTestPageBaseUrl() . "/test/standard_form/form.html");
14 $this->browser->find("xpath", '//*[@id="element_3"]');
15 $attributes = $this->browser->attributes(1, 0);
16 $this->assertCount(3, $attributes);
17 $this->assertArraySubset(array("class" => "element select medium", "id" => "element_3", "name" => "element_3"), $attributes);
20 public function testAttribute() {
21 $this->testAttributes();
22 $this->assertEquals("element select medium", $this->browser->attribute(1, 0, "class"));
23 $this->assertEquals("element_3", $this->browser->attribute(1, 0, "id"));
24 $this->assertEquals("element_3", $this->browser->attribute(1, 0, "name"));
27 public function testSetAttribute() {
28 $this->testAttributes();
29 $this->assertTrue($this->browser->setAttribute(1, 0, "class", "element select"));
30 $attributes = $this->browser->attributes(1, 0);
31 $this->assertCount(3, $attributes);
32 $this->assertArraySubset(array("class" => "element select", "id" => "element_3", "name" => "element_3"), $attributes);
35 public function testRemoveAttribute(){
36 $this->testAttributes();
37 $this->assertTrue($this->browser->removeAttribute(1, 0, "THIS_DOES_NOT_EXISTS"));
38 $this->assertTrue($this->browser->removeAttribute(1, 0, "class"));
39 $attributes = $this->browser->attributes(1, 0);
40 $this->assertCount(2, $attributes);
41 $this->assertArraySubset(array("id" => "element_3", "name" => "element_3"), $attributes);