Skip to content

Commit

Permalink
explorer: update AnchorButton test
Browse files Browse the repository at this point in the history
  • Loading branch information
deuch13 committed May 24, 2024
1 parent 4809d19 commit 468fce9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-nocheck

import { afterEach, describe, expect, it } from "vitest";
import { cleanup, render } from "@testing-library/svelte";
import { mdiFolderOutline } from "@mdi/js";
Expand All @@ -15,6 +13,7 @@ describe("AnchorButton", () => {
props: baseProps,
target: document.body,
};
const iconPositions = /** @type {const} */ (["after", "before", undefined]);

afterEach(cleanup);

Expand Down Expand Up @@ -56,7 +55,7 @@ describe("AnchorButton", () => {
});

it("should be able to render a AnchorButton with an icon and text", () => {
["after", "before"].forEach((position) => {
iconPositions.forEach((position) => {
const props = {
...baseProps,
icon: {
Expand All @@ -71,7 +70,7 @@ describe("AnchorButton", () => {
});

it("should be able to render a AnchorButton with an icon only", () => {
["after", "before"].forEach((position) => {
iconPositions.forEach((position) => {
const props = {
...baseProps,
icon: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,33 @@ exports[`AnchorButton > should be able to render a AnchorButton with an icon and
</a>
`;

exports[`AnchorButton > should be able to render a AnchorButton with an icon and text 3`] = `
<a
aria-disabled="false"
class="dusk-anchor dusk-anchor-button dusk-anchor-button--variant--primary dusk-anchor-button--size--normal dusk-icon-button--labeled"
href="/some-url"
>
<span
class="dusk-anchor-button__text"
>
some text
</span>
<svg
class="dusk-icon dusk-icon--size--normal dusk-anchor-button__icon"
role="graphics-symbol"
viewBox="0 0 24 24"
>
<path
d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z"
/>
</svg>
<!--&lt;Icon&gt;-->
</a>
`;

exports[`AnchorButton > should be able to render a AnchorButton with an icon only 1`] = `
<a
aria-disabled="false"
Expand Down Expand Up @@ -114,6 +141,28 @@ exports[`AnchorButton > should be able to render a AnchorButton with an icon onl
</a>
`;

exports[`AnchorButton > should be able to render a AnchorButton with an icon only 3`] = `
<a
aria-disabled="false"
class="dusk-anchor dusk-anchor-button dusk-anchor-button--variant--primary dusk-anchor-button--size--normal dusk-icon-button"
href="/some-url"
>
<svg
class="dusk-icon dusk-icon--size--normal dusk-anchor-button__icon"
role="graphics-symbol"
viewBox="0 0 24 24"
>
<path
d="M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z"
/>
</svg>
<!--&lt;Icon&gt;-->
</a>
`;

exports[`AnchorButton > should pass additional class names and attributes to the rendered element 1`] = `
<a
aria-disabled="false"
Expand Down

0 comments on commit 468fce9

Please sign in to comment.