Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
675c07a
style(editor): remove stray double blank lines in editor.scss
chethann007 Oct 9, 2026
3801bb0
refactor(transcripts): remove legacy transcript create/approve/reject…
chethann007 Oct 9, 2026
b026482
feat(transcripts): read and request transcripts via the EnrichmentObj…
chethann007 Oct 9, 2026
af1ea86
feat: Enhance Dynamic Assess functionality and improve content handling
Deeksha1502 Oct 23, 2026
930e011
fix(dynamic-assess): store the selected skills in the framework's dee…
Deeksha1502 Oct 27, 2026
b6d38e6
feat(dynamic-assess): use the content's own minCriteria and multiplie…
Deeksha1502 Oct 27, 2026
051b567
chore(dynamic-assess): default the multiplier to 2 [SBCOSS-1190]
Deeksha1502 Oct 27, 2026
ad48969
feat(dynamic-assess): add a min-per-skill example to the Difficulty T…
Deeksha1502 Oct 29, 2026
08ba7cc
chore(release): bump version to 2.0.7 [SBCOSS-1190]
Deeksha1502 Nov 2, 2026
ca54f2b
fix(dynamic-assess): address review feedback [SBCOSS-1190]
Deeksha1502 Nov 2, 2026
a6ba003
Merge pull request #7 from Deeksha1502/feat/dynamic-assess
pallakartheekreddy Nov 3, 2026
36daaf8
feat(dynamic-assess): preview the whole Dynamic Assess pool [SBCOSS-1…
Deeksha1502 Nov 3, 2026
2736d85
Merge pull request #8 from Deeksha1502/feat/dynamic-assess-full-pool
pallakartheekreddy Nov 3, 2026
69c62df
fix(enrichment): address review findings and drop translations-pendin…
chethann007 Nov 6, 2026
3cf6e8e
chore: update package-lock.json dependencies
chethann007 Nov 6, 2026
6eee03e
Merge origin/v1.1.2 into feat/transcript-v2
chethann007 Nov 6, 2026
fc4df93
test(editor): cover clearing saved enrichment types on file or URL re…
chethann007 Nov 9, 2026
57c65d2
refactor(enrichment): derive upload prompt types from EXTENSION_MIME
chethann007 Nov 9, 2026
9bba034
fix(content): normalize enrichmentTypes as a list
chethann007 Nov 9, 2026
88f7647
fix(preview): remount the player only for captions it can show
chethann007 Nov 9, 2026
acde01e
fix(transcripts): show an empty state when a transcript has no cues
chethann007 Nov 9, 2026
2c4651d
fix(enrichment): add a neutral style for the draft status dot
chethann007 Nov 9, 2026
c6c1d4e
feat(enrichment): add Refresh to the enrichments drawer
chethann007 Nov 9, 2026
f37f17c
refactor(enrichment): move Refresh into the drawer header
chethann007 Nov 9, 2026
09febd1
chore: update package-lock.json peer annotations
chethann007 Nov 9, 2026
feef8a1
chore(release): bump version to 2.0.8
chethann007 Nov 9, 2026
46fcbdf
Merge pull request #9 from Sunbird-Knowlg/feat/transcript-v2
pallakartheekreddy Nov 9, 2026
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ You can also override per-load via URL query params: `?contentId=do_123&lang=hi&
| **Review workflow** | Send for review, reviewer request-changes (with reasons checklist), publish. |
| **Locking** | Creates a content lock on upload / edit-open; retires it on close and on send-for-review. |
| **Session guard** | 30-minute inactivity prompt (Continue / Close). |
| **Enrichments** | Ticking "Generate transcripts" when uploading a video saves `enrichmentTypes` on the content; the platform generates transcripts after publish. A published video's transcripts show in a read-only drawer and as preview captions, read via `POST /object/enrichment/v4/list` (served under `config.portalSlug`, default `/portal`). |
| **Telemetry** | Emits Sunbird 3.0 telemetry (impression / interact / error / end) via `onTelemetryEvent`. |
| **Preview** | Renders through the ekstep content renderer for every supported mimeType. |

Expand Down
33 changes: 21 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@project-sunbird/generic-editor-v2",
"version": "2.0.6",
"version": "2.0.8",
"description": "Sunbird Generic Editor — React content upload/generic editor (theme-reactive, multilingual). Fork of @sunbird/content-editor that previews via the legacy ekstep content renderer.",
"main": "dist/sunbird-generic-editor.umd.js",
"module": "dist/sunbird-generic-editor.es.js",
Expand Down Expand Up @@ -49,4 +49,4 @@
"vite-plugin-dts": "^4.5.4",
"vitest": "^3.2.6"
}
}
}
116 changes: 115 additions & 1 deletion src/ContentEditor.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen, waitFor } from '@testing-library/react';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { describe, it, expect, vi } from 'vitest';
import ContentEditor from './ContentEditor';
import type { ContentEditorService } from './services/ContentEditorService';
Expand All @@ -11,6 +11,9 @@ function svc(over: Record<string, unknown> = {}) {
readContent: vi.fn().mockResolvedValue(mockContent),
createLock: vi.fn().mockResolvedValue({}),
retireLock: vi.fn().mockResolvedValue(undefined),
readFormFields: vi.fn().mockResolvedValue([]),
readFramework: vi.fn().mockResolvedValue([]),
searchFrameworks: vi.fn().mockResolvedValue([]),
getBase: () => ({ baseUrl: '', apiSlug: '/action', headers: {}, fetchImpl: fetch }),
getEndpoints: () => ({}),
...over,
Expand Down Expand Up @@ -44,3 +47,114 @@ describe('<ContentEditor /> — existing content', () => {
expect(await screen.findByText('Failed to load content.')).toBeInTheDocument();
});
});

describe('<ContentEditor /> — Dynamic Assess empty state', () => {
it('shows a placeholder instead of the legacy player when no body has been generated yet (positive)', async () => {
const service = svc({
readContent: vi.fn().mockResolvedValue({
...mockContent,
primaryCategory: 'Dynamic Course Assessment',
totalQuestions: 0,
}),
});
render(<ContentEditor context={mockContext} contentId="do_da_1" service={service} onClose={vi.fn()} />);
expect(await screen.findByText('No questions generated yet')).toBeInTheDocument();
expect(screen.getByText(/save to generate the questions/)).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Edit details' })).toBeInTheDocument();
expect(screen.queryByText('PDF')).not.toBeInTheDocument();
});

it('shows the normal preview once the job has written questions, even for a never-published Draft (negative)', async () => {
const service = svc({
readContent: vi.fn().mockResolvedValue({
...mockContent,
primaryCategory: 'Dynamic Course Assessment',
status: 'Draft',
pkgVersion: 0,
totalQuestions: 3,
}),
});
render(<ContentEditor context={mockContext} contentId="do_da_2" service={service} onClose={vi.fn()} />);
await waitFor(() => expect(screen.getAllByText('Sample content').length).toBeGreaterThan(0));
expect(screen.queryByText('No questions generated yet')).not.toBeInTheDocument();
});

it('does not point a reviewer at a Generate button they do not have (positive)', async () => {
const service = svc({
readContent: vi.fn().mockResolvedValue({
...mockContent,
primaryCategory: 'Dynamic Course Assessment',
status: 'Review',
totalQuestions: 0,
}),
});
const reviewerContext = { ...mockContext, user: { ...mockContext.user!, roles: ['CONTENT_REVIEWER'] } };
render(<ContentEditor context={reviewerContext} contentId="do_da_3" service={service} onClose={vi.fn()} />);
expect(await screen.findByText('No questions have been generated for this content yet.')).toBeInTheDocument();
expect(screen.queryByText(/save to generate the questions/)).not.toBeInTheDocument();
});
});

describe('<ContentEditor /> — Dynamic Assess generating overlay', () => {
const staleBody = JSON.stringify({
theme: { stage: [{ 'org.ekstep.questionset': { config: { __cdata: JSON.stringify({ dynamic_assess: { skills: ['Physics'], target: { E: 2, M: 0, D: 0 } } }) } } }] },
});
const daContent = (over: Record<string, unknown> = {}) => ({
...mockContent,
primaryCategory: 'Dynamic Course Assessment',
totalQuestions: 3,
lastUpdatedOn: 't0',
skill: ['Physics'],
difficultyTarget: '{"E":1,"M":1,"D":1}',
body: staleBody,
...over,
});

it('shows a blocking loader while questions generate and removes it once the job writes (positive)', async () => {
let written = false;
const service = svc({
readContent: vi.fn().mockImplementation(async () => daContent(written ? { lastUpdatedOn: 't1' } : {})),
refreshContentBody: vi.fn().mockResolvedValue({}),
});
render(<ContentEditor context={mockContext} contentId="do_da_4" service={service} onClose={vi.fn()} />);
fireEvent.click(await screen.findByRole('button', { name: /Regenerate/ }));
expect(await screen.findByRole('status')).toHaveTextContent('Generating questions');
// The settings banner stays hidden behind the loader while generating.
expect(screen.queryByText('Settings changed since the questions were generated')).not.toBeInTheDocument();
written = true;
await waitFor(() => expect(screen.queryByText('Generating questions')).not.toBeInTheDocument(), { timeout: 8000 });
expect(await screen.findByText('Questions generated')).toBeInTheDocument();
}, 10000);

it('never shows the loader or a Generate button for ordinary content (negative)', async () => {
render(<ContentEditor context={mockContext} contentId="do_1" service={svc()} onClose={vi.fn()} />);
await waitFor(() => expect(screen.getAllByText('Sample content').length).toBeGreaterThan(0));
expect(screen.queryByRole('button', { name: /Regenerate/ })).not.toBeInTheDocument();
expect(screen.queryByText('Generating questions')).not.toBeInTheDocument();
});
});

describe('<ContentEditor /> — Dynamic Assess stale settings banner', () => {
const generatedBody = JSON.stringify({
theme: { stage: [{ 'org.ekstep.questionset': { config: { __cdata: JSON.stringify({ dynamic_assess: { skills: ['Physics'], target: { E: 3, M: 3, D: 3 } } }) } } }] },
});
const daContent = (over: Record<string, unknown> = {}) => ({
...mockContent, primaryCategory: 'Dynamic Course Assessment', totalQuestions: 9,
skill: ['Physics'], difficultyTarget: '{"E":3,"M":3,"D":3}', body: generatedBody, ...over,
});

it('warns the creator and disables Send for Review when settings changed after generation (positive)', async () => {
const service = svc({ readContent: vi.fn().mockResolvedValue(daContent({ difficultyTarget: '{"E":3,"M":2,"D":3}' })) });
render(<ContentEditor context={mockContext} contentId="do_da_6" service={service} onClose={vi.fn()} />);
expect(await screen.findByRole('alert')).toHaveTextContent('Settings changed since the questions were generated');
expect(screen.getByText(/Click Regenerate to update them/)).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Send for review/i })).toBeDisabled();
});

it('shows no banner when the settings match the generated questions (negative)', async () => {
const service = svc({ readContent: vi.fn().mockResolvedValue(daContent()) });
render(<ContentEditor context={mockContext} contentId="do_da_7" service={service} onClose={vi.fn()} />);
await waitFor(() => expect(screen.getAllByText('Sample content').length).toBeGreaterThan(0));
expect(screen.queryByText('Settings changed since the questions were generated')).not.toBeInTheDocument();
});
});
Loading
Loading