blob: 706874f9ee614e0589775adf45ebf0f7f4f24997 [file] [log] [blame]
Greg Akerb5679472011-04-21 14:34:31 -05001<?php
2
3require_once(BASEPATH.'helpers/html_helper.php');
4
Greg Akerb4d93db2011-04-21 14:42:33 -05005class Html_helper_test extends CI_TestCase
Greg Akerb5679472011-04-21 14:34:31 -05006{
Eric Barnes68286a42011-04-21 22:00:33 -04007
8 // ------------------------------------------------------------------------
9
10 public function test_br()
11 {
12 $this->assertEquals('<br /><br />', br(2));
13 }
14
15 // ------------------------------------------------------------------------
16
17 public function test_heading()
Greg Akerb5679472011-04-21 14:34:31 -050018 {
19 $this->assertEquals('<h1>foobar</h1>', heading('foobar'));
Eric Barnes68286a42011-04-21 22:00:33 -040020 $this->assertEquals('<h2 class="bar">foobar</h2>', heading('foobar', 2, 'class="bar"'));
Greg Akerb5679472011-04-21 14:34:31 -050021 }
22
23 // ------------------------------------------------------------------------
24
Eric Barnes68286a42011-04-21 22:00:33 -040025 public function test_Ul()
Greg Akerb5679472011-04-21 14:34:31 -050026 {
27 $expect = <<<EOH
28<ul>
29 <li>foo</li>
30 <li>bar</li>
31</ul>
32
33EOH;
34
35 $expect = ltrim($expect);
36
37 $list = array('foo', 'bar');
38
39 $this->assertEquals($expect, ul($list));
40
41
42 $expect = <<<EOH
43<ul class="test">
44 <li>foo</li>
45 <li>bar</li>
46</ul>
47
48EOH;
49
50 $expect = ltrim($expect);
51
52 $list = array('foo', 'bar');
53
54 $this->assertEquals($expect, ul($list, ' class="test"'));
55
56 $this->assertEquals($expect, ul($list, array('class' => 'test')));
57 }
58
59 // ------------------------------------------------------------------------
60
Eric Barnes68286a42011-04-21 22:00:33 -040061 public function test_NBS()
Greg Akerb5679472011-04-21 14:34:31 -050062 {
63 $this->assertEquals('&nbsp;&nbsp;&nbsp;', nbs(3));
64 }
65
66 // ------------------------------------------------------------------------
67
Eric Barnes68286a42011-04-21 22:00:33 -040068 public function test_meta()
Greg Akerb5679472011-04-21 14:34:31 -050069 {
70 $this->assertEquals("<meta name=\"test\" content=\"foo\" />\n", meta('test', 'foo'));
71
72 $expect = "<meta name=\"foo\" content=\"\" />\n";
73
74 $this->assertEquals($expect, meta(array('name' => 'foo')));
75
76 }
77
78}