Skip to content
Open
Show file tree
Hide file tree
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 Nov 7, 2025
13c795b
Add StudioDetailsPanel component for displaying detailed studio infor…
vtushar06 Nov 7, 2025
8cc6dc6
Replace DetailsPanel with StudioDetailsPanel in ChannelDetailsModal
vtushar06 Nov 7, 2025
bf39104
Add unit tests for StudioDetailsRow component
vtushar06 Nov 7, 2025
fcfa1db
Add tests for StudioDetailsPanel component
vtushar06 Nov 7, 2025
4d126f9
Refactor StudioChip and StudioDetailsRow styles; update ChannelDetail…
vtushar06 Nov 7, 2025
47896ea
Remove unnecessary comments from StudioChip component
vtushar06 Nov 7, 2025
5600ff2
Remove duplicate StudioChip files - using contributor's implementatio…
vtushar06 Nov 20, 2025
02dd1fa
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] Nov 20, 2025
96b7ac1
Enhance tests for StudioDetailsPanel and StudioDetailsRow components;…
vtushar06 Nov 20, 2025
ff8e9e0
Refactor StudioDetailsPanel and StudioDetailsRow components; improve …
vtushar06 Nov 20, 2025
2534418
Remove unnecessary comments from StudioDetailsPanel tests
vtushar06 Nov 20, 2025
2533dba
Refactor StudioDetailsPanel and StudioDetailsRow components; improve …
vtushar06 Dec 3, 2025
2443393
Merge branch 'unstable' into fix/channel-details-in-channel
vtushar06 Dec 3, 2025
b5b35d7
Update license chip reference to use dynamic keys for improved unique…
vtushar06 Dec 3, 2025
6c28b87
Add data-testid attribute to details panel for improved testing
vtushar06 Dec 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@
<script>

import { mapActions, mapGetters } from 'vuex';
import StudioChip from 'shared/views/StudioChip';
import ExpandableList from 'shared/views/ExpandableList';
import { generateFormMixin } from 'shared/mixins';
import StudioChip from 'shared/views/StudioChip';

const formMixin = generateFormMixin({
subject: { required: true },
Expand Down

This file was deleted.

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();
});
});
});
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();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</template>
</KButton>
</div>
<DetailsPanel
<StudioDetailsPanel
v-if="channel && details"
class="channel-details-wrapper"
:details="channelWithDetails"
Expand All @@ -43,15 +43,15 @@
import useKShow from 'kolibri-design-system/lib/composables/useKShow';
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import { channelExportMixin } from './mixins';
import DetailsPanel from 'shared/views/details/DetailsPanel.vue';
import StudioDetailsPanel from 'shared/views/details/StudioDetailsPanel.vue';
import StudioLargeLoader from 'shared/views/StudioLargeLoader';
import StudioImmersiveModal from 'shared/views/StudioImmersiveModal';
import { routerMixin } from 'shared/mixins';

export default {
name: 'ChannelDetailsModal',
components: {
DetailsPanel,
StudioDetailsPanel,
StudioLargeLoader,
StudioImmersiveModal,
},
Expand Down
Loading