refs #917 - added capture zoom factor tests
Showing
1 changed file
with
29 additions
and
0 deletions
... | @@ -142,6 +142,35 @@ casper.test.begin('ClientUtils.getElementBounds() tests', 3, function(test) { | ... | @@ -142,6 +142,35 @@ casper.test.begin('ClientUtils.getElementBounds() tests', 3, function(test) { |
142 | }); | 142 | }); |
143 | }); | 143 | }); |
144 | 144 | ||
145 | casper.test.begin('ClientUtils.getElementBounds() page zoom factor tests', 3, function(test) { | ||
146 | casper.start().zoom(2).then(function() { | ||
147 | var html = '<div id="boxes">'; | ||
148 | html += ' <div id="b1" style="position:fixed;top:10px;left:11px;width:50px;height:60px"></div>'; | ||
149 | html += ' <div style="position:fixed;top:20px;left:21px;width:70px;height:80px"></div>'; | ||
150 | html += '</div>'; | ||
151 | this.page.content = html; | ||
152 | test.assertEquals( | ||
153 | this.getElementBounds('#b1'), | ||
154 | { top: 20, left: 22, width: 100, height: 120 }, | ||
155 | 'ClientUtils.getElementBounds() is aware of the page zoom factor' | ||
156 | ); | ||
157 | var bounds = this.getElementsBounds('#boxes div'); | ||
158 | test.assertEquals( | ||
159 | bounds[0], | ||
160 | { top: 20, left: 22, width: 100, height: 120 }, | ||
161 | 'ClientUtils.getElementsBounds() is aware of the page zoom factor' | ||
162 | ); | ||
163 | test.assertEquals( | ||
164 | bounds[1], | ||
165 | { top: 40, left: 42, width: 140, height: 160 }, | ||
166 | 'ClientUtils.getElementsBounds() is aware of the page zoom factor' | ||
167 | ); | ||
168 | }); | ||
169 | casper.run(function() { | ||
170 | test.done(); | ||
171 | }); | ||
172 | }); | ||
173 | |||
145 | casper.test.begin('ClientUtils.getElementInfo() tests', 10, function(test) { | 174 | casper.test.begin('ClientUtils.getElementInfo() tests', 10, function(test) { |
146 | casper.page.content = '<a href="plop" class="plip plup"><i>paf</i></a>'; | 175 | casper.page.content = '<a href="plop" class="plip plup"><i>paf</i></a>'; |
147 | var info = casper.getElementInfo('a.plip'); | 176 | var info = casper.getElementInfo('a.plip'); | ... | ... |
-
Please register or sign in to post a comment