tree.spec.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. describe('tree', () => {
  2. it('clear search value', () => {
  3. cy.visit('http://127.0.0.1:6006/iframe.html?id=tree--searchable-tree&args=&viewMode=story');
  4. // type riben and expect riben node to expand
  5. cy.get('input').eq(0).type('riben');
  6. cy.get('.semi-tree-option-label-text').contains('日本');
  7. // clear value and expect all nodes to unexpand
  8. cy.get('input').eq(0).trigger('mouseover');
  9. cy.get('.semi-input-clearbtn').click();
  10. cy.get('.semi-tree-option-label-text').contains('日本').should('not.exist');
  11. cy.get('.semi-tree-option-label-text').contains('中国').should('not.exist');
  12. });
  13. it('load data', () => {
  14. cy.visit('http://127.0.0.1:6006/iframe.html?id=tree--loading&args=&viewMode=story');
  15. cy.get('.semi-tree-option-label-text').contains('Child Node').should('not.exist');
  16. cy.get('.semi-icon-tree_triangle_down').eq(0).click();
  17. cy.wait(1000);
  18. cy.get('.semi-tree-option-label-text').contains('Child Node');
  19. });
  20. it('filter data', () => {
  21. cy.visit('http://127.0.0.1:6006/iframe.html?id=tree--dynamic-tree-data-with-search-value-and-controlled-expand&args=&viewMode=story');
  22. cy.get('.semi-tree-option-expand-icon').should('not.exist');
  23. cy.get('input').eq(0).type('0-0');
  24. cy.get('button').contains('动态改变数据').click();
  25. cy.get('.semi-tree-option-expand-icon');
  26. });
  27. it("unRelated + async load", () => {
  28. cy.visit('http://127.0.0.1:6006/iframe.html?id=tree--un-related-and-async-load&args=&viewMode=story');
  29. cy.get('.semi-checkbox').eq(0).get('.semi-checkbox-inner-checked').should("exist");
  30. cy.get('.semi-icon-tree_triangle_down').eq(0).trigger('click');
  31. // sync load, 1000ms
  32. cy.wait(1000);
  33. cy.get('.semi-checkbox').eq(0).get('.semi-checkbox-inner-checked').should("exist");
  34. });
  35. });