Commit 0477a6e9 authored by John Resig's avatar John Resig

Added a test case for "purple include", fixed a bug.

parent 34f10429
<div class="user">This is a user</div>
<div class="user">This is a user</div>
<div class="teacher">This is a teacher</div>
...@@ -49,8 +49,10 @@ jQuery.fn.extend({ ...@@ -49,8 +49,10 @@ jQuery.fn.extend({
return this.bind("load", url); return this.bind("load", url);
var off = url.indexOf(" "); var off = url.indexOf(" ");
var selector = url.slice(off, url.length); if ( off >= 0 ) {
url = url.slice(0, off); var selector = url.slice(off, url.length);
url = url.slice(0, off);
}
callback = callback || function(){}; callback = callback || function(){};
......
...@@ -94,6 +94,15 @@ test("load(String)", function() { ...@@ -94,6 +94,15 @@ test("load(String)", function() {
$('#first').load("data/name.html", start); $('#first').load("data/name.html", start);
}); });
test("load('url selector')", function() {
expect(1);
stop(true); // check if load can be called with only url
$('#first').load("data/test3.html div.user", function(){
equals( $(this).children("div").length, 2, "Verify that specific elements were injected" );
start();
});
});
test("load(String, Function) - simple: inject text into DOM", function() { test("load(String, Function) - simple: inject text into DOM", function() {
expect(2); expect(2);
stop(); stop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment