{"size": 2548, "ext": "js", "max_stars_repo_path": "cypress/integration/tests.spec.js", "max_stars_repo_name": "jabawack81/impossible-clock", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "cypress/integration/tests.spec.js", "max_issues_repo_name": "jabawack81/impossible-clock", "max_issues_repo_issues_event_min_datetime": "2019-08-29T08:44:48.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T07:08:02.000Z", "max_forks_repo_path": "cypress/integration/tests.spec.js", "max_forks_repo_name": "internetblacksmith/impossible-clock", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 430, "max_forks_count": null, "avg_line_length": 33.9733333333, "max_line_length": 73, "alphanum_fraction": 0.5879120879}
/// <reference types="cypress" />
// remove no check once Cypress.sinon is typed
// https://github.com/cypress-io/cypress/issues/6720

context("Test", () => {
  const url = "/";
  const now = new Date(Date.UTC(2017, 2, 14)).getTime();

  beforeEach(function () {
    cy.clock(now);
    cy.visit(url);
  });

  context("by default", () => {
    it("Hours, Minutes and seconds checkboxes should be checked", () => {
      cy.get("#input-show-second").should("be.checked");
      cy.get("#input-show-minute").should("be.checked");
      cy.get("#input-show-hour").should("be.checked");
    });

    it("hours minutes and seconds are displayed", () => {
      cy.get("#display-1").should("have.class", "display-no-0-0-0");
      cy.get("#display-2").should("have.class", "display-no-0-0-0");

      cy.tick(45296000); // 12 hours 34 minutes and 56 seconds passed

      cy.get("#display-1").should("have.class", "display-no-1-3-5");
      cy.get("#display-2").should("have.class", "display-no-2-4-6");
    });
  });
  context("hiding sections", () => {
    it("unchecking the hours should disable them", () => {
      cy.get("label.switch.hour").first().click();

      cy.tick(1000);

      cy.get("#display-1").should("have.class", "display-no-10-0-0");
      cy.get("#display-2").should("have.class", "display-no-10-0-1");

      cy.tick(45295000); // 12 hours 34 minutes and 56 seconds passed

      cy.get("#display-1").should("have.class", "display-no-10-3-5");
      cy.get("#display-2").should("have.class", "display-no-10-4-6");
    });

    it("unchecking the minutes should disable them", () => {
      cy.get("label.switch.minute").first().click();

      cy.tick(1000);

      cy.get("#display-1").should("have.class", "display-no-0-10-0");
      cy.get("#display-2").should("have.class", "display-no-0-10-1");

      cy.tick(45295000); // 12 hours 34 minutes and 56 seconds passed

      cy.get("#display-1").should("have.class", "display-no-1-10-5");
      cy.get("#display-2").should("have.class", "display-no-2-10-6");
    });

    it("unchecking the seconds should disable them", () => {
      cy.get("label.switch.second").first().click();

      cy.tick(1000);

      cy.get("#display-1").should("have.class", "display-no-0-0-10");
      cy.get("#display-2").should("have.class", "display-no-0-0-10");

      cy.tick(45295000); // 12 hours 34 minutes and 56 seconds passed

      cy.get("#display-1").should("have.class", "display-no-1-3-10");
      cy.get("#display-2").should("have.class", "display-no-2-4-10");
    });
  });
});
