bootcamp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +14 -0
  5. data/Gemfile.lock +36 -0
  6. data/LICENSE.txt +20 -0
  7. data/NOTES +3 -0
  8. data/README.rdoc +49 -0
  9. data/Rakefile +42 -0
  10. data/VERSION +1 -0
  11. data/bin/bootcamp +8 -0
  12. data/bootcamp.gemspec +190 -0
  13. data/lib/bootcamp.rb +22 -0
  14. data/lib/bootcamp/armory.rb +20 -0
  15. data/lib/bootcamp/drill_instructor.rb +95 -0
  16. data/lib/bootcamp/formations/core.rb +13 -0
  17. data/lib/bootcamp/formations/html.rb +17 -0
  18. data/lib/bootcamp/formations/jquery.rb +13 -0
  19. data/lib/bootcamp/recruit.rb +28 -0
  20. data/spec/bootcamp_spec.rb +12 -0
  21. data/spec/spec_helper.rb +12 -0
  22. data/vendor/core.js +1 -0
  23. data/vendor/dojo.js +14 -0
  24. data/vendor/jquery.js +18 -0
  25. data/vendor/midori.js +1502 -0
  26. data/vendor/mootools.js +486 -0
  27. data/vendor/prototype.js +6082 -0
  28. data/vendor/test_suites/jasmine/SpecRunner.html +27 -0
  29. data/vendor/test_suites/jasmine/lib/jasmine-1.0.2/MIT.LICENSE +20 -0
  30. data/vendor/test_suites/jasmine/lib/jasmine-1.0.2/jasmine-html.js +188 -0
  31. data/vendor/test_suites/jasmine/lib/jasmine-1.0.2/jasmine.css +166 -0
  32. data/vendor/test_suites/jasmine/lib/jasmine-1.0.2/jasmine.js +2421 -0
  33. data/vendor/test_suites/jasmine/spec/PlayerSpec.js +58 -0
  34. data/vendor/test_suites/jasmine/spec/SpecHelper.js +9 -0
  35. data/vendor/test_suites/jasmine/src/Player.js +22 -0
  36. data/vendor/test_suites/jasmine/src/Song.js +7 -0
  37. data/vendor/test_suites/jspec/History.md +790 -0
  38. data/vendor/test_suites/jspec/Manifest +79 -0
  39. data/vendor/test_suites/jspec/README.md +1030 -0
  40. data/vendor/test_suites/jspec/Rakefile +28 -0
  41. data/vendor/test_suites/jspec/bin/jspec +182 -0
  42. data/vendor/test_suites/jspec/jspec.gemspec +44 -0
  43. data/vendor/test_suites/jspec/lib/images/bg.png +0 -0
  44. data/vendor/test_suites/jspec/lib/images/hr.png +0 -0
  45. data/vendor/test_suites/jspec/lib/images/loading.gif +0 -0
  46. data/vendor/test_suites/jspec/lib/images/sprites.bg.png +0 -0
  47. data/vendor/test_suites/jspec/lib/images/sprites.png +0 -0
  48. data/vendor/test_suites/jspec/lib/images/vr.png +0 -0
  49. data/vendor/test_suites/jspec/lib/jspec.css +149 -0
  50. data/vendor/test_suites/jspec/lib/jspec.growl.js +115 -0
  51. data/vendor/test_suites/jspec/lib/jspec.jquery.js +72 -0
  52. data/vendor/test_suites/jspec/lib/jspec.js +1876 -0
  53. data/vendor/test_suites/jspec/lib/jspec.shell.js +39 -0
  54. data/vendor/test_suites/jspec/lib/jspec.timers.js +90 -0
  55. data/vendor/test_suites/jspec/lib/jspec.xhr.js +195 -0
  56. data/vendor/test_suites/jspec/spec/commands/example_command.rb +19 -0
  57. data/vendor/test_suites/jspec/spec/dom.html +33 -0
  58. data/vendor/test_suites/jspec/spec/fixtures/test.html +1 -0
  59. data/vendor/test_suites/jspec/spec/fixtures/test.json +1 -0
  60. data/vendor/test_suites/jspec/spec/fixtures/test.xml +5 -0
  61. data/vendor/test_suites/jspec/spec/node.js +17 -0
  62. data/vendor/test_suites/jspec/spec/rhino.js +23 -0
  63. data/vendor/test_suites/jspec/spec/ruby/bin/init_spec.rb +101 -0
  64. data/vendor/test_suites/jspec/spec/ruby/bin/install_spec.rb +141 -0
  65. data/vendor/test_suites/jspec/spec/ruby/bin/run_spec.rb +0 -0
  66. data/vendor/test_suites/jspec/spec/ruby/bin/shell_spec.rb +13 -0
  67. data/vendor/test_suites/jspec/spec/ruby/bin/spec_helper.rb +8 -0
  68. data/vendor/test_suites/jspec/spec/ruby/bin/update_spec.rb +72 -0
  69. data/vendor/test_suites/jspec/spec/server.html +29 -0
  70. data/vendor/test_suites/jspec/spec/server.rb +2 -0
  71. data/vendor/test_suites/jspec/spec/support/env.js +10118 -0
  72. data/vendor/test_suites/jspec/spec/support/jquery.js +4376 -0
  73. data/vendor/test_suites/jspec/spec/unit/helpers.js +64 -0
  74. data/vendor/test_suites/jspec/spec/unit/spec.fixtures.js +24 -0
  75. data/vendor/test_suites/jspec/spec/unit/spec.grammar-less.js +34 -0
  76. data/vendor/test_suites/jspec/spec/unit/spec.grammar.js +275 -0
  77. data/vendor/test_suites/jspec/spec/unit/spec.jquery.js +178 -0
  78. data/vendor/test_suites/jspec/spec/unit/spec.jquery.xhr.js +84 -0
  79. data/vendor/test_suites/jspec/spec/unit/spec.js +187 -0
  80. data/vendor/test_suites/jspec/spec/unit/spec.matchers.js +577 -0
  81. data/vendor/test_suites/jspec/spec/unit/spec.modules.js +51 -0
  82. data/vendor/test_suites/jspec/spec/unit/spec.shared-behaviors.js +279 -0
  83. data/vendor/test_suites/jspec/spec/unit/spec.utils.js +346 -0
  84. data/vendor/test_suites/jspec/spec/unit/spec.xhr.js +157 -0
  85. data/vendor/test_suites/jspec/src/browsers.rb +279 -0
  86. data/vendor/test_suites/jspec/src/helpers.rb +67 -0
  87. data/vendor/test_suites/jspec/src/installables.rb +229 -0
  88. data/vendor/test_suites/jspec/src/project.rb +341 -0
  89. data/vendor/test_suites/jspec/src/routes.rb +57 -0
  90. data/vendor/test_suites/jspec/src/server.rb +88 -0
  91. data/vendor/test_suites/jspec/support/js.jar +0 -0
  92. data/vendor/test_suites/jspec/templates/default/History.md +5 -0
  93. data/vendor/test_suites/jspec/templates/default/Readme.md +29 -0
  94. data/vendor/test_suites/jspec/templates/default/lib/yourlib.js +2 -0
  95. data/vendor/test_suites/jspec/templates/default/spec/commands/example_command.rb +19 -0
  96. data/vendor/test_suites/jspec/templates/default/spec/dom.html +22 -0
  97. data/vendor/test_suites/jspec/templates/default/spec/node.js +10 -0
  98. data/vendor/test_suites/jspec/templates/default/spec/rhino.js +10 -0
  99. data/vendor/test_suites/jspec/templates/default/spec/server.html +18 -0
  100. data/vendor/test_suites/jspec/templates/default/spec/server.rb +4 -0
  101. data/vendor/test_suites/jspec/templates/default/spec/unit/spec.helper.js +0 -0
  102. data/vendor/test_suites/jspec/templates/default/spec/unit/spec.js +8 -0
  103. data/vendor/test_suites/jspec/templates/node/History.md +5 -0
  104. data/vendor/test_suites/jspec/templates/node/Readme.md +29 -0
  105. data/vendor/test_suites/jspec/templates/node/lib/yourlib.js +2 -0
  106. data/vendor/test_suites/jspec/templates/node/spec/node.js +10 -0
  107. data/vendor/test_suites/jspec/templates/node/spec/unit/spec.helper.js +0 -0
  108. data/vendor/test_suites/jspec/templates/node/spec/unit/spec.js +8 -0
  109. data/vendor/test_suites/jspec/templates/rails/commands/example_commands.rb +19 -0
  110. data/vendor/test_suites/jspec/templates/rails/dom.html +22 -0
  111. data/vendor/test_suites/jspec/templates/rails/rhino.js +10 -0
  112. data/vendor/test_suites/jspec/templates/rails/server.html +18 -0
  113. data/vendor/test_suites/jspec/templates/rails/server.rb +4 -0
  114. data/vendor/test_suites/jspec/templates/rails/unit/spec.helper.js +0 -0
  115. data/vendor/test_suites/jspec/templates/rails/unit/spec.js +8 -0
  116. data/vendor/test_suites/qunit/README.md +24 -0
  117. data/vendor/test_suites/qunit/package.json +21 -0
  118. data/vendor/test_suites/qunit/qunit/qunit.css +225 -0
  119. data/vendor/test_suites/qunit/qunit/qunit.js +1448 -0
  120. data/vendor/test_suites/qunit/test/headless.html +24 -0
  121. data/vendor/test_suites/qunit/test/index.html +19 -0
  122. data/vendor/test_suites/qunit/test/logs.html +17 -0
  123. data/vendor/test_suites/qunit/test/logs.js +150 -0
  124. data/vendor/test_suites/qunit/test/same.js +1421 -0
  125. data/vendor/test_suites/qunit/test/test.js +324 -0
  126. metadata +282 -0
