mirror of
https://github.com/pebble-dev/clay.git
synced 2026-09-01 22:57:41 -04:00
Account for cases where the Pebble global is undefined
This commit is contained in:
+17
-3
@@ -255,12 +255,18 @@ describe('Clay', function() {
|
||||
});
|
||||
|
||||
describe('.meta', function() {
|
||||
var emptyMeta = {
|
||||
activeWatchInfo: null,
|
||||
accountToken: '',
|
||||
watchToken: ''
|
||||
};
|
||||
|
||||
it('populates the meta in the showConfiguration handler', function() {
|
||||
stubPebble();
|
||||
var clay = fixture.clay([]);
|
||||
|
||||
// meta only gets populated after showConfiguration happens
|
||||
assert.deepEqual(clay.meta, {});
|
||||
assert.deepEqual(clay.meta, emptyMeta);
|
||||
Pebble.addEventListener.withArgs('showConfiguration').callArg(1);
|
||||
|
||||
assert.deepEqual(clay.meta, {
|
||||
@@ -274,8 +280,8 @@ describe('Clay', function() {
|
||||
stubPebble();
|
||||
var clay = fixture.clay([], null, {autoHandleEvents: false});
|
||||
|
||||
// meta only gets populated after showConfiguration happens
|
||||
assert.deepEqual(clay.meta, {});
|
||||
// meta only gets populated after ready happens
|
||||
assert.deepEqual(clay.meta, emptyMeta);
|
||||
Pebble.addEventListener.withArgs('ready').callArg(1);
|
||||
|
||||
assert.deepEqual(clay.meta, {
|
||||
@@ -284,6 +290,14 @@ describe('Clay', function() {
|
||||
watchToken: watchToken
|
||||
});
|
||||
});
|
||||
|
||||
it('populates the meta with with empty values when there is no Pebble global',
|
||||
function() {
|
||||
delete global.Pebble;
|
||||
var clay = fixture.clay([], null, {autoHandleEvents: false});
|
||||
|
||||
assert.deepEqual(clay.meta, emptyMeta);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Clay.encodeDataUri()', function() {
|
||||
|
||||
Reference in New Issue
Block a user