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

add preact snapshot test #1267

Closed
paranoidjk opened this issue May 4, 2017 · 7 comments
Closed

add preact snapshot test #1267

paranoidjk opened this issue May 4, 2017 · 7 comments
Assignees
Milestone

Comments

@paranoidjk
Copy link
Contributor

paranoidjk commented May 4, 2017

preactjs/preact#560
preactjs/preact-render-to-string#16
enzymejs/enzyme#742

@paranoidjk paranoidjk added the Plan label May 4, 2017
@paranoidjk paranoidjk self-assigned this May 4, 2017
@paranoidjk paranoidjk added this to the 1.2.0 milestone May 8, 2017
@benjycui
Copy link
Contributor

@yesmeck 其实单测可不可以这样写:

import React from '../shared/ReactOrPreact';

...
// ReactOrPreact

export default (function () {
  if (ENV === 'xxx') {
    return Preact
  }
  return React
})();

这样无论 Snapshot 还是单测都可以同时测试 Preact 和 React

@yesmeck
Copy link
Member

yesmeck commented May 10, 2017

应该可以把 React mock 掉,http://facebook.github.io/jest/docs/en/manual-mocks.html#content

在 Mock 里判断用哪个版本的 React

@yesmeck
Copy link
Member

yesmeck commented May 10, 2017

但是需要 React 和 Preact 生成的 snapshot 一致。

@paranoidjk
Copy link
Contributor Author

@paranoidjk
Copy link
Contributor Author

paranoidjk commented May 12, 2017

snapshot 跑通了,#1306

还剩一个问题是 jest-serializer-html-string 没有把 html 元素的属性换行排列,所以与 react snaoshot 不一致,这个抽空过去 PR fix 掉。

@paranoidjk
Copy link
Contributor Author

paranoidjk commented May 13, 2017

@silentcloud silentcloud mentioned this issue May 13, 2017
33 tasks
@paranoidjk paranoidjk modified the milestones: 1.2.0, 1.3.0 Jun 8, 2017
@paranoidjk
Copy link
Contributor Author

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 a pull request may close this issue.

3 participants