Re: [fw-general] Zend_Test_PHPUnit_ControllerTestCase: asserting a checkbox is checked

2010-04-29 Thread Núria
Yesterday I reported the issue:
http://framework.zend.com/issues/browse/ZF-9764 and Matthew resolved it at
the speed of light (many thanks!), so the fix will be included in the next
mini release.

--

Núria

2010/4/28 Marian Meres marian.me...@gmail.com

 I confirm I had similar problems with css selectors. I didn't discover
 it deeply though, but used xpath assertion instead which worked as
 expected.

 m.

 On Tue, Apr 27, 2010 at 11:04 PM, Núria nuq...@gmail.com wrote:
  I'm afraid this is a bug. CSS selectors are converted to XPath queries
  before the evaluation, and apparently there is something wrong with that
  conversion.
 
  In this case, the expression:
 
  #person_acti...@checked=checked]
 
  is transformed to the XPath query:
 
  //*...@id='person_active'][checked=checked]
 
  The problem here is that the @ before the attribute checked is missing,
  therefore it fails to match any element.
 
  This workaround will get the job done (although it's not a valid
 selector):
 
  $this-assertQuery('#person_acti...@checked=checked]');
 
  or you can use the assertXpath() method instead.
 
  --
 
  Núria
 
  2010/4/27 David Mintz da...@davidmintz.org
 
  I am having some trouble figuring out the magic words. My response body
  contains this:
 
  input type=checkbox name=person[active] id=person_active
 value=1
  checked=checked /
 
  In the controller test, I when I say
 
   $this-assertQuery('#person_active');
 
  the assertion succeeds, but
 
   $this-assertQuery('#person_active[checked=checked]');
 
  fails with 'Failed asserting node DENOTED BY
  #person_active[checked=checked] EXISTS.'
 
  After diddling around with several variations, the only thing that works
  for me is to assert that the containing element contains a checkbox
 whose
  checked attribute is checked:
 
   $this-assertQuery('#person_active-element input[checked=checked]') ;
 
  It might be worth noting that the jQuery snippet
 
   $('#person_active[checked=checked]').length == 1
 
  typed into the Firebug console evaluates to true. So it looks like my
 CSS
  is kosher.
 
  Any ideas? Thanks.
 
  --
  Support real health care reform:
  http://phimg.org/
 
  --
  David Mintz
  http://davidmintz.org/
 
 
 
 



Re: [fw-general] Zend_Test_PHPUnit_ControllerTestCase: asserting a checkbox is checked

2010-04-29 Thread David Mintz
On Thu, Apr 29, 2010 at 3:24 AM, Núria nuq...@gmail.com wrote:

 Yesterday I reported the issue:
 http://framework.zend.com/issues/browse/ZF-9764 and Matthew resolved it at
 the speed of light (many thanks!), so the fix will be included in the next
 mini release.


I guess I won't be demanding a refund just yet (-:

-- 
Support real health care reform:
http://phimg.org/

--
David Mintz
http://davidmintz.org/


Re: [fw-general] Zend_Test_PHPUnit_ControllerTestCase: asserting a checkbox is checked

2010-04-28 Thread Marian Meres
I confirm I had similar problems with css selectors. I didn't discover
it deeply though, but used xpath assertion instead which worked as
expected.

m.

On Tue, Apr 27, 2010 at 11:04 PM, Núria nuq...@gmail.com wrote:
 I'm afraid this is a bug. CSS selectors are converted to XPath queries
 before the evaluation, and apparently there is something wrong with that
 conversion.

 In this case, the expression:

     #person_acti...@checked=checked]

 is transformed to the XPath query:

     //*...@id='person_active'][checked=checked]

 The problem here is that the @ before the attribute checked is missing,
 therefore it fails to match any element.

 This workaround will get the job done (although it's not a valid selector):

     $this-assertQuery('#person_acti...@checked=checked]');

 or you can use the assertXpath() method instead.

 --

 Núria

 2010/4/27 David Mintz da...@davidmintz.org

 I am having some trouble figuring out the magic words. My response body
 contains this:

 input type=checkbox name=person[active] id=person_active value=1
 checked=checked /

 In the controller test, I when I say

  $this-assertQuery('#person_active');

 the assertion succeeds, but

  $this-assertQuery('#person_active[checked=checked]');

 fails with 'Failed asserting node DENOTED BY
 #person_active[checked=checked] EXISTS.'

 After diddling around with several variations, the only thing that works
 for me is to assert that the containing element contains a checkbox whose
 checked attribute is checked:

  $this-assertQuery('#person_active-element input[checked=checked]') ;

 It might be worth noting that the jQuery snippet

  $('#person_active[checked=checked]').length == 1

 typed into the Firebug console evaluates to true. So it looks like my CSS
 is kosher.

 Any ideas? Thanks.

 --
 Support real health care reform:
 http://phimg.org/

 --
 David Mintz
 http://davidmintz.org/






[fw-general] Zend_Test_PHPUnit_ControllerTestCase: asserting a checkbox is checked

2010-04-27 Thread David Mintz
I am having some trouble figuring out the magic words. My response body
contains this:

input type=checkbox name=person[active] id=person_active value=1
checked=checked /

In the controller test, I when I say

 $this-assertQuery('#person_active');

the assertion succeeds, but

 $this-assertQuery('#person_active[checked=checked]');

fails with 'Failed asserting node DENOTED BY
#person_active[checked=checked] EXISTS.'

After diddling around with several variations, the only thing that works for
me is to assert that the containing element contains a checkbox whose
checked attribute is checked:

 $this-assertQuery('#person_active-element input[checked=checked]') ;

It might be worth noting that the jQuery snippet

 $('#person_active[checked=checked]').length == 1

typed into the Firebug console evaluates to true. So it looks like my CSS is
kosher.

Any ideas? Thanks.

-- 
Support real health care reform:
http://phimg.org/

--
David Mintz
http://davidmintz.org/


Re: [fw-general] Zend_Test_PHPUnit_ControllerTestCase: asserting a checkbox is checked

2010-04-27 Thread Núria
I'm afraid this is a bug. CSS selectors are converted to XPath queries
before the evaluation, and apparently there is something wrong with that
conversion.

In this case, the expression:

#person_acti...@checked=checked]

is transformed to the XPath query:

//*...@id='person_active'][checked=checked]

The problem here is that the @ before the attribute checked is missing,
therefore it fails to match any element.

This workaround will get the job done (although it's not a valid selector):

$this-assertQuery('#person_acti...@checked=checked]');

or you can use the assertXpath() method instead.

--

Núria

2010/4/27 David Mintz da...@davidmintz.org

 I am having some trouble figuring out the magic words. My response body
 contains this:

 input type=checkbox name=person[active] id=person_active value=1
 checked=checked /

 In the controller test, I when I say

  $this-assertQuery('#person_active');

 the assertion succeeds, but

  $this-assertQuery('#person_active[checked=checked]');

 fails with 'Failed asserting node DENOTED BY
 #person_active[checked=checked] EXISTS.'

 After diddling around with several variations, the only thing that works
 for me is to assert that the containing element contains a checkbox whose
 checked attribute is checked:

  $this-assertQuery('#person_active-element input[checked=checked]') ;

 It might be worth noting that the jQuery snippet

  $('#person_active[checked=checked]').length == 1

 typed into the Firebug console evaluates to true. So it looks like my CSS
 is kosher.

 Any ideas? Thanks.

 --
 Support real health care reform:
 http://phimg.org/

 --
 David Mintz
 http://davidmintz.org/