]> git.proxmox.com Git - extjs.git/blame - extjs/classic/classic/test/specs/rtl/dom/Element.js
add extjs 6.0.1 sources
[extjs.git] / extjs / classic / classic / test / specs / rtl / dom / Element.js
CommitLineData
6527f429
DM
1describe("Ext.rtl.dom.Element", function() {\r
2 var wrap, el;\r
3\r
4 beforeEach(function() {\r
5 wrap = Ext.getBody().createChild({\r
6 className: Ext.baseCSSPrefix + 'rtl',\r
7 cn: [{\r
8 style: {\r
9 width: '100px',\r
10 height: '100px',\r
11 right: '15px',\r
12 top: '20px',\r
13 position: 'absolute'\r
14 },\r
15 cn: [{\r
16 style: {\r
17 width: '40px',\r
18 height: '40px',\r
19 right: '6px',\r
20 top: '7px',\r
21 'z-index': 10,\r
22 position: 'absolute'\r
23 }\r
24 }]\r
25 }]\r
26 });\r
27 \r
28 el = wrap.first().first();\r
29 });\r
30\r
31 afterEach(function() {\r
32 el.destroy();\r
33 wrap.destroy();\r
34 });\r
35\r
36 describe("rtlGetLocalX", function() {\r
37 it("should return the local x position", function(){\r
38 expect(el.rtlGetLocalX()).toBe(6);\r
39 }); \r
40 });\r
41\r
42 describe("rtlGetLocalXY", function() {\r
43 it("should return the local xy position", function(){\r
44 expect(el.rtlGetLocalXY()).toEqual([6,7]);\r
45 }); \r
46 });\r
47\r
48 describe("rtlSetLocalX", function() {\r
49 it("should set the local x coordinate to a pixel value", function() {\r
50 el.rtlSetLocalX(100);\r
51 expect(el.dom.style.right).toBe('100px');\r
52 });\r
53\r
54 it("should set the local x coordinate to an auto value", function() {\r
55 el.rtlSetLocalX(null);\r
56 expect(el.dom.style.right).toBe('auto');\r
57 });\r
58 });\r
59\r
60 describe("rtlSetLocalXY", function() {\r
61 describe("x and y as separate parameters", function() {\r
62 it("should set only the local x coordinate to a pixel value", function() {\r
63 el.rtlSetLocalXY(100);\r
64 expect(el.dom.style.right).toBe('100px');\r
65 expect(el.dom.style.top).toBe('7px');\r
66 });\r
67\r
68 it("should set only the local x coordinate to an auto value", function() {\r
69 el.rtlSetLocalXY(null);\r
70 expect(el.dom.style.right).toBe('auto');\r
71 expect(el.dom.style.top).toBe('7px');\r
72 });\r
73\r
74 it("should set only the local y coordinate to a pixel value", function() {\r
75 el.rtlSetLocalXY(undefined, 100);\r
76 expect(el.dom.style.right).toBe('6px');\r
77 expect(el.dom.style.top).toBe('100px');\r
78 });\r
79\r
80 it("should set only the local y coordinate to an auto value", function() {\r
81 el.rtlSetLocalXY(undefined, null);\r
82 expect(el.dom.style.right).toBe('6px');\r
83 expect(el.dom.style.top).toBe('auto');\r
84 });\r
85\r
86 it("should set pixel x and pixel y", function() {\r
87 el.rtlSetLocalXY(100, 200);\r
88 expect(el.dom.style.right).toBe('100px');\r
89 expect(el.dom.style.top).toBe('200px');\r
90 });\r
91\r
92 it("should set pixel x and auto y", function() {\r
93 el.rtlSetLocalXY(100, null);\r
94 expect(el.dom.style.right).toBe('100px');\r
95 expect(el.dom.style.top).toBe('auto');\r
96 });\r
97\r
98 it("should set auto x and pixel y", function() {\r
99 el.rtlSetLocalXY(null, 100);\r
100 expect(el.dom.style.right).toBe('auto');\r
101 expect(el.dom.style.top).toBe('100px');\r
102 });\r
103\r
104 it("should set auto x and auto y", function() {\r
105 el.rtlSetLocalXY(null, null);\r
106 expect(el.dom.style.right).toBe('auto');\r
107 expect(el.dom.style.top).toBe('auto');\r
108 });\r
109 });\r
110\r
111 describe("x and y as array parameter", function() {\r
112 it("should set only the local x coordinate to a pixel value", function() {\r
113 el.rtlSetLocalXY([100]);\r
114 expect(el.dom.style.right).toBe('100px');\r
115 expect(el.dom.style.top).toBe('7px');\r
116 });\r
117\r
118 it("should set only the local x coordinate to an auto value", function() {\r
119 el.rtlSetLocalXY([null]);\r
120 expect(el.dom.style.right).toBe('auto');\r
121 expect(el.dom.style.top).toBe('7px');\r
122 });\r
123\r
124 it("should set only the local y coordinate to a pixel value", function() {\r
125 el.rtlSetLocalXY([undefined, 100]);\r
126 expect(el.dom.style.right).toBe('6px');\r
127 expect(el.dom.style.top).toBe('100px');\r
128 });\r
129\r
130 it("should set only the local y coordinate to an auto value", function() {\r
131 el.rtlSetLocalXY([undefined, null]);\r
132 expect(el.dom.style.right).toBe('6px');\r
133 expect(el.dom.style.top).toBe('auto');\r
134 });\r
135\r
136 it("should set pixel x and pixel y", function() {\r
137 el.rtlSetLocalXY([100, 200]);\r
138 expect(el.dom.style.right).toBe('100px');\r
139 expect(el.dom.style.top).toBe('200px');\r
140 });\r
141\r
142 it("should set pixel x and auto y", function() {\r
143 el.rtlSetLocalXY([100, null]);\r
144 expect(el.dom.style.right).toBe('100px');\r
145 expect(el.dom.style.top).toBe('auto');\r
146 });\r
147\r
148 it("should set auto x and pixel y", function() {\r
149 el.rtlSetLocalXY([null, 100]);\r
150 expect(el.dom.style.right).toBe('auto');\r
151 expect(el.dom.style.top).toBe('100px');\r
152 });\r
153\r
154 it("should set auto x and auto y", function() {\r
155 el.rtlSetLocalXY([null, null]);\r
156 expect(el.dom.style.right).toBe('auto');\r
157 expect(el.dom.style.top).toBe('auto');\r
158 });\r
159 });\r
160 });\r
161});