Skip to content

Commit 50e836e

Browse files
committed
Added verification test for path token substitutions
1 parent e6b3d88 commit 50e836e

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed

build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@
402402
<file name="testNodeAttachments2.js"/>
403403
<file name="testNodeAttachments3.js"/>
404404
<file name="testNodeContainers1.js"/>
405+
<file name="testNodeContainers2.js"/>
405406
<file name="testNodeFeatures1.js"/>
406407
<file name="testNodeType1.js"/>
407408
<file name="testNodeQName1.js"/>

js/gitana/repository/Branch.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
var associationType = "a:child"; // default
201201
var filePath = null;
202202
var parentFolderPath = null;
203+
var fileName = null;
203204

204205
// if they pass in a string instead of an options object, then the string can follow the format
205206
// (/root/pages/file.txt) where root is the root node to start from
@@ -228,12 +229,27 @@
228229
if (options.associationType) {
229230
associationType = options.associationType;
230231
}
231-
if (options.filePath) {
232-
filePath = options.filePath;
232+
if (options.fileName) {
233+
fileName = options.fileName;
234+
}
235+
else if (options.filename) {
236+
fileName = options.filename;
233237
}
234238
if (options.parentFolderPath) {
235239
parentFolderPath = options.parentFolderPath;
236240
}
241+
else if (options.folderPath) {
242+
parentFolderPath = options.folderPath;
243+
}
244+
else if (options.folderpath) {
245+
parentFolderPath = options.folderpath;
246+
}
247+
if (options.filePath) {
248+
filePath = options.filePath;
249+
}
250+
else if (options.filepath) {
251+
filePath = options.filepath;
252+
}
237253
}
238254

239255
// plug in the resolved params
@@ -243,6 +259,9 @@
243259
if (associationType) {
244260
params.associationType = associationType;
245261
}
262+
if (fileName) {
263+
params.fileName = fileName;
264+
}
246265
if (filePath) {
247266
params.filePath = filePath;
248267
}

tests/js/testNodeContainers2.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
(function($) {
2+
3+
module("nodeContainers2");
4+
5+
// Test case : Node Containers #2
6+
test("Node Containers #2", function() {
7+
8+
stop();
9+
10+
expect(2);
11+
12+
var gitana = GitanaTest.authenticateFullOAuth();
13+
gitana.createRepository().readBranch("master").then(function() {
14+
15+
// NOTE: this = branch
16+
17+
// create a nested folder
18+
this.createNode({
19+
"description": "Booya"
20+
}, {
21+
"filename": "{document.id}.txt",
22+
"folderPath": "/a/b/c/{document.id}"
23+
});
24+
25+
this.then(function() {
26+
27+
// query by path
28+
this.readNode("root", "/a/b/c").then(function() {
29+
30+
this.listChildren().then(function() {
31+
32+
this.keepOne().then(function() {
33+
34+
// THIS = the folder named {document.id}
35+
36+
this.listChildren().keepOne().then(function() {
37+
38+
var newTitle = this._doc + ".txt";
39+
40+
ok(this.title == newTitle, "title matches");
41+
ok(this.description == "Booya", "description matches");
42+
43+
start();
44+
});
45+
});
46+
});
47+
});
48+
});
49+
});
50+
});
51+
52+
}(jQuery) );

0 commit comments

Comments
 (0)