Open
Conversation
|
|
||
| ```js | ||
| simulate.load('/comp') // 渲染出来的结果是 <comp><wx-view class="main--abc">123</wx-view></comp> | ||
| const comp = simulate.render(simulate.load('/comp')) |
Contributor
There was a problem hiding this comment.
simulate.loadComponent ?
| ``` | ||
|
|
||
| ## dom 接口模拟 | ||
| ## 根路径 |
|
|
||
| ## 内置组件 | ||
|
|
||
| TODO |
Contributor
There was a problem hiding this comment.
直接告知内置组件会渲染成没有任何作用的自定义标签?
|
|
||
| > PS:推荐使用 jest 来搭配此工具集使用,jest 内部已集成 jsdom,通过配置 testEnvironment 字段的值为 jsdom 即可以类浏览器环境的方式来执行测试用例。 | ||
| ```js | ||
| simulate.load('/comp/index', { rootPath: '/comp' }) |
Contributor
There was a problem hiding this comment.
simulate.loadComponent
|
|
||
| it('test', () => { | ||
| // 加载自定义组件,自定义组件在当前的 components/comp/index 目录下 | ||
| const id = simulate.load( |
Contributor
There was a problem hiding this comment.
simulate.loadComponent
|
|
||
| it('should run successfully', () => { | ||
| // 加载自定义组件,自定义组件在当前的 components/comp/index 目录下 | ||
| const id = simulate.load('/components/comp/index') |
Contributor
There was a problem hiding this comment.
simulate.loadComponent
|
|
||
| comp.detach() // 将组件从容器节点中移除,会触发 detached 生命周期 | ||
| // 加载自定义组件,自定义组件在当前的 components/comp/index 目录下 | ||
| const id = simulate.load( |
| // 前略 | ||
|
|
||
| // 加载自定义组件,自定义组件在当前的 components/comp/index 目录下 | ||
| const id = simulate.load( |
|
|
||
| it('test', () => { | ||
| // 加载自定义组件 | ||
| const id = simulate.load( |
| const simulate = require('miniprogram-simulate') | ||
| ``` | ||
|
|
||
| ## 起步例子 |
Contributor
There was a problem hiding this comment.
下面的例子,可以补充一下 scrollTo 和 dispatchTapEvent 的例子?
| # 接口 | ||
|
|
||
| ## behavior(definition) | ||
| ## `loadComponent(componentPath: string): string` |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.