nilclass-onfire 0.1.2.nc → 0.1.3.nc
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/onfire.rb +2 -2
- data/test/onfire_test.rb +12 -0
- metadata +4 -3
data/lib/onfire.rb
CHANGED
@@ -14,8 +14,8 @@ module Onfire
|
|
14
14
|
attach_event_handler(options[:do], table_options)
|
15
15
|
end
|
16
16
|
|
17
|
-
def fire(event_type)
|
18
|
-
bubble_event Event.new(event_type, self)
|
17
|
+
def fire(event_type, data=nil)
|
18
|
+
bubble_event Event.new(event_type, self, data)
|
19
19
|
end
|
20
20
|
|
21
21
|
def bubble_event(event)
|
data/test/onfire_test.rb
CHANGED
@@ -222,6 +222,18 @@ class OnfireTest < Test::Unit::TestCase
|
|
222
222
|
assert_equal [], @obj.list
|
223
223
|
end
|
224
224
|
|
225
|
+
context "With some payload given as the last argument" do
|
226
|
+
setup { @obj.on :click do |event| @obj.list << event.data end }
|
227
|
+
|
228
|
+
should "Make that data accessible in the handler through it's event" do
|
229
|
+
data = { :user => { :defined => ['data'] }, :with => [{'no' => 'special'}, {'meaning' => 'to'}], :onfire => '.' }
|
230
|
+
|
231
|
+
@obj.fire :click, data
|
232
|
+
|
233
|
+
assert_equal [data], @obj.list
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
225
237
|
should "invoke the attached matching handler" do
|
226
238
|
@obj.on :click do @obj.list << 1 end
|
227
239
|
@obj.fire :click
|
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nilclass-onfire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7441434
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
9
|
+
- 3
|
10
10
|
- nc
|
11
|
-
version: 0.1.
|
11
|
+
version: 0.1.3.nc
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Nick Sutterer
|
15
|
+
- Niklas E. Cathor
|
15
16
|
autorequire:
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|