Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪟 🐛 Handle className removal on SVG #17935

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions airbyte-webapp/scripts/classname-serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ import { prettyDOM } from "@testing-library/react";
* the count of classnames instead, e.g. "<3 classnames>"
*/
const traverseAndRedactClasses = (node) => {
if (node.className && typeof node.className === "string") {
node.className = `<removed-for-snapshot-test>`;
if (
node.className &&
(typeof node.className === "string" || (node.className instanceof SVGAnimatedString && node.className.baseVal))
) {
// We need to use setAttribute here, since on SVGElement we can't
// set `className` to a string for the `SVGAnimatedString` case.
node.setAttribute("class", `<removed-for-snapshot-test>`);
}
node.childNodes.forEach(traverseAndRedactClasses);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ exports[`CreateConnectionForm should render 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-sort-down sc-dPyBCJ eGVczJ"
class="<removed-for-snapshot-test>"
data-icon="sort-down"
data-prefix="fas"
focusable="false"
Expand Down Expand Up @@ -283,7 +283,7 @@ exports[`CreateConnectionForm should render 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-sort-down sc-dPyBCJ eGVczJ"
class="<removed-for-snapshot-test>"
data-icon="sort-down"
data-prefix="fas"
focusable="false"
Expand Down Expand Up @@ -379,7 +379,7 @@ exports[`CreateConnectionForm should render 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-rotate tryArrow"
class="<removed-for-snapshot-test>"
data-icon="rotate"
data-prefix="fas"
focusable="false"
Expand Down Expand Up @@ -644,7 +644,7 @@ exports[`CreateConnectionForm should render 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-chevron-right sc-ehmTmK eOIlNv"
class="<removed-for-snapshot-test>"
data-icon="chevron-right"
data-prefix="fas"
focusable="false"
Expand Down Expand Up @@ -760,7 +760,7 @@ exports[`CreateConnectionForm should render 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-sort-down sc-dPyBCJ eGVczJ"
class="<removed-for-snapshot-test>"
data-icon="sort-down"
data-prefix="fas"
focusable="false"
Expand Down Expand Up @@ -977,7 +977,7 @@ exports[`CreateConnectionForm should render with an error 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-xmark "
class="<removed-for-snapshot-test>"
data-icon="xmark"
data-prefix="fas"
focusable="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`<GitBlock /> should render with default props 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-github icon"
class="<removed-for-snapshot-test>"
data-icon="github"
data-prefix="fab"
focusable="false"
Expand Down Expand Up @@ -66,7 +66,7 @@ exports[`<GitBlock /> should render with overwritten props 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-github icon"
class="<removed-for-snapshot-test>"
data-icon="github"
data-prefix="fab"
focusable="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ exports[`ConnectionReplicationTab should render 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-sort-down sc-BeQoi gptVmb"
class="<removed-for-snapshot-test>"
data-icon="sort-down"
data-prefix="fas"
focusable="false"
Expand Down Expand Up @@ -230,7 +230,7 @@ exports[`ConnectionReplicationTab should render 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-sort-down sc-BeQoi gptVmb"
class="<removed-for-snapshot-test>"
data-icon="sort-down"
data-prefix="fas"
focusable="false"
Expand Down Expand Up @@ -326,7 +326,7 @@ exports[`ConnectionReplicationTab should render 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-rotate tryArrow"
class="<removed-for-snapshot-test>"
data-icon="rotate"
data-prefix="fas"
focusable="false"
Expand Down Expand Up @@ -591,7 +591,7 @@ exports[`ConnectionReplicationTab should render 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-chevron-right sc-ckMVTt eVXgVK"
class="<removed-for-snapshot-test>"
data-icon="chevron-right"
data-prefix="fas"
focusable="false"
Expand Down Expand Up @@ -707,7 +707,7 @@ exports[`ConnectionReplicationTab should render 1`] = `
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-sort-down sc-BeQoi gptVmb"
class="<removed-for-snapshot-test>"
data-icon="sort-down"
data-prefix="fas"
focusable="false"
Expand Down Expand Up @@ -804,7 +804,7 @@ exports[`ConnectionReplicationTab should show an error if there is a schemaError
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-xmark "
class="<removed-for-snapshot-test>"
data-icon="xmark"
data-prefix="fas"
focusable="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports[`<FrequentlyUsedDestinations /> should renders with mock data without cr
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-chevron-left slick-arrow slick-prev slick-disabled"
class="<removed-for-snapshot-test>"
data-icon="chevron-left"
data-prefix="fas"
data-role="none"
Expand Down Expand Up @@ -314,7 +314,7 @@ exports[`<FrequentlyUsedDestinations /> should renders with mock data without cr
>
<svg
aria-hidden="true"
class="svg-inline--fa fa-chevron-right slick-arrow slick-next"
class="<removed-for-snapshot-test>"
data-icon="chevron-right"
data-prefix="fas"
data-role="none"
Expand Down