Skip to content

Commit

Permalink
SWED-2275 fix cards tests
Browse files Browse the repository at this point in the history
  • Loading branch information
goldenraphti committed Mar 18, 2024
1 parent 51821c6 commit f2701a2
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 42 deletions.
52 changes: 26 additions & 26 deletions src/App/Patterns/content/Patterns/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -75,48 +75,48 @@ exports[`Patterns renders 1`] = `
className="component-overview hide-arrow-icon"
>
<a
className="cards cards-primary cards-wide"
className="cards cards-wide min-w-initial"
href="/forms"
onClick={[Function]}
>
<i
aria-hidden="true"
className="at-newspaper-newsletter cards-icon"
/>
<span
className="h4"
>
Forms
</span>
<div
className="cards-content flex-row align-items-center m-0 "
className="cards-cta"
>
<i
className="at-newspaper-newsletter small mr-3"
/>
<span
className="h3 m-0"
>
Forms
</span>
className="arrow"
/>
</div>
<i
aria-hidden="true"
className="at-arrow-right small"
/>
</a>
<a
className="cards cards-primary cards-wide"
className="cards cards-wide min-w-initial"
href="/login"
onClick={[Function]}
>
<i
aria-hidden="true"
className="at-user-key cards-icon"
/>
<span
className="h4"
>
Login
</span>
<div
className="cards-content flex-row align-items-center m-0 "
className="cards-cta"
>
<i
className="at-user-key small mr-3"
/>
<span
className="h3 m-0"
>
Login
</span>
className="arrow"
/>
</div>
<i
aria-hidden="true"
className="at-arrow-right small"
/>
</a>
</section>
</div>
Expand Down
18 changes: 9 additions & 9 deletions src/App/components/Cards/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ exports[`Component: Cards - renders a child object 1`] = `
<div
className="card-content"
className="cards-content"
>
This is child text
</div>
<div
className="card-cta"
className="cards-cta"
>
Expand All @@ -34,14 +34,14 @@ exports[`Component: Cards - renders a text in card-body 1`] = `
<div
className="card-content"
className="cards-content"
>
Text that goes in card body
</div>
<div
className="card-cta"
className="cards-cta"
>
Expand All @@ -67,7 +67,7 @@ exports[`Component: Cards - renders a title 1`] = `
<div
className="card-cta"
className="cards-cta"
>
Expand All @@ -86,7 +86,7 @@ exports[`Component: Cards - renders a wide card when wide is true 1`] = `
<div
className="card-cta"
className="cards-cta"
>
Expand All @@ -106,12 +106,12 @@ exports[`Component: Cards - renders an icon when icon is provided 1`] = `
<i
aria-hidden="true"
className="title-icon at-home"
className="cards-icon at-home"
/>
<div
className="card-cta"
className="cards-cta"
>
Expand All @@ -137,7 +137,7 @@ exports[`Component: Cards - renders an image 1`] = `
<div
className="card-cta"
className="cards-cta"
>
Expand Down
4 changes: 2 additions & 2 deletions src/App/components/Cards/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("Component: Cards -", () => {
render(<Cards iconClasses="at-home" />);

expect(
screen.getByRole("link").querySelectorAll("i.title-icon").length,
screen.getByRole("link").querySelectorAll("i.cards-icon").length,
).toBe(1);

const componentForSnap = renderer.create(<Cards iconClasses="at-home" />);
Expand All @@ -56,7 +56,7 @@ describe("Component: Cards -", () => {
<Cards hasTextContent={true} textContent="Text that goes in card body" />,
);

expect(container.querySelector(".card-content")).toHaveTextContent(
expect(container.querySelector(".cards-content")).toHaveTextContent(
"Text that goes in card body",
);

Expand Down
12 changes: 7 additions & 5 deletions src/less/components/card.less
Original file line number Diff line number Diff line change
Expand Up @@ -347,20 +347,20 @@
opacity: 1;
}

49.9% {
29.9% {
transform: translateX(150%);
opacity: 1;
}

49.91% {
29.91% {
opacity: 0;
}

50.09% {
30.09% {
opacity: 1;
}

50.1% {
30.1% {
transform: translateX(-150%);
}

Expand All @@ -372,7 +372,9 @@
}

// TODO: silent support for non-migrated cards. Remove during next major release
.cards:not(:has(.cards-cta)) {
// cards.legacy: option for projects who need to support browsers with no implementation of the `has()` selector yet (to be removed during next major version release as well of course)
.cards:not(:has(.cards-cta)),
.cards.legacy {
display: flex;
flex-grow: 1;
flex-direction: column;
Expand Down

0 comments on commit f2701a2

Please sign in to comment.