views:

74

answers:

3

Hi all:

In my code, there is a cluetip that binds itself to an anchor. I need to know what sort of properties can I assert when unit testing it?

At the moment, all I could do is to assert the id of the cluetip, which seems insufficient. I want to find out whether there is some sort of class in cluetip that changes when it is binded to a particular html element.

Thanks.

A: 

Firequery

czarchaic
I believe (s)he wants to know progrmmatically.
Paulo Santos
+1  A: 

I've read the ClueTip code and it uses the $(...).bind() function to bind the desired method desired of showing the tip with the desired element.

I believe that any method of inspecting the bindings of an element will have the desired effect.

It uses the following bindings:

click.cluetip
focus.cluetip
blur.cluetip
mousemove.cluetip
mouseenter.cluetip
mouseleave.cluetip

depending of course the desired method.

Paulo Santos
@Paulo Santos: I believe the way cluetip works is that there is only ever 1 instance of cluetip. Whenever a html element needed to display a cluetip, it binds itself to it. So based on that thinking, when a cluetip is needed there has to be a change of certain variable in cluetip which tells it that okay now I'm displaying info for anchor A. I want to know whether such variable exists, and if so what is it and how to get to it. Being not from javascript background makes reading that file a nightmare. And no I can only use jQuery or Javascript, cant use other 3rd party software. Thanks.
BeraCim
A: 

Please refer to this thread for answer. Thanks.

BeraCim