Skip to content
Permalink
Browse files
test runner: a test for load() with a hash of data, and another for l…
…oad() with a string of data (#1516).

It includes a php that dumps all the GET and POST vars to html elements, where the key makes the id, and the value the text.
  • Loading branch information
flesler committed May 27, 2008
1 parent 7ec7723 commit c6e88b1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
@@ -0,0 +1,12 @@
<div id="post">
<?php
foreach( $_POST as $key=>$value )
echo "<b id='$key'>$value</b>";
?>
</div>
<div id="get">
<?php
foreach( $_GET as $key=>$value )
echo "<b id='$key'>$value</b>";
?>
</div>
@@ -385,6 +385,30 @@ test("load(String, Function) - check file with only a script tag", function() {
});
});

test("load(String, Object, Function)", function() {
expect(2);
stop();

$('<div />').load(url('data/params_html.php'), { foo:3, bar:'ok' }, function() {
var $post = $(this).find('#post');
equals( $post.find('#foo').text(), '3', 'Check if a hash of data is passed correctly');
equals( $post.find('#bar').text(), 'ok', 'Check if a hash of data is passed correctly');
start();
});
});

test("load(String, String, Function)", function() {
expect(2);
stop();

$('<div />').load(url('data/params_html.php'), 'foo=3&bar=ok', function() {
var $get = $(this).find('#get');
equals( $get.find('#foo').text(), '3', 'Check if a string of data is passed correctly');
equals( $get.find('#bar').text(), 'ok', 'Check if a of data is passed correctly');
start();
});
});

test("$.get(String, Hash, Function) - parse xml and use text() on nodes", function() {
expect(2);
stop();

0 comments on commit c6e88b1

Please sign in to comment.