Skip to content

Commit

Permalink
Fix debug API with standalone build and recent versions of webpack
Browse files Browse the repository at this point in the history
Recent versions of webpack define the 'DEBUG' variable to
true or false depending on options.debug, so 'DEBUG.events.logFilter'
in 'lib/logger' was transpiled to '(false).events.logFilter'.

Resolve this by using an explicit reference to window.DEBUG.
  • Loading branch information
Robert Knight authored and tgvashworth committed Apr 2, 2016
1 parent e0b6082 commit 9437af4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/spec/standalone_spec.js
Expand Up @@ -15,6 +15,23 @@ define(['index'], function(index) {
expect(typeof flight[key]).toBe(typeof index[key]);
});
});

it('supports debugging via window.DEBUG', function() {
flight.debug.enable(true);
flight.debug.events.logAll();

var Component = flight.component(function() {
this.after('initialize', function() {
this.trigger('an-event');
});
});
var node = document.createElement('div');
document.body.appendChild(node);

spyOn(console, 'info');
Component.attachTo(node);
expect(console.info).toHaveBeenCalledWith('->', 'trigger', '[an-event]', '\'div\'', '');
});
});
});

0 comments on commit 9437af4

Please sign in to comment.