modularity-rails 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module ModularityRails
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
@@ -13,13 +13,21 @@ describe 'test environment setup', ->
13
13
  describe 'Closable', ->
14
14
  template 'closable.html'
15
15
 
16
- beforeEach ->
17
-
18
- describe 'embedded close button', ->
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'
@@ -8,3 +8,7 @@
8
8
  <div class="CustomCloseButton"></div>
9
9
  </div>
10
10
 
11
+ <div id="closable3">
12
+ A section without a close button.
13
+ </div>
14
+
@@ -1,8 +1,9 @@
1
1
  window.closable =
2
2
 
3
- constructor: (container, close_button = undefined) ->
4
- close_button ||= @container.find('.CloseButton')
5
- # TODO: add alert if no close button found.
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
 
@@ -1,3 +1,5 @@
1
+ #= require mixins/clickable
2
+
1
3
  # A button module.
2
4
  # Responds to clicks on the container element.
3
5
  # The container element is expected to already be populated.
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.2
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: &70127435305940 !ruby/object:Gem::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: *70127435305940
24
+ version_requirements: *70358087399780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: capybara-webkit
27
- requirement: &70127435305520 !ruby/object:Gem::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: *70127435305520
35
+ version_requirements: *70358087399360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: evergreen
38
- requirement: &70127435305060 !ruby/object:Gem::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: *70127435305060
46
+ version_requirements: *70358087398900
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rb-fsevent
49
- requirement: &70127429284100 !ruby/object:Gem::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: *70127429284100
57
+ version_requirements: *70358087398440
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-livereload
60
- requirement: &70127429281440 !ruby/object:Gem::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: *70127429281440
68
+ version_requirements: *70358087398020
69
69
  description: Description of ModularityRails.
70
70
  email:
71
71
  - kevin.goslar@gmail.com