Exemplo n.º 1
0
 public function test__toString_WithProperties()
 {
     $this->button->setIdentifier('Search_Button');
     $this->button->setProperties(array('label' => 'Search', 'id' => 'cmdSearch', 'class' => 'longbtn', 'type' => 'submit', 'name' => '_search'));
     $expectedAttributes = array('type="submit"', 'class="longbtn"', 'id="cmdSearch"', 'name="_search"', 'onmouseover="this.className=\'longbtn longbtnhov\'"', 'onmouseout="this.className=\'longbtn\'"', 'value="Search"');
     $html = $this->button->__toString();
     foreach ($expectedAttributes as $attribute) {
         $this->assertRegExp("/{$attribute}/", $html);
     }
 }
Exemplo n.º 2
0
function printButtonEventBindings($buttons)
{
    foreach ($buttons as $key => $buttonProperties) {
        $button = new Button();
        $button->setProperties($buttonProperties);
        $button->setIdentifier($key);
        if (!empty($buttonProperties['function'])) {
            echo "\t\$('#{$button->getId()}').click({$buttonProperties['function']});", "\n";
        }
    }
}