Skip to content

Commit 7b375bf

Browse files
authored
Merge pull request #443 from titoBouzout/avoiding-onclick-test-changes
remove condition that changed too many tests
2 parents 7b3a26e + 030e8be commit 7b375bf

File tree

4 files changed

+11
-19
lines changed
  • packages/babel-plugin-jsx-dom-expressions

4 files changed

+11
-19
lines changed

packages/babel-plugin-jsx-dom-expressions/src/dom/element.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -877,13 +877,7 @@ function transformAttributes(path, results) {
877877
} else if (key.slice(0, 5) === "attr:") {
878878
if (t.isJSXExpressionContainer(value)) value = value.expression;
879879

880-
/**
881-
* TODO: Unfortunately, `attr:onclick` changes too many tests, as we are working in
882-
* `minor/next` it will mess up merging. This condition `key !== "onclick" &&` to be
883-
* removed once we reach Solid 2.0, which will change a lot of tests.
884-
*/
885-
886-
if (key !== "attr:onclick" && (t.isStringLiteral(value) || t.isNumericLiteral(value))) {
880+
if (t.isStringLiteral(value) || t.isNumericLiteral(value)) {
887881
// inlined "attr:"
888882
inlineAttributeOnTemplate(isSVG, key.slice(5), results, value);
889883
} else {

packages/babel-plugin-jsx-dom-expressions/test/__dom_compatible_fixtures__/attributeExpressions/output.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var _tmpl$ = /*#__PURE__*/ _$template(
1919
_tmpl$3 = /*#__PURE__*/ _$template(`<div foo></div>`),
2020
_tmpl$4 = /*#__PURE__*/ _$template(`<div></div>`),
2121
_tmpl$5 = /*#__PURE__*/ _$template(`<div class="a b"></div>`),
22-
_tmpl$6 = /*#__PURE__*/ _$template(`<div style="margin-right:40px"></div>`),
22+
_tmpl$6 = /*#__PURE__*/ _$template(`<div style="margin-right:40px" onclick="console.log('hi')"></div>`),
2323
_tmpl$7 = /*#__PURE__*/ _$template(`<input type="checkbox">`),
2424
_tmpl$8 = /*#__PURE__*/ _$template(`<div class="\`a">\`$\`</div>`),
2525
_tmpl$9 = /*#__PURE__*/ _$template(`<button class="static hi"type="button">Write</button>`),
@@ -32,7 +32,7 @@ var _tmpl$ = /*#__PURE__*/ _$template(
3232
_tmpl$16 = /*#__PURE__*/ _$template(`<div start="Hi">Hi</div>`),
3333
_tmpl$17 = /*#__PURE__*/ _$template(`<label><span>Input is </span><input><div></div></label>`),
3434
_tmpl$18 = /*#__PURE__*/ _$template(
35-
`<div class="class1 class2 class3 class4 class5 class6"random="random1 random2\n random3 random4"style="color:red;background-color:blue !important;border:1px solid black;font-size:12px"></div>`
35+
`<div class="class1 class2 class3 class4 class5 class6"style="color:red;background-color:blue !important;border:1px solid black;font-size:12px;"random="random1 random2\n random3 random4"></div>`
3636
),
3737
_tmpl$19 = /*#__PURE__*/ _$template(`<button></button>`),
3838
_tmpl$20 = /*#__PURE__*/ _$template(`<input value="10">`),
@@ -240,10 +240,9 @@ const template11 = (() => {
240240
return _el$17;
241241
})();
242242
const template12 = (() => {
243-
var _el$18 = _tmpl$4();
243+
var _el$18 = _tmpl$6();
244244
_el$18.htmlFor = thing;
245245
_el$18.number = 123;
246-
_$setAttribute(_el$18, "onclick", "console.log('hi')");
247246
return _el$18;
248247
})();
249248
const template13 = (() => {

packages/babel-plugin-jsx-dom-expressions/test/__dom_fixtures__/attributeExpressions/output.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var _tmpl$ = /*#__PURE__*/ _$template(`<div id=main><h1 class=base id=my-h1><a h
1717
_tmpl$3 = /*#__PURE__*/ _$template(`<div foo>`),
1818
_tmpl$4 = /*#__PURE__*/ _$template(`<div>`),
1919
_tmpl$5 = /*#__PURE__*/ _$template(`<div class="a b">`),
20-
_tmpl$6 = /*#__PURE__*/ _$template(`<div style=margin-right:40px>`),
20+
_tmpl$6 = /*#__PURE__*/ _$template(`<div style=margin-right:40px onclick="console.log('hi')">`),
2121
_tmpl$7 = /*#__PURE__*/ _$template(`<input type=checkbox>`),
2222
_tmpl$8 = /*#__PURE__*/ _$template(`<div class="\`a">\`$\``),
2323
_tmpl$9 = /*#__PURE__*/ _$template(`<button class="static hi"type=button>Write`),
@@ -30,7 +30,7 @@ var _tmpl$ = /*#__PURE__*/ _$template(`<div id=main><h1 class=base id=my-h1><a h
3030
_tmpl$16 = /*#__PURE__*/ _$template(`<div start=Hi>Hi`),
3131
_tmpl$17 = /*#__PURE__*/ _$template(`<label><span>Input is </span><input><div>`),
3232
_tmpl$18 = /*#__PURE__*/ _$template(
33-
`<div class="class1 class2 class3 class4 class5 class6"random="random1 random2\n random3 random4"style="color:red;background-color:blue !important;border:1px solid black;font-size:12px">`
33+
`<div class="class1 class2 class3 class4 class5 class6"style="color:red;background-color:blue !important;border:1px solid black;font-size:12px;"random="random1 random2\n random3 random4">`
3434
),
3535
_tmpl$19 = /*#__PURE__*/ _$template(`<button>`),
3636
_tmpl$20 = /*#__PURE__*/ _$template(`<input value=10>`),
@@ -73,6 +73,7 @@ var _tmpl$ = /*#__PURE__*/ _$template(`<div id=main><h1 class=base id=my-h1><a h
7373
`<div style=background:red;color:green;margin:3;padding:0.4>`
7474
),
7575
_tmpl$57 = /*#__PURE__*/ _$template(`<div style=background:red;color:green>`);
76+
7677
import * as styles from "./styles.module.css";
7778
import { binding } from "somewhere";
7879
function refFn() {}
@@ -225,10 +226,9 @@ const template11 = (() => {
225226
return _el$17;
226227
})();
227228
const template12 = (() => {
228-
var _el$18 = _tmpl$4();
229+
var _el$18 = _tmpl$6();
229230
_el$18.htmlFor = thing;
230231
_el$18.number = 123;
231-
_$setAttribute(_el$18, "onclick", "console.log('hi')");
232232
return _el$18;
233233
})();
234234
const template13 = (() => {

packages/babel-plugin-jsx-dom-expressions/test/__dom_hydratable_fixtures__/attributeExpressions/output.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var _tmpl$ = /*#__PURE__*/ _$template(`<div id=main><h1 class=base id=my-h1><a h
2020
_tmpl$3 = /*#__PURE__*/ _$template(`<div foo>`),
2121
_tmpl$4 = /*#__PURE__*/ _$template(`<div>`),
2222
_tmpl$5 = /*#__PURE__*/ _$template(`<div class="a b">`),
23-
_tmpl$6 = /*#__PURE__*/ _$template(`<div style=margin-right:40px>`),
23+
_tmpl$6 = /*#__PURE__*/ _$template(`<div style=margin-right:40px onclick="console.log('hi')">`),
2424
_tmpl$7 = /*#__PURE__*/ _$template(`<input type=checkbox>`),
2525
_tmpl$8 = /*#__PURE__*/ _$template(`<div class="\`a">\`$\``),
2626
_tmpl$9 = /*#__PURE__*/ _$template(`<button class="static hi"type=button>Write`),
@@ -33,7 +33,7 @@ var _tmpl$ = /*#__PURE__*/ _$template(`<div id=main><h1 class=base id=my-h1><a h
3333
_tmpl$16 = /*#__PURE__*/ _$template(`<div start=Hi>Hi`),
3434
_tmpl$17 = /*#__PURE__*/ _$template(`<label><span>Input is <!$><!/></span><input><div>`),
3535
_tmpl$18 = /*#__PURE__*/ _$template(
36-
`<div class="class1 class2 class3 class4 class5 class6"random="random1 random2\n random3 random4"style="color:red;background-color:blue !important;border:1px solid black;font-size:12px">`
36+
`<div class="class1 class2 class3 class4 class5 class6"style="color:red;background-color:blue !important;border:1px solid black;font-size:12px;"random="random1 random2\n random3 random4">`
3737
),
3838
_tmpl$19 = /*#__PURE__*/ _$template(`<button>`),
3939
_tmpl$20 = /*#__PURE__*/ _$template(`<input value=10>`),
@@ -191,10 +191,9 @@ const template11 = (() => {
191191
return _el$17;
192192
})();
193193
const template12 = (() => {
194-
var _el$18 = _$getNextElement(_tmpl$4);
194+
var _el$18 = _$getNextElement(_tmpl$6);
195195
_el$18.htmlFor = thing;
196196
_el$18.number = 123;
197-
_$setAttribute(_el$18, "onclick", "console.log('hi')");
198197
return _el$18;
199198
})();
200199
const template13 = (() => {

0 commit comments

Comments
 (0)