Esempio n. 1
0
 protected function getPanelButtonsLabels($expectedNum)
 {
     $buttons = $this->test->css('div.psc-cms-ui-buttonset', $this->html = $this->panelButtons->html())->count(1)->css('button')->count($expectedNum)->getjQuery();
     $labels = array();
     foreach ($buttons as $button) {
         $button = new jQuery($button);
         $labels[] = $button->text();
     }
     return $labels;
 }
Esempio n. 2
0
 public function testRowHTML()
 {
     $this->gridPanel->addRow(array('row1:col1', 'row1:col2', 'row1:col3'));
     $this->gridPanel->addRow(array('row2:col1', 'row2:col2', 'row2:col3'));
     $this->gridPanel->addRow(array('row3:col1', 'row3:col2', 'row3:col3'));
     $trs = $this->test->css('table tr', $this->html = $this->gridPanel->html())->getJQuery();
     foreach ($trs as $row => $tr) {
         if ($row === 0) {
             continue;
         }
         // skip header
         $tr = new jQuery($tr);
         $col = 1;
         foreach ($tr->find('td') as $td) {
             $td = new jQuery($td);
             // everything i right place?
             $this->assertEquals(sprintf('row%d:col%d', $row, $col), $td->text());
             $col++;
         }
         $row++;
     }
 }
Esempio n. 3
0
 /**
  *
  * Reihenfolge der Optionen ist wichtig
  */
 public function formSelect($html, $label, $name, $selectedValue = NULL, $options = NULL)
 {
     $select = $this->css($sel = sprintf('select[name="%s"]', $name), $html)->count(1, 'Count-Selector: ' . $sel)->hasAttribute('name', $name)->getJQuery();
     // options parsen
     $actualSelected = NULL;
     $actualOptions = array();
     foreach ($select->find('option') as $option) {
         $option = new jQuery($option);
         if ($option->attr('selected') != NULL) {
             $this->testCase->assertEmpty($actualSelected, 'Attribut "selected" ist mehrmals in <select> angegeben!');
             $actualSelected = $option->attr('value');
             // kann auch leer sein
         }
         // @TODO reread: name hier "überschreiben" okay? wiesn das in html?
         $actualOptions[$option->attr('value')] = $option->text();
     }
     if (func_num_args() >= 5) {
         $this->testCase->assertEquals($options, $actualOptions, 'Optionen stimmen nicht. (Reihenfolge relevant)');
     }
     if (func_num_args() >= 4) {
         $this->testCase->assertEquals($selectedValue, $actualSelected, 'Selected value stimmt nicht');
     }
     // label muss die id vom input haben
     if ($label != NULL) {
         $this->formLabelFor($html, $label, $select->attr('id'));
     }
 }