jester_test.html can not run in IE 6

1 view
Skip to first unread message

dlee

unread,
Jul 5, 2008, 3:35:47 AM7/5/08
to Jester JS
hi, Eric,

I'm a newbie of JsUnit.
I found jester_test.html can not run in IE 6 at all. I want to solve
this problem myself.

Here is my patch, test.orig/jester_test.html is the original test file
download form github.
http://github.com/thoughtbot/jester/tree/master

diff -r -w -b -B -u test.orig/jester_test.html test/jester_test.html
--- test.orig/jester_test.html Sat May 3 04:24:43 2008
+++ test/jester_test.html Sat Jul 5 15:30:28 2008
@@ -13,7 +13,7 @@

<body>
<script language="JavaScript" type="text/javascript">
-
+var old_ajax = Ajax;
function setUp () {
default_prefix = function() {return window.location.protocol + "//"
+ window.location.hostname + (window.location.port ? ":" +
window.location.port : "");}

@@ -182,6 +182,9 @@
return true;
}

+function tearDown() {
+ Ajax = old_ajax;
+}

/********************************************
************ FIND TESTS ********************
@@ -587,7 +590,7 @@
var eric = User.find(1);
newAttrs = {
'first_name' : 'todd',
- 'admin' : false,
+ 'admin' : false
}
oldAttrs = eric.attributes();
eric.setAttributes(newAttrs);
@@ -602,7 +605,7 @@
var eric = User.find(1);
newAttrs = {
'first_name' : 'todd',
- 'admin' : false,
+ 'admin' : false
}
oldAttrs = eric.attributes();
eric.updateAttributes(newAttrs);

--dlee

Eric Mill

unread,
Jul 8, 2008, 5:23:03 PM7/8/08
to jest...@googlegroups.com
Hi dlee,

I removed the commas, like you pointed it out. Were those old_ajax
lines left over from your testing? I can't see how they would have any
effect on the test suite, in any browser.

I don't have a problem with removing commas, but I'm fine with ignoring
any larger problems with the test suite in IE6, since only developers
are going to be running the test suite.

Thanks,
Eric

dlee

unread,
Jul 8, 2008, 10:39:08 PM7/8/08
to Jester JS
Hi, Eric,

If I don't recover the value of the global variable Ajax, then
testUpdateAttributes will fail in IE 6. And I think we should provide
a tearDown function, it's a good practice.

Here is the full patch about jester.js and jester_test.html, very
graceful, all the tests passed in IE 6 and Firefox 2.

diff -r -w -b -B -u jester.orig/jester.js jester/jester.js
--- jester.orig/jester.js Sat May 3 04:24:43 2008
+++ jester/jester.js Wed Jul 9 10:18:53 2008
@@ -545,7 +545,8 @@
else {
var attributes;
if (this.klass._format == "json") {
- attributes =
this._attributesFromJSON(transport.responseText);
+ eval("var json = " + transport.responseText + ";");
+ attributes = this._attributesFromJSON(json);
}
else {
var doc = Jester.Tree.parseXML(transport.responseText);
diff -r -w -b -B -u jester.orig/test/jester_test.html jester/test/
jester_test.html
--- jester.orig/test/jester_test.html Sat May 3 04:24:43 2008
+++ jester/test/jester_test.html Wed Jul 9 10:25:59 2008
@@ -14,6 +14,8 @@
<body>
<script language="JavaScript" type="text/javascript">

+var old_ajax = Ajax;
+
function setUp () {
default_prefix = function() {return window.location.protocol + "//"
+ window.location.hostname + (window.location.port ? ":" +
window.location.port : "");}

@@ -182,6 +184,9 @@
return true;
}

+function tearDown() {
+ Ajax = old_ajax;
+}

/********************************************
************ FIND TESTS ********************
@@ -587,7 +592,7 @@
var eric = User.find(1);
newAttrs = {
'first_name' : 'todd',
- 'admin' : false,
+ 'admin' : false
}
oldAttrs = eric.attributes();
eric.setAttributes(newAttrs);
@@ -602,7 +607,7 @@

Eric Mill

unread,
Jul 9, 2008, 6:15:31 PM7/9/08
to jest...@googlegroups.com
I don't want to add a tearDown method and a new local variable in the
test suite just for IE6. IE6 testing of Jester should be a non-issue.
Developers working on Jester should run their tests in IE7, Safari, or
Firefox 2/3.

-- Eric

Reply all
Reply to author
Forward
0 new messages