diff options
author | Eric Barnes <eric@ericlbarnes.com> | 2012-07-28 20:57:04 +0200 |
---|---|---|
committer | Eric Barnes <eric@ericlbarnes.com> | 2012-07-28 20:57:04 +0200 |
commit | 62ab8b24fc37a25eab9205c46321fa41729e5faf (patch) | |
tree | 5afb35e82120a141fcaac6294d93783da38a8289 /tests/codeigniter | |
parent | d83e727d6deedded5b637e685accb4fac0dc3985 (diff) |
Adding optional attributes as array or object for html helper
Diffstat (limited to 'tests/codeigniter')
-rw-r--r-- | tests/codeigniter/helpers/html_helper_test.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/codeigniter/helpers/html_helper_test.php b/tests/codeigniter/helpers/html_helper_test.php index 9a7bb48bf..4dd717ff7 100644 --- a/tests/codeigniter/helpers/html_helper_test.php +++ b/tests/codeigniter/helpers/html_helper_test.php @@ -22,6 +22,22 @@ class Html_helper_test extends CI_TestCase { $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() @@ -72,5 +88,4 @@ EOH; $this->assertEquals($expect, meta(array('name' => 'foo'))); } - }
\ No newline at end of file |