Get help with testing, discuss unit testing strategies etc.


Post by proudman »

Dear developers,
In IE9 and IE8 I had a trouble with tests. When I launch a test (for example button UI tests, or routing test) a new frame or window is being opened (DOM visualization works in the frame) and some tests doesn't pass validation. In other browsers tests passed validation.
Last edited by proudman on Wed Oct 31, 2012 3:25 pm, edited 2 times in total.

Post by nickolay »

Can you strip all the code not related to failing assertion and post the test case here, so we can reproduce?

Post by proudman »

Yes I can.
StartTest(function (test) {
	var button = Ext.create('Ext.Button', {
		text: 'Click me',
		renderTo: Ext.getBody(),
		handler: function() {
			alert('You clicked the button!');
		}
	});
	test.diag("button.Button.focus()");
	button.focus();
	test.ok(button.el.hasCls("x-focus"), 'Set focus method added focus class');
});
We use ext-all.css from ExtJS.

Post by mats »

Hmm, why would you want to test the focusing method on Ext JS - it's not part of your codebase?

Post by proudman »

Sorry, but I don't understand your question fully.
Is this right behavior of the focus method?
I use ExtJS because it is simple method for creating elements (buttons, fields, etc)

Post by nickolay »

Try this code:
StartTest(function (test) {
   var button = Ext.create('Ext.Button', {
      text: 'Click me',
      renderTo: Ext.getBody(),
      handler: function() {
         alert('You clicked the button!');
      }
   });
   test.diag("button.Button.focus()");
   button.focus();
   
   setTimeout(function () {
   
        test.ok(button.el.hasCls("x-focus"), 'Set focus method added focus class');
    
   }, 50)
});
IE behaves differently when doing focus and often is doing that asynchronously. You need to give it some time before checking the css class.

Post by proudman »

Do you planned fix this bug in next releases?

Post by nickolay »

Its not a bug. Its the way IE works (or may be ExtJS). If some event happens asynchronously (focusing in this case), you can't check for its result synchronously.

Post by proudman »

Thank you.

Post Reply