Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently there is no indication in the status icon when something is being deleted. We're adding text to the age column (#4056), but the design preference is that this is re-enforced by the status icon changing into a spinner. This adds the DELETING status, using a correctly sized Spinner component with no border. Added a test, and some missing tests for other states. Signed-off-by: Tim deBoer <git@tdeboer.ca>
- Loading branch information
1 parent
c400d70
commit 02861e9
Showing
3 changed files
with
72 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/********************************************************************** | ||
* 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/vitest'; | ||
import { test, expect } from 'vitest'; | ||
import { render, screen } from '@testing-library/svelte'; | ||
import StatusIcon from './StatusIcon.svelte'; | ||
|
||
test('Expect starting styling', async () => { | ||
const status = 'STARTING'; | ||
render(StatusIcon, { status }); | ||
const icon = screen.getByRole('status'); | ||
expect(icon).toBeInTheDocument(); | ||
expect(icon).toHaveAttribute('title', status); | ||
|
||
expect(icon).toHaveClass('bg-green-600'); | ||
}); | ||
|
||
test('Expect running styling', async () => { | ||
const status = 'RUNNING'; | ||
render(StatusIcon, { status }); | ||
const icon = screen.getByRole('status'); | ||
expect(icon).toBeInTheDocument(); | ||
expect(icon).toHaveAttribute('title', status); | ||
|
||
expect(icon).toHaveClass('bg-green-400'); | ||
}); | ||
|
||
test('Expect degraded styling', async () => { | ||
const status = 'DEGRADED'; | ||
render(StatusIcon, { status }); | ||
const icon = screen.getByRole('status'); | ||
expect(icon).toBeInTheDocument(); | ||
expect(icon).toHaveAttribute('title', status); | ||
|
||
expect(icon).toHaveClass('bg-amber-600'); | ||
}); | ||
|
||
test('Expect deleting styling', async () => { | ||
const status = 'DELETING'; | ||
render(StatusIcon, { status }); | ||
const icon = screen.getByRole('status'); | ||
expect(icon).toBeInTheDocument(); | ||
expect(icon).toHaveAttribute('title', status); | ||
expect(icon).not.toHaveAttribute('border'); | ||
|
||
const spinner = screen.getByRole('img'); | ||
expect(spinner).toBeInTheDocument(); | ||
expect(spinner).toHaveAttribute('width', '1.4em'); | ||
}); |
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