예제 #1
0
파일: dmHelperTest.php 프로젝트: jdart/diem
$div = '<div title="title with a #inside" id="test_id" class="test_class other_class"></div>';
$t->is(£('div#test_id.test_class.other_class title="title with a #inside"'), $div, $div);
$div = '<div title="title with a #inside" class="test_class other_class"></div>';
$t->is(£('div.test_class.other_class title="title with a #inside"'), $div, $div);
$div = '<div title="title with a .inside" class="test_class other_class"></div>';
$t->is(£('div.test_class.other_class title="title with a .inside"'), $div, $div);
$div = '<div lang="c1"></div>';
$t->is(£('div lang=c1'), $div, $div);
$div = '<div></div>';
$t->is(£('div lang=' . $helper->get('user')->getCulture()), $div, $div);
$table = '<table><thead><tr><th>Header 1</th><th>Header 2</th></tr></thead></table>';
$t->is(_table()->head('Header 1', 'Header 2')->render(), $table, $table);
$table = '<table><thead><tr><th>Header 1</th><th>Header 2</th></tr></thead><tbody><tr><td>Value 1</td><td>Value 2</td></tr><tr><td>Value 3</td><td>Value 4</td></tr></tbody></table>';
$t->is(£table()->head('Header 1', 'Header 2')->body('Value 1', 'Value 2')->body('Value 3', 'Value 4')->render(), $table, $table);
$table = '<table><thead><tr><th>Header 1</th><th>Header 2</th></tr></thead><tbody><tr class="even"><td>Value 1</td><td>Value 2</td></tr><tr class="odd"><td>Value 3</td><td>Value 4</td></tr></tbody></table>';
$t->is(£table()->useStrip(true)->head('Header 1', 'Header 2')->body('Value 1', 'Value 2')->body('Value 3', 'Value 4')->render(), $table, $table);
$ctrlFullPath = dmOs::join(sfConfig::get('sf_web_dir'), 'dmCorePlugin/js/dmCoreCtrl.js');
$t->is($helper->get('helper')->getJavascriptFullPath('core.ctrl'), $ctrlFullPath, 'core ctrl is in ' . $ctrlFullPath);
$t->comment('Test use_beaf');
$helper->get('helper')->setOption('use_beaf', true);
$expected = '<div class="beafh clearfix"><div class="beafore"></div><div class="beafin">test</div><div class="beafter"></div></div>';
$t->is($helper->get('helper')->tag('div.beafh', 'test'), $expected, $expected);
$expected = '<div class="beafv clearfix"><div class="beafore"></div><div class="beafin">test</div><div class="beafter"></div></div>';
$t->is($helper->get('helper')->tag('div.beafv', 'test'), $expected, $expected);
$expected = '<div class="beafh myclass clearfix"><div class="beafore"></div><div class="beafin">test</div><div class="beafter"></div></div>';
$t->is($helper->get('helper')->tag('div.beafh.myclass', 'test'), $expected, $expected);
$expected = '<div class="beafv myclass clearfix"><div class="beafore"></div><div class="beafin">test</div><div class="beafter"></div></div>';
$t->is($helper->get('helper')->tag('div.beafv.myclass', 'test'), $expected, $expected);
$expected = '<p class="beafh clearfix"><span class="beafore"></span><span class="beafin">test</span><span class="beafter"></span></p>';
$t->is($helper->get('helper')->tag('p.beafh', 'test'), $expected, $expected);
$expected = '<p class="beafv clearfix"><span class="beafore"></span><span class="beafin">test</span><span class="beafter"></span></p>';
예제 #2
0
<?php

