mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-28 04:46:57 -04:00
Allow response in webviewclosed event to optionally be URI encoded
This commit is contained in:
+17
-1
@@ -239,7 +239,7 @@ describe('Clay', function() {
|
||||
});
|
||||
|
||||
describe('.getSettings', function() {
|
||||
it('stores the response to localStorage and returns the decoded data',
|
||||
it('it writes to localStorage and returns the data when input is encoded',
|
||||
function() {
|
||||
var clay = fixture.clay([]);
|
||||
var settings = encodeURIComponent(JSON.stringify({
|
||||
@@ -255,6 +255,22 @@ describe('Clay', function() {
|
||||
assert.deepEqual(result, expected);
|
||||
});
|
||||
|
||||
it('it writes to localStorage and returns the data when input is not encoded',
|
||||
function() {
|
||||
var clay = fixture.clay([]);
|
||||
var settings = JSON.stringify({
|
||||
key1: 'value1',
|
||||
key2: {value: 'value2%7Dbreaks'}
|
||||
});
|
||||
var expected = {
|
||||
key1: 'value1',
|
||||
key2: 'value2%7Dbreaks'
|
||||
};
|
||||
var result = clay.getSettings(settings);
|
||||
assert.equal(localStorage.getItem('clay-settings'), JSON.stringify(expected));
|
||||
assert.deepEqual(result, expected);
|
||||
});
|
||||
|
||||
it('does not store the response if it is invalid JSON and logs an error',
|
||||
function() {
|
||||
var clay = fixture.clay([]);
|
||||
|
||||
Reference in New Issue
Block a user