Skip to content

Commit

Permalink
testing for completion of strings and numeric indexes
Browse files Browse the repository at this point in the history
this tests joddie/completion merge and closes #47
  • Loading branch information
rksm committed Sep 8, 2012
1 parent 0a253e8 commit 7605d75
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions client/browser-tests.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -104,6 +104,23 @@ test({
assert.equal("testCompleteEverything.foo", assert.equal("testCompleteEverything.foo",
result.values[1], "Result 2 wrong? " + result); 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")
});
} }
}); });


Expand Down

0 comments on commit 7605d75

Please sign in to comment.