Esempio n. 1
0
 function testRunatAsHasMorePriority()
 {
     $parent = $this->_createParentTag();
     $info = new WactTagInfo('my_tag', 'blah');
     $info->setRunat('client');
     $info->setRunatAs('WactRuntimeComponentHTMLTag');
     $this->dictionary->registerWactTagInfo($info, $file = 'whatever');
     $tag = 'my_tag';
     $attrs = array();
     $this->assertEqual($this->dictionary->findTagInfo($tag, $attrs, FALSE, $parent), $info);
 }
Esempio n. 2
0
 function findTagInfo($tag, $attrs, $isEmpty, $current_node)
 {
     $tag = strtolower($tag);
     if (isset($attrs['wact:id'])) {
         $attrs['runat'] = 'server';
     }
     // Does the tag have the runat attribute? If so it might be a component
     if (isset($attrs['runat'])) {
         if (strtolower($attrs['runat']) == 'server') {
             if (isset($this->info[$tag])) {
                 return $this->info[$tag];
             } else {
                 // we are a generic tag.  We run at the server, but have no
                 // specific WactTagInfo record in the dictionary.
                 if (!$isEmpty) {
                     $generic = new WactTagInfo($tag, 'WactGenericContainerHTMLTag');
                     $generic->File = 'limb/wact/src/compiler/tag_node/WactGenericContainerHTMLTag.class.php';
                 } else {
                     $generic = new WactTagInfo($tag, 'WactGenericHTMLTag');
                     $generic->File = 'limb/wact/src/compiler/tag_node/WactGenericHTMLTag.class.php';
                     $generic->setForbidEndTag();
                 }
                 $generic->setRunat('client');
                 return $generic;
             }
         }
     } else {
         if (isset($this->info[$tag])) {
             $WactTagInfo = $this->info[$tag];
             if ($WactTagInfo->getRunat() == 'server') {
                 return $WactTagInfo;
             }
             // Check if tag allowed to inherit runat attribute from parent
             if ($runat_as = $WactTagInfo->getRunatAs()) {
                 if ($parent = $current_node->findSelfOrParentByClass($runat_as)) {
                     if ($parent->getBoolAttribute('children_reuse_runat', TRUE)) {
                         return $WactTagInfo;
                     }
                 }
             }
         }
     }
     return NULL;
 }
Esempio n. 3
0
 function testEndTagIsPlainSinceRunAtClientButPopExpectedPlainTagReturnMatchToWactTag()
 {
     $tag = 'test';
     $info = new WactTagInfo($tag, 'test');
     $info->setRunat('client');
     $this->tag_dictionary->setReturnReference('getWactTagInfo', $info);
     $location = new WactSourceLocation('my_file', 10);
     $this->tree_builder->expectOnce('popExpectedPlainTag', array($tag, $location));
     $this->tree_builder->setReturnValue('popExpectedPlainTag', WACT_EXPECTED_WACT_TAG);
     $this->tree_builder->expectOnce('popNode');
     $this->state->endTag($tag, $location);
 }