Skip to content

Commit

Permalink
Fixup linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Apr 21, 2024
1 parent 2ab421d commit 325db3d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
8 changes: 5 additions & 3 deletions e2e/cypress/e2e/demo/combo-nav.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {snapId, goCheckNext, goCheckPrev, styles} from "../../support/test-helper.ts";

describe("Test all comboNavs for all styles", () => {
const id = "#combo-nav-js";
const id = "#combo-nav-js";
const id_input = `${id} input`;

for (const style of styles) {
Expand All @@ -11,9 +11,11 @@ describe("Test all comboNavs for all styles", () => {
goCheckNext(id);
cy.get(id_input).type("3{enter}");
snapId(id);
cy.get(id_input).type("50").blur();
cy.get(id_input).type("50");
cy.blur();
snapId(id);
cy.get(id_input).focus().type("{downarrow}{enter}");
cy.get(id_input).focus();
cy.type("{downarrow}{enter}");
snapId(id);
goCheckPrev(id);
});
Expand Down
6 changes: 4 additions & 2 deletions e2e/cypress/e2e/demo/helpers.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ describe("Test generic helpers", () => {
snapId(id);
cy.get(id_input).type("10{enter}");
snapId(id);
cy.get(id_input).type("17").blur();
cy.get(id_input).type("17");
cy.blur();
snapId(id);
cy.get(id_input).focus().type("{uparrow}{enter}");
cy.get(id_input).focus();
cy.type("{uparrow}{enter}");
snapId(id);
}
});
Expand Down
26 changes: 13 additions & 13 deletions e2e/cypress/e2e/demo/input.cy.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
describe("Test behavior of input based helpers", () => {

const invalids = ["1000", "abcdef"];
const pages = ["1", "5"];
const pages = ["1", "5"];

for (const invalid of invalids) {
it("Test input in #items-selector-js", () => {
cy.visit(`/pagy?page=1`)
.get("#items-selector-js input").type(`${invalid}{enter}`)
.should(($input) => {
expect($input.val()).not.to.eq(invalid);
expect($input.val()).to.eq("20");
}).location().should(loc => expect(loc.href).to.match(new RegExp(`page=1`)));
cy.visit(`/pagy?page=1`);
cy.get("#items-selector-js input").type(`${invalid}{enter}`);
cy.should(($input) => {
expect($input.val()).not.to.eq(invalid);
expect($input.val()).to.eq("20");
}).location().should(loc => expect(loc.href).to.match(new RegExp(`page=1`)));
});

for (const page of pages) {
for (const invalid of invalids) {
it(`Test input in #combo-nav-js at page ${page}`, () => {
cy.visit(`/pagy?page=${page}`)
.get("#combo-nav-js input").type(`${invalid}{enter}`)
.should(($input) => {
expect($input.val()).not.to.eq(invalid);
expect($input.val()).to.eq(page);
}).location().should(loc => expect(loc.href).to.match(new RegExp(`page=${page}`)));
cy.visit(`/pagy?page=${page}`);
cy.get("#combo-nav-js input").type(`${invalid}{enter}`);
cy.should(($input) => {
expect($input.val()).not.to.eq(invalid);
expect($input.val()).to.eq(page);
}).location().should(loc => expect(loc.href).to.match(new RegExp(`page=${page}`)));
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions e2e/cypress/support/test-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ function checkStyleId(style:string, id:string) {
}

export function goCheckNext(id:string) {
cy.get(id).contains(">").click()
cy.get(id).contains(">").click();
snapId(id);
}

export function goCheckPrev(id:string) {
cy.get(id).contains("<").click()
cy.get(id).contains("<").click();
snapId(id);
}

0 comments on commit 325db3d

Please sign in to comment.