]>
git.proxmox.com Git - extjs.git/blob - extjs/classic/classic/test/specs/resizer/Resizer.js
1 describe('Ext.resizer.Resizer', function () {
3 testIt
= Ext
.isWebKit
? it
: xit
;
5 function makeResizer(cfg
) {
6 target
= new Ext
.Component(Ext
.apply({
7 renderTo
: Ext
.getBody()
10 resizer
= new Ext
.resizer
.Resizer({
16 afterEach(function () {
17 Ext
.destroy(resizer
, target
);
18 resizer
= target
= null;
21 describe('init', function () {
22 describe('when target el needs to be wrapped', function () {
23 beforeEach(function () {
27 html
: 'And any fool knows a dog needs a home, A shelter from pigs on the wing.'
32 it('should be given an `originalTarget` property', function () {
33 expect(resizer
.originalTarget
).toBeDefined();
36 it('should redefine the target to be an element', function () {
37 expect(resizer
.target
.isElement
).toBe(true);
40 it('should not set originalTarget equalTo target', function () {
41 expect(resizer
.originalTarget
).not
.toBe(resizer
.target
);
46 describe('constraining', function() {
47 // Synthetic event resizing only works on good browsers.
48 // Code tested is not browser dependent however.
49 testIt('should not constrain if constrain config !== true', function() {
51 panel
= new Ext
.panel
.Panel({
54 renderTo
: document
.body
,
55 items
: [window
= new Ext
.window
.Window({
63 jasmine
.fireMouseEvent(window
.resizer
.east
, 'mousedown');
64 jasmine
.fireMouseEvent(document
.body
, 'mousemove', 200, 150);
65 jasmine
.fireMouseEvent(document
.body
, 'mouseup');
67 // Window must be allowed to resize outside its owning Panel's bounds
68 expect(window
.getWidth()).toBe(300);
69 Ext
.destroy(panel
, window
);
71 testIt("should constrain to floatParent's targetEl if constrain config == true", function() {
73 panel
= new Ext
.panel
.Panel({
76 renderTo
: document
.body
,
77 items
: [window
= new Ext
.window
.Window({
86 jasmine
.fireMouseEvent(window
.resizer
.east
, 'mousedown');
87 jasmine
.fireMouseEvent(document
.body
, 'mousemove', 200, 150);
88 jasmine
.fireMouseEvent(document
.body
, 'mouseup');
90 // Window must NOT be allowed to resize outside its owning Panel's bounds
91 expect(window
.getWidth()).toBe(150);
92 Ext
.destroy(panel
, window
);
96 describe('resizing in a layout', function() {
97 testIt('Should allow layout last word on positioning when sizing using top handle', function() {
101 "The Tragedy of Macbeth - Shakespeare <br>ACT I<br>SCENE I. A desert place.<br><br>Thunder and lightning. Enter three Witches",
102 "First Witch: When shall we three meet again In thunder, lightning, or in rain?",
103 "Second Witch: When the hurlyburly's done, When the battle's lost and won.",
104 "Third Witch: That will be ere the set of sun."
108 for (i
= 0; i
< macBeth
.length
; i
++) {
109 panels
.push(new Ext
.panel
.Panel({
111 title
: "I'm Panel #" + (i
+ 1),
112 titleAlign
: 'center',
120 outerPanel
= new Ext
.panel
.Panel({
127 renderTo
: document
.body
130 var panel1Top
= panels
[1].getY();
132 jasmine
.fireMouseEvent(panels
[1].resizer
.north
, 'mousedown');
133 jasmine
.fireMouseEvent(document
.body
, 'mousemove', 0, -50);
134 jasmine
.fireMouseEvent(document
.body
, 'mouseup');
136 // Layout should have correctred the top
137 expect(panels
[1].getY()).toBe(panel1Top
);
138 outerPanel
.destroy();