snowflake/proxy/spec/init.spec.js
Cecylia Bocovich 9b470fbe4b Removed "janky" snowflake state machine
The only place it was used was in window.onpageunload, and we have a
better way of determining if the proxy is active there (through the ui).

I also removed that code from the webextension since the proxy won't
stop running unless you close the browser and after testing it looks
like that code doesn't notify the user anyway.
2019-10-31 11:59:13 -04:00

34 lines
818 B
JavaScript

/* global expect, it, describe, Snowflake, UI */
// Fake snowflake to interact with
var snowflake = {
ui: new UI,
broker: {
sendAnswer: function() {}
}
};
describe('Init', function() {
it('gives a dialog when closing, only while active', function() {
silenceNotifications = false;
ui.setActive(true);
var msg = window.onbeforeunload();
expect(ui.active).toBe(true);
expect(msg).toBe(Snowflake.MESSAGE.CONFIRMATION);
ui.setActive(false);
msg = window.onbeforeunload();
expect(ui.active).toBe(false);
expect(msg).toBe(null);
});
it('does not give a dialog when silent flag is on', function() {
silenceNotifications = true;
ui.setActive(true);
var msg = window.onbeforeunload();
expect(ui.active).toBe(true);
expect(msg).toBe(null);
});
});