Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: polymer_1.2.3/bower_components/iron-fit-behavior/test/iron-fit-behavior.html

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <!-- 2 <!--
3 @license 3 @license
4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
5 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 5 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
8 Code distributed by Google as part of the polymer project is also 8 Code distributed by Google as part of the polymer project is also
9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
10 --> 10 -->
11 <html> 11 <html>
12 <head> 12 <head>
13 13
14 <title>iron-fit-behavior tests</title> 14 <title>iron-fit-behavior tests</title>
15 15
16 <meta charset="utf-8"> 16 <meta charset="utf-8">
17 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 17 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
18 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initia l-scale=1, user-scalable=yes"> 18 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initia l-scale=1, user-scalable=yes">
19 19
20 <script src="../../webcomponentsjs/webcomponents.js"></script> 20 <script src="../../webcomponentsjs/webcomponents.js"></script>
21 21
22 <script src="../../web-component-tester/browser.js"></script> 22 <script src="../../web-component-tester/browser.js"></script>
23 <script src="../../test-fixture/test-fixture-mocha.js"></script>
24
25 <link rel="import" href="../../test-fixture/test-fixture.html">
26 <link rel="import" href="test-fit.html"> 23 <link rel="import" href="test-fit.html">
27 24
28 <style> 25 <style>
29 body { 26 body {
30 margin: 0; 27 margin: 0;
31 padding: 0; 28 padding: 0;
32 } 29 }
33 30
34 .absolute { 31 .absolute {
35 position: absolute; 32 position: absolute;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 <div> 129 <div>
133 Sized (x), auto center/center with scrolling section 130 Sized (x), auto center/center with scrolling section
134 </div> 131 </div>
135 <div class="internal"></div> 132 <div class="internal"></div>
136 </test-fit> 133 </test-fit>
137 </template> 134 </template>
138 </test-fixture> 135 </test-fixture>
139 136
140 <test-fixture id="constrain-target"> 137 <test-fixture id="constrain-target">
141 <template> 138 <template>
142 <div class="constrain" style="position: fixed; top: 0; left: 0; width: 5 0vw; height: 50vh; border: 1px solid black;"> 139 <div class="constrain" style="position: fixed; top: 20px; left: 100px; w idth: 50vw; height: 50vh; border: 1px solid black;">
143 <test-fit auto-fit-on-attach class="el"> 140 <test-fit auto-fit-on-attach class="el">
144 <div> 141 <div>
145 Auto center/center to parent element 142 Auto center/center to parent element
146 </div> 143 </div>
147 </test-fit> 144 </test-fit>
148 </div> 145 </div>
149 </template> 146 </template>
150 </test-fixture> 147 </test-fixture>
151 148
149 <test-fixture id="offscreen-container">
150 <template>
151 <div style="position: fixed; top: -1px; left: 0;">
152 <test-fit auto-fit-on-attach class="el sized-x">
153 <div>
154 Sized (x), auto center/center, container is offscreen
155 </div>
156 </test-fit>
157 </div>
158 </template>
159 </test-fixture>
160
152 <template id="ipsum"> 161 <template id="ipsum">
153 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, qu is nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> 162 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, qu is nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
154 </template> 163 </template>
155 164
156 <script> 165 <script>
157 166
158 function makeScrolling(el) { 167 function makeScrolling(el) {
159 el.classList.add('scrolling'); 168 el.classList.add('scrolling');
160 var template = document.getElementById('ipsum'); 169 var template = document.getElementById('ipsum');
161 for (var i = 0; i < 20; i++) { 170 for (var i = 0; i < 20; i++) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 }); 233 });
225 234
226 test('scrolling element is constrained to viewport height', function() { 235 test('scrolling element is constrained to viewport height', function() {
227 var el = fixture('sized-x'); 236 var el = fixture('sized-x');
228 makeScrolling(el); 237 makeScrolling(el);
229 el.refit(); 238 el.refit();
230 var rect = el.getBoundingClientRect(); 239 var rect = el.getBoundingClientRect();
231 assert.isTrue(rect.height <= window.innerHeight, 'height is less than or equal to viewport height'); 240 assert.isTrue(rect.height <= window.innerHeight, 'height is less than or equal to viewport height');
232 }); 241 });
233 242
243 test('scrolling element with offscreen container is constrained to viewp ort height', function() {
244 var container = fixture('offscreen-container');
245 var el = Polymer.dom(container).querySelector('.el')
246 makeScrolling(el);
247 el.refit();
248 var rect = el.getBoundingClientRect();
249 assert.isTrue(rect.height <= window.innerHeight, 'height is less than or equal to viewport height');
250 });
251
234 test('scrolling element with max-height is centered in viewport', functi on() { 252 test('scrolling element with max-height is centered in viewport', functi on() {
235 var el = fixture('sized-x'); 253 var el = fixture('sized-x');
236 el.classList.add('with-max-height'); 254 el.classList.add('with-max-height');
237 makeScrolling(el); 255 makeScrolling(el);
238 el.refit(); 256 el.refit();
239 var rect = el.getBoundingClientRect(); 257 var rect = el.getBoundingClientRect();
240 assert.closeTo(rect.left - (window.innerWidth - rect.right), 0, 5, 'ce ntered horizontally'); 258 assert.closeTo(rect.left - (window.innerWidth - rect.right), 0, 5, 'ce ntered horizontally');
241 assert.closeTo(rect.top - (window.innerHeight - rect.bottom), 0, 5, 'c entered vertically'); 259 assert.closeTo(rect.top - (window.innerHeight - rect.bottom), 0, 5, 'c entered vertically');
242 }); 260 });
243 261
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 var el = Polymer.dom(constrain).querySelector('.el') 342 var el = Polymer.dom(constrain).querySelector('.el')
325 makeScrolling(el); 343 makeScrolling(el);
326 el.fitInto = constrain; 344 el.fitInto = constrain;
327 el.refit(); 345 el.refit();
328 var rect = el.getBoundingClientRect(); 346 var rect = el.getBoundingClientRect();
329 var crect = constrain.getBoundingClientRect(); 347 var crect = constrain.getBoundingClientRect();
330 assert.isTrue(rect.height <= crect.height, 'width is less than or equa l to fitInto width'); 348 assert.isTrue(rect.height <= crect.height, 'width is less than or equa l to fitInto width');
331 assert.isTrue(rect.height <= crect.height, 'height is less than or equ al to fitInto height'); 349 assert.isTrue(rect.height <= crect.height, 'height is less than or equ al to fitInto height');
332 }); 350 });
333 351
352 test('element centers in another element', function() {
353 var constrain = fixture('constrain-target');
354 var el = Polymer.dom(constrain).querySelector('.el')
355 makeScrolling(el);
356 el.fitInto = constrain;
357 el.refit();
358 var rect = el.getBoundingClientRect();
359 var crect = constrain.getBoundingClientRect();
360 assert.closeTo(rect.left - crect.left - (crect.right - rect.right), 0, 5, 'centered horizontally in fitInto');
361 assert.closeTo(rect.top - crect.top - (crect.bottom - rect.bottom), 0, 5, 'centered vertically in fitInto');
362 });
363
334 }); 364 });
335 365
336 </script> 366 </script>
337 367
338 </body> 368 </body>
339 </html> 369 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698