Add an extra test to make sure webviewclosed & showConfiguration events are not handled

This commit is contained in:
Keegan
2016-02-19 10:37:03 -08:00
parent 85025f19f8
commit 49de62b639
+9 -2
View File
@@ -64,7 +64,7 @@ describe('Clay', function() {
assert(Pebble.openURL.calledWith(clay.generateUrl())); assert(Pebble.openURL.calledWith(clay.generateUrl()));
}); });
it('handles the "showConfiguration" event if autoHandleEvents is not false', it('handles the "webviewclosed" event if autoHandleEvents is not false',
function() { function() {
stubPebble(); stubPebble();
fixture.clay([]); fixture.clay([]);
@@ -94,6 +94,13 @@ describe('Clay', function() {
assert(Pebble.addEventListener.calledWith('webviewclosed')); assert(Pebble.addEventListener.calledWith('webviewclosed'));
assert.strictEqual(Pebble.sendAppMessage.callCount, 0); assert.strictEqual(Pebble.sendAppMessage.callCount, 0);
}); });
it('does not handle the "webviewclosed" or "showConfiguration" events ' +
'if autoHandleEvents is false', function() {
stubPebble();
fixture.clay([], null, { autoHandleEvents: false });
assert.strictEqual(Pebble.addEventListener.called, false);
});
}); });
describe('.registerComponent()', function() { describe('.registerComponent()', function() {
@@ -129,7 +136,7 @@ describe('Clay', function() {
); );
}); });
it('doesn\'t thow and logs an error if setting in localStorage are broken', it('doesn\'t throw and logs an error if settings in localStorage are broken',
function() { function() {
var clay = fixture.clay([]); var clay = fixture.clay([]);
var errorStub = sinon.stub(console, 'error'); var errorStub = sinon.stub(console, 'error');