@@ -0,0 +1,64 @@
1
+
2
+ JSpec.include({
3
+ name: 'Helpers',
4
+ utilities : {
5
+ mock_it : function(body) {
6
+ JSpec.assert = false
7
+ var spec = new JSpec.Spec('mock', body)
8
+ var prev = JSpec.currentSpec
9
+ JSpec.runSpec(spec)
10
+ JSpec.currentSpec = prev
11
+ JSpec.assert = true
12
+ return spec
13
+ }
14
+ },
15
+
16
+ matchers : {
17
+ have_failure_message : function(spec, expected) {
18
+ return JSpec.any(spec.assertions, function(assertion){
19
+ if (assertion.passed) return
20
+ switch (expected.constructor) {
21
+ case String: return assertion.message == expected
22
+ case RegExp: return expected.test(assertion.message)
23
+ default : return false
24
+ }
25
+ })
26
+ }
27
+ }
28
+ })
29
+
30
+ JSpec.include({
31
+ name: 'ExampleModule',
32
+ utilities : {
33
+ doFoo : function(){ return 'foo' },
34
+ doBar : function(){ return 'bar' }
35
+ },
36
+ randomHook : function(a, b) {
37
+ return [a, b]
38
+ },
39
+ beforeSpec : function() { addedBeforeSpec = true; this.utilities.doFoo() },
40
+ afterSpec : function() { addedAfterSpec = true },
41
+ beforeSuite : function() { addedBeforeSuite = true },
42
+ afterSuite : function() { addedAfterSuite = true },
43
+ matchers : {
44
+ be_foo_bar : function() {
45
+ return true
46
+ }
47
+ },
48
+ DSLs : {
49
+ snake : {
50
+ some_snake_case_stuff : function(){
51
+ return true
52
+ }
53
+ },
54
+ camel : {
55
+ someCamelCaseStuff : function() {
56
+ return true
57
+ }
58
+ }
59
+ }
60
+ })
61
+
62
+ JSpec.include({
63
+ name : 'EmptyModule'
64
+ })
@@ -0,0 +1,24 @@
1
+
2
+ describe 'Utility'
3
+ describe 'fixture()'
4
+ it 'should return a files contents'
5
+ fixture('test.html').should.eql '<p>test</p>'
6
+ fixture('test').should.eql '<p>test</p>'
7
+ end
8
+
9
+ it 'should cache contents'
10
+ contents = fixture('test')
11
+ JSpec.cache['test'].should.eql contents
12
+ JSpec.cache['test'] = 'foo'
13
+ fixture('test').should.eql 'foo'
14
+ delete JSpec.cache['test']
15
+ end
16
+ end
17
+
18
+ describe 'json_fixture()'
19
+ it 'should evaluate json fixtures'
20
+ json_fixture('test').should.eql { users : { tj : { email : 'tj@vision-media.ca' }}}
21
+ json_fixture('test.json').should.eql { users : { tj : { email : 'tj@vision-media.ca' }}}
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,34 @@
1
+
2
+ JSpec.describe('Grammar-less', function(){
3
+ before(function(){
4
+ n = 1
5
+ })
6
+
7
+ it('should work', function(){
8
+ expect(true).to(be, true)
9
+ expect(n).to(equal, 1)
10
+ })
11
+
12
+ describe('with nested describes', function(){
13
+ before(function(){
14
+ hits = []
15
+ })
16
+
17
+ before_each(function(){
18
+ n++
19
+ hits.push('before_each')
20
+ })
21
+
22
+ it('should work', function(){
23
+ expect(true).not_to(be, false)
24
+ expect(n).to(eql, 2)
25
+ expect(hits).to(eql, ['before_each'])
26
+ })
27
+
28
+ it('should work again', function(){
29
+ expect(n).to(eql, 3)
30
+ expect(hits).to(eql, ['before_each', 'before_each'])
31
+ })
32
+ })
33
+
34
+ })
@@ -0,0 +1,275 @@
1
+ describe 'Grammar'
2
+ it 'should allow "it" spec literal'
3
+ true.should.be_true
4
+ end
5
+
6
+ n = 10
7
+
8
+ it 'should allow literal javascript outside of blocks'
9
+ n.should.eql 10
10
+ end
11
+
12
+ it 'should escape <html> in <p>descriptions</p> and body'
13
+ '<p></p>'.should.eql '<p></p>'
14
+ end
15
+
16
+ it 'should parse correctly when "it" is within the body'
17
+ text = 'Get it at Github'
18
+ text.should.include 'it'
19
+ end
20
+
21
+ it 'should parse correctly when "describe" is within the body'
22
+ text = 'It should work with describe'
23
+ text.should.include 'describe'
24
+ end
25
+
26
+ it 'should parse correctly when "end" is within the body'
27
+ text = 'This should not end the parsing :)'
28
+ text.should.include 'not'
29
+ end
30
+
31
+ it 'should parse correctly with "before" and "after" within the body'
32
+ text = 'This comes before that, which is after the rest'
33
+ text.should.include 'before'
34
+ end
35
+
36
+ it 'should allow parens to be optional when no args are passed'
37
+ true.should.be_true
38
+ true.should.be_true()
39
+ end
40
+
41
+ it 'should not mess up with words like it or append in descriptions'
42
+ -{ element.append().end() }.should.throw_error
43
+ end
44
+
45
+ it 'should not mess up "end" in strings'
46
+ 'foo end bar'.should.not.eql 'foo }); bar'
47
+ end
48
+
49
+ it 'should allow semicolons'
50
+ true.should.be_true;
51
+ true.should.be_true();
52
+ true.should.be_true() ;
53
+ end
54
+
55
+ it 'should allow parens to be optional with args'
56
+ 'foobar'.should.include 'foo'
57
+ 'rawr'.should.not_include 'foo'
58
+ end
59
+
60
+ it 'should allow literals without defining variables variables'
61
+ {}.should.be_an Object
62
+ end
63
+
64
+ it 'should allow alternative closure literal'
65
+ -{ throw 'test' }.should.throw_error
66
+ end
67
+
68
+ it 'should allow grammar-less assertions'
69
+ expect(true).to(be, true)
70
+ expect([1,2,3]).to(include, 1, 2, 3)
71
+ expect(true).not_to(be, false)
72
+ end
73
+
74
+ it 'should allow multi-line expect() assertions'
75
+ expect(' \
76
+ foo \
77
+ bar \
78
+ ').to(include, 'foo', 'bar')
79
+ end
80
+
81
+ it 'should allow commenting out of conversions'
82
+ // -{ throw 'foo' }.should.throw_error
83
+ // foo.should.not.eql 'bar'
84
+ end
85
+
86
+ it 'should allow inclusive range literal n..n'
87
+ 1..5.should.eql [1,2,3,4,5]
88
+ 3..4.should.eql [3,4]
89
+ 1..1.should.eql [1]
90
+ 3..1.should.eql [3,2,1]
91
+ end
92
+
93
+ it 'should allow snakecase style assertions'
94
+ 'foo'.should_equal('foo')
95
+ 'foo'.should_equal 'foo'
96
+ 'bar'.should_not_equal('foo')
97
+ 'bar'.should_not_equal 'foo'
98
+ end
99
+
100
+ it 'should allow dot style assertions'
101
+ 'foo'.should.equal('foo')
102
+ 'foo'.should.equal 'foo'
103
+ 'bar'.should.not.equal('foo')
104
+ 'bar'.should.not.equal 'foo'
105
+ end
106
+
107
+ describe 'with tabs'
108
+ before_each
109
+ foo = 'bar'
110
+ end
111
+
112
+ it 'should work'
113
+ foo.should.eql 'bar'
114
+ end
115
+
116
+ it 'should work'
117
+ true.should.be true
118
+ true.should.be(true)
119
+ true.should.be(true);
120
+ end
121
+ end
122
+
123
+ describe 'with nested describe'
124
+ it 'should work'
125
+ true.should.be_true
126
+ end
127
+
128
+ describe 'nested again'
129
+ it 'should still work'
130
+ true.should.be_true
131
+ end
132
+ end
133
+ end
134
+
135
+ describe 'before / after blocks'
136
+ before
137
+ n = 1
138
+ hits = []
139
+ hits.push('before')
140
+ end
141
+
142
+ after
143
+ n = 0
144
+ hits.push('after')
145
+ end
146
+
147
+ it 'should work'
148
+ n.should.eql 1
149
+ hits.should.eql ['before']
150
+ n++
151
+ end
152
+
153
+ it 'should persist'
154
+ n.should.eql 2
155
+ hits.should.eql ['before']
156
+ end
157
+
158
+ describe 'with nested describe'
159
+ it 'variables should be accessable'
160
+ n.should.eql 2
161
+ end
162
+
163
+ it 'should only run for outer describe'
164
+ hits.should.eql ['before']
165
+ end
166
+ end
167
+ end
168
+
169
+ describe 'before_nested / after_nested blocks'
170
+ before
171
+ x = 0
172
+ y = 0
173
+ end
174
+
175
+ before_nested
176
+ x++
177
+ end
178
+
179
+ after_nested
180
+ y++
181
+ end
182
+
183
+ it 'should execute before_nested before suite'
184
+ x.should.eql 1
185
+ end
186
+
187
+ describe 'with nested describe'
188
+ it 'should execute before_nested before nested suite'
189
+ x.should.eql 2
190
+ end
191
+ end
192
+
193
+ describe 'after_nested'
194
+ it 'should execute after_nested after nested suite'
195
+ y.should.eql 1
196
+ end
197
+ end
198
+ end
199
+
200
+ describe 'before_each / after_each blocks'
201
+ before
202
+ hits = []
203
+ end
204
+
205
+ before_each
206
+ n = 1
207
+ hits.push('before_each')
208
+ end
209
+
210
+ after_each
211
+ o = 2
212
+ hits.push('after_each')
213
+ end
214
+
215
+ it 'should work'
216
+ n.should.eql 1
217
+ hits.should.eql ['before_each']
218
+ n = 2
219
+ end
220
+
221
+ it 'should not persist'
222
+ n.should.eql 1
223
+ o.should.eql 2
224
+ hits.should.eql ['before_each', 'after_each', 'before_each']
225
+ end
226
+
227
+ describe 'with nested describe'
228
+ it 'should be accessable'
229
+ n.should.eql 1
230
+ o.should.eql 2
231
+ hits.should.eql ['before_each', 'after_each', 'before_each', 'after_each', 'before_each']
232
+ end
233
+
234
+ it 'should continue hits'
235
+ hits.should.eql ['before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'after_each', 'before_each']
236
+ end
237
+
238
+ describe 'with more hooks'
239
+ before_each
240
+ hits.push('before_each')
241
+ end
242
+
243
+ after_each
244
+ hits.push('after_each')
245
+ end
246
+
247
+ it 'should continue hits, while cascading properly'
248
+ hits.should.eql ['before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'before_each']
249
+ end
250
+ end
251
+
252
+ describe 'with multiple hooks'
253
+ before_each
254
+ hits = []
255
+ end
256
+
257
+ before_each
258
+ hits.push('before_each')
259
+ end
260
+
261
+ it 'should work'
262
+ hits.should.eql ['before_each']
263
+ end
264
+ end
265
+ end
266
+ end
267
+
268
+ end
269
+
270
+ __END__
271
+
272
+ this should not matter because it is
273
+ considered a comment by the JSpec grammar :)
274
+ and is sometimes useful for temp reference info
275
+ when writting specs.
@@ -0,0 +1,178 @@
1
+
2
+ describe 'jQuery'
3
+ describe 'puts()'
4
+ it 'should output selector when present'
5
+ object = { jquery: '1.3.2', selector: '.foo bar' }
6
+ puts(object).should.eql 'selector ".foo bar"'
7
+ end
8
+
9
+ it 'should output outerHTML otherwise'
10
+ puts($('<p>Foo</p>')).should.match(/<p>Foo<\/p>/i)
11
+ end
12
+ end
13
+
14
+ describe 'with elements'
15
+ it 'should output the outerHTML'
16
+ puts($('<p>Foo</p>').get(0)).should.match(/<p>Foo<\/p>/i)
17
+ end
18
+ end
19
+
20
+ describe 'sandbox()'
21
+ before
22
+ dom = sandbox()
23
+ end
24
+
25
+ it 'should provide an empty DOM sandbox'
26
+ dom.prepend('<em>test</em>')
27
+ dom.should.have_text 'test'
28
+ end
29
+ end
30
+
31
+ describe 'element() / elements()'
32
+ it 'should alias jQuery'
33
+ element.should.be jQuery
34
+ elements.should.be jQuery
35
+ end
36
+ end
37
+
38
+ describe 'matchers'
39
+ before_each
40
+ html = '<p><label><em>Save?</em></label> \
41
+ <select class="save form-select" style="display: none;"> \
42
+ <option value="0">No</option> \
43
+ <option value="1">Yes</option> \
44
+ </select> \
45
+ <strong>test</strong> \
46
+ <strong>test</strong> \
47
+ </p>'
48
+ elem = $(html)
49
+ end
50
+
51
+ it 'should fail with pretty print of element'
52
+ spec = mock_it(function() {
53
+ elem.should.not.have_tag 'label'
54
+ })
55
+ spec.should.have_failure_message(/<label>\s*<em>Save?/i)
56
+ end
57
+
58
+ describe 'have_tag / have_one'
59
+ it 'should check if a single child is present'
60
+ elem.should.have_tag 'label'
61
+ elem.should.have_tag 'em'
62
+ elem.should.have_one 'label'
63
+ elem.should.not.have_tag 'input'
64
+ end
65
+ end
66
+
67
+ describe 'have_tags / have_many / have_any'
68
+ it 'should check if more than one child is present'
69
+ elem.should.have_tags 'option'
70
+ elem.should.have_many 'option'
71
+ elem.should.not.have_many 'label'
72
+ elem.find('option').remove()
73
+ elem.should.not.have_any 'option'
74
+ end
75
+ end
76
+
77
+ describe 'have_child'
78
+ it 'should check if a direct child is present'
79
+ elem.should.have_child 'label'
80
+ elem.should.not.have_child 'em'
81
+ end
82
+ end
83
+
84
+ describe 'have_children'
85
+ it 'should check if more than one direct children are present'
86
+ elem.should.have_children 'strong'
87
+ elem.should.not.have_children 'select'
88
+ end
89
+ end
90
+
91
+ describe 'have_text'
92
+ it 'should check for plain text'
93
+ $('label', elem).should.have_text 'Save?'
94
+ end
95
+ end
96
+
97
+ describe 'have_value'
98
+ it 'should check if an element has the given value'
99
+ elem.find('option').get(1).should.have_value '1'
100
+ end
101
+ end
102
+
103
+ describe 'have_class'
104
+ it 'should check if an element has the given class'
105
+ $('select', elem).should.have_class 'save'
106
+ end
107
+ end
108
+
109
+ describe 'have_classes'
110
+ it 'should check if an element has the classes given'
111
+ $('select', elem).should.have_classes 'save', 'form-select'
112
+ $('select', elem).should.not.have_classes 'save', 'foo'
113
+ $('select', elem).should.not.have_classes 'foo', 'save'
114
+ end
115
+ end
116
+
117
+ describe 'be_visible'
118
+ it 'should check that an element is not hidden or set to display of none'
119
+ element('#jspec-report').should.be_visible
120
+ '#jspec-report'.should.be_visible
121
+ '<input style="visibility: hidden;"/>'.should.not.be_visible
122
+ '<input style="display: none;"/>'.should.not.be_visible
123
+ '<input />'.should.be_visible
124
+ end
125
+ end
126
+
127
+ describe 'be_enabled'
128
+ it 'should check that an element is currently enabled'
129
+ '<input type="button"/>'.should.be_enabled
130
+ '<input type="button" disabled="disabled" />'.should.not.be_enabled
131
+ end
132
+ end
133
+
134
+ describe 'be_BOOLATTR'
135
+ it 'should check that an element is currently selected, disabled, checked etc'
136
+ '<input type="button"/>'.should.not.be_disabled
137
+ '<input type="button" disabled="disabled" />'.should.be_disabled
138
+ '<option value="foo" selected="selected">Foo</option>'.should.be_selected
139
+ end
140
+ end
141
+
142
+ describe 'have_ATTR'
143
+ it 'should check if an attribute exists'
144
+ '<input type="checkbox"/>'.should.have_type
145
+ end
146
+
147
+ it 'should check if an attribute has a specific value'
148
+ '<input type="checkbox"/>'.should.have_type 'checkbox'
149
+ end
150
+ end
151
+
152
+ describe 'be_hidden'
153
+ it 'should check if an element is hidden'
154
+ '<input style="display: none;" />'.should.be_hidden
155
+ '<input style="visibility: hidden;" />'.should.be_hidden
156
+ '<input />'.should.not.be_hidden
157
+ end
158
+ end
159
+
160
+ describe 'have_attr'
161
+ before_each
162
+ elem = '<input type="button" title="some foo" value="Foo" />'
163
+ end
164
+
165
+ it 'should check that an element has the given attribute'
166
+ elem.should.have_attr 'title'
167
+ elem.should.not_have_attr 'rawr'
168
+ end
169
+
170
+ it 'should check that the given attribute has a specific value'
171
+ elem.should.have_attr 'title', 'some foo'
172
+ elem.should.not.have_attr 'some', 'rawr'
173
+ elem.should.not.have_attr 'title', 'bar'
174
+ end
175
+ end
176
+ end
177
+
178
+ end