summaryrefslogtreecommitdiffstats
path: root/tests/jasmine/spec/awesompleteSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/jasmine/spec/awesompleteSpec.js')
-rwxr-xr-xtests/jasmine/spec/awesompleteSpec.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/jasmine/spec/awesompleteSpec.js b/tests/jasmine/spec/awesompleteSpec.js
new file mode 100755
index 0000000..5f48458
--- /dev/null
+++ b/tests/jasmine/spec/awesompleteSpec.js
@@ -0,0 +1,34 @@
+describe("awesomplete helpers",function(){
+
+ describe("$ function",function(){
+
+ it("should return null when is called without input",function(){
+ var null_selector = Awesomplete.$();
+ expect(null_selector).toBe(null);
+ })
+
+
+ it("should escape regular expression tokens",function(){
+ var string_with_tokens = "[^j(a)v?a-sc|ri\\p+t*]";
+ var escape_string = Awesomplete.$.regExpEscape(string_with_tokens);
+ expect(escape_string).toBe("\\[\\^j\\(a\\)v\\?a\\-sc\\|ri\\\\p\\+t\\*\\]");
+ })
+
+ })
+
+ describe("$ function spy",function(){
+ beforeEach(function(){
+ spyOn(Awesomplete,'$');
+ Awesomplete.$(null);
+ })
+
+ it("should call the query selector function",function(){
+ expect(Awesomplete.$).toHaveBeenCalled();
+ })
+
+ it("should have been called with null when called with no args",function(){
+ expect(Awesomplete.$).toHaveBeenCalledWith(null);
+ })
+ })
+
+}); \ No newline at end of file