summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuan Torres <juanto121@hotmail.com>2015-03-27 08:50:22 -0500
committerJuan Torres <juanto121@hotmail.com>2015-03-27 08:55:59 -0500
commitbf3fa33021ae70bb4486d5896f5526faae54a966 (patch)
tree96a53d98bf45fd3d37fa7587b0e78ef86df902f3
parent1c76aa9ed40212602338b745f20a9dcabc9731a4 (diff)
downloadawesomplete-bf3fa33021ae70bb4486d5896f5526faae54a966.zip
awesomplete-bf3fa33021ae70bb4486d5896f5526faae54a966.tar.gz
awesomplete-bf3fa33021ae70bb4486d5896f5526faae54a966.tar.bz2
Testing with jasmine, LeaVerou#14565 - clean version
-rwxr-xr-xtests/jasmine/SpecRunner.html24
-rwxr-xr-xtests/jasmine/spec/awesompleteSpec.js34
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