Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor using glass easel #109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Refactor using glass easel #109

wants to merge 2 commits into from

Conversation

Tidyzq
Copy link
Contributor

@Tidyzq Tidyzq commented Oct 18, 2023

No description provided.

@Tidyzq Tidyzq requested a review from JuneAndGreen as a code owner October 18, 2023 08:08
@@ -19,9 +21,19 @@
```

```js
simulate.load('/comp') // 渲染出来的结果是 <comp><wx-view class="main--abc">123</wx-view></comp>
const comp = simulate.render(simulate.load('/comp'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simulate.loadComponent ?


## dom 接口模拟
## 根路径
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文档顶上的锚点没有更新

@@ -89,10 +117,12 @@ test('test some', () => {

## 内置组件

TODO
Copy link
Contributor

@JuneAndGreen JuneAndGreen Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接告知内置组件会渲染成没有任何作用的自定义标签?


> PS:推荐使用 jest 来搭配此工具集使用,jest 内部已集成 jsdom,通过配置 testEnvironment 字段的值为 jsdom 即可以类浏览器环境的方式来执行测试用例。
```js
simulate.load('/comp/index', { rootPath: '/comp' })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simulate.loadComponent


it('test', () => {
// 加载自定义组件,自定义组件在当前的 components/comp/index 目录下
const id = simulate.load(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simulate.loadComponent


it('should run successfully', () => {
// 加载自定义组件,自定义组件在当前的 components/comp/index 目录下
const id = simulate.load('/components/comp/index')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simulate.loadComponent


comp.detach() // 将组件从容器节点中移除,会触发 detached 生命周期
// 加载自定义组件,自定义组件在当前的 components/comp/index 目录下
const id = simulate.load(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadComponent

// 前略

// 加载自定义组件,自定义组件在当前的 components/comp/index 目录下
const id = simulate.load(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadComponent


it('test', () => {
// 加载自定义组件
const id = simulate.load(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadComponent


```js
const simulate = require('miniprogram-simulate')
```

## 起步例子
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下面的例子,可以补充一下 scrollTo 和 dispatchTapEvent 的例子?

@@ -1,287 +1,152 @@
# 接口

## behavior(definition)
## `loadComponent(componentPath: string): string`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github 渲染出来的样式看着很奇怪:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants