You're not confused. It doesn't work as designed. This line in trunk
LzNode is just wrong:
LzNode.prototype.setOption = function ( key , val ){
if ( !this.options ) this.options = {};
That's makes it break on instances. And it doesn't work in a case like
this:
<class name="a" options="x : 1"/>
<class name="b" options="y : 1" extends="a"/>
Because there's no setter for options. So yeah, it was busted before.
A
On Sep 25, P T Withington wrote:
> From what I understand you to say, I should expect node options to be
> inherited. But this test case fails in trunk. Am I confused, or are options
> completely broken?
>
> <canvas debug="true">
> <include href="lzunit" />
> <class name="top" options="some: 'thing'" />
> <class name="middle" extends="top" options="other: 'else'" />
> <class name="bottom" extends="middle" options="besides: 'what'" />
> <middle id="m1">
> <bottom id="b1" options="last: 'end'">
> </bottom>
> </middle>
>
> <class name="Options" extends="TestCase">
> <method name="testOptions">
> <![CDATA[
> assertEquals('thing', b1.options['some']);
> assertEquals('else', b1.options['other']);
> assertEquals('what', b1.options['besides']);
> assertEquals('end', b1.options['last']);
> b1.setOption('other', 'another');
> assertEquals('else', m1.options['other']);
> ]]>
> </method>
> </class>
>
> <TestSuite>
> <Options />
> </TestSuite>
> </canvas>
>
>
>
> On 2006-09-21, at 18:52 EDT, Adam Wolff wrote:
>
> > This looks good. Is there a test to make sure that instances get their
> > class and superclass options? What about replicated views not sharing a
> > single options slot? The code looks correct, but those would be nice to
> > have.
> >
> > If there is strict enforcement of getter/setter-only access to options,
> > then maybe this would be a good time to rename the options slot to
> > __LZoptions, especially since writing to that slot would be catastrophic.
> >
> > A
> >
> > On Sep 21, P T Withington wrote:
> >
> > > And just let me know if it seems like the right solution? It's a little
> > > tricky, so I didn't want to check it in without a sanity check...
> > >
> > > Begin forwarded message:
> > >
> > > > From: P T Withington <[EMAIL PROTECTED]>
> > > > Date: 18 September 2006 15:09:06 EDT
> > > > To: Adam Wolff <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> > > > Cc: [email protected]
> > > > Subject: For Review: Change change.zpAulUWBZ.txt Summary: Make node
> > > > options
> > > > type safe
> > > >
> > > > Change change.zpAulUWBZ.txt by [EMAIL PROTECTED]
> > > > /Users/ptw/pending-changes/ on 2006-09-18 13:07:00 EDT
> > > >
> > > > Summary: Make node options type safe
> > > >
> > > > Technical Reviewer: adam (pending)
> > > > QA Reviewer: henry (pending)
> > > > Doc Reviewer: (pending)
> > > >
> > > > Details:
> > > > Use a sentinel hash for options. Replace the sentinel in the setter.
> > > >
> > > > Tests:
> > > > Inspection
> > > >
> > > > Files:
> > > > M core/LzNode.lzs
> > >
>
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev