generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#79 signal line thickness
- Loading branch information
Showing
8 changed files
with
452 additions
and
329 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
Apps/frontend/cypress/e2e/2-control-panel/thickness-switch.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe("thicknessSwitch", () => { | ||
beforeEach(() => { | ||
cy.visit("http://localhost:5173/"); | ||
}); | ||
|
||
it("is visible", () => { | ||
Cypress._.times(10, (i) => { | ||
cy.get(`[data-cy="thicknessSwitch-${i}"]`).should("be.visible"); | ||
}); | ||
}); | ||
|
||
it("toggle switch", () => { | ||
cy.get(`[data-cy="thicknessSwitch-0"]`).within(() => { | ||
cy.get('[role="switch"]').should("have.attr", "aria-checked", "false"); | ||
cy.get('[role="switch"]') | ||
.click() | ||
.should("have.attr", "aria-checked", "true"); | ||
}); | ||
}); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script> | ||
import Switch from "svelte-toggle"; | ||
import { LINE_COLORS_RGBA } from "../const.js"; | ||
import { thicknessAdjustment } from "../stores.js"; | ||
export let onClick = (isThick) => { | ||
console.error( | ||
`Missing implementation of ThicknessSwitch.onClick(${isThick})!` | ||
); | ||
return; | ||
}; | ||
export let channel; | ||
let isThick = false; | ||
</script> | ||
|
||
<div class="switch-wrapper" data-cy="thicknessSwitch-{channel}"> | ||
<Switch | ||
hideLabel | ||
bind:toggled={isThick} | ||
on:click={() => { | ||
$thicknessAdjustment[channel] = isThick; | ||
onClick(isThick); | ||
}} | ||
toggledColor={LINE_COLORS_RGBA[channel]} | ||
/> | ||
</div> | ||
|
||
<style> | ||
.switch-wrapper { | ||
display: flex; | ||
justify-content: center; | ||
margin: 0.25rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters