spec_app/spec/javascripts/up/bus_spec.js.coffee in upjs-rails-0.14.1 vs spec_app/spec/javascripts/up/bus_spec.js.coffee in upjs-rails-0.15.0

- old
+ new

@@ -74,21 +74,23 @@ up.emit('foo', { customField: 'custom-value' }) expect(emittedEvent.customField).toEqual('custom-value') - it 'triggers an event on an element given as .$element event property', -> - emittedEvent = undefined - emitted$Target = undefined + describe 'with .$element option', -> - $element = affix('.element').text('foo') + it 'triggers an event on the given element', -> + emittedEvent = undefined + $emittedTarget = undefined - up.on 'foo', (event, $target) -> - emittedEvent = event - emitted$Target = $target + $element = affix('.element').text('foo') - up.emit('foo', $element: $element) + up.on 'foo', (event, $target) -> + emittedEvent = event + $emittedTarget = $target - expect(emittedEvent).toBeDefined() - expect(emitted$Target).toEqual($element) + up.emit('foo', $element: $element) - expect(emittedEvent.$element).toEqual($element) + expect(emittedEvent).toBeDefined() + expect($emittedTarget).toEqual($element) + + expect(emittedEvent.$element).toEqual($element)