Add first element to getElementsInfo() tests
Showing
1 changed file
with
30 additions
and
14 deletions
... | @@ -162,22 +162,38 @@ casper.test.begin('ClientUtils.getElementInfo() tests', 10, function(test) { | ... | @@ -162,22 +162,38 @@ casper.test.begin('ClientUtils.getElementInfo() tests', 10, function(test) { |
162 | test.done(); | 162 | test.done(); |
163 | }); | 163 | }); |
164 | 164 | ||
165 | casper.test.begin('ClientUtils.getElementsInfo() tests', 10, function(test) { | 165 | casper.test.begin('ClientUtils.getElementsInfo() tests', 20, function(test) { |
166 | casper.page.content = '<a href="plop" class="plip plup"><i>paf</i></a><a href="plap" class="plip plup"><i>puf</i></a>'; | 166 | casper.page.content = '<a href="plop" class="plip plup"><i>paf</i></a><a href="plap" class="plip plup"><i>puf</i></a>'; |
167 | var info = casper.getElementsInfo('a.plip')[1]; | 167 | var info = casper.getElementsInfo('a.plip'); |
168 | test.assertEquals(info.nodeName, 'a', 'ClientUtils.getElementsInfo() retrieves element name'); | 168 | |
169 | test.assertEquals(info.attributes, { | 169 | test.assertEquals(info[0].nodeName, 'a', 'ClientUtils.getElementsInfo() retrieves first element name'); |
170 | test.assertEquals(info[0].attributes, { | ||
171 | 'href': 'plop', | ||
172 | 'class': 'plip plup' | ||
173 | }, 'ClientUtils.getElementsInfo() retrieves first element attributes'); | ||
174 | test.assertEquals(info[0].html, '<i>paf</i>', 'ClientUtils.getElementsInfo() retrieves first element html content'); | ||
175 | test.assertEquals(info[0].text, 'paf', 'ClientUtils.getElementsInfo() retrieves first element text'); | ||
176 | test.assert(info[0].x > 0, 'ClientUtils.getElementsInfo() retrieves first element x pos'); | ||
177 | test.assert(info[0].y > 0, 'ClientUtils.getElementsInfo() retrieves first element y pos'); | ||
178 | test.assert(info[0].width > 0, 'ClientUtils.getElementsInfo() retrieves first element width'); | ||
179 | test.assert(info[0].height > 0, 'ClientUtils.getElementsInfo() retrieves first element height'); | ||
180 | test.assert(info[0].visible, 'ClientUtils.getElementsInfo() retrieves first element visibility'); | ||
181 | test.assertEquals(info[0].tag, '<a href="plop" class="plip plup"><i>paf</i></a>', | ||
182 | 'ClientUtils.getElementsInfo() retrieves first element whole tag contents'); | ||
183 | |||
184 | test.assertEquals(info[1].nodeName, 'a', 'ClientUtils.getElementsInfo() retrieves second element name'); | ||
185 | test.assertEquals(info[1].attributes, { | ||
170 | 'href': 'plap', | 186 | 'href': 'plap', |
171 | 'class': 'plip plup' | 187 | 'class': 'plip plup' |
172 | }, 'ClientUtils.getElementsInfo() retrieves element attributes'); | 188 | }, 'ClientUtils.getElementsInfo() retrieves second element attributes'); |
173 | test.assertEquals(info.html, '<i>puf</i>', 'ClientUtils.getElementsInfo() retrieves element html content'); | 189 | test.assertEquals(info[1].html, '<i>puf</i>', 'ClientUtils.getElementsInfo() retrieves second element html content'); |
174 | test.assertEquals(info.text, 'puf', 'ClientUtils.getElementsInfo() retrieves element text'); | 190 | test.assertEquals(info[1].text, 'puf', 'ClientUtils.getElementsInfo() retrieves second element text'); |
175 | test.assert(info.x > 0, 'ClientUtils.getElementsInfo() retrieves element x pos'); | 191 | test.assert(info[1].x > 0, 'ClientUtils.getElementsInfo() retrieves second element x pos'); |
176 | test.assert(info.y > 0, 'ClientUtils.getElementsInfo() retrieves element y pos'); | 192 | test.assert(info[1].y > 0, 'ClientUtils.getElementsInfo() retrieves second element y pos'); |
177 | test.assert(info.width > 0, 'ClientUtils.getElementsInfo() retrieves element width'); | 193 | test.assert(info[1].width > 0, 'ClientUtils.getElementsInfo() retrieves second element width'); |
178 | test.assert(info.height > 0, 'ClientUtils.getElementsInfo() retrieves element height'); | 194 | test.assert(info[1].height > 0, 'ClientUtils.getElementsInfo() retrieves second element height'); |
179 | test.assert(info.visible, 'ClientUtils.getElementsInfo() retrieves element visibility'); | 195 | test.assert(info[1].visible, 'ClientUtils.getElementsInfo() retrieves second element visibility'); |
180 | test.assertEquals(info.tag, '<a href="plap" class="plip plup"><i>puf</i></a>', | 196 | test.assertEquals(info[1].tag, '<a href="plap" class="plip plup"><i>puf</i></a>', |
181 | 'ClientUtils.getElementsInfo() retrieves element whole tag contents'); | 197 | 'ClientUtils.getElementsInfo() retrieves second element whole tag contents'); |
182 | test.done(); | 198 | test.done(); |
183 | }); | 199 | }); | ... | ... |
-
Please register or sign in to post a comment