Sha256: f5c0b4fc703f8997a151d24fbab910952a1438d31907f58214823556fa7d5286

Contents?: true

Size: 828 Bytes

Versions: 23

Compression:

Stored size: 828 Bytes

Contents

describe('events', () => {
  beforeEach(() => {
    mumuki.events.clear('foo');
  });

  it('is not called when it is not fired', () => {
    mumuki.events.on('foo', (e) => {
      fail(`should not be called, but got ${JSON.stringify(e)}`);
    })
  })

  it('is not called when it is fired but not enabled', () => {
    let fired = false;
    mumuki.events.on('foo', (e) => {
      fail(`should not be called, but got ${JSON.stringify(e)}`);
      fired = true;
    })
    mumuki.events.fire('foo', 42);
    expect(fired).toBe(false);
  })

  it('is called when it is fired and enabled', () => {
    let fired = false;
    mumuki.events.enable('foo');
    mumuki.events.on('foo', (event) => {
      expect(event).toEqual(42);
      fired = true;
    })

    mumuki.events.fire('foo', 42);
    expect(fired).toBe(true);
  })
})

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
mumuki-laboratory-8.4.0 spec/javascripts/events-spec.js
mumuki-laboratory-8.3.0 spec/javascripts/events-spec.js
mumuki-laboratory-8.2.1 spec/javascripts/events-spec.js
mumuki-laboratory-8.2.0 spec/javascripts/events-spec.js
mumuki-laboratory-8.1.3 spec/javascripts/events-spec.js
mumuki-laboratory-8.1.2 spec/javascripts/events-spec.js
mumuki-laboratory-8.1.1 spec/javascripts/events-spec.js
mumuki-laboratory-8.1.0 spec/javascripts/events-spec.js
mumuki-laboratory-7.12.3 spec/javascripts/events-spec.js
mumuki-laboratory-8.0.0 spec/javascripts/events-spec.js
mumuki-laboratory-7.12.1 spec/javascripts/events-spec.js
mumuki-laboratory-7.12.0 spec/javascripts/events-spec.js
mumuki-laboratory-7.11.1 spec/javascripts/events-spec.js
mumuki-laboratory-7.11.0 spec/javascripts/events-spec.js
mumuki-laboratory-7.10.5 spec/javascripts/events-spec.js
mumuki-laboratory-7.10.4 spec/javascripts/events-spec.js
mumuki-laboratory-7.10.3 spec/javascripts/events-spec.js
mumuki-laboratory-7.10.2 spec/javascripts/events-spec.js
mumuki-laboratory-7.10.1 spec/javascripts/events-spec.js
mumuki-laboratory-7.10.0 spec/javascripts/events-spec.js