spyne 0.21.1 → 0.21.2

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Spyne 0.21.1
2
+ * Spyne 0.21.2
3
3
  * https://spynejs.org
4
4
  *
5
5
  * @license
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  /*!
18
- * spynejs 0.21.1
18
+ * spynejs 0.21.2
19
19
  * https://spynejs.org
20
20
  * (c) 2017-present Frank Batista
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spyne",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "description": "Reactive Real-DOM Framework for Advanced Javascript applications",
5
5
  "sideEffects": true,
6
6
  "main": "./lib/spyne.esm.js",
@@ -6,7 +6,7 @@ import { sanitizeHTMLConfigure } from './utils/sanitize-html.js'
6
6
  import { sanitizeDataConfigure } from './utils/sanitize-data.js'
7
7
 
8
8
  const _channels = new ChannelsMap()
9
- const version = '0.21.1'
9
+ const version = '0.21.2'
10
10
 
11
11
  class SpyneApplication {
12
12
  /**
@@ -41,7 +41,7 @@ class SpyneApplication {
41
41
  init(config = {}, testMode = false) {
42
42
  // this.channels = new ChannelsMap();
43
43
  /*!
44
- * Spyne 0.21.1
44
+ * Spyne 0.21.2
45
45
  * https://spynejs.org
46
46
  *
47
47
  * @license
@@ -8,8 +8,10 @@ export class DomElementTemplate {
8
8
  this.isProxyData = data.__cms__isProxy === true
9
9
  this.testMode = opts?.testMode
10
10
 
11
- if (this.isProxyData === true && SpyneAppProperties.enableCMSProxies) {
12
- this.template = SpyneAppProperties.formatTemplateForProxyData(this.template)
11
+ if (this.isProxyData === true) {
12
+ if (SpyneAppProperties.enableCMSProxies === true) {
13
+ this.template = SpyneAppProperties.formatTemplateForProxyData(this.template)
14
+ }
13
15
  }
14
16
 
15
17
  const checkForArrayData = () => {
@@ -1,82 +1,12 @@
1
1
  import { DomElementTemplate } from '../../spyne/views/dom-element-template';
2
2
 
3
- // Evaluate once at the top
4
- const isPublic = process.env.IS_PUBLIC === true;
5
-
6
-
7
- // If not public, skip this test suite altogether
8
- (isPublic ? describe : describe.skip)('DomElementTemplate Proxy (Public Test)', () => {
9
- it('should not have a proxy method', () => {
10
- expect(DomElementTemplate.hasOwnProperty('formatTemplateForProxyData')).to.be.false;
11
- });
12
- });
13
-
14
- (!isPublic ? describe : describe.skip)('DomElementTemplate Proxy (Internal Test)', () => {
15
- describe('formatTemplateForProxyData', () => {
16
- it('should wrap text-node placeholders like <h1>{{title}}</h1> in <spyne-cms-item>', () => {
17
- const input = '<h1>{{title}}</h1>';
18
- const output = DomElementTemplate.formatTemplateForProxyData(input);
19
-
20
- // wrapper exists
21
- expect(output).to.include('<spyne-cms-item');
22
-
23
- // text is preserved inside the CMS text wrapper
24
- expect(output).to.include(
25
- '<spyne-cms-item-text>{{title}}</spyne-cms-item-text>'
26
- );
27
-
28
- // structural sanity check
29
- expect(output).to.include('</spyne-cms-item>');
30
- });
31
-
32
- it('should NOT wrap attribute placeholders like <img src="{{imgUrl}}"> and keep them intact', () => {
33
- const input = '<img src="{{imgUrl}}">';
34
- const output = DomElementTemplate.formatTemplateForProxyData(input);
35
-
36
- // attributes must remain untouched
37
- expect(output).to.equal(input);
38
- expect(output).to.not.include('<spyne-cms-item');
39
- });
40
-
41
- it('should allow prefixed attr* placeholders inside attributes without CMS wrapping', () => {
42
- const input = '<img src="{{attrImgSrc}}" alt="{{attrImgAlt}}">';
43
- const output = DomElementTemplate.formatTemplateForProxyData(input);
44
-
45
- // attr* placeholders should remain intact
46
- expect(output).to.include('{{attrImgSrc}}');
47
- expect(output).to.include('{{attrImgAlt}}');
48
-
49
- // no CMS proxy tags should be injected
50
- expect(output).to.not.include('<spyne-cms-item');
51
- });
52
-
53
- it('should not wrap loop root elements or corrupt list structure', () => {
54
- const input = `
55
- <ul>
56
- {{#items}}
57
- <li><span>{{title}}</span></li>
58
- {{/items}}
59
- </ul>
60
- `;
61
-
62
- const data = {
63
- __cms__isProxy: true,
64
- items: [
65
- { title: 'A' },
66
- { title: 'B' },
67
- { title: 'C' }
68
- ]
69
- };
70
-
71
- const tmpl = new DomElementTemplate(input, data);
72
- const output = tmpl.renderToString();
73
-
74
- // list structure must be preserved
75
- expect(output.match(/<li>/g).length).to.equal(3);
76
-
77
- // CMS proxy should exist only around text nodes
78
- expect(output).to.include('<spyne-cms-item');
79
- expect(output).to.not.match(/data-cms-key="&lt;li/);
80
- });
3
+ describe('DomElementTemplate (Public)', () => {
4
+ it('does not expose CMS proxy functionality', () => {
5
+ expect(
6
+ Object.prototype.hasOwnProperty.call(
7
+ DomElementTemplate,
8
+ 'formatTemplateForProxyData'
9
+ )
10
+ ).to.be.false;
81
11
  });
82
12
  });