$css = new sfDomCssSelector($dom); $t->is(count($css->matchAll('#foo_hour option')->getNodes()), 5, '__construct() can change the default array used for hours'); $t->is(count($css->matchAll('#foo_minute option')->getNodes()), 3, '__construct() can change the default array used for minutes'); $t->is(count($css->matchAll('#foo_second option')->getNodes()), 4, '__construct() can change the default array used for seconds'); // with_seconds option $t->diag('with_seconds option'); $w->setOption('with_seconds', false); $dom->loadHTML($w->render('foo', '12:30:35')); $css = new sfDomCssSelector($dom); $t->is(count($css->matchAll('#foo_second option')->getNodes()), 0, '__construct() can enable or disable the seconds select box with the with_seconds option'); $w->setOption('format_without_seconds', '%hour%#%minute%'); $dom->loadHTML($w->render('foo', '12:30:35')); $css = new sfDomCssSelector($dom); $t->like($css->matchSingle('#foo_hour')->getNode()->nextSibling->nodeValue, '/^#/', '__construct() can change the default format'); $t->ok(!count($css->matchSingle('#foo_second')->getNodes()), '__construct() can change the default format'); // attributes $t->diag('attributes'); $w->setOption('with_seconds', true); $dom->loadHTML($w->render('foo', '12:30:35', array('disabled' => 'disabled'))); $t->is(count($css->matchAll('select[disabled="disabled"]')->getNodes()), 3, '->render() takes the attributes into account for all the three embedded widgets'); $w->setAttribute('disabled', 'disabled'); $dom->loadHTML($w->render('foo', '12:30:35')); $t->is(count($css->matchAll('select[disabled="disabled"]')->getNodes()), 3, '->render() takes the attributes into account for all the three embedded widgets'); // id_format $t->diag('id_format'); $w->setOption('with_seconds', true); $w->setIdFormat('id_%s'); $dom->loadHTML($w->render('foo')); $t->is(count($css->matchAll('#id_foo_hour')), 1, '->render() uses id_format for hour'); $t->is(count($css->matchAll('#id_foo_minute')), 1, '->render() uses id_format for minute'); $t->is(count($css->matchAll('#id_foo_second')), 1, '->render() uses id_format for second');