@barefootjs/test 0.18.3 → 0.18.4

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.
Files changed (2) hide show
  1. package/dist/index.js +106 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -188929,6 +188929,93 @@ var BOOLEAN_ATTRS = new Set([
188929
188929
  "novalidate",
188930
188930
  "formnovalidate"
188931
188931
  ]);
188932
+ var SVG_CAMEL_TO_KEBAB = {
188933
+ strokeWidth: "stroke-width",
188934
+ strokeLinecap: "stroke-linecap",
188935
+ strokeLinejoin: "stroke-linejoin",
188936
+ strokeDasharray: "stroke-dasharray",
188937
+ strokeDashoffset: "stroke-dashoffset",
188938
+ strokeMiterlimit: "stroke-miterlimit",
188939
+ strokeOpacity: "stroke-opacity",
188940
+ fillOpacity: "fill-opacity",
188941
+ fillRule: "fill-rule",
188942
+ stopColor: "stop-color",
188943
+ stopOpacity: "stop-opacity",
188944
+ textAnchor: "text-anchor",
188945
+ dominantBaseline: "dominant-baseline",
188946
+ alignmentBaseline: "alignment-baseline",
188947
+ fontFamily: "font-family",
188948
+ fontSize: "font-size",
188949
+ fontWeight: "font-weight",
188950
+ fontStyle: "font-style",
188951
+ letterSpacing: "letter-spacing",
188952
+ wordSpacing: "word-spacing",
188953
+ pointerEvents: "pointer-events",
188954
+ vectorEffect: "vector-effect",
188955
+ colorInterpolation: "color-interpolation",
188956
+ clipPath: "clip-path",
188957
+ clipRule: "clip-rule",
188958
+ markerStart: "marker-start",
188959
+ markerMid: "marker-mid",
188960
+ markerEnd: "marker-end"
188961
+ };
188962
+ var HTML_CAMEL_ALIASES = {
188963
+ acceptCharset: "accept-charset",
188964
+ accessKey: "accesskey",
188965
+ allowFullScreen: "allowfullscreen",
188966
+ autoCapitalize: "autocapitalize",
188967
+ autoComplete: "autocomplete",
188968
+ autoCorrect: "autocorrect",
188969
+ autoFocus: "autofocus",
188970
+ autoPlay: "autoplay",
188971
+ cellPadding: "cellpadding",
188972
+ cellSpacing: "cellspacing",
188973
+ charSet: "charset",
188974
+ colSpan: "colspan",
188975
+ contentEditable: "contenteditable",
188976
+ controlsList: "controlslist",
188977
+ crossOrigin: "crossorigin",
188978
+ dateTime: "datetime",
188979
+ dirName: "dirname",
188980
+ encType: "enctype",
188981
+ enterKeyHint: "enterkeyhint",
188982
+ fetchPriority: "fetchpriority",
188983
+ formAction: "formaction",
188984
+ formEncType: "formenctype",
188985
+ formMethod: "formmethod",
188986
+ formNoValidate: "formnovalidate",
188987
+ formTarget: "formtarget",
188988
+ frameBorder: "frameborder",
188989
+ hrefLang: "hreflang",
188990
+ httpEquiv: "http-equiv",
188991
+ imageSizes: "imagesizes",
188992
+ imageSrcSet: "imagesrcset",
188993
+ inputMode: "inputmode",
188994
+ itemID: "itemid",
188995
+ itemProp: "itemprop",
188996
+ itemRef: "itemref",
188997
+ itemScope: "itemscope",
188998
+ itemType: "itemtype",
188999
+ marginHeight: "marginheight",
189000
+ marginWidth: "marginwidth",
189001
+ maxLength: "maxlength",
189002
+ minLength: "minlength",
189003
+ noModule: "nomodule",
189004
+ noValidate: "novalidate",
189005
+ playsInline: "playsinline",
189006
+ popoverTarget: "popovertarget",
189007
+ popoverTargetAction: "popovertargetaction",
189008
+ radioGroup: "radiogroup",
189009
+ readOnly: "readonly",
189010
+ referrerPolicy: "referrerpolicy",
189011
+ rowSpan: "rowspan",
189012
+ spellCheck: "spellcheck",
189013
+ srcDoc: "srcdoc",
189014
+ srcLang: "srclang",
189015
+ srcSet: "srcset",
189016
+ tabIndex: "tabindex",
189017
+ useMap: "usemap"
189018
+ };
188932
189019
  var SVG_XML_CAMEL_ATTRS = new Set([
188933
189020
  "allowReorder",
188934
189021
  "attributeName",
@@ -188995,6 +189082,19 @@ var SVG_XML_CAMEL_ATTRS = new Set([
188995
189082
  "yChannelSelector",
188996
189083
  "zoomAndPan"
188997
189084
  ]);
189085
+ function toHTMLAttrName(key) {
189086
+ if (key === "className")
189087
+ return "class";
189088
+ if (key === "htmlFor")
189089
+ return "for";
189090
+ const htmlAlias = HTML_CAMEL_ALIASES[key];
189091
+ if (htmlAlias !== undefined)
189092
+ return htmlAlias;
189093
+ const svgKebab = SVG_CAMEL_TO_KEBAB[key];
189094
+ if (svgKebab !== undefined)
189095
+ return svgKebab;
189096
+ return key;
189097
+ }
188998
189098
  // ../jsx/src/ir-to-client-js/utils.ts
188999
189099
  var PROPS_PARAM = "_p";
189000
189100
  // ../jsx/src/ir-to-client-js/component-scope.ts
@@ -194729,27 +194829,28 @@ function processAttributes(attributes, ctx) {
194729
194829
  }
194730
194830
  if (!import_typescript11.default.isJsxAttribute(attr))
194731
194831
  continue;
194732
- const name = attr.name.getText(ctx.sourceFile);
194733
- if (name === "ref") {
194832
+ const rawName = attr.name.getText(ctx.sourceFile);
194833
+ if (rawName === "ref") {
194734
194834
  if (attr.initializer && import_typescript11.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
194735
194835
  reportJsxBranchLocalInCallback(attr.initializer.expression, ctx);
194736
194836
  ref = ctx.getJS(attr.initializer.expression);
194737
194837
  }
194738
194838
  continue;
194739
194839
  }
194740
- if (/^on[A-Z]/.test(name)) {
194840
+ if (/^on[A-Z]/.test(rawName)) {
194741
194841
  if (attr.initializer && import_typescript11.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
194742
- const eventName = name.slice(2).toLowerCase();
194842
+ const eventName = rawName.slice(2).toLowerCase();
194743
194843
  reportJsxBranchLocalInCallback(attr.initializer.expression, ctx);
194744
194844
  events.push({
194745
194845
  name: eventName,
194746
- originalAttr: name,
194846
+ originalAttr: rawName,
194747
194847
  handler: ctx.getJS(attr.initializer.expression),
194748
194848
  loc: getSourceLocation(attr, ctx.sourceFile, ctx.filePath)
194749
194849
  });
194750
194850
  }
194751
194851
  continue;
194752
194852
  }
194853
+ const name = toHTMLAttrName(rawName);
194753
194854
  let value = getAttributeValue(attr, ctx);
194754
194855
  let clientOnly;
194755
194856
  if (attr.initializer && import_typescript11.default.isJsxExpression(attr.initializer) && attr.initializer.expression) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/test",
3
- "version": "0.18.3",
3
+ "version": "0.18.4",
4
4
  "description": "Test utilities for BarefootJS - IR-based component testing without a browser",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "directory": "packages/test"
40
40
  },
41
41
  "dependencies": {
42
- "@barefootjs/jsx": "0.18.3"
42
+ "@barefootjs/jsx": "0.18.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "typescript": "^5.0.0"