visionmedia-jspec 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,24 @@
1
+ <html>
2
+ <head>
3
+ <link type="text/css" rel="stylesheet" href="../lib/jspec.css" />
4
+ <script src="jquery-1.3.1.js"></script>
5
+ <script src="../lib/jspec.js"></script>
6
+ <script src="../lib/jspec.jquery.js"></script>
7
+ <script>
8
+ function runSuites() {
9
+ JSpec
10
+ .exec('spec.grammar.js')
11
+ .exec('spec.core.js')
12
+ .exec('spec.core.dom.js')
13
+ .exec('spec.jquery.js')
14
+ .run()
15
+ .report()
16
+ }
17
+ </script>
18
+ </head>
19
+ <body class="jspec" onLoad="runSuites();">
20
+ <div id="jspec-top"><h2 id="jspec-title">JSpec <em><script>document.write(JSpec.version)</script></em></h2></div>
21
+ <div id="jspec"></div>
22
+ <div id="jspec-bottom"></div>
23
+ </body>
24
+ </html>
@@ -0,0 +1,162 @@
1
+
2
+ describe 'jQuery'
3
+ describe 'helpers'
4
+ before
5
+ .dom = this.sandbox()
6
+ end
7
+
8
+ it 'should add elements to a sandbox'
9
+ .dom.prepend('<em>test</em>').should.have_text 'test'
10
+ end
11
+
12
+ it 'should retain visibility within a sandbox'
13
+ .dom.children('em').hide().should.be_hidden
14
+ .dom.children('em').show().should.be_visible
15
+ end
16
+ end
17
+
18
+ describe 'async'
19
+ it 'should load mah cookies (textfile)'
20
+ $.post('async', function(text){
21
+ text.should_eql 'cookies!'
22
+ })
23
+ end
24
+
25
+ it 'should load mah cookies twice (ensure multiple async requests work)'
26
+ $.post('async', function(text){
27
+ text.should.eql 'cookies!'
28
+ })
29
+ $.post('async', function(text){
30
+ text.should.not.eql 'rawr'
31
+ })
32
+ end
33
+ end
34
+
35
+ describe 'matchers'
36
+ before_each
37
+ html = '<p><label><em>Save?</em></label> \
38
+ <select class="save" style="display: none;"> \
39
+ <option value="0">No</option> \
40
+ <option value="1">Yes</option> \
41
+ </select> \
42
+ <strong>test</strong> \
43
+ <strong>test</strong> \
44
+ </p>'
45
+ .elem = $(html)
46
+ end
47
+
48
+ it 'should fail with pretty print of element'
49
+ .elem.should.not.have_tag 'label'
50
+ end
51
+
52
+ describe 'have_tag / have_one'
53
+ it 'should check if a single child is present'
54
+ .elem.should.have_tag 'label'
55
+ .elem.should.have_tag 'em'
56
+ .elem.should.have_one 'label'
57
+ .elem.should.not.have_tag 'input'
58
+ end
59
+ end
60
+
61
+ describe 'have_tags / have_many'
62
+ it 'should check if more than one child is present'
63
+ .elem.should.have_tags 'option'
64
+ .elem.should.have_many 'option'
65
+ .elem.should.not.have_many 'label'
66
+ end
67
+ end
68
+
69
+ describe 'have_child'
70
+ it 'should check if a direct child is present'
71
+ .elem.should.have_child 'label'
72
+ .elem.should.not.have_child 'em'
73
+ end
74
+ end
75
+
76
+ describe 'have_children'
77
+ it 'should check if more than one direct children are present'
78
+ .elem.should.have_children 'strong'
79
+ .elem.should.not.have_children 'select'
80
+ end
81
+ end
82
+
83
+ describe 'have_text'
84
+ it 'should check for plain text'
85
+ .elem.children('label').should.have_text 'Save?'
86
+ end
87
+ end
88
+
89
+ describe 'have_value'
90
+ it 'should check if an element has the given value'
91
+ .elem.find('option').get(1).should.have_value '1'
92
+ end
93
+ end
94
+
95
+ describe 'have_class'
96
+ it 'should check if an element has the given class'
97
+ .elem.children('select').should.have_class 'save'
98
+ end
99
+ end
100
+
101
+ describe 'be_visible'
102
+ it 'should check that an element is not hidden or set to display of none'
103
+ .element('#jspec-report').should.be_visible
104
+ '#jspec-report'.should.be_visible
105
+ '<input style="visibility: hidden;"/>'.should.not.be_visible
106
+ '<input style="display: none;"/>'.should.not.be_visible
107
+ '<input />'.should.be_visible
108
+ end
109
+ end
110
+
111
+ describe 'be_enabled'
112
+ it 'should check that an element is currently enabled'
113
+ '<input type="button"/>'.should.be_enabled
114
+ '<input type="button" disabled="disabled" />'.should.not.be_enabled
115
+ end
116
+ end
117
+
118
+ describe 'be_BOOLATTR'
119
+ it 'should check that an element is currently selected, disabled, checked etc'
120
+ '<input type="button"/>'.should.not.be_disabled
121
+ '<input type="button" disabled="disabled" />'.should.be_disabled
122
+ '<option value="foo" selected="selected">Foo</option>'.should.be_selected
123
+ end
124
+ end
125
+
126
+ describe 'have_ATTR'
127
+ it 'should check if an attribute exists'
128
+ '<input type="checkbox"/>'.should.have_type
129
+ end
130
+
131
+ it 'should check if an attribute has a specific value'
132
+ '<input type="checkbox"/>'.should.have_type 'checkbox'
133
+ end
134
+ end
135
+
136
+ describe 'be_hidden'
137
+ it 'should check if an element is hidden'
138
+ '<input style="display: none;" />'.should.be_hidden
139
+ '<input style="visibility: hidden;" />'.should.be_hidden
140
+ '<input />'.should.not.be_hidden
141
+ end
142
+ end
143
+
144
+ describe 'have_attr'
145
+ before_each
146
+ .elem = '<input type="button" title="some foo" value="Foo" />'
147
+ end
148
+
149
+ it 'should check that an element has the given attribute'
150
+ .elem.should.have_attr 'title'
151
+ .elem.should.not_have_attr 'rawr'
152
+ end
153
+
154
+ it 'should check that the given attribute has a specific value'
155
+ .elem.should.have_attr 'title', 'some foo'
156
+ .elem.should.not.have_attr 'some', 'rawr'
157
+ .elem.should.not.have_attr 'title', 'bar'
158
+ end
159
+ end
160
+ end
161
+
162
+ end
@@ -0,0 +1,4 @@
1
+
2
+ === 0.0.1 / YYYY-MM-DD
3
+
4
+ * Initial release
@@ -0,0 +1,29 @@
1
+
2
+ = YourLib
3
+
4
+ Description
5
+
6
+ == License
7
+
8
+ (The MIT License)
9
+
10
+ Copyright (c) 2009 Your Name <Your Email>
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining
13
+ a copy of this software and associated documentation files (the
14
+ 'Software'), to deal in the Software without restriction, including
15
+ without limitation the rights to use, copy, modify, merge, publish,
16
+ distribute, sublicense, and/or sell copies of the Software, and to
17
+ permit persons to whom the Software is furnished to do so, subject to
18
+ the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be
21
+ included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
24
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
27
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+
2
+ // EvoJS - Core - Copyright (c) TJ Holowaychuk <tj@vision-media.ca>
3
+
4
+ (function(){
5
+
6
+ this.Evo = { version : '0.0.1' }
7
+
8
+ /**
9
+ * Merge methods and properties of _other_.
10
+ *
11
+ * @param {hash} other
12
+ * @return {mixed} this
13
+ * @api public
14
+ */
15
+
16
+ Object.prototype.extend = function(other) {
17
+ for (key in other)
18
+ if (other.hasOwnProperty(key))
19
+ this[key] = other[key]
20
+ return this
21
+ }
22
+
23
+ /**
24
+ * Merge prototype with methods and properties with _mixin_.
25
+ *
26
+ * @param {hash} mixin
27
+ * @return {mixed} this
28
+ * @api public
29
+ */
30
+
31
+ Object.prototype.include = function(mixin) {
32
+ return this.prototype.extend(mixin)
33
+ }
34
+
35
+ })()
@@ -0,0 +1,8 @@
1
+
2
+ describe 'YourLib'
3
+ describe '.someMethod()'
4
+ it 'should do something'
5
+ true.should.be true
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,20 @@
1
+ <html>
2
+ <head>
3
+ <link type="text/css" rel="stylesheet" href="JSPEC_ROOT/lib/jspec.css" />
4
+ <script src="JSPEC_ROOT/lib/jspec.js"></script>
5
+ <script src="../lib/yourlib.core.js"></script>
6
+ <script>
7
+ function runSuites() {
8
+ JSpec
9
+ .exec('spec.core.js')
10
+ .run()
11
+ .report()
12
+ }
13
+ </script>
14
+ </head>
15
+ <body class="jspec" onLoad="runSuites();">
16
+ <div id="jspec-top"><h2 id="jspec-title">JSpec <em><script>document.write(JSpec.version)</script></em></h2></div>
17
+ <div id="jspec"></div>
18
+ <div id="jspec-bottom"></div>
19
+ </body>
20
+ </html>
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: visionmedia-jspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
+ platform: ruby
6
+ authors:
7
+ - TJ Holowaychuk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-04-12 00:00:00 -07:00
13
+ default_executable: jspec
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: visionmedia-commander
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 3.2.9
24
+ version:
25
+ description: JavaScript BDD Testing Framework
26
+ email: tj@vision-media.ca
27
+ executables:
28
+ - jspec
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - bin/jspec
33
+ - lib/images/bg.png
34
+ - lib/images/hr.png
35
+ - lib/images/sprites.bg.png
36
+ - lib/images/sprites.png
37
+ - lib/images/vr.png
38
+ - lib/jspec.css
39
+ - lib/jspec.jquery.js
40
+ - lib/jspec.js
41
+ - README.rdoc
42
+ files:
43
+ - bin/jspec
44
+ - History.rdoc
45
+ - jspec.gemspec
46
+ - lib/images/bg.png
47
+ - lib/images/hr.png
48
+ - lib/images/sprites.bg.png
49
+ - lib/images/sprites.png
50
+ - lib/images/vr.png
51
+ - lib/jspec.css
52
+ - lib/jspec.jquery.js
53
+ - lib/jspec.js
54
+ - Manifest
55
+ - Rakefile
56
+ - README.rdoc
57
+ - spec/async
58
+ - spec/jquery-1.3.1.js
59
+ - spec/spec.core.dom.js
60
+ - spec/spec.core.js
61
+ - spec/spec.grammar.js
62
+ - spec/spec.html
63
+ - spec/spec.jquery.js
64
+ - templates/default/History.rdoc
65
+ - templates/default/lib/yourlib.core.js
66
+ - templates/default/README.rdoc
67
+ - templates/default/spec/spec.core.js
68
+ - templates/default/spec/spec.html
69
+ has_rdoc: true
70
+ homepage: http://visionmedia.github.com/jspec
71
+ post_install_message:
72
+ rdoc_options:
73
+ - --line-numbers
74
+ - --inline-source
75
+ - --title
76
+ - Jspec
77
+ - --main
78
+ - README.rdoc
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: "0"
86
+ version:
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: "1.2"
92
+ version:
93
+ requirements: []
94
+
95
+ rubyforge_project: jspec
96
+ rubygems_version: 1.2.0
97
+ signing_key:
98
+ specification_version: 2
99
+ summary: JavaScript BDD Testing Framework
100
+ test_files: []
101
+