summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codeigniter')
-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