-
Notifications
You must be signed in to change notification settings - Fork 172
feat: New library sync icon [FC-0114] #2739
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
Merged
ChrisChV
merged 10 commits into
openedx:master
from
open-craft:chris/FAL-4300-updates-in-library-sync-icon
Dec 16, 2025
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ddc7a4c
feat: Update Upstream Icon Info
ChrisChV 132e440
feat: Update Upstream info Icon in break state
ChrisChV d628cd9
feat: Adds sync state to upstream link icon
ChrisChV 0969264
feat: Library sync icon with course overrides state
ChrisChV eb4fa67
feat: Add tooltips to library sync icon
ChrisChV 153b5bd
style: Update message
ChrisChV 5ac12b3
feat: Update styles
ChrisChV aa7b32f
style: Fix nits on the code
ChrisChV ff7cb21
Merge branch 'master' into chris/FAL-4300-updates-in-library-sync-icon
ChrisChV 36975b1
refactor: Nits on the code
ChrisChV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,42 @@ | ||
| .upstream-info-icon { | ||
| border: 1px solid var(--pgn-color-light-800); | ||
| color: var(--pgn-color-primary-500); | ||
|
|
||
| &.sync-state { | ||
| &:hover { | ||
| border-color: var(--pgn-color-primary-500); | ||
| background-color: var(--pgn-color-primary-500); | ||
| color: white; | ||
| } | ||
| } | ||
|
|
||
| &.size-one-md { | ||
| width: 32px; | ||
| height: 26px; | ||
| } | ||
|
|
||
| &.size-one-sm { | ||
| width: 28px; | ||
| height: 22px; | ||
| } | ||
|
|
||
ChrisChV marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| &.size-one-xs { | ||
| width: 24px; | ||
| height: 18px; | ||
| } | ||
|
|
||
| &.size-two-md { | ||
| width: 60px; | ||
| height: 26px; | ||
| } | ||
|
|
||
| &.size-two-sm { | ||
| width: 46px; | ||
| height: 22px; | ||
| } | ||
|
|
||
| &.size-two-xs { | ||
| width: 36px; | ||
| height: 18px; | ||
| } | ||
| } | ||
This file contains hidden or 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,35 +1,105 @@ | ||
| import { IntlProvider } from '@edx/frontend-platform/i18n'; | ||
| import { render, screen } from '@testing-library/react'; | ||
| import { | ||
| render, screen, fireEvent, waitFor, initializeMocks, | ||
| } from '@src/testUtils'; | ||
| import { UpstreamInfoIcon, UpstreamInfoIconProps } from '.'; | ||
|
|
||
| type UpstreamInfo = UpstreamInfoIconProps['upstreamInfo']; | ||
| const mockOpenSyncModal = jest.fn(); | ||
|
|
||
| const renderComponent = (upstreamInfo?: UpstreamInfo) => ( | ||
| render( | ||
| <IntlProvider locale="en"> | ||
| <UpstreamInfoIcon upstreamInfo={upstreamInfo} /> | ||
| </IntlProvider>, | ||
| <UpstreamInfoIcon upstreamInfo={upstreamInfo} openSyncModal={mockOpenSyncModal} />, | ||
| ) | ||
| ); | ||
|
|
||
| describe('<UpstreamInfoIcon>', () => { | ||
| beforeEach(() => { | ||
| initializeMocks(); | ||
| }); | ||
|
|
||
| it('should render with link', () => { | ||
| renderComponent({ upstreamRef: 'some-ref', errorMessage: null }); | ||
| renderComponent({ | ||
| upstreamRef: 'some-ref', | ||
| errorMessage: null, | ||
| readyToSync: false, | ||
| downstreamCustomized: [], | ||
| upstreamName: 'Upstream', | ||
| }); | ||
| expect(screen.getByTitle('This item is linked to a library item.')).toBeInTheDocument(); | ||
| expect(screen.queryByTitle('The linked library object has updates available.')).not.toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('should render with broken link', () => { | ||
| renderComponent({ upstreamRef: 'some-ref', errorMessage: 'upstream error' }); | ||
| expect(screen.getByTitle('The link to the library item is broken.')).toBeInTheDocument(); | ||
| renderComponent({ | ||
| upstreamRef: 'some-ref', | ||
| errorMessage: 'upstream error', | ||
| readyToSync: false, | ||
| downstreamCustomized: [], | ||
| upstreamName: 'Upstream', | ||
| }); | ||
| expect(screen.getByTitle('This item is linked to a library item.')).toBeInTheDocument(); | ||
| expect(screen.getByTitle('The referenced library or library object is not available.')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('should render with ready to sync link and opens the sync modal', async () => { | ||
| renderComponent({ | ||
| upstreamRef: 'some-ref', | ||
| errorMessage: null, | ||
| readyToSync: true, | ||
| downstreamCustomized: [], | ||
| upstreamName: 'Upstream', | ||
| }); | ||
|
|
||
| const icon = screen.getByTitle('This item is linked to a library item.'); | ||
| expect(icon).toBeInTheDocument(); | ||
| expect(screen.getByTitle('The linked library object has updates available.')).toBeInTheDocument(); | ||
|
|
||
| fireEvent.click(icon); | ||
| await waitFor(() => expect(mockOpenSyncModal).toHaveBeenCalled()); | ||
| }); | ||
|
|
||
| it('should render with course overrides', () => { | ||
| renderComponent({ | ||
| upstreamRef: 'some-ref', | ||
| errorMessage: null, | ||
| readyToSync: false, | ||
| downstreamCustomized: ['data'], | ||
| upstreamName: 'Upstream', | ||
| }); | ||
|
|
||
| expect(screen.getByTitle('This item is linked to a library item.')).toBeInTheDocument(); | ||
| expect(screen.getByTitle('This library reference has course overrides applied.')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('should render with ready to sync and course overrides', () => { | ||
| renderComponent({ | ||
| upstreamRef: 'some-ref', | ||
| errorMessage: null, | ||
| readyToSync: true, | ||
| downstreamCustomized: ['data'], | ||
| upstreamName: 'Upstream', | ||
| }); | ||
|
|
||
| expect(screen.getByTitle('This item is linked to a library item.')).toBeInTheDocument(); | ||
| expect(screen.queryByTitle('This library reference has course overrides applied.')).not.toBeInTheDocument(); | ||
| expect(screen.getByTitle('The linked library object has updates available.')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('should render null without upstream', () => { | ||
| const { container } = renderComponent(undefined); | ||
| renderComponent(undefined); | ||
| const container = screen.getByTestId('redux-provider'); | ||
| expect(container).toBeEmptyDOMElement(); | ||
| }); | ||
|
|
||
| it('should render null without upstreamRf', () => { | ||
| const { container } = renderComponent({ upstreamRef: null, errorMessage: null }); | ||
| renderComponent({ | ||
| upstreamRef: null, | ||
| errorMessage: null, | ||
| readyToSync: false, | ||
| downstreamCustomized: [], | ||
| upstreamName: 'Upstream', | ||
| }); | ||
| const container = screen.getByTestId('redux-provider'); | ||
| expect(container).toBeEmptyDOMElement(); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.