View Full Version : fireEvent with Ext.Msg.prompt

8 Jan 2013, 3:10 PM
I'm currently working on unit tests using Jasmine, and I've had a fairly easy time of getting actions to occur using Ext JS's fireEvent method to put my app through it's paces during the tests, but I'm having difficulty getting the fireEvent to work in a window created by Ext.Msg.prompt.

Basically, I have an event that fires a Ext.Msg.confirm window when a selection is changed.

Ext.Msg.confirm('Change Status','Do you want to  change this status?',  function(btn){<br>              if(btn=='no'||  btn=='cancel'){<br>                    combobox.setValue(model.get('status'));<br>               }<br>              else  {<br>                    this.saveStatustoDB(model,  combobox);<br>               }          <br>});

I believe that to carry on the change in selection and proceed to testing, I have to programmatically fire the click event on the 'yes' button.

I tried using

var promptwin = &nbsp;&amp;lt;br&amp;gt;Ext.ComponentQuery.query('window')[0]<br>to find the window, and therefore the button, but something is going wrong - neither



will hide the window, but not pass the confim's function.

Is there a different way I can confirm this window programattically, or am I missing something with how to get a 'handle' on the window to fire the click event?

I've been able to use fireEvent('click') on buttons within the app, so I know that's effective on it's own. I appreciate any help on this matter.

9 Jan 2013, 9:03 AM
Actually, after more experimentation, I found my own answer with btnCallback.

var promptwin = Ext.ComponentQuery.query('window')[0];