You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 rivejä
1.2 KiB

  1. context("Control Select", () => {
  2. before(() => {
  3. cy.login();
  4. cy.visit("/app/website");
  5. });
  6. function get_dialog_with_select() {
  7. return cy.dialog({
  8. title: "Select",
  9. fields: [
  10. {
  11. fieldname: "select_control",
  12. fieldtype: "Select",
  13. placeholder: "Select an Option",
  14. options: ["", "Option 1", "Option 2", "Option 2"],
  15. },
  16. ],
  17. });
  18. }
  19. it("toggles placholder on clicking an option", () => {
  20. get_dialog_with_select().as("dialog");
  21. cy.get(".xhiveframework-control[data-fieldname=select_control] .control-input").as("control");
  22. cy.get(".xhiveframework-control[data-fieldname=select_control] .control-input select").as(
  23. "select"
  24. );
  25. cy.get("@control").get(".select-icon").should("exist");
  26. cy.get("@control").get(".placeholder").should("have.css", "display", "block");
  27. cy.get("@select").select("Option 1");
  28. cy.findByDisplayValue("Option 1").should("exist");
  29. cy.get("@control").get(".placeholder").should("have.css", "display", "none");
  30. cy.get("@select").invoke("val", "");
  31. cy.findByDisplayValue("Option 1").should("not.exist");
  32. cy.get("@control").get(".placeholder").should("have.css", "display", "block");
  33. cy.get("@dialog").then((dialog) => {
  34. dialog.hide();
  35. });
  36. });
  37. });