@learnmd/default-theme 0.0.1-beta.0 → 0.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/dist/components/Callout.test.d.ts +0 -2
- package/dist/components/Callout.test.d.ts.map +0 -1
- package/dist/components/Callout.test.js +0 -24
- package/dist/components/Callout.test.js.map +0 -1
- package/dist/components/Quiz.test.d.ts +0 -2
- package/dist/components/Quiz.test.d.ts.map +0 -1
- package/dist/components/Quiz.test.js +0 -48
- package/dist/components/Quiz.test.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learnmd/default-theme",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.1",
|
|
4
4
|
"description": "Default theme for LearnMD courses",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,9 +23,8 @@
|
|
|
23
23
|
"@mdx-js/react": "^3.0.1",
|
|
24
24
|
"react": ">=18.0.0",
|
|
25
25
|
"react-dom": ">=18.0.0",
|
|
26
|
-
"react-router-dom": "^7.13.1",
|
|
27
26
|
"zustand": "^4.5.0",
|
|
28
|
-
"@learnmd/core": "0.0.1-beta.
|
|
27
|
+
"@learnmd/core": "0.0.1-beta.1"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@testing-library/jest-dom": "^6.4.2",
|
|
@@ -45,7 +44,8 @@
|
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
46
|
"react": ">=18.0.0",
|
|
48
|
-
"react-dom": ">=18.0.0"
|
|
47
|
+
"react-dom": ">=18.0.0",
|
|
48
|
+
"react-router-dom": ">=6.4.0"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
51
51
|
"learnmd",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Callout.test.d.ts","sourceRoot":"","sources":["../../src/components/Callout.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import { describe, it, expect } from 'vitest';
|
|
4
|
-
import Callout from './Callout';
|
|
5
|
-
describe('Callout', () => {
|
|
6
|
-
it('should render children content', () => {
|
|
7
|
-
render(_jsx(Callout, { children: "Test Content" }));
|
|
8
|
-
expect(screen.getByText('Test Content')).toBeDefined();
|
|
9
|
-
});
|
|
10
|
-
it('should render with correct title', () => {
|
|
11
|
-
render(_jsx(Callout, { title: "Custom Title", children: "Content" }));
|
|
12
|
-
expect(screen.getByText('Custom Title')).toBeDefined();
|
|
13
|
-
});
|
|
14
|
-
it('should apply correct classes based on type', () => {
|
|
15
|
-
const { container } = render(_jsx(Callout, { type: "danger", children: "Danger Content" }));
|
|
16
|
-
// Check for rose classes (danger)
|
|
17
|
-
expect(container.firstChild).toHaveClass('bg-rose-50');
|
|
18
|
-
});
|
|
19
|
-
it('should render default title if none provided', () => {
|
|
20
|
-
render(_jsx(Callout, { type: "warning", children: "Warning Content" }));
|
|
21
|
-
expect(screen.getByText('Warning')).toBeDefined();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
//# sourceMappingURL=Callout.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Callout.test.js","sourceRoot":"","sources":["../../src/components/Callout.test.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,KAAC,OAAO,+BAAuB,CAAC,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,KAAC,OAAO,IAAC,KAAK,EAAC,cAAc,wBAAkB,CAAC,CAAC;QACxD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,KAAC,OAAO,IAAC,IAAI,EAAC,QAAQ,+BAAyB,CAAC,CAAC;QAC9E,kCAAkC;QAClC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,CAAC,KAAC,OAAO,IAAC,IAAI,EAAC,SAAS,gCAA0B,CAAC,CAAC;QAC1D,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Quiz.test.d.ts","sourceRoot":"","sources":["../../src/components/Quiz.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
4
|
-
import Quiz from './Quiz';
|
|
5
|
-
describe('Quiz', () => {
|
|
6
|
-
const mockQuestions = [
|
|
7
|
-
{
|
|
8
|
-
id: 'q1',
|
|
9
|
-
type: 'multiple-choice',
|
|
10
|
-
question: 'What is 1+1?',
|
|
11
|
-
options: [
|
|
12
|
-
{ id: '1', label: '1' },
|
|
13
|
-
{ id: '2', label: '2' },
|
|
14
|
-
],
|
|
15
|
-
correctAnswer: '2',
|
|
16
|
-
explanation: 'Math basic',
|
|
17
|
-
},
|
|
18
|
-
];
|
|
19
|
-
it('should render the first question', () => {
|
|
20
|
-
render(_jsx(Quiz, { id: "quiz-1", questions: mockQuestions }));
|
|
21
|
-
expect(screen.getByText('What is 1+1?')).toBeDefined();
|
|
22
|
-
expect(screen.getByText('Question 1 of 1')).toBeDefined();
|
|
23
|
-
});
|
|
24
|
-
it('should allow selecting and submitting an answer', () => {
|
|
25
|
-
const onComplete = vi.fn();
|
|
26
|
-
render(_jsx(Quiz, { id: "quiz-1", questions: mockQuestions, onComplete: onComplete }));
|
|
27
|
-
// Select answer
|
|
28
|
-
const option = screen.getByText('2');
|
|
29
|
-
fireEvent.click(option);
|
|
30
|
-
// Submit
|
|
31
|
-
const submitBtn = screen.getByText('Submit Answer');
|
|
32
|
-
fireEvent.click(submitBtn);
|
|
33
|
-
// The results view is shown immediately for the last question
|
|
34
|
-
expect(onComplete).toHaveBeenCalledWith(expect.objectContaining({
|
|
35
|
-
score: 100,
|
|
36
|
-
passed: true
|
|
37
|
-
}));
|
|
38
|
-
expect(screen.getByText('Congratulations!')).toBeDefined();
|
|
39
|
-
});
|
|
40
|
-
it('should show results on completion', () => {
|
|
41
|
-
render(_jsx(Quiz, { id: "quiz-1", questions: mockQuestions }));
|
|
42
|
-
fireEvent.click(screen.getByText('2'));
|
|
43
|
-
fireEvent.click(screen.getByText('Submit Answer'));
|
|
44
|
-
expect(screen.getByText('Congratulations!')).toBeDefined();
|
|
45
|
-
expect(screen.getByText('100%')).toBeDefined();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
//# sourceMappingURL=Quiz.test.js.map
|
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