diff --git a/.changeset/witty-hats-drop.md b/.changeset/witty-hats-drop.md new file mode 100644 index 0000000000..b9bfe13a06 --- /dev/null +++ b/.changeset/witty-hats-drop.md @@ -0,0 +1,5 @@ +--- +"@stackoverflow/stacks-svelte": patch +--- + +vote component: allow downvoting for horizontal layout diff --git a/packages/stacks-classic/lib/components/vote/vote.a11y.test.ts b/packages/stacks-classic/lib/components/vote/vote.a11y.test.ts index c107011c2d..a229aa6207 100644 --- a/packages/stacks-classic/lib/components/vote/vote.a11y.test.ts +++ b/packages/stacks-classic/lib/components/vote/vote.a11y.test.ts @@ -1,58 +1,12 @@ import { runA11yTests } from "../../test/a11y-test-utils"; -import { - IconVote16Up, - IconVote16Down, -} from "@stackoverflow/stacks-icons/icons"; +import { children } from "./vote.test.setup"; import "../../index"; -const children = { - default: ` - - - 12 - +20 - -8 - - - `, - upvoteOnly: ` - - - 12 - +20 - -8 - - `, -}; - describe("vote", () => { runA11yTests({ baseClass: "s-vote", modifiers: { - primary: ["expanded"], - }, - children: { - default: children.default, - }, - }); - - // Horizontal with and without downvote - runA11yTests({ - baseClass: "s-vote", - modifiers: { - primary: ["horizontal"], - }, - options: { - includeNullModifier: false, + primary: ["expanded", "horizontal"], }, children, }); diff --git a/packages/stacks-classic/lib/components/vote/vote.test.setup.ts b/packages/stacks-classic/lib/components/vote/vote.test.setup.ts new file mode 100644 index 0000000000..ab68e89e9e --- /dev/null +++ b/packages/stacks-classic/lib/components/vote/vote.test.setup.ts @@ -0,0 +1,35 @@ +import { + IconVote16Up, + IconVote16Down, +} from "@stackoverflow/stacks-icons/icons"; + +const children = { + default: ` + + + 12 + +20 + -8 + + + `, + upvoteOnly: ` + + `, +}; + +export { children }; diff --git a/packages/stacks-classic/lib/components/vote/vote.visual.test.ts b/packages/stacks-classic/lib/components/vote/vote.visual.test.ts index badf453347..f10dd78622 100644 --- a/packages/stacks-classic/lib/components/vote/vote.visual.test.ts +++ b/packages/stacks-classic/lib/components/vote/vote.visual.test.ts @@ -1,64 +1,15 @@ import { runVisualTests } from "../../test/visual-test-utils"; import { html } from "@open-wc/testing"; -import { - IconVote16Up, - IconVote16Down, -} from "@stackoverflow/stacks-icons/icons"; +import { children } from "./vote.test.setup"; import "../../index"; describe("vote", () => { runVisualTests({ baseClass: "s-vote", modifiers: { - primary: ["expanded"], - }, - children: { - default: ` - - - 12 - +20 - -8 - - - `, - }, - template: ({ component, testid }) => html` -