summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2005-10-29 02:26:52 +0200
committerAndreas Gohr <andi@splitbrain.org>2005-10-29 02:26:52 +0200
commitbad31ae944f074dab12f7a6d1362775d8f2b18dd (patch)
treeaf7ed25d7d8ef9c2c836afdd21b1ee7398db3dcd /_test
parent551242f8292dd257969d52089332f6ddb8bd70b2 (diff)
downloadrpg-bad31ae944f074dab12f7a6d1362775d8f2b18dd.tar.gz
rpg-bad31ae944f074dab12f7a6d1362775d8f2b18dd.tar.bz2
JavaScript refactoring
This patch addes a first go on a central javascript and CSS dispatcher which builds a single script from all needed scripts, does optimizing and caching. darcs-hash:20051029002652-7ad00-7558b569c2bf65f5e41820644580d97c62edd0d6.gz
Diffstat (limited to '_test')
-rw-r--r--_test/cases/lib/exe/jscss_js_compress.test.php68
1 files changed, 68 insertions, 0 deletions
diff --git a/_test/cases/lib/exe/jscss_js_compress.test.php b/_test/cases/lib/exe/jscss_js_compress.test.php
new file mode 100644
index 000000000..3d9a8b627
--- /dev/null
+++ b/_test/cases/lib/exe/jscss_js_compress.test.php
@@ -0,0 +1,68 @@
+<?php
+
+require_once DOKU_INC.'lib/exe/jscss.php';
+
+
+class jscss_js_compress_test extends UnitTestCase {
+
+ function test_mlcom1(){
+ $text = '/**
+ * A multi
+ * line *test*
+ * check
+ */';
+ $this->assertEqual(js_compress($text), '');
+ }
+
+ function test_mlcom2(){
+ $text = 'var foo=6;/* another comment */';
+ $this->assertEqual(js_compress($text), 'var foo=6;');
+ }
+
+ function test_slcom1(){
+ $text = '// an comment';
+ $this->assertEqual(js_compress($text), '');
+ }
+
+ function test_slcom2(){
+ $text = 'var foo=6;// another comment ';
+ $this->assertEqual(js_compress($text), 'var foo=6;');
+ }
+
+ function test_slcom3(){
+ $text = 'var foo=6;// another comment / or something with // comments ';
+ $this->assertEqual(js_compress($text), 'var foo=6;');
+ }
+
+ function test_regex1(){
+ $text = 'foo.split( /[a-Z\/]*/ );';
+ $this->assertEqual(js_compress($text), 'foo.split(/[a-Z\/]*/);');
+ }
+
+ function test_dquot1(){
+ $text = 'var foo="Now what \'do we//get /*here*/ ?";';
+ $this->assertEqual(js_compress($text), $text);
+ }
+
+ function test_squot1(){
+ $text = "var foo='Now what \"do we//get /*here*/ ?';";
+ $this->assertEqual(js_compress($text), $text);
+ }
+
+ function test_nl1(){
+ $text = "var foo=6;\nvar baz=7;";
+ $this->assertEqual(js_compress($text), 'var foo=6;var baz=7;');
+ }
+
+ function test_lws1(){
+ $text = " \t var foo=6;";
+ $this->assertEqual(js_compress($text), 'var foo=6;');
+ }
+
+ function test_tws1(){
+ $text = "var foo=6; \t ";
+ $this->assertEqual(js_compress($text), 'var foo=6;');
+ }
+}
+
+//Setup VIM: ex: et ts=4 enc=utf-8 :