Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

55 rader
1.1 KiB

  1. context("Control Rating", () => {
  2. before(() => {
  3. cy.login();
  4. cy.visit("/app/website");
  5. });
  6. function get_dialog_with_rating() {
  7. return cy.dialog({
  8. title: "Rating",
  9. fields: [
  10. {
  11. fieldname: "rate",
  12. fieldtype: "Rating",
  13. options: 7,
  14. },
  15. ],
  16. });
  17. }
  18. it("click on the star rating to record value", () => {
  19. get_dialog_with_rating().as("dialog");
  20. cy.get("div.rating")
  21. .children("svg")
  22. .find(".right-half")
  23. .first()
  24. .click()
  25. .should("have.class", "star-click");
  26. cy.get("@dialog").then((dialog) => {
  27. var value = dialog.get_value("rate");
  28. expect(value).to.equal(1 / 7);
  29. dialog.hide();
  30. });
  31. });
  32. it("hover on the star", () => {
  33. get_dialog_with_rating();
  34. cy.get("div.rating")
  35. .children("svg")
  36. .find(".right-half")
  37. .first()
  38. .invoke("trigger", "mouseenter")
  39. .should("have.class", "star-hover")
  40. .invoke("trigger", "mouseleave")
  41. .should("not.have.class", "star-hover");
  42. });
  43. it("check number of stars in rating", () => {
  44. get_dialog_with_rating();
  45. cy.get("div.rating").first().children("svg").should("have.length", 7);
  46. });
  47. });