diff options
author | Eric Roberts <eric@cryode.com> | 2012-08-03 22:39:04 +0200 |
---|---|---|
committer | Eric Roberts <eric@cryode.com> | 2012-08-03 22:39:04 +0200 |
commit | 17636e8bb20a4d53fec8fd8aaf530f53bd22d612 (patch) | |
tree | a844b9aff5ecb42ce2c49ea4e187ef44cc4d39a8 /tests/codeigniter/core/Common_test.php | |
parent | da038d2ebccb4d45ea6d819c914563b2bc009a86 (diff) | |
parent | 6c94c2dcfb6557947c9ac67e419b2856fd80e01d (diff) |
Merge branch 'develop' of https://github.com/EllisLab/CodeIgniter into develop
Diffstat (limited to 'tests/codeigniter/core/Common_test.php')
-rw-r--r-- | tests/codeigniter/core/Common_test.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/codeigniter/core/Common_test.php b/tests/codeigniter/core/Common_test.php index f9bf6c27f..27d48efc2 100644 --- a/tests/codeigniter/core/Common_test.php +++ b/tests/codeigniter/core/Common_test.php @@ -10,4 +10,35 @@ class Common_test extends CI_TestCase { $this->assertEquals(FALSE, is_php('9999.9.9')); } + // ------------------------------------------------------------------------ + + public function test_stringify_attributes() + { + $this->assertEquals(' class="foo" id="bar"', _stringify_attributes(array('class' => 'foo', 'id' => 'bar'))); + + $atts = new Stdclass; + $atts->class = 'foo'; + $atts->id = 'bar'; + $this->assertEquals(' class="foo" id="bar"', _stringify_attributes($atts)); + + $atts = new Stdclass; + $this->assertEquals('', _stringify_attributes($atts)); + + $this->assertEquals(' class="foo" id="bar"', _stringify_attributes('class="foo" id="bar"')); + + $this->assertEquals('', _stringify_attributes(array())); + } + + // ------------------------------------------------------------------------ + + public function test_stringify_js_attributes() + { + $this->assertEquals('width=800,height=600', _stringify_attributes(array('width' => '800', 'height' => '600'), TRUE)); + + $atts = new Stdclass; + $atts->width = 800; + $atts->height = 600; + $this->assertEquals('width=800,height=600', _stringify_attributes($atts, TRUE)); + } + }
\ No newline at end of file |