Skip to content

Commit

Permalink
Specs for #1220 - Request options for update, filter, append not work…
Browse files Browse the repository at this point in the history
  • Loading branch information
anutron committed May 3, 2011
1 parent 1cd2b77 commit e075cec
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion 1.3client/Request/Request.HTML.js
Expand Up @@ -115,7 +115,7 @@ describe('Request.HTML', function(){
});

});

it('should create an ajax request and correctly append the response to an element', function(){

runs(function(){
Expand Down Expand Up @@ -170,6 +170,34 @@ describe('Request.HTML', function(){

});

it('should create an ajax request that filters the response and updates the target', function(){

runs(function(){
new Element('div', {'id': 'update', 'html': '<div>some</div>'}).inject(document.body);
this.request = new Request.HTML({
url: '../Helpers/request.php',
onComplete: this.spy,
update: 'update',
filter: 'a'
}).send({data: {
'__response': '<div>text<p><a>a link</a></p></div>', '__type': 'html'
}});
});

waitsFor(800, function(){
return this.spy.wasCalled;
});

runs(function(){
var update = $('update');
expect(update.getChildren().length).toEqual(1);
expect(update.getFirst().get('tag')).toEqual('a');
expect(update.getFirst().get('text')).toEqual('a link');
update.dispose();
});

});

it('should create an ajax request through Element.load', function(){

var element = new Element('div');
Expand Down

0 comments on commit e075cec

Please sign in to comment.