~deryck/lazr-js/datasource-for-wizard

« back to all changes in this revision

Viewing changes to src-js/lazrjs/overlay/tests/overlay.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2009-11-13 01:44:19 UTC
  • mfrom: (133.2.3 bug-480986)
  • Revision ID: launchpad@pqm.canonical.com-20091113014419-ud79yi1d0i8n1blg
[r=barry][ui=rs][bug=480986] Fix escape handling in Chrome for
        overlay-based widgets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        cleanup_widget(this.overlay);
52
52
    },
53
53
 
 
54
    hitEscape: function() {
 
55
        simulate(this.overlay.get('boundingBox'),
 
56
                 '.close .close-button',
 
57
                 'keydown', { keyCode: ESCAPE });
 
58
    },
 
59
 
54
60
    test_picker_can_be_instantiated: function() {
55
61
        this.overlay = new Y.lazr.PrettyOverlay();
56
62
        Assert.isInstanceOf(
146
152
        this.overlay = new Y.lazr.PrettyOverlay();
147
153
        this.overlay.render();
148
154
 
149
 
        simulate(this.overlay.get('boundingBox'),
150
 
                 '.close .close-button',
151
 
                 'keypress', { keyCode: ESCAPE });
 
155
        this.hitEscape();
152
156
        Assert.isFalse(this.overlay.get('visible'), "The widget wasn't hidden");
153
157
    },
154
158
 
162
166
                event_was_fired = true;
163
167
            });
164
168
        }, this);
165
 
        simulate(this.overlay.get('boundingBox'),
166
 
                 '.close .close-button',
167
 
                 'click', { keyCode: ESCAPE });
 
169
        this.hitEscape();
168
170
        this.wait(function() {
169
171
                Assert.isTrue(event_was_fired, "cancel event wasn't fired");
170
172
            }, 3000);
177
179
        this.overlay = new Y.lazr.PrettyOverlay();
178
180
        this.overlay.render();
179
181
 
180
 
        simulate(this.overlay.get('boundingBox'),
181
 
                 '.close .close-button',
182
 
                 'keypress', { keyCode: ESCAPE });
 
182
        this.hitEscape();
183
183
        Assert.isFalse(this.overlay.get('visible'), "The widget wasn't hidden");
184
184
        this.overlay.show();
185
185
        Assert.isTrue(this.overlay.get('visible'), "The widget wasn't shown again");
186
 
        simulate(this.overlay.get('boundingBox'),
187
 
                 '.close .close-button',
188
 
                 'keypress', { keyCode: ESCAPE });
 
186
        this.hitEscape();
189
187
        Assert.isFalse(this.overlay.get('visible'), "The widget wasn't hidden");
190
188
    },
191
189
 
193
191
        this.overlay = new Y.lazr.PrettyOverlay();
194
192
        function PrettyOverlaySubclass(config) {
195
193
            PrettyOverlaySubclass.superclass.constructor.apply(this, arguments);
196
 
        };
 
194
        }
197
195
        PrettyOverlaySubclass.NAME = 'lazr-overlaysubclass';
198
196
        Y.extend(PrettyOverlaySubclass, Y.lazr.PrettyOverlay);
199
197
 
206
204
    test_overlay_bodyContent_has_size_1: function() {
207
205
        var overlay = new Y.Overlay({
208
206
            headerContent: 'Form for testing',
209
 
            bodyContent: '<input type="text" name="field1" />',
 
207
            bodyContent: '<input type="text" name="field1" />'
210
208
        });
211
209
        overlay.render();
212
210
        Assert.areEqual(
213
211
            1,
214
212
            overlay.get("bodyContent").size(),
215
 
            "The bodContent should contain only one node."
216
 
        )
 
213
            "The bodContent should contain only one node.");
217
214
    },
218
215
 
219
216
    test_set_progress: function() {
226
223
        Assert.areEqual(
227
224
            '23%',
228
225
            this.overlay.get('boundingBox').query('.steps .step-on').getStyle('width')
229
 
        )
 
226
        );
230
227
    }
231
228
 
232
229
}));