anchor.spec.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. describe('anchor', () => {
  2. it.skip('show tooltip', () => {
  3. cy.visit('http://127.0.0.1:6006/iframe.html?id=anchor--show-tooltip&args=&viewMode=story');
  4. cy.get('.semi-anchor-link').contains('工具提示是一个有用的工具').trigger('mouseover');
  5. cy.get('.semi-portal').contains('工具提示是一个有用的工具');
  6. cy.get('.semi-anchor-link').eq(9).contains('工具提示是一个有用的工具').trigger('mouseover');
  7. cy.get('.semi-portal div[x-placement="right"]').contains('工具提示是一个有用的工具');
  8. });
  9. it('key press', () => {
  10. cy.visit('http://127.0.0.1:6006/iframe.html?id=anchor--style-position&args=&viewMode=story');
  11. cy.get('.semi-anchor-link').contains('contact').type('{upArrow}').type('{enter}');
  12. cy.get('h1').contains('Contact me').click();
  13. });
  14. it('scroll', () => {
  15. cy.visit('http://127.0.0.1:6006/iframe.html?id=anchor--target-offset&args=&viewMode=story');
  16. cy.get('#box').scrollTo('bottom');
  17. cy.get('.semi-anchor-link-title-active').contains('doc1');
  18. cy.wait(500);
  19. cy.get('#box').scrollTo('top');
  20. cy.get('h1').contains('whatever').click();
  21. });
  22. it('click', () => {
  23. cy.visit('http://127.0.0.1:6006/iframe.html?id=anchor--target-offset&args=&viewMode=story');
  24. cy.get('.semi-anchor-link').contains('api too much').click();
  25. cy.get('#api').contains('API').click();
  26. });
  27. it('auto collapse', () => {
  28. cy.visit('http://127.0.0.1:6006/iframe.html?id=anchor--auto-collapse&args=&viewMode=story');
  29. cy.get('.semi-anchor-link').contains('组件').should('have.length', 0);
  30. cy.get('.semi-anchor-link').contains('动态展示').click();
  31. cy.get('.semi-anchor-link').contains('组件').should('have.length', 1);
  32. cy.get('.semi-anchor-link').contains('设计语言').click();
  33. cy.get('.semi-anchor-link').contains('组件').should('have.length', 0);
  34. });
  35. it('update href', () => {
  36. cy.visit('http://127.0.0.1:6006/iframe.html?id=anchor--auto-collapse&args=&viewMode=story');
  37. cy.get('#root').contains('setHref').click();
  38. });
  39. });