comparison _test/Test/Web/View.pm @ 238:b8c724f6de36

DOM model refactoring TT view refactoring, controls are no longer derived from DOM nodes bugfixes
author sergey
date Tue, 16 Oct 2012 01:33:06 +0400
parents 7a920771fd8e
children 0f59b2de72af
comparison
equal deleted inserted replaced
237:61db68166c37 238:b8c724f6de36
98 my $doc = $loader->document('simple'); 98 my $doc = $loader->document('simple');
99 99
100 assert(defined $doc); 100 assert(defined $doc);
101 $doc->title('test document'); 101 $doc->title('test document');
102 102
103 assert($doc->nodeName eq 'document'); 103 assert($doc->name eq 'document');
104 assert($doc->title eq 'test document'); 104 assert($doc->title eq 'test document');
105 105
106 assert(not $doc->can('notexists')); # autoloaded property should be ignored 106 assert(not $doc->can('notexists')); # autoloaded property should be ignored
107 assert(not defined $doc->notexists); # nonexisting property 107 assert(not defined $doc->notexists); # nonexisting property
108 assert($doc->template->version == 10); # static metadata 108 assert($doc->template->version == 10); # static metadata
125 125
126 my $doc = $loader->document('simple'); 126 my $doc = $loader->document('simple');
127 127
128 assert(defined $doc); 128 assert(defined $doc);
129 129
130 my $factory = $doc->require('My/Org/Panel'); 130 my $factory = $doc->RequireControl('My/Org/Panel');
131 131
132 assert(defined $factory); 132 assert(defined $factory);
133 133
134 134
135 assert($factory->context->stash != $doc->context->stash); 135 assert($factory->context->stash != $doc->context->stash);
136 136
137 assert($factory == $doc->require('My/Org/Panel'), "Control should be loaded only once"); 137 assert($factory == $doc->RequireControl('My/Org/Panel'), "Control should be loaded only once");
138 138
139 my $ctl = $factory->new('information', { visualClass => 'simple', data => ['one','two','hello world'] } ); 139 my $ctl = $factory->new('information', { visualClass => 'simple', data => ['one','two','hello world'] } );
140 140
141 assert(defined $ctl); 141 assert(defined $ctl);
142 142
143 assert($ctl->nodeName eq 'information', "Created control should have a name", "Got: ".$ctl->nodeName, "Expected: information"); 143 assert($ctl->name eq 'information', "Created control should have a name", "Got: ".$ctl->name, "Expected: information");
144 144
145 assert($ctl->nodeProperty('visualClass') eq 'simple'); 145 assert($ctl->GetAttribute('visualClass') eq 'simple');
146 146
147 assert($factory->instances == 1); 147 assert($factory->instances == 1);
148 148
149 $doc->appendChild($ctl); 149 $doc->childNodes([$ctl]);
150 150
151 assert($doc->templateVars('dojo.require')); 151 assert($doc->templateVars('dojo.require'));
152 assert(ref $doc->templateVars('dojo.require') eq 'ARRAY'); 152 assert(ref $doc->templateVars('dojo.require') eq 'ARRAY');
153 assert($doc->templateVars('dojo.require')->[0] eq 'dijit.form.Input' ); 153 assert($doc->templateVars('dojo.require')->[0] eq 'dijit.form.Input' );
154 154
203 $loader->template('Layout/default'); 203 $loader->template('Layout/default');
204 $loader->template('My/Org/Panel'); 204 $loader->template('My/Org/Panel');
205 $loader->template('My/Org/TextPreview'); 205 $loader->template('My/Org/TextPreview');
206 AssertMemoryLeak(sub { 206 AssertMemoryLeak(sub {
207 my $doc = $loader->document('simple'); 207 my $doc = $loader->document('simple');
208 my $factory = $doc->require('My/Org/Panel'); 208 my $factory = $doc->RequireControl('My/Org/Panel');
209 my $ctl = $doc->AppendChild($factory->new('information', { visualClass => 'complex' }) ); 209 my $ctl = $doc->childNodes($factory->new('information', { visualClass => 'complex' }) );
210 }); 210 });
211 211
212 $loader->template('complex'); 212 $loader->template('complex');
213 AssertMemoryLeak(sub { 213 AssertMemoryLeak(sub {
214 my $doc = $loader->document('complex'); 214 my $doc = $loader->document('complex');