Home page Forum Wiki Mail Jabber Devel NIX-FILES

AltLUG Git

Git-repositories of Altai Linux User Group

Keep a local reference to Date. Fixes #283.
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 18 Jul 2012 19:19:43 +0000 (12:19 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 18 Jul 2012 19:35:18 +0000 (12:35 -0700)
qunit/qunit.js
test/test.js

index da38d45..5c9050b 100644 (file)
@@ -17,6 +17,8 @@ var QUnit,
        fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
        toString = Object.prototype.toString,
        hasOwn = Object.prototype.hasOwnProperty,
+       // Keep a local reference to Date (GH-283)
+       Date = window.Date,
        defined = {
        setTimeout: typeof window.setTimeout !== "undefined",
        sessionStorage: (function() {
index 7fc20b7..37e8b7a 100644 (file)
@@ -71,6 +71,28 @@ test("module without setup/teardown", function() {
        ok(true);
 });
 
+
+
+var orgDate;
+
+module("Date test", {
+       setup: function() {
+               orgDate = Date;
+               Date = function () {
+                       ok( false, 'QUnit should internally be independant from Date-related manipulation and testing' );
+                       return new orgDate();
+               };
+       },
+       teardown: function() {
+               Date = orgDate;
+       }
+});
+
+test("sample test for Date test", function () {
+       expect(1);
+       ok(true);
+});
+
 if (typeof setTimeout !== 'undefined') {
 state = 'fail';
 

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