mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-28 04:46:57 -04:00
Sub clay.generateUrl() to avoid the very large string comparison
This commit is contained in:
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -58,10 +58,15 @@ describe('Clay', function() {
|
||||
function() {
|
||||
stubPebble();
|
||||
var clay = fixture.clay([]);
|
||||
|
||||
// we stub the generateUrl method to avoid very large string comparisons.
|
||||
var generateUrlStub = sinon.stub(clay, 'generateUrl');
|
||||
generateUrlStub.returns('data:text/html;base64,PGh0bWw%2BVEVTVDwvaHRtbD4%3D');
|
||||
Pebble.addEventListener.withArgs('showConfiguration').callArg(1);
|
||||
|
||||
assert(Pebble.addEventListener.calledWith('showConfiguration'));
|
||||
assert(Pebble.openURL.calledWith(clay.generateUrl()));
|
||||
generateUrlStub.restore();
|
||||
});
|
||||
|
||||
it('handles the "webviewclosed" event if autoHandleEvents is not false',
|
||||
@@ -117,6 +122,17 @@ describe('Clay', function() {
|
||||
});
|
||||
|
||||
describe('.generateUrl()', function() {
|
||||
|
||||
// @todo this test becomes redundant with the work in 94428b1
|
||||
it('Replaces $$RETURN_TO$$ if in not in the emulator', function() {
|
||||
var clay = fixture.clay([]);
|
||||
stubPebble();
|
||||
Pebble.platform = 'ios';
|
||||
var decodedUrl =
|
||||
atob(decodeURIComponent(clay.generateUrl().replace(/^.*?,/, '')));
|
||||
assert.match(decodedUrl, /pebblejs:\/\/close#/);
|
||||
});
|
||||
|
||||
it('does not replace $$RETURN_TO$$ if in the emulator', function() {
|
||||
var clay = fixture.clay([]);
|
||||
stubPebble();
|
||||
|
||||
Reference in New Issue
Block a user