summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/helpers/html_helper_test.php
diff options
context:
space:
mode:
authorEric Roberts <eric@cryode.com>2012-12-12 14:02:11 +0100
committerEric Roberts <eric@cryode.com>2012-12-12 14:02:11 +0100
commitb9e35f21e1c70b6aa67c47e9244ed83195abc00a (patch)
tree64f82db362deeac48cc20d1d1afd80651f36f5a5 /tests/codeigniter/helpers/html_helper_test.php
parent0b05705c52c3bca7f9b3aee657c888e8ad1ff422 (diff)
parent545a7c86701875e1412bcde316e9bcc76d9a23a0 (diff)
Merge branch 'refs/heads/develop' into feature/form_error_msgs
Conflicts: system/language/english/form_validation_lang.php user_guide_src/source/libraries/form_validation.rst Signed-off-by: Eric Roberts <eric@cryode.com>
Diffstat (limited to 'tests/codeigniter/helpers/html_helper_test.php')
-rw-r--r--tests/codeigniter/helpers/html_helper_test.php44
1 files changed, 28 insertions, 16 deletions
diff --git a/tests/codeigniter/helpers/html_helper_test.php b/tests/codeigniter/helpers/html_helper_test.php
index 28974b0f8..d66ad895c 100644
--- a/tests/codeigniter/helpers/html_helper_test.php
+++ b/tests/codeigniter/helpers/html_helper_test.php
@@ -6,24 +6,40 @@ class Html_helper_test extends CI_TestCase {
{
$this->helper('html');
}
-
+
// ------------------------------------------------------------------------
-
+
public function test_br()
{
$this->assertEquals('<br /><br />', br(2));
}
-
+
// ------------------------------------------------------------------------
-
+
public function test_heading()
{
$this->assertEquals('<h1>foobar</h1>', heading('foobar'));
$this->assertEquals('<h2 class="bar">foobar</h2>', heading('foobar', 2, 'class="bar"'));
}
+ public function test_heading_array_attributes()
+ {
+ // Test array of attributes
+ $this->assertEquals('<h2 class="bar" id="foo">foobar</h2>', heading('foobar', 2, array('class' => 'bar', 'id' => 'foo')));
+ }
+
+ public function test_heading_object_attributes()
+ {
+ // Test array of attributes
+ $this->assertEquals('<h2 class="bar" id="foo">foobar</h2>', heading('foobar', 2, array('class' => 'bar', 'id' => 'foo')));
+ $test = new stdClass;
+ $test->class = "bar";
+ $test->id = "foo";
+ $this->assertEquals('<h2 class="bar" id="foo">foobar</h2>', heading('foobar', 2, $test));
+ }
+
// ------------------------------------------------------------------------
-
+
public function test_Ul()
{
$expect = <<<EOH
@@ -35,11 +51,9 @@ class Html_helper_test extends CI_TestCase {
EOH;
$expect = ltrim($expect);
-
$list = array('foo', 'bar');
-
- $this->assertEquals($expect, ul($list));
+ $this->assertEquals(ltrim($expect), ul($list));
$expect = <<<EOH
<ul class="test">
@@ -51,13 +65,11 @@ 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 test_NBS()
@@ -66,15 +78,15 @@ EOH;
}
// ------------------------------------------------------------------------
-
+
public function test_meta()
{
$this->assertEquals("<meta name=\"test\" content=\"foo\" />\n", meta('test', 'foo'));
-
+
$expect = "<meta name=\"foo\" content=\"\" />\n";
-
+
$this->assertEquals($expect, meta(array('name' => 'foo')));
-
+
}
-
+
} \ No newline at end of file