-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1228 from rainlanguage/ser/deser-with-new-state-m…
…anagement Review choices and sharing links for deployments
- Loading branch information
Showing
21 changed files
with
489 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/ui-components/src/__tests__/DeploymentSectionHeader.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { render, screen } from '@testing-library/svelte'; | ||
import { describe, it, expect } from 'vitest'; | ||
import DeploymentSectionHeader from '../lib/components/deployment/DeploymentSectionHeader.svelte'; | ||
|
||
describe('DeploymentSectionHeader', () => { | ||
const defaultProps = { | ||
title: 'Test Title', | ||
description: 'Test Description', | ||
open: false, | ||
value: 'Test Value' | ||
}; | ||
|
||
it('renders title and description', () => { | ||
render(DeploymentSectionHeader, defaultProps); | ||
|
||
expect(screen.getByText('Test Title')).toBeInTheDocument(); | ||
expect(screen.getByText('Test Description')).toBeInTheDocument(); | ||
}); | ||
|
||
it('shows value when not open', () => { | ||
render(DeploymentSectionHeader, defaultProps); | ||
|
||
expect(screen.getByTestId('header-value')).toBeInTheDocument(); | ||
expect(screen.getByText('Test Value')).toBeInTheDocument(); | ||
}); | ||
|
||
it('hides value when open', () => { | ||
render(DeploymentSectionHeader, { | ||
...defaultProps, | ||
open: true | ||
}); | ||
|
||
expect(screen.queryByTestId('header-value')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('hides value when value is undefined', () => { | ||
render(DeploymentSectionHeader, { | ||
...defaultProps, | ||
value: undefined | ||
}); | ||
|
||
expect(screen.queryByTestId('header-value')).not.toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 19 additions & 5 deletions
24
packages/ui-components/src/lib/components/deployment/DeploymentSectionHeader.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
<script lang="ts"> | ||
import { fade } from 'svelte/transition'; | ||
export let title: string; | ||
export let description: string = ''; | ||
export let open: boolean; | ||
export let value: string | undefined; | ||
</script> | ||
|
||
<div class="max-w-2xl text-left"> | ||
<h1 class="break-words text-2xl font-bold text-gray-900 lg:text-3xl dark:text-white">{title}</h1> | ||
<p class="lg:text-2xltext-gray-600 break-words text-xl dark:text-gray-400"> | ||
{description} | ||
</p> | ||
<div class="flex w-full items-center justify-between gap-12 pr-6"> | ||
<div class="max-w-xl flex-grow text-left"> | ||
<h1 class="break-words text-xl font-semibold text-gray-900 lg:text-2xl dark:text-white"> | ||
{title} | ||
</h1> | ||
<p class="break-words text-sm font-light text-gray-600 lg:text-base dark:text-gray-400"> | ||
{description} | ||
</p> | ||
</div> | ||
|
||
{#if !open && value} | ||
<span data-testid="header-value" in:fade class="text-right text-base font-semibold lg:text-lg"> | ||
{value} | ||
</span> | ||
{/if} | ||
</div> |
Oops, something went wrong.