TypeError: String.specialChar is undefined

34 views
Skip to first unread message

Szczepan Faber

unread,
Jul 27, 2009, 7:34:04 AM7/27/09
to Dr Nic's JavaScript projects
Hi,

I've got a long String (big, fat multiline String) and I was not able
to use assertEqual for it because of this error:

TypeError: String.specialChar is undefined

Not sure why, maybe because I'm using jQuery to get the string to
assertEqual: $('#myTextArea').text()

There are 2 workaround for this. Either I do:

assertEqual(new String(expected), new String(actual));

or I change the jsunittest.js file:

//var character = String.specialChar[match[0]];
var character = match[0];

So far I chose the latter because this way my tests are more readable.
I figured out you wanted to know about my issue :)

jsunitest is cool!

Cheers,
Szczepan

Dr Nic Williams

unread,
Jul 27, 2009, 7:37:27 AM7/27/09
to drnic-javasc...@googlegroups.com
Hmm, I'm not sure where String.specialChar originally comes from nor what bad things happen if we stop using it :)
--
Dr Nic Williams
Mocra - Premier iPhone and Ruby on Rails Consultants
w - http://mocra.com
twitter - @drnic
skype - nicwilliams
e - dr...@mocra.com
p - +61 412 002 126 or +61 7 3102 3237

Choan Gálvez

unread,
Jul 27, 2009, 7:59:38 AM7/27/09
to drnic-javasc...@googlegroups.com
Hello.

String.specialChar is a translattion table coming from the prototype
library.

The problem it's been resolved on the "jsunittest" project for some
time, maybe the version used on the newjs gem has not been updated?

Best.
--
Choan
<http://choangalvez.nom.es/>

Dr Nic Williams

unread,
Jul 27, 2009, 10:26:10 AM7/27/09
to drnic-javasc...@googlegroups.com
Ok I've released newjs 1.7.4 with latest jsunittest.js files.
Reply all
Reply to author
Forward
0 new messages