mirror of
https://github.com/mschuepbach/matrix-kernel-filter-calculator.git
synced 2026-01-15 21:12:14 +01:00
Migrate to SvelteKit and Vite
This commit is contained in:
@@ -1,38 +1,38 @@
|
||||
describe("Claculator", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/");
|
||||
});
|
||||
describe('Claculator', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/');
|
||||
});
|
||||
|
||||
it("shows default calculation", () => {
|
||||
cy.get("[data-test=matrix] input").should("have.length", 16);
|
||||
cy.get("[data-test=kernel] input").should("have.length", 9);
|
||||
cy.get("[data-test=result] input").should("have.length", 16);
|
||||
});
|
||||
it('shows default calculation', () => {
|
||||
cy.get('[data-test=matrix] input').should('have.length', 16);
|
||||
cy.get('[data-test=kernel] input').should('have.length', 9);
|
||||
cy.get('[data-test=result] input').should('have.length', 16);
|
||||
});
|
||||
|
||||
it("shows result when matrix changes", () => {
|
||||
cy.get("[data-test=matrix] input").first().type(2);
|
||||
cy.get("[data-test=result] input").first().should("have.value", 5);
|
||||
});
|
||||
it('shows result when matrix changes', () => {
|
||||
cy.get('[data-test=matrix] input').first().type(2);
|
||||
cy.get('[data-test=result] input').first().should('have.value', 5);
|
||||
});
|
||||
|
||||
it("shows result when kernel changes", () => {
|
||||
cy.get("[data-test=kernel] input").first().type(2);
|
||||
cy.get("[data-test=result] input").last().should("have.value", 5);
|
||||
});
|
||||
it('shows result when kernel changes', () => {
|
||||
cy.get('[data-test=kernel] input').first().type(2);
|
||||
cy.get('[data-test=result] input').last().should('have.value', 5);
|
||||
});
|
||||
|
||||
it("can change matrix size", () => {
|
||||
cy.get("[data-test=matrix-size] input").first().type(2);
|
||||
cy.get("[data-test=matrix-size] input").last().type(2);
|
||||
cy.get("[data-test=matrix] input").should("have.length", 4);
|
||||
});
|
||||
it('can change matrix size', () => {
|
||||
cy.get('[data-test=matrix-size] input').first().type(2);
|
||||
cy.get('[data-test=matrix-size] input').last().type(2);
|
||||
cy.get('[data-test=matrix] input').should('have.length', 4);
|
||||
});
|
||||
|
||||
it("can change kernel size", () => {
|
||||
cy.get("[data-test=kernel-size] input").first().type(2);
|
||||
cy.get("[data-test=kernel-size] input").last().type(2);
|
||||
cy.get("[data-test=kernel] input").should("have.length", 4);
|
||||
});
|
||||
it('can change kernel size', () => {
|
||||
cy.get('[data-test=kernel-size] input').first().type(2);
|
||||
cy.get('[data-test=kernel-size] input').last().type(2);
|
||||
cy.get('[data-test=kernel] input').should('have.length', 4);
|
||||
});
|
||||
|
||||
it("can toggle padding", () => {
|
||||
cy.get("[data-test=padding]").click();
|
||||
cy.get("[data-test=result] input").should("have.length", 4);
|
||||
});
|
||||
it('can toggle padding', () => {
|
||||
cy.get('[data-test=padding]').click();
|
||||
cy.get('[data-test=result] input').should('have.length', 4);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
const visit = (darkAppearance) =>
|
||||
cy.visit("/", {
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, "matchMedia")
|
||||
.withArgs("(prefers-color-scheme: dark)")
|
||||
.returns({
|
||||
matches: darkAppearance,
|
||||
addEventListener: () => {},
|
||||
removeEventListener: () => {},
|
||||
});
|
||||
},
|
||||
});
|
||||
cy.visit('/', {
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, 'matchMedia')
|
||||
.withArgs('(prefers-color-scheme: dark)')
|
||||
.returns({
|
||||
matches: darkAppearance,
|
||||
addEventListener: () => {},
|
||||
removeEventListener: () => {}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const isDarkMode = () => {
|
||||
cy.get("html").should("have.attr", "theme", "dark");
|
||||
cy.get("html").should("have.css", "background-color", "rgb(51, 51, 51)");
|
||||
cy.get("html").should("have.css", "color", "rgb(238, 238, 238)");
|
||||
cy.get('html').should('have.attr', 'theme', 'dark');
|
||||
cy.get('html').should('have.css', 'background-color', 'rgb(34, 34, 34)');
|
||||
cy.get('html').should('have.css', 'color', 'rgb(238, 238, 238)');
|
||||
};
|
||||
|
||||
const isLightMode = () => {
|
||||
cy.get("html").should("have.attr", "theme", "light");
|
||||
cy.get("html").should("have.css", "background-color", "rgb(255, 255, 255)");
|
||||
cy.get("html").should("have.css", "color", "rgb(51, 51, 51)");
|
||||
cy.get('html').should('have.attr', 'theme', 'light');
|
||||
cy.get('html').should('have.css', 'background-color', 'rgb(255, 255, 255)');
|
||||
cy.get('html').should('have.css', 'color', 'rgb(34, 34, 34)');
|
||||
};
|
||||
|
||||
describe("Theme", () => {
|
||||
it("is light by default", () => {
|
||||
cy.visit("/");
|
||||
isLightMode();
|
||||
});
|
||||
describe('Theme', () => {
|
||||
it('is light if preferred', () => {
|
||||
visit(false);
|
||||
isLightMode();
|
||||
});
|
||||
|
||||
it("is dark if user has set it in the browser", () => {
|
||||
visit(true);
|
||||
isDarkMode();
|
||||
});
|
||||
it('is dark if preferred', () => {
|
||||
visit(true);
|
||||
isDarkMode();
|
||||
});
|
||||
|
||||
it("can toggle", () => {
|
||||
cy.visit("/");
|
||||
isLightMode();
|
||||
cy.get("[data-test=toggle-theme]").click();
|
||||
isDarkMode();
|
||||
cy.get("[data-test=toggle-theme]").click();
|
||||
isLightMode();
|
||||
});
|
||||
it('can toggle', () => {
|
||||
visit(false);
|
||||
isLightMode();
|
||||
cy.get('[data-test=toggle-theme]').click();
|
||||
isDarkMode();
|
||||
cy.get('[data-test=toggle-theme]').click();
|
||||
isLightMode();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
||||
|
||||
@@ -22,4 +22,4 @@
|
||||
//
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
import './commands';
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
// require('./commands')
|
||||
|
||||
Reference in New Issue
Block a user