Skip to content

feat: try revert "safe test" transitions directives #6404

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

Closed
Closed
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
Binary file modified frontend/dfinity-gix-components-5.0.0.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions frontend/src/lib/components/accounts/TransactionCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
TransactionIconType,
UiTransaction,
} from "$lib/types/transaction";
import { KeyValuePair, testSafeFade } from "@dfinity/gix-components";
import { KeyValuePair } from "@dfinity/gix-components";
import {
nonNullish,
type TokenAmount,
type TokenAmountV2,
} from "@dfinity/utils";
import { fade } from "svelte/transition";

export let transaction: UiTransaction;

Expand Down Expand Up @@ -55,7 +56,7 @@
$: seconds = timestamp && timestamp.getTime() / 1000;
</script>

<article data-tid="transaction-card" transition:testSafeFade>
<article data-tid="transaction-card" transition:fade|global>
<div class="icon">
<TransactionIcon type={iconType} {isPending} />
</div>
Expand Down
15 changes: 6 additions & 9 deletions frontend/src/lib/components/common/JsonPreview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
import { jsonRepresentationModeStore } from "$lib/derived/json-representation.derived";
import { i18n } from "$lib/stores/i18n";
import { expandObject, getObjMaxDepth } from "$lib/utils/utils";
import {
IconCollapseAll,
IconExpandAll,
testSafeFade,
} from "@dfinity/gix-components";
import { IconCollapseAll, IconExpandAll } from "@dfinity/gix-components";
import { isNullish } from "@dfinity/utils";
import { fade } from "svelte/transition";

const DEFAULT_EXPANDED_LEVEL = 1;

Expand Down Expand Up @@ -41,12 +38,12 @@
on:click={toggleExpanded}
>
{#if isAllExpanded}
<div in:testSafeFade>
<div in:fade>
<IconCollapseAll />
<span class="expand-all-label">{$i18n.core.collapse_all}</span>
</div>
{:else}
<div in:testSafeFade>
<div in:fade>
<IconExpandAll />
<span class="expand-all-label">{$i18n.core.expand_all}</span>
</div>
Expand All @@ -55,15 +52,15 @@
{/if}
<div data-tid="json-wrapper" class="json-wrapper">
{#if $jsonRepresentationModeStore === "tree"}
<div in:testSafeFade>
<div in:fade>
<TreeJson
testId="tree-json"
json={expandedData}
defaultExpandedLevel={isAllExpanded ? Number.MAX_SAFE_INTEGER : 1}
/>
</div>
{:else}
<div in:testSafeFade>
<div in:fade>
<RawJson testId="raw-json" {json} />
</div>
{/if}
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/lib/components/common/MenuItems.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
ThemeToggleButton,
layoutMenuOpen,
menuCollapsed,
testSafeScale,
} from "@dfinity/gix-components";
import type { Component } from "svelte";
import { cubicIn, cubicOut } from "svelte/easing";
import { scale } from "svelte/transition";

let routes: {
context: string;
Expand Down Expand Up @@ -127,8 +127,8 @@
<div
data-tid="menu-footer"
class="menu-footer"
out:testSafeScale={{ duration: 200, easing: cubicOut }}
in:testSafeScale={{ duration: 200, easing: cubicIn }}
out:scale={{ duration: 200, easing: cubicOut }}
in:scale={{ duration: 200, easing: cubicIn }}
>
<TotalValueLocked layout="stacked" />
<div class="menu-footer-buttons">
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/lib/components/common/TreeJson.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
type TreeJsonValueType,
} from "$lib/utils/json.utils";
import { typeOfLikeANumber } from "$lib/utils/utils";
import { IconExpandMore, testSafeFade } from "@dfinity/gix-components";
import { IconExpandMore } from "@dfinity/gix-components";
import { fade } from "svelte/transition";

export let json: unknown | undefined = undefined;
export let defaultExpandedLevel = Infinity;
Expand Down Expand Up @@ -71,7 +72,7 @@
{/if}
{#if !collapsed}
<!-- children of expandable-key -->
<ul class:root class:is-array={isArray} in:testSafeFade data-tid={testId}>
<ul class:root class:is-array={isArray} in:fade data-tid={testId}>
{#each children as [key, value]}
<li class:root class:key-is-index={keyIsIndex}>
<svelte:self
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
<script lang="ts">
import {
Collapsible,
IconExpandCircleDown,
testSafeFade,
} from "@dfinity/gix-components";
import { Collapsible, IconExpandCircleDown } from "@dfinity/gix-components";
import { fade } from "svelte/transition";

export let testId: string;

let toggleContent: () => void;
let expanded: boolean;
</script>

<div class="container" in:testSafeFade>
<div class="container" in:fade>
<Collapsible
{testId}
expandButton={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import type { Universe } from "$lib/types/universe";
import { replacePlaceholders } from "$lib/utils/i18n.utils";
import { isUniverseNns } from "$lib/utils/universe.utils";
import { Tooltip, testSafeScale } from "@dfinity/gix-components";
import { Tooltip } from "@dfinity/gix-components";
import { Principal } from "@dfinity/principal";
import { cubicOut } from "svelte/easing";
import { scale } from "svelte/transition";

export let count: number;
export let universe: Universe | "all";
Expand All @@ -33,7 +34,7 @@
<TestIdWrapper testId="actionable-proposal-count-badge-component">
<Tooltip idPrefix="actionable-count-tooltip" text={tooltipText} top={true}
><span
transition:testSafeScale={{
transition:scale={{
duration: 250,
easing: cubicOut,
}}
Expand Down
8 changes: 2 additions & 6 deletions frontend/src/lib/components/proposals/FiltersWrapper.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
<script lang="ts">
import { testSafeFade } from "@dfinity/gix-components";
import { fade } from "svelte/transition";
</script>

<div
class="filters"
data-tid="proposals-filters"
in:testSafeFade={{ duration: 150 }}
>
<div class="filters" data-tid="proposals-filters" in:fade={{ duration: 150 }}>
<slot />
</div>

Expand Down
8 changes: 4 additions & 4 deletions frontend/src/lib/components/proposals/NnsProposalsList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import { authSignedInStore } from "$lib/derived/auth.derived";
import { filteredActionableProposals } from "$lib/derived/proposals.derived";
import { actionableNnsProposalsStore } from "$lib/stores/actionable-nns-proposals.store";
import { InfiniteScroll, testSafeFade } from "@dfinity/gix-components";
import { InfiniteScroll } from "@dfinity/gix-components";
import type { ProposalInfo } from "@dfinity/nns";
import { isNullish } from "@dfinity/utils";

import { fade } from "svelte/transition";
export let hidden: boolean;
export let disableInfiniteScroll: boolean;
export let loading: boolean;
Expand All @@ -35,7 +35,7 @@

{#if display}
{#if !$actionableProposalsActiveStore}
<div in:testSafeFade data-tid="all-proposal-list">
<div in:fade data-tid="all-proposal-list">
{#if loadingAnimation === "skeleton"}
<LoadingProposals />
{:else if $filteredActionableProposals.proposals.length === 0}
Expand All @@ -59,7 +59,7 @@
{/if}
</div>
{:else}
<div in:testSafeFade data-tid="actionable-proposal-list">
<div in:fade data-tid="actionable-proposal-list">
{#if !$authSignedInStore}
<ActionableProposalsSignIn />
{:else if isNullish(actionableProposals)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
import { authSignedInStore } from "$lib/derived/auth.derived";
import { pageStore } from "$lib/derived/page.derived";
import type { SnsProposalActionableData } from "$lib/derived/sns/sns-filtered-actionable-proposals.derived";
import { InfiniteScroll, testSafeFade } from "@dfinity/gix-components";
import { InfiniteScroll } from "@dfinity/gix-components";
import type { SnsNervousSystemFunction } from "@dfinity/sns";
import { fromNullable, isNullish } from "@dfinity/utils";
import { fade } from "svelte/transition";

export let proposals: SnsProposalActionableData[] | undefined;
export let actionableSelected: boolean;
Expand All @@ -25,7 +26,7 @@
<SnsProposalsFilters />

{#if !actionableSelected}
<div in:testSafeFade data-tid="all-proposal-list">
<div in:fade data-tid="all-proposal-list">
{#if proposals === undefined}
<LoadingProposals />
{:else if proposals.length === 0}
Expand All @@ -50,7 +51,7 @@
{/if}
</div>
{:else}
<div in:testSafeFade data-tid="actionable-proposal-list">
<div in:fade data-tid="actionable-proposal-list">
{#if !$authSignedInStore}
<ActionableProposalsSignIn />
{:else if isNullish(proposals)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
import { i18n } from "$lib/stores/i18n";
import type { Universe } from "$lib/types/universe";
import { isSelectedPath } from "$lib/utils/navigation.utils";
import { Card, testSafeScale } from "@dfinity/gix-components";
import { Card } from "@dfinity/gix-components";
import { nonNullish } from "@dfinity/utils";
import { onMount } from "svelte";
import { cubicOut } from "svelte/easing";
import { scale } from "svelte/transition";

export let selected: boolean;
// "link" for desktop, "button" for mobile, "dropdown" to open the modal
Expand Down Expand Up @@ -73,7 +74,7 @@
{#if $actionableProposalIndicationVisibleStore}
{#if $actionableProposalTotalCountStore > 0 && mounted}
<div
in:testSafeScale={{
in:scale={{
duration: 250,
easing: cubicOut,
}}
Expand Down
9 changes: 6 additions & 3 deletions frontend/vitest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ global.ResizeObserver = class ResizeObserver {
}
};

Element.prototype.animate = vi
.fn()
.mockImplementation(() => ({ cancel: vi.fn(), finished: Promise.resolve() }));
Element.prototype.animate = () => ({
cancel: vi.fn(),
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore finished expect a Promise that resolves an Animation. For simplicity reason we mock it as undefined.
finished: Promise.resolve(),
});

// Environment Variables Setup
vi.mock("./src/lib/utils/env-vars.utils.ts", () => ({
Expand Down
Loading