-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
8,160 additions
and
2,777 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"printWidth": 120 | ||
"trailingComma": "none", | ||
"arrowParens": "avoid", | ||
"printWidth": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
moduleDirectories: ['node_modules', 'packages'], | ||
testEnvironment: 'jsdom', | ||
collectCoverageFrom: ['./dist/index.js'], | ||
transform: { | ||
'^.+\\.jsx?$': 'babel-jest' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/babel-preset-solid-taro/test/__tag_collector_fixtures__/simpleElements/code.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const template = ( | ||
<div id="main"> | ||
<style>{"div { color: red; }"}</style> | ||
<h1>Welcome</h1> | ||
<label for={"entry"}>Edit:</label> | ||
<input id="entry" type="text" /> | ||
{/* Comment Node */} | ||
</div> | ||
); | ||
|
||
const template2 = ( | ||
<div> | ||
<span> | ||
<a></a> | ||
</span> | ||
<span /> | ||
</div> | ||
); | ||
|
||
const template3 = ( | ||
<div> | ||
<div> | ||
<table> | ||
<tbody></tbody> | ||
</table> | ||
</div> | ||
<div></div> | ||
</div> | ||
); | ||
|
||
const template4 = ( | ||
<div> | ||
<div> | ||
<footer> | ||
<div /> | ||
</footer> | ||
</div> | ||
<div> | ||
<button> | ||
<span>{0}</span> | ||
</button> | ||
</div> | ||
</div> | ||
); |
62 changes: 62 additions & 0 deletions
62
packages/babel-preset-solid-taro/test/__tag_collector_fixtures__/simpleElements/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { createTextNode as _$createTextNode } from "r-custom"; | ||
import { insertNode as _$insertNode } from "r-custom"; | ||
import { setProp as _$setProp } from "r-custom"; | ||
import { createElement as _$createElement } from "r-custom"; | ||
const template = (() => { | ||
var _el$ = _$createElement("div"), | ||
_el$2 = _$createElement("style"), | ||
_el$4 = _$createElement("h1"), | ||
_el$6 = _$createElement("label"), | ||
_el$8 = _$createElement("input"); | ||
_$insertNode(_el$, _el$2); | ||
_$insertNode(_el$, _el$4); | ||
_$insertNode(_el$, _el$6); | ||
_$insertNode(_el$, _el$8); | ||
_$setProp(_el$, "id", "main"); | ||
_$insertNode(_el$2, _$createTextNode(`div \{ color: red; }`)); | ||
_$insertNode(_el$4, _$createTextNode(`Welcome`)); | ||
_$insertNode(_el$6, _$createTextNode(`Edit:`)); | ||
_$setProp(_el$6, "for", "entry"); | ||
_$setProp(_el$8, "id", "entry"); | ||
_$setProp(_el$8, "type", "text"); | ||
return _el$; | ||
})(); | ||
const template2 = (() => { | ||
var _el$9 = _$createElement("div"), | ||
_el$10 = _$createElement("span"), | ||
_el$11 = _$createElement("a"), | ||
_el$12 = _$createElement("span"); | ||
_$insertNode(_el$9, _el$10); | ||
_$insertNode(_el$9, _el$12); | ||
_$insertNode(_el$10, _el$11); | ||
return _el$9; | ||
})(); | ||
const template3 = (() => { | ||
var _el$13 = _$createElement("div"), | ||
_el$14 = _$createElement("div"), | ||
_el$15 = _$createElement("table"), | ||
_el$16 = _$createElement("tbody"), | ||
_el$17 = _$createElement("div"); | ||
_$insertNode(_el$13, _el$14); | ||
_$insertNode(_el$13, _el$17); | ||
_$insertNode(_el$14, _el$15); | ||
_$insertNode(_el$15, _el$16); | ||
return _el$13; | ||
})(); | ||
const template4 = (() => { | ||
var _el$18 = _$createElement("div"), | ||
_el$19 = _$createElement("div"), | ||
_el$20 = _$createElement("footer"), | ||
_el$21 = _$createElement("div"), | ||
_el$22 = _$createElement("div"), | ||
_el$23 = _$createElement("button"), | ||
_el$24 = _$createElement("span"); | ||
_$insertNode(_el$18, _el$19); | ||
_$insertNode(_el$18, _el$22); | ||
_$insertNode(_el$19, _el$20); | ||
_$insertNode(_el$20, _el$21); | ||
_$insertNode(_el$22, _el$23); | ||
_$insertNode(_el$23, _el$24); | ||
_$insertNode(_el$24, _$createTextNode(`0`)); | ||
return _el$18; | ||
})(); |
19 changes: 19 additions & 0 deletions
19
packages/babel-preset-solid-taro/test/tag-collector.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const path = require('path') | ||
const pluginTester = require('babel-plugin-tester').default | ||
const plugin = require('../dist/index') | ||
|
||
pluginTester({ | ||
plugin, | ||
pluginOptions: { | ||
moduleName: 'r-custom', | ||
builtIns: ['For', 'Show'], | ||
generate: 'universal', | ||
staticMarker: '@once', | ||
tagCollector: jest.fn(tags => { | ||
expect(tags.length).toBeGreaterThan(0) // 检查至少被调用一次 | ||
}) | ||
}, | ||
title: 'Convert JSX', | ||
fixtures: path.join(__dirname, '__tag_collector_fixtures__'), | ||
snapshot: true | ||
}) |
Oops, something went wrong.