summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/helpers/html_helper_test.php
blob: 3b7f2b3426138b19e6ffdf2824449e3020e5aa52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php

require_once(BASEPATH.'helpers/html_helper.php');

class Html_helper_test extends PHPUnit_Framework_TestCase
{
	public function testHeading()
	{
		$this->assertEquals('<h1>foobar</h1>', heading('foobar'));
	}

	// ------------------------------------------------------------------------
	
	public function testUl()
	{
		$expect = <<<EOH
<ul>
  <li>foo</li>
  <li>bar</li>
</ul>

EOH;

		$expect = ltrim($expect);

		$list = array('foo', 'bar');
		
		$this->assertEquals($expect, ul($list));


		$expect = <<<EOH
<ul class="test">
  <li>foo</li>
  <li>bar</li>
</ul>

EOH;

		$expect = ltrim($expect);

		$list = array('foo', 'bar');

		$this->assertEquals($expect, ul($list, ' class="test"'));

		$this->assertEquals($expect, ul($list, array('class' => 'test')));
	}
	
	// ------------------------------------------------------------------------

	public function testNBS()
	{
		$this->assertEquals('&nbsp;&nbsp;&nbsp;', nbs(3));
	}

	// ------------------------------------------------------------------------
	
	public function testMeta()
	{
		$this->assertEquals("<meta name=\"test\" content=\"foo\" />\n", meta('test', 'foo'));
		
		$expect = "<meta name=\"foo\" content=\"\" />\n";
		
		$this->assertEquals($expect, meta(array('name' => 'foo')));
		
	}
	
}