POE-XUL
view release on metacpan or search on metacpan
javascript/test/unit/util.html view on Meta::CPAN
output += 'A mutant pig named ';
Animal.prototype.talk.apply( this );
}
// --------------------------------------------------------
new Test.Unit.Runner( {
// Loaded
testLoaded: function() { with(this) {
assertNotNull( String.prototype.substring2, "util.js loaded substring2" );
assertNotNull( String.prototype.substr2, "util.js loaded substr2" );
assertNotNull( String.prototype.reverse, "util.js loaded reverse" );
assertNotNull( String.prototype.html_escape, "util.js loaded html_escape" );
}},
// html_escape
test_html_escape: function() { with(this) {
var was = "\xC9t\xe9 comme en hivers";
var out = was.html_escape();
assertEqual( out, "Été comme en hivers", "Escaped" );
}},
// reverse
test_reverse: function() {
var was = "hello world";
var out = was.reverse();
this.assertEqual( "dlrow olleh", out );
},
// substring2
test_substring2: function() { with(this) {
var was = "hello world";
var out = was.substring2( 0, 5, "good-bye" );
assertEqual( "good-bye world", out );
out = was.substring2( 6, 11, "good-bye" );
assertEqual( "hello good-bye", out );
out = was.substring2( 6, 7, "W" );
assertEqual( "hello World", out );
}},
// substr2
test_substr2: function() { with(this) {
var was = "hello world";
var out = was.substr2( 6, 5, "Mars" );
assertEqual( "hello Mars", out );
var out = was.substr2( 0, 0, "hello " );
assertEqual( "hello hello world", out );
}},
// isalpha
test_isalpha: function() { with(this) {
assert( isalpha( 'a' ) );
assert( isalpha( 'A' ) );
assert( isalpha( 'é' ) );
assert( isalpha( 'É' ) );
assert( ! isalpha( ':' ) );
assert( ! isalpha( '!' ) );
assert( ! isalpha( '~' ) );
}},
// popup
test_popup: function() { with(this) {
var something = $( 'something' );
assert( something );
assertNotVisible( something );
popup( 'something' );
assertVisible( something );
Element.hide( something );
assertNotVisible( something );
}},
// rollup
test_rollup: function() {
var up = $( 'UP_roll' );
this.assert( up );
var down = $( 'DOWN_roll' );
this.assert( down );
var widget = $( 'WIDGET_roll' );
this.assert( widget );
this.assertNotVisible( down );
this.assertVisible( up );
this.assertEqual( "++", widget.value );
rollup( 'roll', '++', '--' );
this.assertVisible( down );
this.assertNotVisible( up );
this.assertEqual( "--", widget.value );
rollup( 'roll', '++', '--' );
this.assertNotVisible( down );
this.assertVisible( up );
this.assertEqual( "++", widget.value );
Element.hide( up );
Element.hide( widget );
},
// inherit
test_inherit: function() {
var oinky = new DoublePig( "Oinky" );
this.assert( oinky );
oinky.talk();
this.assertEqual( output, "A mutant pig named Oinky says oink and something." );
}
}, "testlog" );
</script>
</body>
( run in 1.311 second using v1.01-cache-2.11-cpan-364913b4093 )