@raydiant/playlist-window-manager 0.14.20 → 0.14.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/build/embeddedApps.js +2 -3
- package/build/embeddedApps.test.js +5 -0
- package/package.json +1 -1
- package/src/embeddedApps.test.ts +13 -0
- package/src/embeddedApps.ts +3 -3
package/README.md
CHANGED
package/build/embeddedApps.js
CHANGED
|
@@ -21,9 +21,8 @@ function createEmbeddedApp(presentation, embeddedUrlFormat) {
|
|
|
21
21
|
if (!isNaN(Number(variableName)))
|
|
22
22
|
return;
|
|
23
23
|
var value = presentation.applicationVariables[m[2]];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
url = url.replace(variable, value);
|
|
24
|
+
var encodedValue = value === undefined ? '' : encodeURIComponent(value);
|
|
25
|
+
url = url.replace(variable, encodedValue);
|
|
27
26
|
});
|
|
28
27
|
return url;
|
|
29
28
|
}
|
|
@@ -37,3 +37,8 @@ test('Replaces variable with underscore', function () {
|
|
|
37
37
|
test('Does not replace variable that is a number', function () {
|
|
38
38
|
expect(embeddedApps_1.default(createPresentation({ applicationVariables: { foo: 'bar' } }), 'http://localhost:8080?foo=:foo')).toBe('http://localhost:8080?foo=bar');
|
|
39
39
|
});
|
|
40
|
+
test('Encodes a variables containing special characters', function () {
|
|
41
|
+
var fooValue = 'Lorem Ipsum. !@#$%^&*()-. More Text';
|
|
42
|
+
var fooValueEncoded = 'Lorem%20Ipsum.%20!%40%23%24%25%5E%26*()-.%20More%20Text';
|
|
43
|
+
expect(embeddedApps_1.default(createPresentation({ applicationVariables: { foo: fooValue } }), "http://localhost:8080?foo=:foo")).toBe("http://localhost:8080?foo=" + fooValueEncoded);
|
|
44
|
+
});
|
package/package.json
CHANGED
package/src/embeddedApps.test.ts
CHANGED
|
@@ -64,3 +64,16 @@ test('Does not replace variable that is a number', () => {
|
|
|
64
64
|
)
|
|
65
65
|
).toBe('http://localhost:8080?foo=bar');
|
|
66
66
|
});
|
|
67
|
+
|
|
68
|
+
test('Encodes a variables containing special characters', () => {
|
|
69
|
+
const fooValue = 'Lorem Ipsum. !@#$%^&*()-. More Text';
|
|
70
|
+
const fooValueEncoded =
|
|
71
|
+
'Lorem%20Ipsum.%20!%40%23%24%25%5E%26*()-.%20More%20Text';
|
|
72
|
+
|
|
73
|
+
expect(
|
|
74
|
+
createEmbeddedApp(
|
|
75
|
+
createPresentation({ applicationVariables: { foo: fooValue } }),
|
|
76
|
+
`http://localhost:8080?foo=:foo`
|
|
77
|
+
)
|
|
78
|
+
).toBe(`http://localhost:8080?foo=${fooValueEncoded}`);
|
|
79
|
+
});
|
package/src/embeddedApps.ts
CHANGED
|
@@ -25,9 +25,9 @@ export default function createEmbeddedApp(
|
|
|
25
25
|
// port numbers in the embedded app url.
|
|
26
26
|
if (!isNaN(Number(variableName))) return;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
url = url.replace(variable,
|
|
28
|
+
const value = presentation.applicationVariables[m[2]];
|
|
29
|
+
const encodedValue = value === undefined ? '' : encodeURIComponent(value);
|
|
30
|
+
url = url.replace(variable, encodedValue);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
return url;
|