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

chore: bump deps #41

Merged
merged 1 commit into from
Jan 25, 2019
Merged

chore: bump deps #41

merged 1 commit into from
Jan 25, 2019

Conversation

jigsawye
Copy link
Collaborator

@jigsawye jigsawye commented Jan 11, 2019

升個 react 16.8 alpha

@tw0517tw
Copy link
Collaborator

測試跑不動

@@ -116,7 +116,8 @@ describe('Dropdown', () => {
expect(onDisabledItemClick).not.toBeCalled();
});

it('should render subList when hover on Item and match snapshots', async () => {
// FIXME: test
Copy link
Collaborator

Choose a reason for hiding this comment

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

這個測試是怎樣

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

完全修不好,全部測試死在這支

Copy link
Collaborator

Choose a reason for hiding this comment

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

初步研判 await wait(callback) 這個有點問題

改成下面這樣也跑不過

await wait(() => expect(1).toBe(1));

而且詭異的是,一般來說應該會 timeout 的,不知道為啥不會 timeout 了,就持續的執行不完

Copy link
Collaborator

Choose a reason for hiding this comment

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

同樣一個東西放在別的測試就會過...不懂

Copy link
Collaborator

Choose a reason for hiding this comment

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

目前是感覺在那個 test it 裡面 setTimeout 不會正常運作,包括 wait 這個也會壞掉:
https://github.com/TheBrainFamily/wait-for-expect/blob/0f11a85f704561b98d87b8039855c925b422766d/src/index.ts#L48

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

我那天修了一個多小時修不好直接放棄,skip 掉 XDD

Copy link
Collaborator

@chentsulin chentsulin Jan 17, 2019

Choose a reason for hiding this comment

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

setup 完 setTimeout 就壞了,放前面過,放後面就卡

    await new Promise(resolve => setTimeout(resolve, 0));

    const { overlay, getByText } = await setup({
      overlay: (
        <Dropdown.List textAlign="center">
          <Dropdown.Item key="Item 1">Item 1</Dropdown.Item>
          <Dropdown.Item key="Item 2">Item 2</Dropdown.Item>
          <Dropdown.SubList key="Item 3" title="Sub List">
            <Dropdown.Item key="1">Sub Item</Dropdown.Item>
            <Dropdown.SubList
              key="Overflow Sub List"
              title="Overflow Sub List"
              maxHeight="200px"
              overflow="auto"
            >
              <Dropdown.Item key="1">Sub List Item</Dropdown.Item>
            </Dropdown.SubList>
          </Dropdown.SubList>
        </Dropdown.List>
      ),
    });
    const { overlay, getByText } = await setup({
      overlay: (
        <Dropdown.List textAlign="center">
          <Dropdown.Item key="Item 1">Item 1</Dropdown.Item>
          <Dropdown.Item key="Item 2">Item 2</Dropdown.Item>
          <Dropdown.SubList key="Item 3" title="Sub List">
            <Dropdown.Item key="1">Sub Item</Dropdown.Item>
            <Dropdown.SubList
              key="Overflow Sub List"
              title="Overflow Sub List"
              maxHeight="200px"
              overflow="auto"
            >
              <Dropdown.Item key="1">Sub List Item</Dropdown.Item>
            </Dropdown.SubList>
          </Dropdown.SubList>
        </Dropdown.List>
      ),
    });

    await new Promise(resolve => setTimeout(resolve, 0));

Copy link
Collaborator

Choose a reason for hiding this comment

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

click 完 setTimeout 就壞了,太神啦

fireEvent.click(button);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

錯了 發現是後面那行的影響,這行可以把前面的 setTimeout 弄壞

await new Promise(resolve => setTimeout(resolve, 0));

await waitForElement(() => utils.queryByTestId(overlayTestId))

@kpman
Copy link
Contributor

kpman commented Jan 24, 2019

看起來測試過了?

@@ -116,7 +116,8 @@ describe('Dropdown', () => {
expect(onDisabledItemClick).not.toBeCalled();
});

it('should render subList when hover on Item and match snapshots', async () => {
// FIXME: test
it.skip('should render subList when hover on Item and match snapshots', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

原來是 skip 掉了呀

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@chentsulin 教的 skip 大法好

Copy link
Collaborator

Choose a reason for hiding this comment

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

讓我再來研究一次

Copy link
Collaborator

Choose a reason for hiding this comment

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

還是解到這裡,結論還是 setTimeout 壞了

https://github.com/TheBrainFamily/wait-for-expect/blob/0f11a85f704561b98d87b8039855c925b422766d/src/index.ts#L48

setTimeout(runExpectation, 0);

這行改成

runExpectation();

就會過

setTimeout toString 是 jsdom 正常的 setTimeout 也不是 mock 的

https://github.com/jsdom/jsdom/blob/3cb5ec40eb3c85505b7cd187dc8a9a73151c6034/lib/jsdom/browser/Window.js#L267-L273

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

大神給跪了,那這樣要怎麼解決,發 PR 嗎

Copy link
Collaborator

Choose a reason for hiding this comment

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

還是無法解決XD
理論上

setTimeout(runExpectation, 0);

應該也要正常的 resolve promise 然後 await 往下走,還是搞不懂 setTimeout 為啥沒用,所以也無法去發這個 PR

Copy link
Collaborator

@chentsulin chentsulin Jan 24, 2019

Choose a reason for hiding this comment

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

或是把 tailor-ui 的 subset 做成 reproduce example 去發 issue 問他,只留 Dropdown 相關的 code 跟這個有問題的測試

Copy link
Collaborator

Choose a reason for hiding this comment

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

結果把 Dropdown 以外的東西都幹掉就過了

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

去去 bug 走

@jigsawye jigsawye merged commit ab6e332 into master Jan 25, 2019
@jigsawye jigsawye deleted the chore/bump-deps branch January 25, 2019 05:45
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.

4 participants