slicejs-web-framework 3.1.1 → 3.1.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.
package/Slice/Slice.js CHANGED
@@ -132,7 +132,7 @@ export default class Slice {
132
132
 
133
133
  let isVisual = slice.paths.components[componentCategory].type === 'Visual';
134
134
  let modulePath = `${slice.paths.components[componentCategory].path}/${componentName}/${componentName}.js`;
135
- const isJsOnlyVisualComponent = isVisual && (componentName === 'MultiRoute' || componentName === 'Route' || componentName === 'Link');
135
+ const isJsOnlyVisualComponent = isVisual && (componentName === 'MultiRoute' || componentName === 'Route');
136
136
 
137
137
  // Load template, class, and CSS concurrently if needed
138
138
  try {
@@ -80,7 +80,7 @@ function createSlice() {
80
80
  return instance;
81
81
  }
82
82
 
83
- test('build does not fetch html/css for MultiRoute, Route, and Link', async () => {
83
+ test('build does not fetch html/css for MultiRoute and Route', async () => {
84
84
  const originalSlice = globalThis.slice;
85
85
 
86
86
  try {
@@ -103,6 +103,27 @@ test('build does not fetch html/css for MultiRoute, Route, and Link', async () =
103
103
  async init() {}
104
104
  }
105
105
 
106
+ sliceInstance.controller.classes.set('MultiRoute', MultiRouteComponent);
107
+ sliceInstance.controller.classes.set('Route', RouteComponent);
108
+
109
+ const builtMultiRoute = await sliceInstance.build('MultiRoute', {});
110
+ const builtRoute = await sliceInstance.build('Route', {});
111
+
112
+ assert.ok(builtMultiRoute, 'Expected MultiRoute instance to be created');
113
+ assert.ok(builtRoute, 'Expected Route instance to be created');
114
+ assert.equal(sliceInstance.controller.fetchCalls, 0);
115
+ } finally {
116
+ globalThis.slice = originalSlice;
117
+ }
118
+ });
119
+
120
+ test('build still fetches html/css for Link', async () => {
121
+ const originalSlice = globalThis.slice;
122
+
123
+ try {
124
+ const sliceInstance = createSlice();
125
+ globalThis.slice = sliceInstance;
126
+
106
127
  class LinkComponent {
107
128
  constructor(props) {
108
129
  this.props = props;
@@ -111,18 +132,12 @@ test('build does not fetch html/css for MultiRoute, Route, and Link', async () =
111
132
  async init() {}
112
133
  }
113
134
 
114
- sliceInstance.controller.classes.set('MultiRoute', MultiRouteComponent);
115
- sliceInstance.controller.classes.set('Route', RouteComponent);
116
135
  sliceInstance.controller.classes.set('Link', LinkComponent);
117
136
 
118
- const builtMultiRoute = await sliceInstance.build('MultiRoute', {});
119
- const builtRoute = await sliceInstance.build('Route', {});
120
137
  const builtLink = await sliceInstance.build('Link', {});
121
138
 
122
- assert.ok(builtMultiRoute, 'Expected MultiRoute instance to be created');
123
- assert.ok(builtRoute, 'Expected Route instance to be created');
124
- assert.ok(builtLink, 'Expected Link instance to be created');
125
- assert.equal(sliceInstance.controller.fetchCalls, 0);
139
+ assert.equal(builtLink, null);
140
+ assert.ok(sliceInstance.controller.fetchCalls > 0, 'Expected Link to trigger resource fetches');
126
141
  } finally {
127
142
  globalThis.slice = originalSlice;
128
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-web-framework",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=20"