-
Notifications
You must be signed in to change notification settings - Fork 262
[Remove Vuetify from Studio] Channel details in Channels - content #5540
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
Open
vtushar06
wants to merge
16
commits into
learningequality:unstable
Choose a base branch
from
vtushar06:fix/channel-details-in-channel
base: unstable
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b4b7827
Add StudioDetailsRow component for displaying studio details
vtushar06 13c795b
Add StudioDetailsPanel component for displaying detailed studio infor…
vtushar06 8cc6dc6
Replace DetailsPanel with StudioDetailsPanel in ChannelDetailsModal
vtushar06 bf39104
Add unit tests for StudioDetailsRow component
vtushar06 fcfa1db
Add tests for StudioDetailsPanel component
vtushar06 4d126f9
Refactor StudioChip and StudioDetailsRow styles; update ChannelDetail…
vtushar06 47896ea
Remove unnecessary comments from StudioChip component
vtushar06 5600ff2
Remove duplicate StudioChip files - using contributor's implementatio…
vtushar06 02dd1fa
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 96b7ac1
Enhance tests for StudioDetailsPanel and StudioDetailsRow components;…
vtushar06 ff8e9e0
Refactor StudioDetailsPanel and StudioDetailsRow components; improve …
vtushar06 2534418
Remove unnecessary comments from StudioDetailsPanel tests
vtushar06 2533dba
Refactor StudioDetailsPanel and StudioDetailsRow components; improve …
vtushar06 2443393
Merge branch 'unstable' into fix/channel-details-in-channel
vtushar06 b5b35d7
Update license chip reference to use dynamic keys for improved unique…
vtushar06 6c28b87
Add data-testid attribute to details panel for improved testing
vtushar06 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
44 changes: 0 additions & 44 deletions
44
contentcuration/contentcuration/frontend/shared/views/__tests__/StudioChip.spec.js
This file was deleted.
Oops, something went wrong.
184 changes: 184 additions & 0 deletions
184
contentcuration/contentcuration/frontend/shared/views/__tests__/StudioDetailsPanel.spec.js
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,184 @@ | ||
| import { render, screen } from '@testing-library/vue'; | ||
| import VueRouter from 'vue-router'; | ||
| import StudioDetailsPanel from '../details/StudioDetailsPanel.vue'; | ||
|
|
||
| jest.mock('../../constants', () => ({ | ||
| ...jest.requireActual('../../constants'), | ||
| LevelsLookup: { | ||
| lower_primary: 'LOWER_PRIMARY', | ||
| upper_primary: 'UPPER_PRIMARY', | ||
| }, | ||
| CategoriesLookup: { | ||
| mathematics: 'MATHEMATICS', | ||
| sciences: 'SCIENCES', | ||
| }, | ||
| })); | ||
|
|
||
| jest.mock('../../utils/metadataStringsTranslation', () => ({ | ||
| translateMetadataString: jest.fn(key => { | ||
| const translations = { | ||
| lowerPrimary: 'Lower Primary', | ||
| upperPrimary: 'Upper Primary', | ||
| mathematics: 'Mathematics', | ||
| sciences: 'Sciences', | ||
| }; | ||
| return translations[key] || key; | ||
| }), | ||
| })); | ||
|
|
||
| const router = new VueRouter({ routes: [] }); | ||
|
|
||
| const translations = { | ||
| publishedHeading: 'Published on', | ||
| currentVersionHeading: 'Published version', | ||
| primaryLanguageHeading: 'Primary language', | ||
| creationHeading: 'Created on', | ||
| sizeHeading: 'Channel size', | ||
| resourceHeading: 'Total resources', | ||
| levelsHeading: 'Levels', | ||
| categoriesHeading: 'Categories', | ||
| authorsLabel: 'Authors', | ||
| tagsHeading: 'Common tags', | ||
| unpublishedText: 'Unpublished', | ||
| }; | ||
|
|
||
| const createMocks = () => ({ | ||
| $formatNumber: jest.fn(n => String(n)), | ||
| $formatDate: jest.fn(() => 'January 15, 2025'), | ||
| $tr: jest.fn(key => translations[key] || key), | ||
| translateConstant: jest.fn(key => key), | ||
| }); | ||
|
|
||
| describe('StudioDetailsPanel', () => { | ||
| const fullChannel = { | ||
| name: 'Complete Channel', | ||
| description: 'A fully populated channel', | ||
| thumbnail_url: 'https://example.com/thumb.jpg', | ||
| published: true, | ||
| version: 2, | ||
| primary_token: 'abc12345', | ||
| language: 'en', | ||
| created: '2025-01-15T10:00:00Z', | ||
| last_published: '2025-01-20T15:30:00Z', | ||
| resource_count: 42, | ||
| resource_size: 1024000000, | ||
| kind_count: [], | ||
| levels: ['lower_primary', 'upper_primary'], | ||
| categories: ['mathematics', 'sciences'], | ||
| includes: { coach_content: 1, exercises: 1 }, | ||
| tags: [{ tag_name: 'science' }, { tag_name: 'math' }], | ||
| languages: [], | ||
| accessible_languages: [], | ||
| authors: ['Author One', 'Author Two'], | ||
| providers: [], | ||
| aggregators: [], | ||
| licenses: [], | ||
| copyright_holders: [], | ||
| original_channels: [], | ||
| sample_nodes: [], | ||
| }; | ||
|
|
||
| const minimalChannel = { | ||
| name: 'Minimal Channel', | ||
| description: '', | ||
| thumbnail_url: null, | ||
| published: false, | ||
| version: null, | ||
| primary_token: null, | ||
| language: null, | ||
| created: null, | ||
| last_published: null, | ||
| resource_count: 0, | ||
| resource_size: 0, | ||
| kind_count: [], | ||
| levels: [], | ||
| categories: [], | ||
| includes: { coach_content: 0, exercises: 0 }, | ||
| tags: [], | ||
| languages: [], | ||
| accessible_languages: [], | ||
| authors: [], | ||
| providers: [], | ||
| aggregators: [], | ||
| licenses: [], | ||
| copyright_holders: [], | ||
| original_channels: [], | ||
| sample_nodes: [], | ||
| }; | ||
|
|
||
| describe('basic rendering', () => { | ||
| it('renders channel header with name and description', () => { | ||
| render(StudioDetailsPanel, { | ||
| router, | ||
| props: { details: fullChannel, isChannel: true, loading: false }, | ||
| mocks: createMocks(), | ||
| }); | ||
|
|
||
| expect(screen.getByText('Complete Channel')).toBeInTheDocument(); | ||
| expect(screen.getByText('A fully populated channel')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('shows placeholder when thumbnail is missing', () => { | ||
| render(StudioDetailsPanel, { | ||
| router, | ||
| props: { details: minimalChannel, isChannel: true, loading: false }, | ||
| mocks: createMocks(), | ||
| }); | ||
|
|
||
| expect(screen.getByTestId('placeholder-content')).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('published channel with full data', () => { | ||
| beforeEach(() => { | ||
| render(StudioDetailsPanel, { | ||
| router, | ||
| props: { details: fullChannel, isChannel: true, loading: false }, | ||
| mocks: createMocks(), | ||
| }); | ||
| }); | ||
|
|
||
| it('displays published status and version', () => { | ||
| expect(screen.getByText('Published on')).toBeInTheDocument(); | ||
| expect(screen.getByText('Published version')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('displays translated levels and categories', () => { | ||
| expect(screen.getByText('Lower Primary')).toBeInTheDocument(); | ||
| expect(screen.getByText('Upper Primary')).toBeInTheDocument(); | ||
| expect(screen.getByText('Mathematics')).toBeInTheDocument(); | ||
| expect(screen.getByText('Sciences')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('displays resource count and metadata', () => { | ||
| expect(screen.getByText('42')).toBeInTheDocument(); | ||
| expect(screen.getByText('Author One')).toBeInTheDocument(); | ||
| expect(screen.getByText('Author Two')).toBeInTheDocument(); | ||
| expect(screen.getByText('science')).toBeInTheDocument(); | ||
| expect(screen.getByText('math')).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('unpublished channel with missing data', () => { | ||
| beforeEach(() => { | ||
| render(StudioDetailsPanel, { | ||
| router, | ||
| props: { details: minimalChannel, isChannel: true, loading: false }, | ||
| mocks: createMocks(), | ||
| }); | ||
| }); | ||
|
|
||
| it('displays unpublished status', () => { | ||
| expect(screen.getByText('Unpublished')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('shows placeholder text for empty fields', () => { | ||
| const placeholders = screen.getAllByText('---'); | ||
| expect(placeholders.length).toBeGreaterThan(0); | ||
| }); | ||
|
|
||
| it('hides conditional fields when data is missing', () => { | ||
| expect(screen.queryByText('Primary language')).not.toBeInTheDocument(); | ||
| }); | ||
| }); | ||
| }); |
77 changes: 77 additions & 0 deletions
77
contentcuration/contentcuration/frontend/shared/views/__tests__/StudioDetailsRow.spec.js
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,77 @@ | ||
| import { render, screen } from '@testing-library/vue'; | ||
| import VueRouter from 'vue-router'; | ||
| import StudioDetailsRow from '../details/StudioDetailsRow.vue'; | ||
|
|
||
| const router = new VueRouter({ routes: [] }); | ||
|
|
||
| const HelpTooltipStub = { | ||
| name: 'HelpTooltip', | ||
| props: ['text', 'tooltipId'], | ||
| template: '<span data-testid="help-tooltip">{{ text }}</span>', | ||
| }; | ||
|
|
||
| describe('StudioDetailsRow', () => { | ||
| describe('basic rendering', () => { | ||
| it('renders label and text value', () => { | ||
| render(StudioDetailsRow, { | ||
| router, | ||
| props: { label: 'Channel size', text: '1.5 GB' }, | ||
| stubs: { HelpTooltip: HelpTooltipStub }, | ||
| }); | ||
|
|
||
| expect(screen.getByText('Channel size')).toBeInTheDocument(); | ||
| expect(screen.getByText('1.5 GB')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('renders slot content instead of text prop', () => { | ||
| render(StudioDetailsRow, { | ||
| router, | ||
| props: { label: 'Authors' }, | ||
| slots: { default: '<div>Author One, Author Two</div>' }, | ||
| stubs: { HelpTooltip: HelpTooltipStub }, | ||
| }); | ||
|
|
||
| expect(screen.getByText('Authors')).toBeInTheDocument(); | ||
| expect(screen.getByText('Author One, Author Two')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('prioritizes slot content over text prop', () => { | ||
| render(StudioDetailsRow, { | ||
| router, | ||
| props: { label: 'Field', text: 'Text Value' }, | ||
| slots: { default: '<span>Slot Value</span>' }, | ||
| stubs: { HelpTooltip: HelpTooltipStub }, | ||
| }); | ||
|
|
||
| expect(screen.getByText('Slot Value')).toBeInTheDocument(); | ||
| expect(screen.queryByText('Text Value')).not.toBeInTheDocument(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('tooltip behavior', () => { | ||
| it('displays HelpTooltip when definition is provided', () => { | ||
| render(StudioDetailsRow, { | ||
| router, | ||
| props: { | ||
| label: 'Resources for coaches', | ||
| text: '5', | ||
| definition: 'Resources only visible to coaches', | ||
| }, | ||
| stubs: { HelpTooltip: HelpTooltipStub }, | ||
| }); | ||
|
|
||
| expect(screen.getByTestId('help-tooltip')).toBeInTheDocument(); | ||
| expect(screen.getByText('Resources only visible to coaches')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('does not display HelpTooltip when definition is not provided', () => { | ||
| render(StudioDetailsRow, { | ||
| router, | ||
| props: { label: 'Created on', text: 'October 11, 2025' }, | ||
| stubs: { HelpTooltip: HelpTooltipStub }, | ||
| }); | ||
|
|
||
| expect(screen.queryByTestId('help-tooltip')).not.toBeInTheDocument(); | ||
| }); | ||
| }); | ||
| }); |
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
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.