[Seaside] SeasideTesting released on SqueakMap
Avi Bryant
avi at beta4.com
Fri Jul 23 00:30:50 CEST 2004
On Jul 20, 2004, at 1:16 PM, C. David Shaffer wrote:
> This will be my last release for Seaside 2.5a5 since my extensions to
> WAHalo tend to be fairly version dependent. There is still a fair
> amount to be done but I've been using it off and on for a couple weeks
> and I think that, if you're test infected, you'll find it makes a good
> framework upon which to build component tests. Feedback is always
> welcome ;-)
Wow. I had a chance to take a look at this today, and it's a very nice
piece of work. It's the only thing I've seen so far that makes it seem
like testing web UIs could actually be feasible. I'll definitely be
demoing this the next time I do a Seaside talk. Especially nice for
demos (and for general use, I imagine) is being able to browse through
the history of rendered pages - though it would be even cooler if
their links worked.
One thing this encourages is adding good CSS ids throughout the render,
which is something that's always seemed overly clunky to me. That is,
the necessity to put #cssClass: and #cssId:, as well as #div:, #span:,
etc everywhere, clutters up the more interesting parts (like anchors
and callbacks) of any given render method. Anyone have any good ideas
to keep these separated? I'm just throwing out random thoughts here,
but one possible pattern that occurs to me would be to introduce a
higher level wrapper around the HtmlRenderer, that was specific to a
particular component. For lack of a more imaginative name, let's call
this a View. The idea would be that the *structure* of the rendering
is still controlled by the component, but the specifics (the actual
tags and ids) are filled in by the View. So, for example, take the
following fairly typical render method:
MyComponent>>renderItems: aCollection on: html
html cssClass: 'item-list'.
html unorderedList:
[aCollection do:
[:ea |
html listItem:
[html cssClass: 'item-choose'.
html anchorWithAction: [self choose: ea] text: ea description.
html spanClass: 'item-actions' with: [html anchorWithAction: [self
remove: ea] text: '(remove)']]]]
Would it be better, or just more confusing and cumbersome, to split
this into something like:
MyComponent>>renderItems: aCollection on: view
view itemList:
[aCollection do:
[:ea |
view item:
[view chooseItem: [self choose: ea] text: ea description.
view itemActions: [view removeItem: [self remove: ea]]]]]
MyView>>itemList: aBlock
html cssClass: 'item-list'.
html unorderedList: aBlock
MyView>>item: aBlock
html listItem: aBlock
MyView>>chooseItem: actionBlock text: aString
html cssClass: 'item-choose'.
html anchorWithAction: actionBlock text: aString
MyView>>itemActions: aBlock
html spanClass: 'item-actions' with: aBlock
MyView>>removeItem: actionBlock
html anchorWithAction: actionBlock text: '(remove)'
Anyway, just a thought.
Cheers,
Avi
More information about the Seaside
mailing list