summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Stoeckler2010-09-22 17:32:46 (GMT)
committer Tobias Stoeckler2010-09-22 17:32:46 (GMT)
commit1e3bab85e96412d68bfb6a2898ac360f74e8c927 (patch)
treeea3cfa4ec970206d9148e5bcd79af58fc45589f4
parentd033c26088622995d9b143174932bc860a80c417 (diff)
#719896 followup: commit files missed in previous commit
-rw-r--r--tests/example/README.txt43
-rw-r--r--tests/example/example_1.css13
-rw-r--r--tests/example/example_1.js19
-rw-r--r--tests/example/example_1.php13
-rw-r--r--tests/example/example_2.css13
-rw-r--r--tests/example/example_2.js19
-rw-r--r--tests/example/example_2.php13
-rw-r--r--tests/example/example_3.css13
-rw-r--r--tests/example/example_3.js19
-rw-r--r--tests/example/example_3.php13
-rw-r--r--tests/example/example_4.css13
-rw-r--r--tests/example/example_4.js19
-rw-r--r--tests/example/example_4.php13
13 files changed, 223 insertions, 0 deletions
diff --git a/tests/example/README.txt b/tests/example/README.txt
new file mode 100644
index 0000000..c781e9c
--- /dev/null
+++ b/tests/example/README.txt
@@ -0,0 +1,43 @@
+; $Id$
+
+Example library
+
+Version 2
+
+This file is an example file to test version detection.
+
+The various other files in this directory are to test the loading of JavaScript,
+CSS and PHP files.
+- JavaScript: The filenames of the JavaScript files are asserted to be in the
+ raw HTML via SimpleTest. Since the filename could appear, for instance, in an
+ error message, this is not very robust. Explicit testing of JavaScript,
+ though, is not yet possible with SimpleTest. Hence, the JavaScript files, if
+ loaded, insert a div with the id 'libraries-test' after the page title and put
+ some sample text in it of the form: "If this text shows up, the JavaScript
+ file was loaded successfully. If this text is [color], the CSS file was loaded
+ successfully." [color] is either 'red', 'green', 'orange' or 'blue' (see
+ below). If you enable SimpleTest's verbose mode and see the above text in one
+ of the debug pages, a JavaScript file was loaded successfully. Which file
+ depends on the color that is mentioned in the shown text (see below).
+- CSS: The filenames of the CSS files are asserted to be in the raw HTML via
+ SimpleTest. Since the filename could appear, for instance, in an error
+ message, this is not very robust. Explicit testing of CSS, though, is not yet
+ possible with SimpleTest. Hence, the CSS files, if loaded, make the text that
+ was inserted via JavaScipt (see above) a certain color. If you enable
+ SimpleTest's verbose mode, and see the above text in a certain color (i.e. not
+ in black), a CSS file was loaded successfully. Which file depends on the
+ color:
+ - example_1: red
+ - example_2: green
+ - example_3: orange
+ - example_4: blue
+ Note that, because the CSS affects a div that is inserted via JavaScript, the
+ testing of CSS loading with this method is dependent on JavaScript loading.
+- PHP: The loading of PHP files is tested by defining a dummy function in the
+ PHP files and then checking whether this function was defined using
+ function_exists(). This can be checked programatically with SimpleTest.
+The loading of integration files is tested with the same method. The integration
+files are libraries_test.js, libraries_test.css, libraries_test.inc and are
+located in the tests directory alongside libraries_test.module (i.e. they are
+not in the same directory as this file). The color that the JavaScript and CSS
+integration files refer to is purple.
diff --git a/tests/example/example_1.css b/tests/example/example_1.css
new file mode 100644
index 0000000..12ec7aa
--- /dev/null
+++ b/tests/example/example_1.css
@@ -0,0 +1,13 @@
+/* $Id$ */
+
+/**
+ * @file
+ * Test CSS file for Libraries loading.
+ *
+ * Color the 'libraries-test' div red. See example_installed.txt for more
+ * information.
+ */
+
+div#libraries-test {
+ color: red;
+}
diff --git a/tests/example/example_1.js b/tests/example/example_1.js
new file mode 100644
index 0000000..0a46b8a
--- /dev/null
+++ b/tests/example/example_1.js
@@ -0,0 +1,19 @@
+// $Id$
+
+/**
+ * @file
+ * Test JavaScript file for Libraries loading.
+ *
+ * Insert a 'libraries-test' div and some text below the page title. See
+ * example_installed.txt for more information.
+ */
+
+(function ($) {
+
+Drupal.behaviors.librariesTest = {
+ attach: function(context, settings) {
+ $('h1#page-title').after('<div id="libraries-test">If this text shows up, the JavaScript file was loaded successfully. If this text is red, the CSS file was loaded successfully.</div>')
+ }
+};
+
+})(jQuery);
diff --git a/tests/example/example_1.php b/tests/example/example_1.php
new file mode 100644
index 0000000..7b4afdc
--- /dev/null
+++ b/tests/example/example_1.php
@@ -0,0 +1,13 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Test PHP file for Libraries loading.
+ */
+
+/**
+ * Dummy function to see if this file was loaded.
+ */
+function _libraries_test_example_1() {
+}
diff --git a/tests/example/example_2.css b/tests/example/example_2.css
new file mode 100644
index 0000000..14266bc
--- /dev/null
+++ b/tests/example/example_2.css
@@ -0,0 +1,13 @@
+/* $Id$ */
+
+/**
+ * @file
+ * Test CSS file for Libraries loading.
+ *
+ * Color the 'libraries-test' div green. See example_installed.txt for more
+ * information.
+ */
+
+div#libraries-test {
+ color: green;
+}
diff --git a/tests/example/example_2.js b/tests/example/example_2.js
new file mode 100644
index 0000000..8d42cdb
--- /dev/null
+++ b/tests/example/example_2.js
@@ -0,0 +1,19 @@
+// $Id$
+
+/**
+ * @file
+ * Test JavaScript file for Libraries loading.
+ *
+ * Insert a 'libraries-test' div and some text below the page title. See
+ * example_installed.txt for more information.
+ */
+
+(function ($) {
+
+Drupal.behaviors.librariesTest = {
+ attach: function(context, settings) {
+ $('h1#page-title').after('<div id="libraries-test">If this text shows up, the JavaScript file was loaded successfully. If this text is green, the CSS file was loaded successfully.</div>')
+ }
+};
+
+})(jQuery);
diff --git a/tests/example/example_2.php b/tests/example/example_2.php
new file mode 100644
index 0000000..c0b8a98
--- /dev/null
+++ b/tests/example/example_2.php
@@ -0,0 +1,13 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Test PHP file for Libraries loading.
+ */
+
+/**
+ * Dummy function to see if this file was loaded.
+ */
+function _libraries_test_example_2() {
+}
diff --git a/tests/example/example_3.css b/tests/example/example_3.css
new file mode 100644
index 0000000..9bca57d
--- /dev/null
+++ b/tests/example/example_3.css
@@ -0,0 +1,13 @@
+/* $Id$ */
+
+/**
+ * @file
+ * Test CSS file for Libraries loading.
+ *
+ * Color the 'libraries-test' div orange. See example_installed.txt for more
+ * information.
+ */
+
+div#libraries-test {
+ color: orange;
+}
diff --git a/tests/example/example_3.js b/tests/example/example_3.js
new file mode 100644
index 0000000..ec22b22
--- /dev/null
+++ b/tests/example/example_3.js
@@ -0,0 +1,19 @@
+// $Id$
+
+/**
+ * @file
+ * Test JavaScript file for Libraries loading.
+ *
+ * Insert a 'libraries-test' div and some text below the page title. See
+ * example_installed.txt for more information.
+ */
+
+(function ($) {
+
+Drupal.behaviors.librariesTest = {
+ attach: function(context, settings) {
+ $('h1#page-title').after('<div id="libraries-test">If this text shows up, the JavaScript file was loaded successfully. If this text is orange, the CSS file was loaded successfully.</div>')
+ }
+};
+
+})(jQuery);
diff --git a/tests/example/example_3.php b/tests/example/example_3.php
new file mode 100644
index 0000000..9b3b492
--- /dev/null
+++ b/tests/example/example_3.php
@@ -0,0 +1,13 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Test PHP file for Libraries loading.
+ */
+
+/**
+ * Dummy function to see if this file was loaded.
+ */
+function _libraries_test_example_3() {
+}
diff --git a/tests/example/example_4.css b/tests/example/example_4.css
new file mode 100644
index 0000000..52ad073
--- /dev/null
+++ b/tests/example/example_4.css
@@ -0,0 +1,13 @@
+/* $Id$ */
+
+/**
+ * @file
+ * Test CSS file for Libraries loading.
+ *
+ * Color the 'libraries-test' div blue. See example_installed.txt for more
+ * information.
+ */
+
+div#libraries-test {
+ color: blue;
+}
diff --git a/tests/example/example_4.js b/tests/example/example_4.js
new file mode 100644
index 0000000..ed6842e
--- /dev/null
+++ b/tests/example/example_4.js
@@ -0,0 +1,19 @@
+// $Id$
+
+/**
+ * @file
+ * Test JavaScript file for Libraries loading.
+ *
+ * Insert a 'libraries-test' div and some text below the page title. See
+ * example_installed.txt for more information.
+ */
+
+(function ($) {
+
+Drupal.behaviors.librariesTest = {
+ attach: function(context, settings) {
+ $('h1#page-title').after('<div id="libraries-test">If this text shows up, the JavaScript file was loaded successfully. If this text is blue, the CSS file was loaded successfully.</div>')
+ }
+};
+
+})(jQuery);
diff --git a/tests/example/example_4.php b/tests/example/example_4.php
new file mode 100644
index 0000000..7899209
--- /dev/null
+++ b/tests/example/example_4.php
@@ -0,0 +1,13 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Test PHP file for Libraries loading.
+ */
+
+/**
+ * Dummy function to see if this file was loaded.
+ */
+function _libraries_test_example_4() {
+}