summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/core
diff options
context:
space:
mode:
authorEric Barnes <eric@ericlbarnes.com>2012-07-29 19:17:50 +0200
committerEric Barnes <eric@ericlbarnes.com>2012-07-29 19:17:50 +0200
commitb01b4f5507523155a598d4ee03d2709a275e88cf (patch)
treecfe86860d3af5ead77bacda9794a4aad7f8925f1 /tests/codeigniter/core
parentd83e727d6deedded5b637e685accb4fac0dc3985 (diff)
parent49d2f304d4bb9c04c41c34f4675813b9d8ac3204 (diff)
Merge pull request #1669 from EllisLab/feature/stringify_attributes
Feature/stringify attributes
Diffstat (limited to 'tests/codeigniter/core')
-rw-r--r--tests/codeigniter/core/Common_test.php31
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