textarea.spec.js 1.1 KB

12345678910111213141516171819202122232425
  1. // textarea.spec.js created with Cypress
  2. //
  3. // Start writing your Cypress tests below!
  4. // If you're unfamiliar with how Cypress works,
  5. // check out the link below and learn how to write your first test:
  6. // https://on.cypress.io/writing-first-test
  7. describe('textarea', () => {
  8. it('autosize', () => {
  9. cy.visit('http://localhost:6006/iframe.html?id=input--text-area-autosize&args=&viewMode=story');
  10. cy.get('.semi-input-textarea').first().type("semi design");
  11. cy.fixture("placeholder").then(placeholder => {
  12. cy.get('.semi-input-textarea').first().type(placeholder.medium);
  13. cy.document().then(document => {
  14. const textAreaDOM = document.querySelector(".semi-input-textarea");
  15. expect(textAreaDOM.scrollHeight).to.equal(textAreaDOM.clientHeight);
  16. });
  17. cy.get('.semi-input-textarea').first().clear().type(placeholder.long);
  18. cy.document().then(document => {
  19. const textAreaDOM = document.querySelector(".semi-input-textarea");
  20. expect(textAreaDOM.scrollHeight).to.equal(textAreaDOM.clientHeight);
  21. });
  22. });
  23. });
  24. });