modularity-rails 0.6.2 → 0.6.3
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.
- data/lib/modularity-rails/version.rb +1 -1
- data/spec/javascripts/mixins/closable_spec.coffee +12 -4
- data/spec/javascripts/modularity_spec.coffee +9 -13
- data/spec/javascripts/templates/closable.html +4 -0
- data/vendor/assets/javascripts/mixins/closable.coffee +4 -3
- data/vendor/assets/javascripts/modules/button.coffee +2 -0
- metadata +11 -11
@@ -13,13 +13,21 @@ describe 'test environment setup', ->
|
|
13
13
|
describe 'Closable', ->
|
14
14
|
template 'closable.html'
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
describe 'constructor', ->
|
17
|
+
it 'shows an alert if there is no close button', ->
|
18
|
+
spy = spyOn window, 'alert'
|
19
|
+
new ClosableModuleStandard('#test #closable3')
|
20
|
+
expect(spy).toHaveBeenCalled()
|
21
|
+
expect(spy.argsForCall[0][0]).toMatch(/close button not found/i)
|
22
|
+
|
23
|
+
it 'shows no alert if there is a close button', ->
|
24
|
+
spy = spyOn window, 'alert'
|
25
|
+
new ClosableModuleStandard('#test #closable1')
|
26
|
+
expect(spy).not.toHaveBeenCalled()
|
27
|
+
|
19
28
|
it 'finds the close button div automatically', ->
|
20
29
|
new ClosableModuleStandard('#test #closable1')
|
21
30
|
$('#test #closable1 .CloseButton').click()
|
22
|
-
|
23
31
|
expect($('#test #closable1').length).toEqual(0)
|
24
32
|
|
25
33
|
|
@@ -265,34 +265,30 @@ describe 'modularity', ->
|
|
265
265
|
|
266
266
|
describe 'mixins', ->
|
267
267
|
|
268
|
-
myMixin = instance = recordedSelf = null
|
268
|
+
myMixin = instance = recordedSelf = Test = null
|
269
|
+
myMixin =
|
270
|
+
constructor: -> recordedSelf = @
|
271
|
+
method1: ->
|
269
272
|
|
270
273
|
beforeEach ->
|
271
|
-
myMixin =
|
272
|
-
constructor: -> recordedSelf = @
|
273
|
-
method1: ->
|
274
|
-
|
275
|
-
spyOn(myMixin, 'constructor').andCallThrough()
|
276
|
-
|
277
274
|
class Test extends Module
|
278
275
|
@mixin myMixin
|
279
276
|
|
280
|
-
instance = new Test('testing')
|
281
277
|
|
282
278
|
|
283
279
|
it 'adds all methods from the mixin object to the class prototype', ->
|
280
|
+
instance = new Test('testing')
|
284
281
|
expect(typeof instance.method1).toBe("function")
|
285
282
|
|
286
283
|
|
287
284
|
it 'calls the constructor of the mixin', ->
|
285
|
+
spyOn(myMixin, 'constructor')
|
286
|
+
instance = new Test('testing')
|
288
287
|
expect(myMixin.constructor).toHaveBeenCalled()
|
289
288
|
|
290
289
|
|
291
290
|
it 'calls the constructor with the this pointing to the instance', ->
|
291
|
+
instance = new Test('testing')
|
292
292
|
expect(recordedSelf).toBe(instance)
|
293
293
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
294
|
+
xit 'provides arguments to the @mixin method to the mixin constructor'
|
@@ -1,8 +1,9 @@
|
|
1
1
|
window.closable =
|
2
2
|
|
3
|
-
constructor: (container
|
4
|
-
close_button
|
5
|
-
|
3
|
+
constructor: (container) ->
|
4
|
+
close_button = @container.find('.CloseButton')
|
5
|
+
unless close_button?.length > 0
|
6
|
+
window.alert 'Error: Close button not found'
|
6
7
|
close_button.click @close_button_clicked
|
7
8
|
|
8
9
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modularity-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-04-30 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70358087399780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70358087399780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capybara-webkit
|
27
|
-
requirement: &
|
27
|
+
requirement: &70358087399360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70358087399360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: evergreen
|
38
|
-
requirement: &
|
38
|
+
requirement: &70358087398900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70358087398900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rb-fsevent
|
49
|
-
requirement: &
|
49
|
+
requirement: &70358087398440 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70358087398440
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard-livereload
|
60
|
-
requirement: &
|
60
|
+
requirement: &70358087398020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70358087398020
|
69
69
|
description: Description of ModularityRails.
|
70
70
|
email:
|
71
71
|
- kevin.goslar@gmail.com
|