ripple 0.2.57 → 0.2.58

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ripple is an elegant TypeScript UI framework",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.2.57",
6
+ "version": "0.2.58",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index.js",
9
9
  "main": "src/runtime/index.js",
@@ -293,7 +293,7 @@ function RipplePlugin(config) {
293
293
  node.block = this.parseBlock();
294
294
  node.handler = null;
295
295
 
296
- if (this.value === 'pending') {
296
+ if (this.value === 'pending') {
297
297
  this.next();
298
298
  node.pending = this.parseBlock();
299
299
  } else {
@@ -487,8 +487,10 @@ function RipplePlugin(config) {
487
487
  if (attr.name.type === 'JSXIdentifier') {
488
488
  attr.name.type = 'Identifier';
489
489
  }
490
- if (attr.value.type === 'JSXExpressionContainer') {
491
- attr.value = attr.value.expression;
490
+ if (attr.value !== null) {
491
+ if (attr.value.type === 'JSXExpressionContainer') {
492
+ attr.value = attr.value.expression;
493
+ }
492
494
  }
493
495
  }
494
496
  }
@@ -409,7 +409,7 @@ const visitors = {
409
409
 
410
410
  attr.metadata.delegated = delegated_event;
411
411
  }
412
- } else {
412
+ } else if (attr.value !== null) {
413
413
  visit(attr.value, state);
414
414
  }
415
415
  }
@@ -470,6 +470,11 @@ const visitors = {
470
470
  if (attr.name.type === 'Identifier') {
471
471
  const name = attr.name.name;
472
472
 
473
+ if (attr.value === null) {
474
+ handle_static_attr(name, true);
475
+ continue;
476
+ }
477
+
473
478
  if (attr.value.type === 'Literal' && name !== 'class') {
474
479
  handle_static_attr(name, attr.value.value);
475
480
  continue;
@@ -1,5 +1,24 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
+ exports[`basic > handles boolean attributes with no prop value provides 1`] = `
4
+ <div>
5
+ <div
6
+ class="container"
7
+ >
8
+ <button
9
+ disabled=""
10
+ >
11
+ Button
12
+ </button>
13
+ <input
14
+ checked=""
15
+ type="checkbox"
16
+ />
17
+ </div>
18
+
19
+ </div>
20
+ `;
21
+
3
22
  exports[`basic > render semi-dynamic text 1`] = `
4
23
  <div>
5
24
  <div>
@@ -1246,4 +1246,16 @@ describe('basic', () => {
1246
1246
  flushSync();
1247
1247
  expect(countSpan.textContent).toBe('1');
1248
1248
  });
1249
+
1250
+ it('handles boolean attributes with no prop value provides', () => {
1251
+ component App() {
1252
+ <div class="container">
1253
+ <button onClick={() => console.log("clicked!")} disabled>{"Button"}</button>
1254
+ <input type="checkbox" checked />
1255
+ </div>
1256
+ }
1257
+
1258
+ render(App);
1259
+ expect(container).toMatchSnapshot();
1260
+ });
1249
1261
  });