]> git.proxmox.com Git - extjs.git/blame - extjs/classic/classic/test/specs/layout/component/Component.js
add extjs 6.0.1 sources
[extjs.git] / extjs / classic / classic / test / specs / layout / component / Component.js
CommitLineData
6527f429
DM
1describe("Ext.layout.component.Component", function() {\r
2 var c;\r
3\r
4 afterEach(function() {\r
5 c = Ext.destroy(c);\r
6 });\r
7\r
8 describe("retaining dimensions between layout runs", function() {\r
9 it("should use the last calculated width when running a top level layout & previously had a value", function() {\r
10 c = new Ext.container.Container({\r
11 layout: {\r
12 type: 'vbox',\r
13 align: 'stretchmax'\r
14 },\r
15 renderTo: Ext.getBody(),\r
16 items: [{\r
17 xtype: 'panel',\r
18 border: false,\r
19 width: 50,\r
20 flex: 1,\r
21 dockedItems: [{\r
22 dock: 'bottom',\r
23 html: 'X'\r
24 }]\r
25\r
26 }, {\r
27 xtype: 'panel',\r
28 border: false,\r
29 html: '<div style="width: 150px;">asdf</div>',\r
30 flex: 1\r
31 }]\r
32 });\r
33 var child = c.items.first();\r
34 expect(child.getWidth()).toBe(150);\r
35 // Changing the html of the docked item will never change the size\r
36 // of "child", so child will run as a top level layout. Ensure that\r
37 // we retain the width previously calculated.\r
38 child.getDockedItems()[0].setHtml('Foo<br>bar');\r
39 expect(child.getWidth()).toBe(150);\r
40 });\r
41\r
42 it("should use the last calculated height when running a top level layout & previously had a value", function() {\r
43 c = new Ext.container.Container({\r
44 layout: {\r
45 type: 'hbox',\r
46 align: 'stretchmax'\r
47 },\r
48 renderTo: Ext.getBody(),\r
49 items: [{\r
50 xtype: 'panel',\r
51 border: false,\r
52 height: 50,\r
53 flex: 1,\r
54 dockedItems: [{\r
55 dock: 'right',\r
56 html: 'X'\r
57 }]\r
58\r
59 }, {\r
60 xtype: 'panel',\r
61 border: false,\r
62 html: '<div style="height: 150px;">asdf</div>',\r
63 flex: 1\r
64 }]\r
65 });\r
66 var child = c.items.first();\r
67 expect(child.getHeight()).toBe(150);\r
68 // Changing the html of the docked item will never change the size\r
69 // of "child", so child will run as a top level layout. Ensure that\r
70 // we retain the height previously calculated.\r
71 child.getDockedItems()[0].setHtml('Foo<br>bar');\r
72 expect(child.getHeight()).toBe(150);\r
73 });\r
74 });\r
75});