Comparison

spec/util_events_spec.lua @ 8797:7b621a4a2e8d

util.iterators: Add join() method and tests
author Matthew Wild <mwild1@gmail.com>
date Fri, 18 May 2018 14:57:39 +0100
parent 8761:b6e193e33145
child 8802:befffddf1b25
comparison
equal deleted inserted replaced
8796:51375b007239 8797:7b621a4a2e8d
206 e.fire_event("myevent", "abc"); 206 e.fire_event("myevent", "abc");
207 assert.spy(w).was_called(1); 207 assert.spy(w).was_called(1);
208 assert.spy(h).was_called(2); 208 assert.spy(h).was_called(2);
209 end); 209 end);
210 end); 210 end);
211
212 describe("chaining", function ()
213 local e2;
214 before_each(function ()
215 e2 = events.new(e);
216 h2 = spy.new(function () end);
217 end);
218 it("should fire parent handlers when an event is fired", function ()
219 e.add_handler("myevent", h);
220 e2.add_handler("myevent", h2);
221 e2.fire_event("myevent", "abc");
222 assert.spy(h).was_called(1);
223 assert.spy(h).was_called.with("abc");
224 assert.spy(h2).was_called(1);
225 assert.spy(h2).was_called.with("abc");
226 end);
227 it("should handle changes in the parent's handlers", function ()
228 end);
229 it("should fire wrappers in child and parent", function ()
230 end);
231 end);
211 end); 232 end);
212 end); 233 end);