[jquery-em commit] r23 - in trunk: . test test/data

0 views
Skip to first unread message

codesite...@google.com

unread,
Aug 19, 2007, 6:03:33 AM8/19/07
to jque...@googlegroups.com
Author: davecardwell
Date: Sun Aug 19 03:03:17 2007
New Revision: 23

Modified:
trunk/jquery.em.js
trunk/test/data/test.js
trunk/test/data/testsuite.css
trunk/test/index.html

Log:
Added version numbers for jQuery and jQuery-Em to the test suite.

Modified: trunk/jquery.em.js
==============================================================================
--- trunk/jquery.em.js (original)
+++ trunk/jquery.em.js Sun Aug 19 03:03:17 2007
@@ -67,7 +67,7 @@
* @example $.em.action = function() { ... }
* @desc The default action is to trigger a global "emchange" event.
* You probably shouldn't change this behaviour as other plugins may
- * rely on it.
+ * rely on it, but the option is here for completion.
*
* @example $(document).bind('emchange', function(e, cur, prev) {...})
* @desc Any functions triggered on this event are passed the current

Modified: trunk/test/data/test.js
==============================================================================
--- trunk/test/data/test.js (original)
+++ trunk/test/data/test.js Sun Aug 19 03:03:17 2007
@@ -1,89 +1,93 @@
jQuery(function($) {
- (function($) {
- /***
- * Property Type Tests
- */
- test('Property Types', function() {
- expect(6);
+ $('#versions').html(
+ '<dt>jQuery</dt>' + '<dd>v' + $.fn.jquery + '</dd>'
+ + '<dt>jQuery-Em</dt>' + '<dd>v' + $.em.version + '</dd>'
+ );
+
+
+ /***
+ * Property Type Tests
+ */
+ test('Property Types', function() {
+ expect(6);
+
+ // Since the values can vary from browser to browser, we can only
+ // really test their types reliably.
+ equals( 'string', typeof $.em.version, '$.em.version' );
+ equals( 'number', typeof $.em.delay, '$.em.delay' );
+ equals( 'function', typeof $.em.action, '$.em.action' );
+ equals( 'number', typeof $.em.current, '$.em.current' );
+ equals( 'undefined', typeof $.em.previous, '$.em.previous' );
+ equals( 'number', typeof $.em.iid, '$.em.iid' );
+ });
+
+
+ /***
+ * Element Tests
+ */
+ test('Element', function() {
+ expect(5);
+
+ // Make sure the element exists...
+ ok( $.em.element, '$.em.element exists' );
+
+
+ // ...and that it's a <div>
+ ok( $($.em.element).is('div'), '$.em.element is a &#60;div&#62;' );
+
+
+ // Check the element's CSS properties are set correctly.
+ equals( '-100em', $($.em.element).css('left'), 'CSS left' );
+ equals( 'absolute', $($.em.element).css('position'), 'CSS position' );
+ equals( '100em', $($.em.element).css('width'), 'CSS width' );
+ });
+
+
+ /***
+ * Event Tests
+ */
+ test('Event', function() {
+ expect(3);
+
+ // Test that the verbose method of binding and manually triggering
+ // events works correctly.
+ var longTest = false;
+ $(document)
+ .bind('emchange', function() { longTest = true; })
+ .trigger('emchange')
+ .unbind('emchange');
+ ok( longTest, 'Manual (long)' );
+
+
+ // Test that the shortened method of binding and manually
+ // triggering events works correctly.
+ var shortTest = false;
+ $(document)
+ .emchange(function() { shortTest = true; })
+ .emchange()
+ .unbind('emchange');
+ ok( shortTest, 'Manual (short)' );
+
+
+ // Test that the emchange event is correctly triggered when the
+ // base font-size changes.
+ var $body = $('body'),
+ oFontSize = $body.css('font-size');
+
+ stop();
+ $body.css('font-size','10px');
+ $(document).bind('emchange', function() {
+ $(document).unbind('emchange');

- // Since the values can vary from browser to browser, we can only
- // really test their types reliably.
- equals( 'string', typeof $.em.version, '$.em.version' );
- equals( 'number', typeof $.em.delay, '$.em.delay' );
- equals( 'function', typeof $.em.action, '$.em.action' );
- equals( 'number', typeof $.em.current, '$.em.current' );
- equals( 'undefined', typeof $.em.previous, '$.em.previous' );
- equals( 'number', typeof $.em.iid, '$.em.iid' );
- });
-
-
- /***
- * Element Tests
- */
- test('Element', function() {
- expect(5);
-
- // Make sure the element exists...
- ok( $.em.element, '$.em.element exists' );
-
-
- // ...and that it's a <div>
- ok( $($.em.element).is('div'), '$.em.element is a &#60;div&#62;' );
-
-
- // Check the element's CSS properties are set correctly.
- equals( '-100em', $($.em.element).css('left'), 'CSS left' );
- equals( 'absolute', $($.em.element).css('position'), 'CSS position' );
- equals( '100em', $($.em.element).css('width'), 'CSS width' );
- });
-
-
- /***
- * Event Tests
- */
- test('Event', function() {
- expect(3);
-
- // Test that the verbose method of binding and manually triggering
- // events works correctly.
- var longTest = false;
- $(document)
- .bind('emchange', function() { longTest = true; })
- .trigger('emchange')
- .unbind('emchange');
- ok( longTest, 'Manual (long)' );
-
-
- // Test that the shortened method of binding and manually
- // triggering events works correctly.
- var shortTest = false;
- $(document)
- .emchange(function() { shortTest = true; })
- .emchange()
- .unbind('emchange');
- ok( shortTest, 'Manual (short)' );
+ ok( true, 'Auto' );

-
- // Test that the emchange event is correctly triggered when the
- // base font-size changes.
- var $body = $('body'),
- oFontSize = $body.css('font-size');
-
- stop();
- $body.css('font-size','10px');
- $(document).bind('emchange', function() {
- $(document).unbind('emchange');
-
- ok( true, 'Auto' );
-
- $body.css('font-size', oFontSize);
- start();
- });
- $body.css('font-size','11px');
+ $body.css('font-size', oFontSize);
+ start();
});
-
-
- // Run the above tests.
- runTest();
- })(jQuery);
+ $body.css('font-size','11px');
+ });
+
+
+ // Run the above tests.
+ runTest();
});

Modified: trunk/test/data/testsuite.css
==============================================================================
--- trunk/test/data/testsuite.css (original)
+++ trunk/test/data/testsuite.css Sun Aug 19 03:03:17 2007
@@ -10,3 +10,9 @@
#banner { height: 2em; border-bottom: 1px solid white; }
h2.pass { background-color: green; }
h2.fail { background-color: red; }
+
+
+
+#versions { margin-bottom:2em; }
+#versions dt { float:left; font-weight:bold; margin-left:1em; width:6em; }
+#versions dd { margin-left:6em; }
\ No newline at end of file

Modified: trunk/test/index.html
==============================================================================
--- trunk/test/index.html (original)
+++ trunk/test/index.html Sun Aug 19 03:03:17 2007
@@ -21,6 +21,7 @@
jQuery-Em Test Suite
</h1>
<h2 id="userAgent"></h2>
+ <dl id="versions"></dl>
<div id="main"></div>
<ol id="tests"></ol>
</body>

Reply all
Reply to author
Forward
0 new messages