[Prototype-core] Creating unit tests for asynchronous operations

2007-10-15 Thread Viktor Kojouharov

Currently, the only way to create unit tests for such operations is to
use the wait function. However, async operations have a nasty habit of
always finishing after the waiting time is over, which causes an
unjust test failure.

So I've made extension to the unittest library, which allows me to
delay a bunch of tests until I decide when the operation is finished.
This is pretty much what the code looks like:
http://pastebin.ca/737294

Should I file this as a bug in trac?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@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-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Cloning elements.

2007-10-15 Thread Yanick

I have been working on a Element.toHTML function, and added two
methods to the Element object. And I was looking for any insight about
my code. Please, feel free to comment. Thanks.

 start 

html
head
/head
body

div id=container
  div id=test_div style=border: 1px solid blue;
div id=foo_divBar !/div
  /div
/div

script type=text/javascript src=prototype.js/script
script type=text/javascript

Element.addMethods( {

toHTML: function(element) {
  if (typeof element=='string') element = $(element);  // IE needs
that check with XML
  return Try.these(
function() {
  var xmlSerializer = new XMLSerializer();
  return  element.nodeType == 4 ? element.nodeValue :
xmlSerializer.serializeToString(element);
},
function() {
  return element.xml || element.outerHTML || $
(element).clone().wrap().up().innerHTML;
}
  ) || '';
},

getStyles: function(element) {
  element = $(element);
  return $A(element.style).inject({}, function(styles, styleName) {
styles[styleName.camelize()] = element.getStyle( styleName );
return styles;
  } );
},

clone: function(element) {
  var clone = new Element(element.tagName);
  $A(element.attributes).each(function(attribute) { if
( attribute.name != 'style' ) clone[attribute.name] =
attribute.value; });

  clone.setStyle( element.getStyles() );
  clone.update(element.innerHTML);

  return clone;
} } );


alert( $('test_div').toHTML() );

$('container').appendChild( $('test_div').clone() );
$('container').appendChild( $('test_div').clone() );
$('container').appendChild( $('test_div').clone() );

/script
/body
/html

 end --


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@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-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Prototype Pagination

2007-10-15 Thread Matt Foster

Greetings Everyone,

I have developed a pretty smooth UI Control for handling
client side pagination.  It is composed of 3 classes that allow for
maximum decoupling.  In this manner the view is decoupled from the
iteration control, such that the same iteration control can be used on
any data set while the view can be specialized for any format of JSON
or XML.

http://positionabsolute.net/blog/2007/10/prototype-pagination.php

Best Regards,
 Matthew Foster


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@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-core?hl=en
-~--~~~~--~~--~--~---