use_helper('Date');
echo _open('div.snippet.list');
if ($sf_user->getFlash('form_saved')) {
    echo _tag('p.mt20.mb20', 'Thanks for your snippet !');
}
echo $snippetPager->renderNavigationTop();
$table = £table()->head(__('Snippet'), __('Date'), __('Author'));
foreach ($snippetPager as $snippet) {
    $table->body(_tag('h2.t_plugin', _link($snippet)->text(escape($snippet->name))), format_date($snippet->createdAt, 'd'), escape($snippet->createdBy));
}
echo $table;
echo $snippetPager->renderNavigationBottom();
echo _close('div');
예제 #3
0
$t->is($templateHelper->£('div', array('json' => array('attr' => 'value')), 'div content'), _tag('div', array('json' => array('attr' => 'value')), 'div content'), $div);
$t->is(£('div', array('json' => array('attr' => 'value')), 'div content'), _tag('div', array('json' => array('attr' => 'value')), 'div content'), $div);
$a = '<a href="an_href#with_anchor" id="test_id" class="test_class">a content</a>';
$t->is($templateHelper->£('a#test_id.test_class href="an_href#with_anchor"', 'a content'), _tag('a#test_id.test_class href="an_href#with_anchor"', 'a content'), $a);
$t->is(£('a#test_id.test_class href="an_href#with_anchor"', 'a content'), _tag('a#test_id.test_class href="an_href#with_anchor"', 'a content'), $a);
$closeDiv = '</div>';
$t->is(£c('div'), _tagC('div'), $closeDiv);
$div = '<div title="title with a # inside" id="test_id" class="test_class other_class"></div>';
$t->is($templateHelper->£('div#test_id.test_class.other_class title="title with a # inside"'), _tag('div#test_id.test_class.other_class title="title with a # inside"'), $div);
$t->is(£('div#test_id.test_class.other_class title="title with a # inside"'), _tag('div#test_id.test_class.other_class title="title with a # inside"'), $div);
$div = '<div title="title with a #inside" id="test_id" class="test_class other_class"></div>';
$t->is($templateHelper->£('div#test_id.test_class.other_class title="title with a #inside"'), _tag('div#test_id.test_class.other_class title="title with a #inside"'), $div);
$t->is(£('div#test_id.test_class.other_class title="title with a #inside"'), _tag('div#test_id.test_class.other_class title="title with a #inside"'), $div);
$div = '<div title="title with a #inside" class="test_class other_class"></div>';
$t->is($templateHelper->£('div.test_class.other_class title="title with a #inside"'), _tag('div.test_class.other_class title="title with a #inside"'), $div);
$t->is(£('div.test_class.other_class title="title with a #inside"'), _tag('div.test_class.other_class title="title with a #inside"'), $div);
$div = '<div title="title with a .inside" class="test_class other_class"></div>';
$t->is($templateHelper->£('div.test_class.other_class title="title with a .inside"'), _tag('div.test_class.other_class title="title with a .inside"'), $div);
$t->is(£('div.test_class.other_class title="title with a .inside"'), _tag('div.test_class.other_class title="title with a .inside"'), $div);
$div = '<div lang="c1"></div>';
$t->is($templateHelper->£('div lang=c1'), _tag('div lang=c1'), $div);
$t->is(£('div lang=c1'), _tag('div lang=c1'), $div);
$div = '<div></div>';
$t->is(£('div lang=' . $helper->get('user')->getCulture()), $div, $div);
$table = '<table><thead><tr><th>Header 1</th><th>Header 2</th></tr></thead></table>';
$t->is(£table()->head('Header 1', 'Header 2')->render(), _table()->head('Header 1', 'Header 2')->render(), $table);
$t->is($templateHelper->£table()->head('Header 1', 'Header 2')->render(), _table()->head('Header 1', 'Header 2')->render(), $table);
$table = '<table><thead><tr><th>Header 1</th><th>Header 2</th></tr></thead><tbody><tr class="even"><td>Value 1</td><td>Value 2</td></tr><tr class="odd"><td>Value 3</td><td>Value 4</td></tr></tbody></table>';
$t->is($templateHelper->£table()->head('Header 1', 'Header 2')->body('Value 1', 'Value 2')->body('Value 3', 'Value 4')->render(), _table()->head('Header 1', 'Header 2')->body('Value 1', 'Value 2')->body('Value 3', 'Value 4')->render(), $table);
$t->is(£table()->head('Header 1', 'Header 2')->body('Value 1', 'Value 2')->body('Value 3', 'Value 4')->render(), _table()->head('Header 1', 'Header 2')->body('Value 1', 'Value 2')->body('Value 3', 'Value 4')->render(), $table);