[Proto-Scripty] Re: Prototype Unit Testing Framworks

2009-11-10 Thread Joe Athman

We use JsUnit with prototype successfully.  Could you post any
additional info about the errors you are getting?  What version of
prototype/jsunit/browser are you using?  I will say that JsUnit seems
to be basically on life support so you might want to look in to
something else.  I've recently been looking in to the YUI Test library
which seems very full featured.  http://developer.yahoo.com/yui/3/test/

Joe

On Nov 10, 1:51 pm, Daff d...@spidertracks.co.nz wrote:
 Hi All,

 I have been trying to find a Javascript Unit testing framework that
 works with Prototype. I initially tried JsUnit, but it would appear that
 there is a namespace conflict with the asserts, because as soon as I
 include the prototype file, all the previously passing test fail, with
 errors.

 I have searched the forums and did note that there is mention of
 unittest.js in some of them but have been unable to find said file. The
 posts where is was mentioned were also quite old.

 I am really more interested in what others are using to test their
 Prototype created classes via unit testing.

 Any thoughts of help would be most appreciated.
 --
 daff
 SOFTWARE ENGINEER

 andrew 'daff' niles | spider tracks ltd |  117a the square
 po box 5203 | palmerston north 4441 | new zealand
 P: +64 6 353 3395 | M: +64 210 255 8576
 E: d...@spidertracks.co.nz mailto:d...@spidertracks.co.nz
  W:www.spidertracks.comhttp://www.spidertracks.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Stack overflow in IE when using both Ext JS and Prototype 1.6.1

2009-09-11 Thread Joe Athman

This is more of an FYI in case anyone is using Ext and Prototype on a
project.  I can't exactly figure out why, but something change in the
way prototype is defining or using it's defer function from 1.6.0.3
to 1.6.1 which causes a stack overflow to occur in IE6 (and maybe
IE7).  Ext and Prototype both define a defer function on the
Function prototype but with incompatible usage.  See this post in the
Ext forums for more information 
http://www.extjs.com/forum/showthread.php?t=78935.
I posted a patch in that thread which changes the name of the
prototype defer function to work around the problem.

I guess I can't really say this is a bug, but it would be
interesting to know why it is a problem now in 1.6.1.  Doesn't seem
like the code in prototype changed much.

-Joe
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Ajax.Autocompleter and running scripts in results

2009-04-09 Thread Joe Athman

What you are looking for is the evalScripts option that you can pass
to Ajax.Updater.  See this page for more information about it:

http://prototypejs.org/api/ajax/updater

So you could do something like this:

new Ajax.Updater('items', '/items', {
  parameters: { text: $F('text') },
  evalScripts: true
});


On Apr 8, 9:42 am, Antti Boman antti.bo...@gmail.com wrote:
 I actually checked the source and couldn't find anything there, or
 then I just didn't understand it completely. That's why I decided to
 ask here. The updateElement and afterUpdateElement methods are useless
 in this case, as they are run after the selection's been made. Also,
 callback is too early for my purposes. The thing I'm looking for is
 in the middle of them, and it seems there is no such thing and I may
 have to code it myself.

 Thanks for your help, anyway!

 -a

 On Apr 8, 5:06 pm, Walter Lee Davis wa...@wdstudio.com wrote:

  I haven't seen anything in the Wiki either, but you might want to  
  check the source. There may be a function in there you could hook on  
  to that's just not documented. The only two events in the  
  autocompleter cycle that appear extensible are updateElement (where  
  you have to replace the entire add-the-item-to-the-field part with  
  your own creation), afterUpdateElement (which looks interesting) and  
  callback (before the field data is sent to the server, might be too  
  soon for you).

  Walter

  On Apr 8, 2009, at 8:50 AM, Antti Boman wrote:

   I couldn't find any method for the Autocompleter object that would run
   a piece of javascript, either. And I also didn't find anything by
   googling.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Is there a obfuscator that works particularly well with Script.aculo.us?

2009-04-08 Thread Joe Athman

From my experience YUI compressor is both extremely good and very
safe.  I believe they have fixed any of these one off things like
$super that could create bugs.  We've been using it for well over a
year and shrink prototype, scriptaculous, ExtJS, and our own code all
together.  Works great.

Joe

On Apr 7, 9:35 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 The thing to be careful about with any of these is that if they change
 the names of argument to functions (like Dean Edwards' Packer[1]
 does), you need to modify them so that they leave the $super argument
 name alone, since it has special meaning[2] to Prototype.

 Perhaps slightly OT, but you'll find some notes on minimizing file
 download sizes (as opposed to obfuscation) and such here[3] on the
 unofficial wiki.

 [1]http://dean.edwards.name/weblog/2007/04/packer3/
 [2]http://prototypejs.org/api/class/create
 [3]http://proto-scripty.wikidot.com/prototype:tip-minimizing-download-times

 HTH,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Apr 6, 8:45 pm, Jay jebum@gmail.com wrote:

  Or feel free to share your experience with any particular obfuscator
  tool.
  Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Event.observer with mouseup?

2009-01-04 Thread Joe Athman

Another alternative is to use Prototype's Curry function which let's
you create new functions with default arguments.

So you could write:
Event.observe(window, 'mouseup', alert.curry('hi'));

Joe

As long as you know what curry does, I think this is more obvious for
really simple examples like this.

