In jest environment: Expand by clicking switcher stays in motion and does not work

Aberta
#544 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Precisa de esclarecimento
Status de atividade
Estagnada
Stack de tecnologia
react, typescript
Domínio
frontend, testing-qa

Direção de pesquisa

Comece reproduzindo o teste auxiliar que clica em um switcher de Tree e verifica o elemento ant-tree-treenode-motion. Leia o handler de expansão de Tree em torno do guard listChanging e inspecione o comportamento de useStepQueue do rc-motion, especialmente a limpeza de requestAnimationFrame. Está concluído quando a expansão termina no teste e uma expansão subsequente de um nó é aceita.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

I have a helper function that expands a tree node (node1) by clicking on the switcher element.

  • The onExpand handler is invoked with expanded = true.
  • But I noticed that the tree is still animation mode. Reasons it is still in animation mode:
    • The child nodes of the expanded node1 are still inside a div element <div class="ant-tree-treenode-motion">{my 3 child treeNodes are here}</div>

    • In the same test, I try to expand another node (node2) but it does not expand. I debugged and learned that the Tree component rejects node2 expand (Tree's expand handler is correctly invoked) because of the below code ...

      var key = treeNode.key,
      expanded = treeNode.expanded; // Do nothing when motion is in progress
      
      if (listChanging) {
          return;
      }
      
    • I also debugged further and went into the rc-motion code. The hook useStepQueue's below code is invoked and the requestAnimationFrame is canceled (I am not sure if this is normal or not). But the step never moved forward from "NONE"

      React.useEffect(function () {
          return function () {
              cancelNextFrame();
         };
      }, []);
  • I studied the test code in this repo. The test clicks on a switcher and makes sure the handler is invoked. It does not test if the tree is in animation mode or not. I have written this code to make sure the Tree is not animating:
    isAnimating: (tree: HTMLElement) => {
          return !!tree.querySelector('.ant-tree-treenode-motion');
    },

We use the Tree component a lot in our UI and we need to test our features. Appreciate if you guys can help.

Linguagem predominante
TypeScript
Estrelas
1.3k
Forks
494
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de react-component/tree

Todas as issues de react-component/tree

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.