Home page Forum Wiki Mail Jabber Devel NIX-FILES

AltLUG Git

Git-repositories of Altai Linux User Group

Make QUnit.expect() (without arguments) a getter. Fixes #226
authorAntranig Basman <antranig.basman@colorado.edu>
Fri, 10 Aug 2012 10:20:05 +0000 (04:20 -0600)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 17 Aug 2012 11:49:47 +0000 (13:49 +0200)
qunit/qunit.js
test/test.js

index e6d5831..a93f945 100644 (file)
@@ -352,7 +352,11 @@ QUnit = {
 
        // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
        expect: function( asserts ) {
-               config.current.expected = asserts;
+               if (arguments.length === 1) {
+                       config.current.expected = asserts;
+               } else {
+                       return config.current.expected;
+               }
        },
 
        start: function( count ) {
index 37e8b7a..7f5d785 100644 (file)
@@ -13,6 +13,15 @@ test("expect in test", 1, function() {
        ok(true);
 });
 
+test("expect query and multiple issue", function() {
+       expect(2);
+       ok(true);
+       var expected = expect();
+       equal(expected, 2);
+       expect(expected + 1);
+       ok(true);
+});
+
 QUnit.module("assertion helpers");
 
 QUnit.test( "QUnit.assert compatibility", function( assert ) {

Hosting is provided AltSPAHow to use Git
Please direct any questions on jabber alex.wolf@jabber.ru

Valid HTML 4.0 Transitional Valid CSS!

Designer Alexander Wolf