forked from podman-desktop/podman-desktop
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes almost all of the remaining pages to FormPages, using the existing icons that are used in the actions to open the form and the form button: - Build image - Pull image - Play Kube YAML - Create Pod from containers Adds a new 'actions' slot for the PullImage page's Manage registries button. Adds 'missing' pull image action to the button to match other pages. Makes Kube play icon resizable so that a larger form can be used in the header. Svelte has no API to test slots directly (see below), so a FormPageSpec component is added solely to be able to test that the icon/actions/content slots work correctly. The actions section is also tested by confirming the pull image registry button. testing-library/svelte-testing-library#48 https://stackoverflow.com/questions/60771586/testing-svelte-components-that-use-slots Signed-off-by: Tim deBoer <[email protected]>
- Loading branch information
1 parent
893b6ab
commit 5886c01
Showing
9 changed files
with
117 additions
and
15 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/********************************************************************** | ||
* Copyright (C) 2023 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
***********************************************************************/ | ||
|
||
import '@testing-library/jest-dom'; | ||
import { test, expect } from 'vitest'; | ||
import { render, screen } from '@testing-library/svelte'; | ||
import FormPageTest from './FormPageSpec.svelte'; | ||
|
||
test('Expect icon slot is defined', async () => { | ||
render(FormPageTest); | ||
|
||
const element = screen.getByLabelText('icon'); | ||
expect(element).toBeInTheDocument(); | ||
}); | ||
|
||
test('Expect actions slot is defined', async () => { | ||
render(FormPageTest); | ||
|
||
const element = screen.getByLabelText('actions'); | ||
expect(element).toBeInTheDocument(); | ||
}); | ||
|
||
test('Expect content slot is defined', async () => { | ||
render(FormPageTest); | ||
|
||
const element = screen.getByLabelText('content'); | ||
expect(element).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script lang="ts"> | ||
import FormPage from './FormPage.svelte'; | ||
</script> | ||
|
||
<FormPage title="Test component" showBreadcrumb="{false}"> | ||
<span slot="icon"> | ||
<i class="fas fa-lightbulb fa-2x" aria-label="icon"></i> | ||
</span> | ||
|
||
<span slot="actions"> | ||
<i class="fas fa-lightbulb fa-2x" aria-label="actions"></i> | ||
</span> | ||
|
||
<div slot="content" class="flex flex-col"> | ||
<i class="fas fa-lightbulb fa-2x" aria-label="content"></i> | ||
</div> | ||
</FormPage> |