You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Lewis <ch...@bellsouth.net> on 2007/11/12 19:29:58 UTC

T5: thoughts on components using javascript

Hello all. I'm working on a component that makes a 'slide show.' It 
doesn't accept input as its only every used do display images. I'm 
writing it so that users can have total control (if they wish) over how 
the images are cycled, how the rotation starts, and what to do at the 
end of the cycle. For example:

    <div t:type="gc/slideshow" interval="3" 
transition="SlideShow.CrossfadeTransition">
        <div>one</div>
        <div>2</div>
        <div>three</div>
        <div>4</div>
    </div>

At the moment each child div represents what will become a slide (this 
will probably be configurable). Obviously the image cycling is 
controlled completely on the client side by javascript. The server side 
of it includes the needed JS, collects the parameters (interval and 
transition), and add a bit of script to instantiate a slideshow object 
in JS on the client. This all works quite nicely, and now I have a question.

The 'transition' parameter is a string. It points to a client-side 
function that will handle the transitioning from one slide to the next. 
The 'SlideShow.CrossfadeTransition' function uses scriptaculous 
Effect.Fade/Appear to do a smooth crossfade from slide to slide. There 
is also a pre-packaged 'SlideShow.AbruptTransition', which simply flips 
to the next slide with no effect. My question is on the 'transition' 
parameter. Its nice as a string because its simple - point it a function 
and it will call it. However because T5 is virtually ignorant of JS, 
specifically of what's available to the client-side runtime, there is no 
way to know if the function exists.

Is this a problem? Obviously it makes it untestable, unless the testing 
framework actually handles JS errors (I'm not aware of this). It seems 
that testing the rendering of the internal Form component would face the 
same problem - how does it test if the error rendering effect works or 
not (in terms of the JS)?

Thanks for your input!

Sincerely,
Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: thoughts on components using javascript

Posted by Chris Lewis <ch...@bellsouth.net>.
After reading a bit on Selenium, it seems that it can in fact test JS 
for errors - how cool :-).

Chris Lewis wrote:
> Hello all. I'm working on a component that makes a 'slide show.' It 
> doesn't accept input as its only every used do display images. I'm 
> writing it so that users can have total control (if they wish) over 
> how the images are cycled, how the rotation starts, and what to do at 
> the end of the cycle. For example:
>
>    <div t:type="gc/slideshow" interval="3" 
> transition="SlideShow.CrossfadeTransition">
>        <div>one</div>
>        <div>2</div>
>        <div>three</div>
>        <div>4</div>
>    </div>
>
> At the moment each child div represents what will become a slide (this 
> will probably be configurable). Obviously the image cycling is 
> controlled completely on the client side by javascript. The server 
> side of it includes the needed JS, collects the parameters (interval 
> and transition), and add a bit of script to instantiate a slideshow 
> object in JS on the client. This all works quite nicely, and now I 
> have a question.
>
> The 'transition' parameter is a string. It points to a client-side 
> function that will handle the transitioning from one slide to the 
> next. The 'SlideShow.CrossfadeTransition' function uses scriptaculous 
> Effect.Fade/Appear to do a smooth crossfade from slide to slide. There 
> is also a pre-packaged 'SlideShow.AbruptTransition', which simply 
> flips to the next slide with no effect. My question is on the 
> 'transition' parameter. Its nice as a string because its simple - 
> point it a function and it will call it. However because T5 is 
> virtually ignorant of JS, specifically of what's available to the 
> client-side runtime, there is no way to know if the function exists.
>
> Is this a problem? Obviously it makes it untestable, unless the 
> testing framework actually handles JS errors (I'm not aware of this). 
> It seems that testing the rendering of the internal Form component 
> would face the same problem - how does it test if the error rendering 
> effect works or not (in terms of the JS)?
>
> Thanks for your input!
>
> Sincerely,
> Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org