Permalink
Browse files

testing for completion of strings and numeric indexes

this tests joddie/completion merge and closes #47
  • Loading branch information...
rksm committed Sep 8, 2012
1 parent 0a253e8 commit 7605d75134daad48a7545e8fea9080a576b87ecf
Showing with 17 additions and 0 deletions.
  1. +17 −0 client/browser-tests.js
View
@@ -104,6 +104,23 @@ test({
assert.equal("testCompleteEverything.foo",
result.values[1], "Result 2 wrong? " + result);
});
+ },
+
+ testCompletionOfString: function() {
+ // "'foo'.charCod" -> ["'foo'.charCodeAt"]
+ completion = new Completion({enumerablePropsOnly: false});
+ var result = completion.complete("'foo'.charCod");
+ assert.equal("'foo'.charCodeAt", result.partial, "result.partial");
+ assert.equal(1, result.values.length, "result,values.length");
+ assert.equal("'foo'.charCodeAt", result.values[0], "Result wrong? " + result);
+ },
+
+ testCompletionOfArrayIgnoresIndices: function() {
+ var name = "testCompletionOfArrayIgnoresIndices";
+ addObjectToWindow(name, [1, 2, 3], function() {
+ var result = completion.complete(name + ".");
+ assert(result.values.indexOf(name + ".0") === -1, "numeric index included")
+ });
}
});

0 comments on commit 7605d75

Please sign in to comment.