diff options
-rwxr-xr-x | tests/jasmine/SpecRunner.html | 24 | ||||
-rwxr-xr-x | tests/jasmine/spec/awesompleteSpec.js | 34 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/jasmine/SpecRunner.html b/tests/jasmine/SpecRunner.html new file mode 100755 index 0000000..2411e17 --- /dev/null +++ b/tests/jasmine/SpecRunner.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> +<head> + + <meta charset="utf-8"> + <title>Jasmine Spec Runner v2.2.0</title> + + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.2.1/jasmine.css"> + + <script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.2.1/jasmine.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.2.1/jasmine-html.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.2.1/boot.js"></script> + + <!-- include source files here... --> + <script src="../../awesomplete.js"></script> + + <!-- include spec files here... --> + <script src="spec/awesompleteSpec.js"></script> + +</head> + +<body> +</body> +</html>
\ No newline at end of file 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 |