]> git.proxmox.com Git - extjs.git/blame - extjs/classic/classic/test/specs/layout/container/Center.js
add extjs 6.0.1 sources
[extjs.git] / extjs / classic / classic / test / specs / layout / container / Center.js
CommitLineData
6527f429
DM
1describe("Ext.layout.container.Center", function() {\r
2\r
3 var ct, item;\r
4\r
5 afterEach(function() {\r
6 item = ct = Ext.destroy(ct);\r
7 });\r
8\r
9 function makeCt(cfg) {\r
10 ct = new Ext.container.Container(Ext.apply({\r
11 renderTo: Ext.getBody(),\r
12 defaultType: 'component',\r
13 layout: 'center'\r
14 }, cfg));\r
15 item = ct.items.getAt(0);\r
16 }\r
17\r
18 function expectResult(w, h, left, top, ctWidth, ctHeight) {\r
19 var pos = item.getEl().getStyle(['left', 'top']);\r
20 expect(item.getWidth()).toBe(w);\r
21 expect(item.getHeight()).toBe(h);\r
22 expect(parseInt(pos.left, 10)).toBe(left);\r
23 expect(parseInt(pos.top, 10)).toBe(top);\r
24 expect(ct.getWidth()).toBe(ctWidth);\r
25 expect(ct.getHeight()).toBe(ctHeight);\r
26 }\r
27\r
28 function makeAutoSizer(w, h) {\r
29 var css = [];\r
30 if (w) {\r
31 css.push('width: ' + w + 'px');\r
32 }\r
33 if (h) {\r
34 css.push('height: ' + h + 'px');\r
35 }\r
36 return '<div style="' + css.join(';') + '"></div>';\r
37 }\r
38\r
39 it("should respect bodyPadding when used as a panel", function() {\r
40 var pad = 20;\r
41\r
42 ct = new Ext.panel.Panel({\r
43 width: 400,\r
44 height: 400,\r
45 renderTo: Ext.getBody(),\r
46 layout: 'center',\r
47 bodyPadding: pad,\r
48 border: false,\r
49 items: {\r
50 xtype: 'component',\r
51 width: '100%',\r
52 height: '100%'\r
53 }\r
54 });\r
55\r
56 item = ct.items.getAt(0);\r
57\r
58 expect(item.getX() - ct.getX()).toBe(pad);\r
59 expect(item.getY() - ct.getY()).toBe(pad);\r
60 });\r
61\r
62 describe("container: fixed width, fixed height", function() {\r
63 function makeSuiteCt(item) {\r
64 makeCt({\r
65 width: 400,\r
66 height: 400,\r
67 items: item\r
68 });\r
69 }\r
70\r
71 function expectSuiteResult(w, h, left, top) {\r
72 // Ct size is static\r
73 expectResult(w, h, left, top, 400, 400);\r
74 }\r
75\r
76 describe("component: fixed width", function() {\r
77 describe("fixed height", function() {\r
78 it("should center the item", function() {\r
79 makeSuiteCt({\r
80 width: 200,\r
81 height: 200\r
82 });\r
83 expectSuiteResult(200, 200, 100, 100);\r
84 });\r
85\r
86 it("should take margins into account", function() {\r
87 makeSuiteCt({\r
88 width: 200,\r
89 height: 200,\r
90 margin: '20 30'\r
91 });\r
92 expectSuiteResult(200, 200, 70, 80);\r
93 });\r
94 });\r
95\r
96 describe("calculated height", function() {\r
97 it("should center the item", function() {\r
98 makeSuiteCt({\r
99 width: 200,\r
100 height: '40%'\r
101 });\r
102 expectSuiteResult(200, 160, 100, 120);\r
103 });\r
104\r
105 it("should take margins into account", function() {\r
106 makeSuiteCt({\r
107 width: 200,\r
108 height: '40%',\r
109 margin: '20 30'\r
110 });\r
111 expectSuiteResult(200, 144, 70, 128);\r
112 });\r
113\r
114 describe("constraints", function() {\r
115 it("should take minHeight into account", function() {\r
116 makeSuiteCt({\r
117 width: 200,\r
118 height: '10%',\r
119 minHeight: 300\r
120 });\r
121 expectSuiteResult(200, 300, 100, 50);\r
122 });\r
123\r
124 it("should take maxHeight into account", function() {\r
125 makeSuiteCt({\r
126 width: 200,\r
127 height: '80%',\r
128 maxHeight: 100\r
129 });\r
130 expectSuiteResult(200, 100, 100, 150);\r
131 });\r
132 });\r
133 });\r
134\r
135 describe("auto height", function() {\r
136 it("should center the item", function() {\r
137 makeSuiteCt({\r
138 width: 200,\r
139 html: makeAutoSizer(null, 50)\r
140 });\r
141 expectSuiteResult(200, 50, 100, 175);\r
142 });\r
143\r
144 it("should take margins into account", function() {\r
145 makeSuiteCt({\r
146 width: 200,\r
147 html: makeAutoSizer(null, 50),\r
148 margin: '20 30'\r
149 });\r
150 expectSuiteResult(200, 50, 70, 155);\r
151 });\r
152\r
153 describe("constraints", function() {\r
154 it("should take minHeight into account", function() {\r
155 makeSuiteCt({\r
156 width: 200,\r
157 html: makeAutoSizer(null, 50),\r
158 minHeight: 300\r
159 });\r
160 expectSuiteResult(200, 300, 100, 50);\r
161 });\r
162\r
163 it("should take maxHeight into account", function() {\r
164 makeSuiteCt({\r
165 width: 200,\r
166 html: makeAutoSizer(null, 300),\r
167 maxHeight: 100\r
168 });\r
169 expectSuiteResult(200, 100, 100, 150);\r
170 });\r
171 });\r
172 });\r
173 });\r
174\r
175 describe("component: calculated width", function() {\r
176 describe("fixed height", function() {\r
177 it("should center the item", function() {\r
178 makeSuiteCt({\r
179 width: '80%',\r
180 height: 200\r
181 });\r
182 expectSuiteResult(320, 200, 40, 100);\r
183 });\r
184\r
185 it("should take margins into account", function() {\r
186 makeSuiteCt({\r
187 width: '80%',\r
188 height: 200,\r
189 margin: '20 30'\r
190 });\r
191 expectSuiteResult(272, 200, 64, 80);\r
192 });\r
193\r
194 describe("constraints", function() {\r
195 it("should take minWidth into account", function() {\r
196 makeSuiteCt({\r
197 width: '10%',\r
198 minWidth: 320,\r
199 height: 200\r
200 });\r
201 expectSuiteResult(320, 200, 40, 100);\r
202 });\r
203\r
204 it("should take maxWidth into account", function() {\r
205 makeSuiteCt({\r
206 width: '80%',\r
207 maxWidth: 100,\r
208 height: 200\r
209 });\r
210 expectSuiteResult(100, 200, 150, 100);\r
211 });\r
212 });\r
213 });\r
214\r
215 describe("calculated height", function() {\r
216 it("should center the item", function() {\r
217 makeSuiteCt({\r
218 width: '80%',\r
219 height: '40%'\r
220 });\r
221 expectSuiteResult(320, 160, 40, 120);\r
222 });\r
223\r
224 it("should take margins into account", function() {\r
225 makeSuiteCt({\r
226 width: '80%',\r
227 height: '40%',\r
228 margin: '20 30'\r
229 });\r
230 expectSuiteResult(272, 144, 64, 128);\r
231 });\r
232\r
233 describe("constraints", function() {\r
234 it("should take minHeight into account", function() {\r
235 makeSuiteCt({\r
236 width: '80%',\r
237 height: '40%',\r
238 minHeight: 300\r
239 });\r
240 expectSuiteResult(320, 300, 40, 50);\r
241 });\r
242\r
243 it("should take maxHeight into account", function() {\r
244 makeSuiteCt({\r
245 width: '80%',\r
246 height: '40%',\r
247 maxHeight: 50\r
248 });\r
249 expectSuiteResult(320, 50, 40, 175);\r
250 });\r
251\r
252 it("should take minWidth into account", function() {\r
253 makeSuiteCt({\r
254 width: '80%',\r
255 height: '40%',\r
256 minWidth: 350\r
257 });\r
258 expectSuiteResult(350, 160, 25, 120);\r
259 });\r
260\r
261 it("should take maxWidth into account", function() {\r
262 makeSuiteCt({\r
263 width: '80%',\r
264 height: '40%',\r
265 maxWidth: 100\r
266 });\r
267 expectSuiteResult(100, 160, 150, 120);\r
268 });\r
269 });\r
270 });\r
271\r
272 describe("auto height", function() {\r
273 it("should center the item", function() {\r
274 makeSuiteCt({\r
275 width: '80%',\r
276 html: makeAutoSizer(null, 100)\r
277 });\r
278 expectSuiteResult(320, 100, 40, 150);\r
279 });\r
280\r
281 it("should take margins into account", function() {\r
282 makeSuiteCt({\r
283 width: '80%',\r
284 html: makeAutoSizer(null, 100),\r
285 margin: '20 30'\r
286 });\r
287 expectSuiteResult(272, 100, 64, 130);\r
288 });\r
289\r
290 describe("constraints", function() {\r
291 it("should take minHeight into account", function() {\r
292 makeSuiteCt({\r
293 width: '80%',\r
294 html: makeAutoSizer(null, 100),\r
295 minHeight: 300\r
296 });\r
297 expectSuiteResult(320, 300, 40, 50);\r
298 });\r
299\r
300 it("should take maxHeight into account", function() {\r
301 makeSuiteCt({\r
302 width: '80%',\r
303 html: makeAutoSizer(null, 350),\r
304 maxHeight: 300\r
305 });\r
306 expectSuiteResult(320, 300, 40, 50);\r
307 });\r
308\r
309 it("should take minWidth into account", function() {\r
310 makeSuiteCt({\r
311 width: '80%',\r
312 html: makeAutoSizer(null, 100),\r
313 minWidth: 350\r
314 });\r
315 expectSuiteResult(350, 100, 25, 150);\r
316 });\r
317\r
318 it("should take maxWidth into account", function() {\r
319 makeSuiteCt({\r
320 width: '80%',\r
321 html: makeAutoSizer(null, 100),\r
322 maxWidth: 100\r
323 });\r
324 expectSuiteResult(100, 100, 150, 150);\r
325 });\r
326 });\r
327 });\r
328 });\r
329\r
330 describe("component: auto width", function() {\r
331 describe("fixed height", function() {\r
332 it("should center the item", function() {\r
333 makeSuiteCt({\r
334 html: makeAutoSizer(200),\r
335 height: 200\r
336 });\r
337 expectSuiteResult(200, 200, 100, 100);\r
338 });\r
339\r
340 it("should take margins into account", function() {\r
341 makeSuiteCt({\r
342 html: makeAutoSizer(200),\r
343 height: 200,\r
344 margin: '20 30'\r
345 });\r
346 expectSuiteResult(200, 200, 70, 80);\r
347 });\r
348\r
349 describe("constraints", function() {\r
350 it("should take minWidth into account", function() {\r
351 makeSuiteCt({\r
352 html: makeAutoSizer(200),\r
353 height: 200,\r
354 minWidth: 300\r
355 });\r
356 expectSuiteResult(300, 200, 50, 100);\r
357 });\r
358\r
359 it("should take maxWidth into account", function() {\r
360 makeSuiteCt({\r
361 html: makeAutoSizer(200),\r
362 height: 200,\r
363 maxWidth: 100\r
364 });\r
365 expectSuiteResult(100, 200, 150, 100);\r
366 });\r
367 });\r
368 });\r
369\r
370 describe("calculated height", function() {\r
371 it("should center the item", function() {\r
372 makeSuiteCt({\r
373 html: makeAutoSizer(200),\r
374 height: '40%'\r
375 });\r
376 expectSuiteResult(200, 160, 100, 120);\r
377 });\r
378\r
379 it("should take margins into account", function() {\r
380 makeSuiteCt({\r
381 html: makeAutoSizer(200),\r
382 height: '40%',\r
383 margin: '20 30'\r
384 });\r
385 expectSuiteResult(200, 144, 70, 128);\r
386 });\r
387\r
388 describe("constraints", function() {\r
389 it("should take minHeight into account", function() {\r
390 makeSuiteCt({\r
391 html: makeAutoSizer(200),\r
392 height: '40%',\r
393 minHeight: 300\r
394 });\r
395 expectSuiteResult(200, 300, 100, 50);\r
396 });\r
397\r
398 it("should take maxHeight into account", function() {\r
399 makeSuiteCt({\r
400 html: makeAutoSizer(200),\r
401 height: '40%',\r
402 maxHeight: 50\r
403 });\r
404 expectSuiteResult(200, 50, 100, 175);\r
405 });\r
406\r
407 it("should take minWidth into account", function() {\r
408 makeSuiteCt({\r
409 html: makeAutoSizer(200),\r
410 height: '40%',\r
411 minWidth: 300\r
412 });\r
413 expectSuiteResult(300, 160, 50, 120);\r
414 });\r
415\r
416 it("should take maxWidth into account", function() {\r
417 makeSuiteCt({\r
418 html: makeAutoSizer(200),\r
419 height: '40%',\r
420 maxWidth: 100\r
421 });\r
422 expectSuiteResult(100, 160, 150, 120);\r
423 });\r
424 });\r
425 });\r
426\r
427 describe("auto height", function() {\r
428 it("should center the item", function() {\r
429 makeSuiteCt({\r
430 html: makeAutoSizer(200, 100)\r
431 });\r
432 expectSuiteResult(200, 100, 100, 150);\r
433 });\r
434\r
435 it("should take margins into account", function() {\r
436 makeSuiteCt({\r
437 html: makeAutoSizer(200, 100),\r
438 margin: '20 30'\r
439 });\r
440 expectSuiteResult(200, 100, 70, 130);\r
441 });\r
442\r
443 describe("constraints", function() {\r
444 it("should take minHeight into account", function() {\r
445 makeSuiteCt({\r
446 html: makeAutoSizer(200, 100),\r
447 minHeight: 300\r
448 });\r
449 expectSuiteResult(200, 300, 100, 50);\r
450 });\r
451\r
452 it("should take maxHeight into account", function() {\r
453 makeSuiteCt({\r
454 html: makeAutoSizer(200, 100),\r
455 maxHeight: 50\r
456 });\r
457 expectSuiteResult(200, 50, 100, 175);\r
458 });\r
459\r
460 it("should take minWidth into account", function() {\r
461 makeSuiteCt({\r
462 html: makeAutoSizer(200, 100),\r
463 minWidth: 300\r
464 });\r
465 expectSuiteResult(300, 100, 50, 150);\r
466 });\r
467\r
468 it("should take maxWidth into account", function() {\r
469 makeSuiteCt({\r
470 html: makeAutoSizer(200, 100),\r
471 maxWidth: 100\r
472 });\r
473 expectSuiteResult(100, 100, 150, 150);\r
474 });\r
475 });\r
476 });\r
477 });\r
478 });\r
479\r
480 describe("container: fixed width, auto height", function() {\r
481 function makeSuiteCt(item) {\r
482 makeCt({\r
483 width: 400,\r
484 items: item\r
485 });\r
486 }\r
487\r
488 function expectSuiteResult(w, h, left, ctHeight) {\r
489 // Top of the item & ctWidth are static\r
490 expectResult(w, h, left, 0, 400, ctHeight);\r
491 }\r
492\r
493 describe("component: fixed width", function() {\r
494 describe("fixed height", function() {\r
495 it("should center the item", function() {\r
496 makeSuiteCt({\r
497 width: 200,\r
498 height: 200\r
499 });\r
500 expectSuiteResult(200, 200, 100, 200);\r
501 });\r
502\r
503 it("should take margins into account", function() {\r
504 makeSuiteCt({\r
505 width: 200,\r
506 height: 200,\r
507 margin: '20 30'\r
508 });\r
509 expectSuiteResult(200, 200, 70, 240);\r
510 });\r
511 });\r
512\r
513 describe("calculated height", function() {\r
514 it("should center the item", function() {\r
515 makeSuiteCt({\r
516 width: 200,\r
517 height: '40%'\r
518 });\r
519 expectSuiteResult(200, 0, 100, 0);\r
520 });\r
521\r
522 it("should take margins into account", function() {\r
523 makeSuiteCt({\r
524 width: 200,\r
525 height: '40%',\r
526 margin: '20 30'\r
527 });\r
528 expectSuiteResult(200, 0, 70, 40);\r
529 });\r
530\r
531 describe("constraints", function() {\r
532 it("should take minHeight into account", function() {\r
533 makeSuiteCt({\r
534 width: 200,\r
535 height: '10%',\r
536 minHeight: 300\r
537 });\r
538 expectSuiteResult(200, 300, 100, 300);\r
539 });\r
540\r
541 it("should take maxHeight into account", function() {\r
542 makeSuiteCt({\r
543 width: 200,\r
544 height: '80%',\r
545 maxHeight: 100\r
546 });\r
547 expectSuiteResult(200, 0, 100, 0);\r
548 });\r
549 });\r
550 });\r
551\r
552 describe("auto height", function() {\r
553 it("should center the item", function() {\r
554 makeSuiteCt({\r
555 width: 200,\r
556 html: makeAutoSizer(null, 50)\r
557 });\r
558 expectSuiteResult(200, 50, 100, 50);\r
559 });\r
560\r
561 it("should take margins into account", function() {\r
562 makeSuiteCt({\r
563 width: 200,\r
564 html: makeAutoSizer(null, 50),\r
565 margin: '20 30'\r
566 });\r
567 expectSuiteResult(200, 50, 70, 90);\r
568 });\r
569\r
570 describe("constraints", function() {\r
571 it("should take minHeight into account", function() {\r
572 makeSuiteCt({\r
573 width: 200,\r
574 html: makeAutoSizer(null, 50),\r
575 minHeight: 300\r
576 });\r
577 expectSuiteResult(200, 300, 100, 300);\r
578 });\r
579\r
580 it("should take maxHeight into account", function() {\r
581 makeSuiteCt({\r
582 width: 200,\r
583 html: makeAutoSizer(null, 300),\r
584 maxHeight: 100\r
585 });\r
586 expectSuiteResult(200, 100, 100, 100);\r
587 });\r
588 });\r
589 });\r
590 });\r
591\r
592 describe("component: calculated width", function() {\r
593 describe("fixed height", function() {\r
594 it("should center the item", function() {\r
595 makeSuiteCt({\r
596 width: '80%',\r
597 height: 200\r
598 });\r
599 expectSuiteResult(320, 200, 40, 200);\r
600 });\r
601\r
602 it("should take margins into account", function() {\r
603 makeSuiteCt({\r
604 width: '80%',\r
605 height: 200,\r
606 margin: '20 30'\r
607 });\r
608 expectSuiteResult(272, 200, 64, 240);\r
609 });\r
610\r
611 describe("constraints", function() {\r
612 it("should take minWidth into account", function() {\r
613 makeSuiteCt({\r
614 width: '10%',\r
615 minWidth: 320,\r
616 height: 200\r
617 });\r
618 expectSuiteResult(320, 200, 40, 200);\r
619 });\r
620\r
621 it("should take maxWidth into account", function() {\r
622 makeSuiteCt({\r
623 width: '80%',\r
624 maxWidth: 100,\r
625 height: 200\r
626 });\r
627 expectSuiteResult(100, 200, 150, 200);\r
628 });\r
629 });\r
630 });\r
631\r
632 describe("calculated height", function() {\r
633 it("should center the item", function() {\r
634 makeSuiteCt({\r
635 width: '80%',\r
636 height: '40%'\r
637 });\r
638 expectSuiteResult(320, 0, 40, 0);\r
639 });\r
640\r
641 it("should take margins into account", function() {\r
642 makeSuiteCt({\r
643 width: '80%',\r
644 height: '40%',\r
645 margin: '20 30'\r
646 });\r
647 expectSuiteResult(272, 0, 64, 40);\r
648 });\r
649\r
650 describe("constraints", function() {\r
651 it("should take minHeight into account", function() {\r
652 makeSuiteCt({\r
653 width: '80%',\r
654 height: '40%',\r
655 minHeight: 300\r
656 });\r
657 expectSuiteResult(320, 300, 40, 300);\r
658 });\r
659\r
660 it("should take maxHeight into account", function() {\r
661 makeSuiteCt({\r
662 width: '80%',\r
663 height: '40%',\r
664 maxHeight: 50\r
665 });\r
666 expectSuiteResult(320, 0, 40, 0);\r
667 });\r
668\r
669 it("should take minWidth into account", function() {\r
670 makeSuiteCt({\r
671 width: '80%',\r
672 height: '40%',\r
673 minWidth: 350\r
674 });\r
675 expectSuiteResult(350, 0, 25, 0);\r
676 });\r
677\r
678 it("should take maxWidth into account", function() {\r
679 makeSuiteCt({\r
680 width: '80%',\r
681 height: '40%',\r
682 maxWidth: 100\r
683 });\r
684 expectSuiteResult(100, 0, 150, 0);\r
685 });\r
686 });\r
687 });\r
688\r
689 describe("auto height", function() {\r
690 it("should center the item", function() {\r
691 makeSuiteCt({\r
692 width: '80%',\r
693 html: makeAutoSizer(null, 100)\r
694 });\r
695 expectSuiteResult(320, 100, 40, 100);\r
696 });\r
697\r
698 it("should take margins into account", function() {\r
699 makeSuiteCt({\r
700 width: '80%',\r
701 html: makeAutoSizer(null, 100),\r
702 margin: '20 30'\r
703 });\r
704 expectSuiteResult(272, 100, 64, 140);\r
705 });\r
706\r
707 describe("constraints", function() {\r
708 it("should take minHeight into account", function() {\r
709 makeSuiteCt({\r
710 width: '80%',\r
711 html: makeAutoSizer(null, 100),\r
712 minHeight: 300\r
713 });\r
714 expectSuiteResult(320, 300, 40, 300);\r
715 });\r
716\r
717 it("should take maxHeight into account", function() {\r
718 makeSuiteCt({\r
719 width: '80%',\r
720 html: makeAutoSizer(null, 350),\r
721 maxHeight: 300\r
722 });\r
723 expectSuiteResult(320, 300, 40, 300);\r
724 });\r
725\r
726 it("should take minWidth into account", function() {\r
727 makeSuiteCt({\r
728 width: '80%',\r
729 html: makeAutoSizer(null, 100),\r
730 minWidth: 350\r
731 });\r
732 expectSuiteResult(350, 100, 25, 100);\r
733 });\r
734\r
735 it("should take maxWidth into account", function() {\r
736 makeSuiteCt({\r
737 width: '80%',\r
738 html: makeAutoSizer(null, 100),\r
739 maxWidth: 100\r
740 });\r
741 expectSuiteResult(100, 100, 150, 100);\r
742 });\r
743 });\r
744 });\r
745 });\r
746\r
747 describe("component: auto width", function() {\r
748 describe("fixed height", function() {\r
749 it("should center the item", function() {\r
750 makeSuiteCt({\r
751 html: makeAutoSizer(200),\r
752 height: 200\r
753 });\r
754 expectSuiteResult(200, 200, 100, 200);\r
755 });\r
756\r
757 it("should take margins into account", function() {\r
758 makeSuiteCt({\r
759 html: makeAutoSizer(200),\r
760 height: 200,\r
761 margin: '20 30'\r
762 });\r
763 expectSuiteResult(200, 200, 70, 240);\r
764 });\r
765\r
766 describe("constraints", function() {\r
767 it("should take minWidth into account", function() {\r
768 makeSuiteCt({\r
769 html: makeAutoSizer(200),\r
770 height: 200,\r
771 minWidth: 300\r
772 });\r
773 expectSuiteResult(300, 200, 50, 200);\r
774 });\r
775\r
776 it("should take maxWidth into account", function() {\r
777 makeSuiteCt({\r
778 html: makeAutoSizer(200),\r
779 height: 200,\r
780 maxWidth: 100\r
781 });\r
782 expectSuiteResult(100, 200, 150, 200);\r
783 });\r
784 });\r
785 });\r
786\r
787 describe("calculated height", function() {\r
788 it("should center the item", function() {\r
789 makeSuiteCt({\r
790 html: makeAutoSizer(200),\r
791 height: '40%'\r
792 });\r
793 expectSuiteResult(200, 0, 100, 0);\r
794 });\r
795\r
796 it("should take margins into account", function() {\r
797 makeSuiteCt({\r
798 html: makeAutoSizer(200),\r
799 height: '40%',\r
800 margin: '20 30'\r
801 });\r
802 expectSuiteResult(200, 0, 70, 40);\r
803 });\r
804\r
805 describe("constraints", function() {\r
806 it("should take minHeight into account", function() {\r
807 makeSuiteCt({\r
808 html: makeAutoSizer(200),\r
809 height: '40%',\r
810 minHeight: 300\r
811 });\r
812 expectSuiteResult(200, 300, 100, 300);\r
813 });\r
814\r
815 it("should take maxHeight into account", function() {\r
816 makeSuiteCt({\r
817 html: makeAutoSizer(200),\r
818 height: '40%',\r
819 maxHeight: 50\r
820 });\r
821 expectSuiteResult(200, 0, 100, 0);\r
822 });\r
823\r
824 it("should take minWidth into account", function() {\r
825 makeSuiteCt({\r
826 html: makeAutoSizer(200),\r
827 height: '40%',\r
828 minWidth: 300\r
829 });\r
830 expectSuiteResult(300, 0, 50, 0);\r
831 });\r
832\r
833 it("should take maxWidth into account", function() {\r
834 makeSuiteCt({\r
835 html: makeAutoSizer(200),\r
836 height: '40%',\r
837 maxWidth: 100\r
838 });\r
839 expectSuiteResult(100, 0, 150, 0);\r
840 });\r
841 });\r
842 });\r
843\r
844 describe("auto height", function() {\r
845 it("should center the item", function() {\r
846 makeSuiteCt({\r
847 html: makeAutoSizer(200, 100)\r
848 });\r
849 expectSuiteResult(200, 100, 100, 100);\r
850 });\r
851\r
852 it("should take margins into account", function() {\r
853 makeSuiteCt({\r
854 html: makeAutoSizer(200, 100),\r
855 margin: '20 30'\r
856 });\r
857 expectSuiteResult(200, 100, 70, 140);\r
858 });\r
859\r
860 describe("constraints", function() {\r
861 it("should take minHeight into account", function() {\r
862 makeSuiteCt({\r
863 html: makeAutoSizer(200, 100),\r
864 minHeight: 300\r
865 });\r
866 expectSuiteResult(200, 300, 100, 300);\r
867 });\r
868\r
869 it("should take maxHeight into account", function() {\r
870 makeSuiteCt({\r
871 html: makeAutoSizer(200, 100),\r
872 maxHeight: 50\r
873 });\r
874 expectSuiteResult(200, 50, 100, 50);\r
875 });\r
876\r
877 it("should take minWidth into account", function() {\r
878 makeSuiteCt({\r
879 html: makeAutoSizer(200, 100),\r
880 minWidth: 300\r
881 });\r
882 expectSuiteResult(300, 100, 50, 100);\r
883 });\r
884\r
885 it("should take maxWidth into account", function() {\r
886 makeSuiteCt({\r
887 html: makeAutoSizer(200, 100),\r
888 maxWidth: 100\r
889 });\r
890 expectSuiteResult(100, 100, 150, 100);\r
891 });\r
892 });\r
893 });\r
894 });\r
895 });\r
896\r
897 describe("container: auto width, fixed height", function() {\r
898 function makeSuiteCt(item) {\r
899 makeCt({\r
900 floating: true, // Float the ct so it shrink wraps\r
901 height: 400,\r
902 items: item\r
903 });\r
904 }\r
905\r
906 function expectSuiteResult(w, h, top, ctWidth) {\r
907 // Left of the item & ctHeight are static\r
908 expectResult(w, h, 0, top, ctWidth, 400);\r
909 }\r
910\r
911 describe("component: fixed width", function() {\r
912 describe("fixed height", function() {\r
913 it("should center the item", function() {\r
914 makeSuiteCt({\r
915 width: 200,\r
916 height: 200\r
917 });\r
918 expectSuiteResult(200, 200, 100, 200);\r
919 });\r
920\r
921 it("should take margins into account", function() {\r
922 makeSuiteCt({\r
923 width: 200,\r
924 height: 200,\r
925 margin: '20 30'\r
926 });\r
927 expectSuiteResult(200, 200, 80, 260);\r
928 });\r
929 });\r
930\r
931 describe("calculated height", function() {\r
932 it("should center the item", function() {\r
933 makeSuiteCt({\r
934 width: 200,\r
935 height: '40%'\r
936 });\r
937 expectSuiteResult(200, 160, 120, 200);\r
938 });\r
939\r
940 it("should take margins into account", function() {\r
941 makeSuiteCt({\r
942 width: 200,\r
943 height: '40%',\r
944 margin: '20 30'\r
945 });\r
946 expectSuiteResult(200, 144, 128, 260);\r
947 });\r
948\r
949 describe("constraints", function() {\r
950 it("should take minHeight into account", function() {\r
951 makeSuiteCt({\r
952 width: 200,\r
953 height: '10%',\r
954 minHeight: 300\r
955 });\r
956 expectSuiteResult(200, 300, 50, 200);\r
957 });\r
958\r
959 it("should take maxHeight into account", function() {\r
960 makeSuiteCt({\r
961 width: 200,\r
962 height: '80%',\r
963 maxHeight: 100\r
964 });\r
965 expectSuiteResult(200, 100, 150, 200);\r
966 });\r
967 });\r
968 });\r
969\r
970 describe("auto height", function() {\r
971 it("should center the item", function() {\r
972 makeSuiteCt({\r
973 width: 200,\r
974 html: makeAutoSizer(null, 50)\r
975 });\r
976 expectSuiteResult(200, 50, 175, 200);\r
977 });\r
978\r
979 it("should take margins into account", function() {\r
980 makeSuiteCt({\r
981 width: 200,\r
982 html: makeAutoSizer(null, 50),\r
983 margin: '20 30'\r
984 });\r
985 expectSuiteResult(200, 50, 155, 260);\r
986 });\r
987\r
988 describe("constraints", function() {\r
989 it("should take minHeight into account", function() {\r
990 makeSuiteCt({\r
991 width: 200,\r
992 html: makeAutoSizer(null, 50),\r
993 minHeight: 300\r
994 });\r
995 expectSuiteResult(200, 300, 50, 200);\r
996 });\r
997\r
998 it("should take maxHeight into account", function() {\r
999 makeSuiteCt({\r
1000 width: 200,\r
1001 html: makeAutoSizer(null, 300),\r
1002 maxHeight: 100\r
1003 });\r
1004 expectSuiteResult(200, 100, 150, 200);\r
1005 });\r
1006 });\r
1007 });\r
1008 });\r
1009\r
1010 describe("component: calculated width", function() {\r
1011 describe("fixed height", function() {\r
1012 it("should center the item", function() {\r
1013 makeSuiteCt({\r
1014 width: '80%',\r
1015 height: 200\r
1016 });\r
1017 expectSuiteResult(0, 200, 100, 0);\r
1018 });\r
1019\r
1020 it("should take margins into account", function() {\r
1021 makeSuiteCt({\r
1022 width: '80%',\r
1023 height: 200,\r
1024 margin: '20 30'\r
1025 });\r
1026 expectSuiteResult(0, 200, 80, 60);\r
1027 });\r
1028\r
1029 describe("constraints", function() {\r
1030 it("should take minWidth into account", function() {\r
1031 makeSuiteCt({\r
1032 width: '10%',\r
1033 minWidth: 320,\r
1034 height: 200\r
1035 });\r
1036 expectSuiteResult(320, 200, 100, 320);\r
1037 });\r
1038\r
1039 it("should take maxWidth into account", function() {\r
1040 makeSuiteCt({\r
1041 width: '80%',\r
1042 maxWidth: 100,\r
1043 height: 200\r
1044 });\r
1045 expectSuiteResult(0, 200, 100, 0);\r
1046 });\r
1047 });\r
1048 });\r
1049\r
1050 describe("calculated height", function() {\r
1051 it("should center the item", function() {\r
1052 makeSuiteCt({\r
1053 width: '80%',\r
1054 height: '40%'\r
1055 });\r
1056 expectSuiteResult(0, 160, 120, 0);\r
1057 });\r
1058\r
1059 it("should take margins into account", function() {\r
1060 makeSuiteCt({\r
1061 width: '80%',\r
1062 height: '40%',\r
1063 margin: '20 30'\r
1064 });\r
1065 expectSuiteResult(0, 144, 128, 60);\r
1066 });\r
1067\r
1068 describe("constraints", function() {\r
1069 it("should take minHeight into account", function() {\r
1070 makeSuiteCt({\r
1071 width: '80%',\r
1072 height: '40%',\r
1073 minHeight: 300\r
1074 });\r
1075 expectSuiteResult(0, 300, 50, 0);\r
1076 });\r
1077\r
1078 it("should take maxHeight into account", function() {\r
1079 makeSuiteCt({\r
1080 width: '80%',\r
1081 height: '40%',\r
1082 maxHeight: 50\r
1083 });\r
1084 expectSuiteResult(0, 50, 175, 0);\r
1085 });\r
1086\r
1087 it("should take minWidth into account", function() {\r
1088 makeSuiteCt({\r
1089 width: '80%',\r
1090 height: '40%',\r
1091 minWidth: 350\r
1092 });\r
1093 expectSuiteResult(350, 160, 120, 350);\r
1094 });\r
1095\r
1096 it("should take maxWidth into account", function() {\r
1097 makeSuiteCt({\r
1098 width: '80%',\r
1099 height: '40%',\r
1100 maxWidth: 100\r
1101 });\r
1102 expectSuiteResult(0, 160, 120, 0);\r
1103 });\r
1104 });\r
1105 });\r
1106\r
1107 describe("auto height", function() {\r
1108 it("should center the item", function() {\r
1109 makeSuiteCt({\r
1110 width: '80%',\r
1111 html: makeAutoSizer(null, 100)\r
1112 });\r
1113 expectSuiteResult(0, 100, 150, 0);\r
1114 });\r
1115\r
1116 it("should take margins into account", function() {\r
1117 makeSuiteCt({\r
1118 width: '80%',\r
1119 html: makeAutoSizer(null, 100),\r
1120 margin: '20 30'\r
1121 });\r
1122 expectSuiteResult(0, 100, 130, 60);\r
1123 });\r
1124\r
1125 describe("constraints", function() {\r
1126 it("should take minHeight into account", function() {\r
1127 makeSuiteCt({\r
1128 width: '80%',\r
1129 html: makeAutoSizer(null, 100),\r
1130 minHeight: 300\r
1131 });\r
1132 expectSuiteResult(0, 300, 50, 0);\r
1133 });\r
1134\r
1135 it("should take maxHeight into account", function() {\r
1136 makeSuiteCt({\r
1137 width: '80%',\r
1138 html: makeAutoSizer(null, 350),\r
1139 maxHeight: 300\r
1140 });\r
1141 expectSuiteResult(0, 300, 50, 0);\r
1142 });\r
1143\r
1144 it("should take minWidth into account", function() {\r
1145 makeSuiteCt({\r
1146 width: '80%',\r
1147 html: makeAutoSizer(null, 100),\r
1148 minWidth: 350\r
1149 });\r
1150 expectSuiteResult(350, 100, 150, 350);\r
1151 });\r
1152\r
1153 it("should take maxWidth into account", function() {\r
1154 makeSuiteCt({\r
1155 width: '80%',\r
1156 html: makeAutoSizer(null, 100),\r
1157 maxWidth: 100\r
1158 });\r
1159 expectSuiteResult(0, 100, 150, 0);\r
1160 });\r
1161 });\r
1162 });\r
1163 });\r
1164\r
1165 describe("component: auto width", function() {\r
1166 describe("fixed height", function() {\r
1167 it("should center the item", function() {\r
1168 makeSuiteCt({\r
1169 html: makeAutoSizer(200),\r
1170 height: 200\r
1171 });\r
1172 expectSuiteResult(200, 200, 100, 200);\r
1173 });\r
1174\r
1175 it("should take margins into account", function() {\r
1176 makeSuiteCt({\r
1177 html: makeAutoSizer(200),\r
1178 height: 200,\r
1179 margin: '20 30'\r
1180 });\r
1181 expectSuiteResult(200, 200, 80, 260);\r
1182 });\r
1183\r
1184 describe("constraints", function() {\r
1185 it("should take minWidth into account", function() {\r
1186 makeSuiteCt({\r
1187 html: makeAutoSizer(200),\r
1188 height: 200,\r
1189 minWidth: 300\r
1190 });\r
1191 expectSuiteResult(300, 200, 100, 300);\r
1192 });\r
1193\r
1194 it("should take maxWidth into account", function() {\r
1195 makeSuiteCt({\r
1196 html: makeAutoSizer(200),\r
1197 height: 200,\r
1198 maxWidth: 100\r
1199 });\r
1200 expectSuiteResult(100, 200, 100, 100);\r
1201 });\r
1202 });\r
1203 });\r
1204\r
1205 describe("calculated height", function() {\r
1206 it("should center the item", function() {\r
1207 makeSuiteCt({\r
1208 html: makeAutoSizer(200),\r
1209 height: '40%'\r
1210 });\r
1211 expectSuiteResult(200, 160, 120, 200);\r
1212 });\r
1213\r
1214 it("should take margins into account", function() {\r
1215 makeSuiteCt({\r
1216 html: makeAutoSizer(200),\r
1217 height: '40%',\r
1218 margin: '20 30'\r
1219 });\r
1220 expectSuiteResult(200, 144, 128, 260);\r
1221 });\r
1222\r
1223 describe("constraints", function() {\r
1224 it("should take minHeight into account", function() {\r
1225 makeSuiteCt({\r
1226 html: makeAutoSizer(200),\r
1227 height: '40%',\r
1228 minHeight: 300\r
1229 });\r
1230 expectSuiteResult(200, 300, 50, 200);\r
1231 });\r
1232\r
1233 it("should take maxHeight into account", function() {\r
1234 makeSuiteCt({\r
1235 html: makeAutoSizer(200),\r
1236 height: '40%',\r
1237 maxHeight: 50\r
1238 });\r
1239 expectSuiteResult(200, 50, 175, 200);\r
1240 });\r
1241\r
1242 it("should take minWidth into account", function() {\r
1243 makeSuiteCt({\r
1244 html: makeAutoSizer(200),\r
1245 height: '40%',\r
1246 minWidth: 300\r
1247 });\r
1248 expectSuiteResult(300, 160, 120, 300);\r
1249 });\r
1250\r
1251 it("should take maxWidth into account", function() {\r
1252 makeSuiteCt({\r
1253 html: makeAutoSizer(200),\r
1254 height: '40%',\r
1255 maxWidth: 100\r
1256 });\r
1257 expectSuiteResult(100, 160, 120, 100);\r
1258 });\r
1259 });\r
1260 });\r
1261\r
1262 describe("auto height", function() {\r
1263 it("should center the item", function() {\r
1264 makeSuiteCt({\r
1265 html: makeAutoSizer(200, 100)\r
1266 });\r
1267 expectSuiteResult(200, 100, 150, 200);\r
1268 });\r
1269\r
1270 it("should take margins into account", function() {\r
1271 makeSuiteCt({\r
1272 html: makeAutoSizer(200, 100),\r
1273 margin: '20 30'\r
1274 });\r
1275 expectSuiteResult(200, 100, 130, 260);\r
1276 });\r
1277\r
1278 describe("constraints", function() {\r
1279 it("should take minHeight into account", function() {\r
1280 makeSuiteCt({\r
1281 html: makeAutoSizer(200, 100),\r
1282 minHeight: 300\r
1283 });\r
1284 expectSuiteResult(200, 300, 50, 200);\r
1285 });\r
1286\r
1287 it("should take maxHeight into account", function() {\r
1288 makeSuiteCt({\r
1289 html: makeAutoSizer(200, 100),\r
1290 maxHeight: 50\r
1291 });\r
1292 expectSuiteResult(200, 50, 175, 200);\r
1293 });\r
1294\r
1295 it("should take minWidth into account", function() {\r
1296 makeSuiteCt({\r
1297 html: makeAutoSizer(200, 100),\r
1298 minWidth: 300\r
1299 });\r
1300 expectSuiteResult(300, 100, 150, 300);\r
1301 });\r
1302\r
1303 it("should take maxWidth into account", function() {\r
1304 makeSuiteCt({\r
1305 html: makeAutoSizer(200, 100),\r
1306 maxWidth: 100\r
1307 });\r
1308 expectSuiteResult(100, 100, 150, 100);\r
1309 });\r
1310 });\r
1311 });\r
1312 });\r
1313 });\r
1314\r
1315 describe("container: auto width, auto height", function() {\r
1316 function makeSuiteCt(item) {\r
1317 makeCt({\r
1318 floating: true, // Float the ct so it shrink wraps\r
1319 items: item\r
1320 });\r
1321 }\r
1322\r
1323 function expectSuiteResult(w, h, ctWidth, ctHeight) {\r
1324 // Position of the item should always be 0,0\r
1325 expectResult(w, h, 0, 0, ctWidth, ctHeight);\r
1326 }\r
1327\r
1328 describe("component: fixed width", function() {\r
1329 describe("fixed height", function() {\r
1330 it("should center the item", function() {\r
1331 makeSuiteCt({\r
1332 width: 200,\r
1333 height: 200\r
1334 });\r
1335 expectSuiteResult(200, 200, 200, 200);\r
1336 });\r
1337\r
1338 it("should take margins into account", function() {\r
1339 makeSuiteCt({\r
1340 width: 200,\r
1341 height: 200,\r
1342 margin: '20 30'\r
1343 });\r
1344 expectSuiteResult(200, 200, 260, 240);\r
1345 });\r
1346 });\r
1347\r
1348 describe("calculated height", function() {\r
1349 it("should center the item", function() {\r
1350 makeSuiteCt({\r
1351 width: 200,\r
1352 height: '40%'\r
1353 });\r
1354 expectSuiteResult(200, 0, 200, 0);\r
1355 });\r
1356\r
1357 it("should take margins into account", function() {\r
1358 makeSuiteCt({\r
1359 width: 200,\r
1360 height: '40%',\r
1361 margin: '20 30'\r
1362 });\r
1363 expectSuiteResult(200, 0, 260, 40);\r
1364 });\r
1365\r
1366 describe("constraints", function() {\r
1367 it("should take minHeight into account", function() {\r
1368 makeSuiteCt({\r
1369 width: 200,\r
1370 height: '10%',\r
1371 minHeight: 300\r
1372 });\r
1373 expectSuiteResult(200, 300, 200, 300);\r
1374 });\r
1375\r
1376 it("should take maxHeight into account", function() {\r
1377 makeSuiteCt({\r
1378 width: 200,\r
1379 height: '80%',\r
1380 maxHeight: 100\r
1381 });\r
1382 expectSuiteResult(200, 0, 200, 0);\r
1383 });\r
1384 });\r
1385 });\r
1386\r
1387 describe("auto height", function() {\r
1388 it("should center the item", function() {\r
1389 makeSuiteCt({\r
1390 width: 200,\r
1391 html: makeAutoSizer(null, 50)\r
1392 });\r
1393 expectSuiteResult(200, 50, 200, 50);\r
1394 });\r
1395\r
1396 it("should take margins into account", function() {\r
1397 makeSuiteCt({\r
1398 width: 200,\r
1399 html: makeAutoSizer(null, 50),\r
1400 margin: '20 30'\r
1401 });\r
1402 expectSuiteResult(200, 50, 260, 90);\r
1403 });\r
1404\r
1405 describe("constraints", function() {\r
1406 it("should take minHeight into account", function() {\r
1407 makeSuiteCt({\r
1408 width: 200,\r
1409 html: makeAutoSizer(null, 50),\r
1410 minHeight: 300\r
1411 });\r
1412 expectSuiteResult(200, 300, 200, 300);\r
1413 });\r
1414\r
1415 it("should take maxHeight into account", function() {\r
1416 makeSuiteCt({\r
1417 width: 200,\r
1418 html: makeAutoSizer(null, 300),\r
1419 maxHeight: 100\r
1420 });\r
1421 expectSuiteResult(200, 100, 200, 100);\r
1422 });\r
1423 });\r
1424 });\r
1425 });\r
1426\r
1427 describe("component: calculated width", function() {\r
1428 describe("fixed height", function() {\r
1429 it("should center the item", function() {\r
1430 makeSuiteCt({\r
1431 width: '80%',\r
1432 height: 200\r
1433 });\r
1434 expectSuiteResult(0, 200, 0, 200);\r
1435 });\r
1436\r
1437 it("should take margins into account", function() {\r
1438 makeSuiteCt({\r
1439 width: '80%',\r
1440 height: 200,\r
1441 margin: '20 30'\r
1442 });\r
1443 expectSuiteResult(0, 200, 60, 240);\r
1444 });\r
1445\r
1446 describe("constraints", function() {\r
1447 it("should take minWidth into account", function() {\r
1448 makeSuiteCt({\r
1449 width: '10%',\r
1450 minWidth: 320,\r
1451 height: 200\r
1452 });\r
1453 expectSuiteResult(320, 200, 320, 200);\r
1454 });\r
1455\r
1456 it("should take maxWidth into account", function() {\r
1457 makeSuiteCt({\r
1458 width: '80%',\r
1459 maxWidth: 100,\r
1460 height: 200\r
1461 });\r
1462 expectSuiteResult(0, 200, 0, 200);\r
1463 });\r
1464 });\r
1465 });\r
1466\r
1467 describe("calculated height", function() {\r
1468 it("should center the item", function() {\r
1469 makeSuiteCt({\r
1470 width: '80%',\r
1471 height: '40%'\r
1472 });\r
1473 expectSuiteResult(0, 0, 0, 0);\r
1474 });\r
1475\r
1476 it("should take margins into account", function() {\r
1477 makeSuiteCt({\r
1478 width: '80%',\r
1479 height: '40%',\r
1480 margin: '20 30'\r
1481 });\r
1482 expectSuiteResult(0, 0, 60, 40);\r
1483 });\r
1484\r
1485 describe("constraints", function() {\r
1486 it("should take minHeight into account", function() {\r
1487 makeSuiteCt({\r
1488 width: '80%',\r
1489 height: '40%',\r
1490 minHeight: 300\r
1491 });\r
1492 expectSuiteResult(0, 300, 0, 300);\r
1493 });\r
1494\r
1495 it("should take maxHeight into account", function() {\r
1496 makeSuiteCt({\r
1497 width: '80%',\r
1498 height: '40%',\r
1499 maxHeight: 50\r
1500 });\r
1501 expectSuiteResult(0, 0, 0, 0);\r
1502 });\r
1503\r
1504 it("should take minWidth into account", function() {\r
1505 makeSuiteCt({\r
1506 width: '80%',\r
1507 height: '40%',\r
1508 minWidth: 350\r
1509 });\r
1510 expectSuiteResult(350, 0, 350, 0);\r
1511 });\r
1512\r
1513 it("should take maxWidth into account", function() {\r
1514 makeSuiteCt({\r
1515 width: '80%',\r
1516 height: '40%',\r
1517 maxWidth: 100\r
1518 });\r
1519 expectSuiteResult(0, 0, 0, 0);\r
1520 });\r
1521 });\r
1522 });\r
1523\r
1524 describe("auto height", function() {\r
1525 it("should center the item", function() {\r
1526 makeSuiteCt({\r
1527 width: '80%',\r
1528 html: makeAutoSizer(null, 100)\r
1529 });\r
1530 expectSuiteResult(0, 100, 0, 100);\r
1531 });\r
1532\r
1533 it("should take margins into account", function() {\r
1534 makeSuiteCt({\r
1535 width: '80%',\r
1536 html: makeAutoSizer(null, 100),\r
1537 margin: '20 30'\r
1538 });\r
1539 expectSuiteResult(0, 100, 60, 140);\r
1540 });\r
1541\r
1542 describe("constraints", function() {\r
1543 it("should take minHeight into account", function() {\r
1544 makeSuiteCt({\r
1545 width: '80%',\r
1546 html: makeAutoSizer(null, 100),\r
1547 minHeight: 300\r
1548 });\r
1549 expectSuiteResult(0, 300, 0, 300);\r
1550 });\r
1551\r
1552 it("should take maxHeight into account", function() {\r
1553 makeSuiteCt({\r
1554 width: '80%',\r
1555 html: makeAutoSizer(null, 350),\r
1556 maxHeight: 300\r
1557 });\r
1558 expectSuiteResult(0, 300, 0, 300);\r
1559 });\r
1560\r
1561 it("should take minWidth into account", function() {\r
1562 makeSuiteCt({\r
1563 width: '80%',\r
1564 html: makeAutoSizer(null, 100),\r
1565 minWidth: 350\r
1566 });\r
1567 expectSuiteResult(350, 100, 350, 100);\r
1568 });\r
1569\r
1570 it("should take maxWidth into account", function() {\r
1571 makeSuiteCt({\r
1572 width: '80%',\r
1573 html: makeAutoSizer(null, 100),\r
1574 maxWidth: 100\r
1575 });\r
1576 expectSuiteResult(0, 100, 0, 100);\r
1577 });\r
1578 });\r
1579 });\r
1580 });\r
1581\r
1582 describe("component: auto width", function() {\r
1583 describe("fixed height", function() {\r
1584 it("should center the item", function() {\r
1585 makeSuiteCt({\r
1586 html: makeAutoSizer(200),\r
1587 height: 200\r
1588 });\r
1589 expectSuiteResult(200, 200, 200, 200);\r
1590 });\r
1591\r
1592 it("should take margins into account", function() {\r
1593 makeSuiteCt({\r
1594 html: makeAutoSizer(200),\r
1595 height: 200,\r
1596 margin: '20 30'\r
1597 });\r
1598 expectSuiteResult(200, 200, 260, 240);\r
1599 });\r
1600\r
1601 describe("constraints", function() {\r
1602 it("should take minWidth into account", function() {\r
1603 makeSuiteCt({\r
1604 html: makeAutoSizer(200),\r
1605 height: 200,\r
1606 minWidth: 300\r
1607 });\r
1608 expectSuiteResult(300, 200, 300, 200);\r
1609 });\r
1610\r
1611 it("should take maxWidth into account", function() {\r
1612 makeSuiteCt({\r
1613 html: makeAutoSizer(200),\r
1614 height: 200,\r
1615 maxWidth: 100\r
1616 });\r
1617 expectSuiteResult(100, 200, 100, 200);\r
1618 });\r
1619 });\r
1620 });\r
1621\r
1622 describe("calculated height", function() {\r
1623 it("should center the item", function() {\r
1624 makeSuiteCt({\r
1625 html: makeAutoSizer(200),\r
1626 height: '40%'\r
1627 });\r
1628 expectSuiteResult(200, 0, 200, 0);\r
1629 });\r
1630\r
1631 it("should take margins into account", function() {\r
1632 makeSuiteCt({\r
1633 html: makeAutoSizer(200),\r
1634 height: '40%',\r
1635 margin: '20 30'\r
1636 });\r
1637 expectSuiteResult(200, 0, 260, 40);\r
1638 });\r
1639\r
1640 describe("constraints", function() {\r
1641 it("should take minHeight into account", function() {\r
1642 makeSuiteCt({\r
1643 html: makeAutoSizer(200),\r
1644 height: '40%',\r
1645 minHeight: 300\r
1646 });\r
1647 expectSuiteResult(200, 300, 200, 300);\r
1648 });\r
1649\r
1650 it("should take maxHeight into account", function() {\r
1651 makeSuiteCt({\r
1652 html: makeAutoSizer(200),\r
1653 height: '40%',\r
1654 maxHeight: 50\r
1655 });\r
1656 expectSuiteResult(200, 0, 200, 0);\r
1657 });\r
1658\r
1659 it("should take minWidth into account", function() {\r
1660 makeSuiteCt({\r
1661 html: makeAutoSizer(200),\r
1662 height: '40%',\r
1663 minWidth: 300\r
1664 });\r
1665 expectSuiteResult(300, 0, 300, 0);\r
1666 });\r
1667\r
1668 it("should take maxWidth into account", function() {\r
1669 makeSuiteCt({\r
1670 html: makeAutoSizer(200),\r
1671 height: '40%',\r
1672 maxWidth: 100\r
1673 });\r
1674 expectSuiteResult(100, 0, 100, 0);\r
1675 });\r
1676 });\r
1677 });\r
1678\r
1679 describe("auto height", function() {\r
1680 it("should center the item", function() {\r
1681 makeSuiteCt({\r
1682 html: makeAutoSizer(200, 100)\r
1683 });\r
1684 expectSuiteResult(200, 100, 200, 100);\r
1685 });\r
1686\r
1687 it("should take margins into account", function() {\r
1688 makeSuiteCt({\r
1689 html: makeAutoSizer(200, 100),\r
1690 margin: '20 30'\r
1691 });\r
1692 expectSuiteResult(200, 100, 260, 140);\r
1693 });\r
1694\r
1695 describe("constraints", function() {\r
1696 it("should take minHeight into account", function() {\r
1697 makeSuiteCt({\r
1698 html: makeAutoSizer(200, 100),\r
1699 minHeight: 300\r
1700 });\r
1701 expectSuiteResult(200, 300, 200, 300);\r
1702 });\r
1703\r
1704 it("should take maxHeight into account", function() {\r
1705 makeSuiteCt({\r
1706 html: makeAutoSizer(200, 100),\r
1707 maxHeight: 50\r
1708 });\r
1709 expectSuiteResult(200, 50, 200, 50);\r
1710 });\r
1711\r
1712 it("should take minWidth into account", function() {\r
1713 makeSuiteCt({\r
1714 html: makeAutoSizer(200, 100),\r
1715 minWidth: 300\r
1716 });\r
1717 expectSuiteResult(300, 100, 300, 100);\r
1718 });\r
1719\r
1720 it("should take maxWidth into account", function() {\r
1721 makeSuiteCt({\r
1722 html: makeAutoSizer(200, 100),\r
1723 maxWidth: 100\r
1724 });\r
1725 expectSuiteResult(100, 100, 100, 100);\r
1726 });\r
1727 });\r
1728 });\r
1729 });\r
1730 });\r
1731\r
1732});