});\r
it("default property", function() {\r
expect(f.open("a")).toEqual(f);\r
- f = function() {\r
- expect(arguments[1][0]).toEqual("h");\r
+ f = function(file, a, b, c) {\r
+ describe("File::open2", function() {\r
+ it("default property", function() {\r
+ expect(a[0]).toEqual("h");\r
+ expect(b).toEqual(0);\r
+ expect(c).toEqual("a.txt");\r
+ expect(file[0]).toEqual("");\r
+ expect(file[1]).toBeUndefined();\r
+ expect(file[2]).toBeUndefined();\r
+ expect(file[3]).toBeUndefined();\r
+ expect(file["a.txt"]).toBeUndefined();\r
+ expect(file["a"]).toEqual("");\r
+ expect(file.read()).toEqual("");\r
+ });\r
+ });\r
+ __start_();\r
};\r
- f.open("a", ["h"]);\r
+ f.open("a", ["h"], 0, "a.txt");\r
});\r
it("arguments inheritance", function() {\r
expect(args[1]).toEqual("b.txt");\r
if (xhr.readyState === 4) {\r
if ((xhr.status === 200) || (xhr.status > 400)) {\r
var text = (xhr.status === 200) ? xhr.responseText : "";\r
- handle.push((handle[fileName] = text));\r
+ fileName && handle.push((handle[fileName] = text));\r
if (fileNames.length !== 0) {\r
- fileName = fileNames.shift().toString();\r
+ fileName = fileNames.shift();\r
f();\r
} else { //Load End\r
xhr.onreadystatechange = Function.empty; //to solve the problem about a memory leak for IE 8\r
}\r
};\r
var f = function() {\r
+ if (!fileName || (typeof fileName !== "string")) {\r
+ /*stop loading files*/\r
+ fileNames = [];\r
+ fileName = null;\r
+ xhr.onreadystatechange();\r
+ return;\r
+ }\r
xhr.open("GET", fileName, true);\r
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");\r
xhr.send(null);\r