-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
401 additions
and
98 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
workspaces/global-floating-action-button/.changeset/thick-wolves-attack.md
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,5 @@ | ||
--- | ||
'@red-hat-developer-hub/backstage-plugin-global-floating-action-button': patch | ||
--- | ||
|
||
update fab content |
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
2 changes: 1 addition & 1 deletion
2
...tton/plugins/global-floating-action-button/dev/ExampleComponent/ExampleFetchComponent.tsx
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
2 changes: 1 addition & 1 deletion
2
workspaces/global-floating-action-button/plugins/global-floating-action-button/dev/index.tsx
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
80 changes: 80 additions & 0 deletions
80
...-floating-action-button/plugins/global-floating-action-button/src/components/FAB.test.tsx
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,80 @@ | ||
/* | ||
* Copyright 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. | ||
*/ | ||
import { render, screen } from '@testing-library/react'; | ||
import GitIcon from '@mui/icons-material/GitHub'; | ||
import * as React from 'react'; | ||
import { FAB } from './FAB'; | ||
|
||
jest.mock('react-router-dom', () => ({ | ||
useNavigate: jest.fn(), | ||
useLocation: jest.fn(() => ({ | ||
pathname: '/test-path', | ||
})), | ||
})); | ||
|
||
jest.mock('@backstage/core-plugin-api', () => ({ | ||
useApp: jest.fn(() => ({ | ||
getSystemIcon: jest.fn(), | ||
})), | ||
usetheme: jest.fn(() => ({ | ||
theme: { | ||
transitions: { | ||
easing: { | ||
easeOut: 'eo', | ||
sharp: 's', | ||
}, | ||
}, | ||
}, | ||
})), | ||
})); | ||
|
||
describe('Floating Action Button', () => { | ||
it('should render the floating action button with icon and label', () => { | ||
render( | ||
<FAB | ||
actionButton={{ | ||
color: 'success', | ||
icon: <GitIcon />, | ||
label: 'Git repo', | ||
showLabel: true, | ||
to: 'https://github.com/xyz', | ||
toolTip: 'Git', | ||
}} | ||
/>, | ||
); | ||
expect(screen.getByTestId('git-repo')).toBeInTheDocument(); | ||
expect(screen.getByTestId('GitHubIcon')).toBeInTheDocument(); | ||
expect(screen.getByText('Git repo')).toBeInTheDocument(); | ||
expect(screen.getByTestId('OpenInNewIcon')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render the floating action button with icon', () => { | ||
render( | ||
<FAB | ||
actionButton={{ | ||
color: 'success', | ||
icon: <GitIcon />, | ||
label: 'Git repo', | ||
to: 'https://github.com/xyz', | ||
toolTip: 'Git', | ||
}} | ||
/>, | ||
); | ||
expect(screen.getByTestId('git-repo')).toBeInTheDocument(); | ||
expect(screen.getByTestId('GitHubIcon')).toBeInTheDocument(); | ||
expect(screen.queryByText('Git repo')).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
Oops, something went wrong.