X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fjcalderonzumba%2Fgastonjs%2Ftests%2Funit%2FBrowserElementAttributesTest.php;fp=vendor%2Fjcalderonzumba%2Fgastonjs%2Ftests%2Funit%2FBrowserElementAttributesTest.php;h=504392d9a6f61fe4ff726f635d6f11af88ec7a46;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/jcalderonzumba/gastonjs/tests/unit/BrowserElementAttributesTest.php b/vendor/jcalderonzumba/gastonjs/tests/unit/BrowserElementAttributesTest.php new file mode 100644 index 000000000..504392d9a --- /dev/null +++ b/vendor/jcalderonzumba/gastonjs/tests/unit/BrowserElementAttributesTest.php @@ -0,0 +1,44 @@ +visitUrl($this->getTestPageBaseUrl() . "/test/standard_form/form.html"); + $this->browser->find("xpath", '//*[@id="element_3"]'); + $attributes = $this->browser->attributes(1, 0); + $this->assertCount(3, $attributes); + $this->assertArraySubset(array("class" => "element select medium", "id" => "element_3", "name" => "element_3"), $attributes); + } + + public function testAttribute() { + $this->testAttributes(); + $this->assertEquals("element select medium", $this->browser->attribute(1, 0, "class")); + $this->assertEquals("element_3", $this->browser->attribute(1, 0, "id")); + $this->assertEquals("element_3", $this->browser->attribute(1, 0, "name")); + } + + public function testSetAttribute() { + $this->testAttributes(); + $this->assertTrue($this->browser->setAttribute(1, 0, "class", "element select")); + $attributes = $this->browser->attributes(1, 0); + $this->assertCount(3, $attributes); + $this->assertArraySubset(array("class" => "element select", "id" => "element_3", "name" => "element_3"), $attributes); + } + + public function testRemoveAttribute(){ + $this->testAttributes(); + $this->assertTrue($this->browser->removeAttribute(1, 0, "THIS_DOES_NOT_EXISTS")); + $this->assertTrue($this->browser->removeAttribute(1, 0, "class")); + $attributes = $this->browser->attributes(1, 0); + $this->assertCount(2, $attributes); + $this->assertArraySubset(array("id" => "element_3", "name" => "element_3"), $attributes); + } + +}