]> git.proxmox.com Git - extjs.git/blob - extjs/classic/classic/test/specs/dom/Layer.js
add extjs 6.0.1 sources
[extjs.git] / extjs / classic / classic / test / specs / dom / Layer.js
1 describe("Ext.dom.Layer", function() {
2 var layer;
3
4 afterEach(function() {
5 layer.destroy();
6 });
7
8 it("should create a div by default", function() {
9 layer = new Ext.dom.Layer();
10
11 expect(layer.dom.tagName).toBe('DIV');
12 });
13
14 it("should have the x-layer cls", function() {
15 layer = new Ext.dom.Layer();
16
17 expect(layer).toHaveCls('x-layer');
18 });
19
20 it("should accept a domhelper config as its element", function() {
21 layer = new Ext.dom.Layer({
22 dh: {
23 tag: 'p',
24 cls: 'today-is-the-greatest-day-Ive-ever-known'
25 }
26 });
27
28 expect(layer.dom.tagName).toBe('P');
29 expect(layer).toHaveCls('today-is-the-greatest-day-Ive-ever-known');
30 });
31
32 it("should append the layer to document.body", function() {
33 layer = new Ext.dom.Layer();
34
35 expect(layer.dom.parentNode).toBe(document.body);
36 });
37
38 it("should allow the parent node to be configured", function() {
39 var parent = Ext.getBody().createChild();
40 layer = new Ext.dom.Layer({
41 parentEl: parent
42 });
43
44 expect(layer.dom.parentNode).toBe(parent.dom);
45
46 parent.destroy();
47 });
48
49 it("should not create a shadow by default", function() {
50 layer = new Ext.dom.Layer();
51
52 expect(layer.shadow).toBeUndefined();
53 });
54
55 it("should create a shadow if shadow is true", function() {
56 layer = new Ext.dom.Layer({
57 shadow: true
58 });
59
60 expect(layer.shadow instanceof Ext.dom.Shadow).toBe(true);
61 expect(layer.shadow.mode).toBe('drop');
62 });
63
64 it("should create a shadow using a shadow mode", function() {
65 layer = new Ext.dom.Layer({
66 shadow: 'sides'
67 });
68
69 expect(layer.shadow instanceof Ext.dom.Shadow).toBe(true);
70 expect(layer.shadow.mode).toBe('sides');
71 });
72
73 it("should not create a shim by default", function() {
74 layer = new Ext.dom.Layer();
75
76 expect(layer.shim).toBeUndefined();
77 });
78
79 it("should create a shim if shim is true", function() {
80 layer = new Ext.dom.Layer({
81 shim: true
82 });
83
84 expect(layer.shim instanceof Ext.dom.Shim).toBe(true);
85 });
86
87 it("should accept a cls", function() {
88 layer = new Ext.dom.Layer({
89 cls: 'ohyeah'
90 });
91
92 expect(layer).toHaveCls('ohyeah');
93 });
94
95 it("should accept a shadowOffset", function() {
96 layer = new Ext.dom.Layer({
97 shadow: true,
98 shadowOffset: 9999
99 });
100
101 expect(layer.shadow.offset).toBe(9999);
102 });
103
104 it("should use css visibility to hide", function() {
105 layer = new Ext.dom.Layer();
106
107 expect(layer.getVisibilityMode()).toBe(Ext.Element.VISIBILITY);
108 });
109
110 it("should use display to hide if useDisplay is true", function() {
111 layer = new Ext.dom.Layer({
112 useDisplay: true
113 });
114
115 expect(layer.getVisibilityMode()).toBe(Ext.Element.DISPLAY);
116 });
117
118 it("should configure the visibility mode using hideMode:'display'", function() {
119 layer = new Ext.dom.Layer({
120 hideMode: 'display'
121 });
122
123 expect(layer.getVisibilityMode()).toBe(Ext.Element.DISPLAY);
124 });
125
126 it("should configure the visibility mode using hideMode:'visibility'", function() {
127 layer = new Ext.dom.Layer({
128 hideMode: 'visibility'
129 });
130
131 expect(layer.getVisibilityMode()).toBe(Ext.Element.VISIBILITY);
132 });
133
134 it("should configure the visibility mode using hideMode:'offsets'", function() {
135 layer = new Ext.dom.Layer({
136 hideMode: 'offsets'
137 });
138
139 expect(layer.getVisibilityMode()).toBe(Ext.Element.OFFSETS);
140 });
141
142 });