On Jan 3, 10:50 am, T.J. Crowder t...@crowdersoftware.com wrote:
  Also any reference to a function inside of an observer needs to be in
  the form of an anonymous function, not a literal function itself.

 Doesn't have to be anonymous.  Named functions are fine:

 function myMouseUpThingy() {
     alert('Howdy');

 }

 // later

 Event.observe(window, 'mouseup', myMouseUpThingy);

 The critical thing is that you need to pass in a function *reference*.

 -- T.J.

 On Jan 3, 4:45 pm, Walter Lee Davis wa...@wdstudio.com wrote:

  Try doing this instead:

  //put the following in a script block near the bottom of your html
  var foo = function(){ alert('howdy') };
  Event.observe(window,'mouseup',foo);

  Note that the function is called Event.observe, not Event.observer.  
  Also any reference to a function inside of an observer needs to be in  
  the form of an anonymous function, not a literal function itself. You  
  could have done this as well:

  Event.observe(window,'mouseup',function(){alert('howdy')});

  It's a subtle distinction, but it becomes much more important in a non-
  trivial example, because an anonymous function won't get its input  
  variables (and won't be called, either) until it is invoked. Then it  
  uncloaks, does its business, and vanishes again.

  Walter

  On Jan 2, 2009, at 1:30 PM, Per wrote:

   Hi,
   I'm new to protocoljs, but it's this thing I'm trying to do, and it
   doesn't work. It drives me mad.

   Anyway,
   I try to do this with protocoljs:
   body onmouseup=alert('hi');

   This was how I wrote it, but it doesn't work:
   Event.observer(window,'mouseup',alert('hi'));

   What is the right way to do it?

   Thank you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Bug/Issue with autocompleter in IE7, first request doesn't appear, subsequent requests do

2008-11-20 Thread Joe Athman

I think I found closer to the root cause of the issue.  In
prototype.js I made a small change to getOffsetParent which fixed my
issue:
The line:
while ((element = element.parentNode)  element != document.body)

Becomes:
while ((element = element.parentNode)  element != document.body
 element.style)


I'm not sure how or why, but somehow an element gets sent to this
method which does not have a style attribute.  The causes the line:
  if (Element.getStyle(element, 'position') != 'static')
To throw an exception.  I couldn't pinpoint what had changed in
prototype to cause this behavior.  We are using prototype 1.6.0.1 just
fine, but 1.6.0.3 on IE6 causes us problems here.  Does anyone else
have thoughts?

Joe


On Nov 18, 4:10 pm, Joe Athman [EMAIL PROTECTED] wrote:
 We are having this exact same problem, although it only seemed to pop
 up with version 1.8.2.  We have been using 1.8.1 just fine.  Does
 anyone else see this?

 Joe

 On Nov 4, 4:28 pm, Tom [EMAIL PROTECTED] wrote:

  I have found an issue with theautocompleterin IE7 where the first
  issued requests doesn't appear in the drop down box while the second
  and subsequent requests do.  The first request does successfully issue
  the ajax request and gets a response, it just isn't displayed.

  This works fine in FF and Chrome.

  I'm using 1.8.1 of script.aculo.us

  IE 7.0.5730.13

  The demo on the website forautocompleterworks fine.

  Example code that doesn't work.  User enters a partial zipcode and
  gets back a list of matching zipcodes (+ city and state)

  code

  div
    input type=text size=30 maxlength=10 name=test_zip
  id=test_zip value=
    span id=test_zip_indicator style=display:noneSearching.../
  span
    div id=test_zip_choices class=autocomplete/div
  /div

  script type=text/javascript language=javascript

    new Ajax.Autocompleter(test_zip,
                           test_zip_choices,
                           ../ajax/zip_list,
                           {minChars: 3,
                            paramName: zip,
                            indicator: test_zip_indicator});

  /script

  /code

  This is a sample response back for '024'.

  code

   ul

    li02420span class=informalbr/nbsp;nbsp;nbsp;LEXINGTON,
  MA/span/li

    li02421span class=informalbr/nbsp;nbsp;nbsp;LEXINGTON,
  MA/span/li

    li02445span class=informalbr/nbsp;nbsp;nbsp;BROOKLINE,
  MA/span/li

    li02446span class=informalbr/nbsp;nbsp;nbsp;BROOKLINE,
  MA/span/li

    li02447span class=informalbr/nbsp;nbsp;nbsp;BROOKLINE
  VILLAGE, MA/span/li

    li02451span class=informalbr/nbsp;nbsp;nbsp;WALTHAM, MA/
  span/li

    li02452span class=informalbr/nbsp;nbsp;nbsp;WALTHAM, MA/
  span/li

    li02453span class=informalbr/nbsp;nbsp;nbsp;WALTHAM, MA/
  span/li

    li02454span class=informalbr/nbsp;nbsp;nbsp;WALTHAM, MA/
  span/li

    li02455span class=informalbr/nbsp;nbsp;nbsp;NORTH
  WALTHAM, MA/span/li

  /ul

  /code

  The problem appears to be down in control.js.  Here is my work
  around / fix.  (478 is our internal subversion number for the original
  control.js).

  code
  ===
  --- controls.js (revision 478)
  +++ controls.js (working copy)
  @@ -65,11 +65,16 @@
         function(element, update){
           if(!update.style.position ||
  update.style.position=='absolute') {
             update.style.position = 'absolute';
  +          try {
             Position.clone(element, update, {
               setHeight: false,
  -            offsetTop: element.offsetHeight
  -          });
  +                           offsetTop: element.offsetHeight});
  +          } catch (exception) {
  +            Position.clone(element, update, {
  +                           setHeight: false,
  +                           offsetTop: element.offsetHeight});
           }
  +        }
           Effect.Appear(update,{duration:0.15});
         };
       this.options.onHide = this.options.onHide ||
  /code

  The first Position.clone call fails for some reason under IE7 while
  the second time it succeeds and the drop down complete box appears.

  If there is a better place to report or post this please let me know.

  Tom

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---