@digabi/exam-engine-core 20.2.3 → 20.2.4-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/dist/__tests__/testExamRendering.js +12 -0
  2. package/dist/__tests__/testExamRendering.js.map +1 -1
  3. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  4. package/dist/components/context/TOCContext.d.ts +9 -0
  5. package/dist/components/context/TOCContext.d.ts.map +1 -0
  6. package/dist/components/context/TOCContext.js +3 -0
  7. package/dist/components/context/TOCContext.js.map +1 -0
  8. package/dist/components/exam/Exam.d.ts +1 -1
  9. package/dist/components/exam/Exam.d.ts.map +1 -1
  10. package/dist/components/exam/Exam.js +97 -108
  11. package/dist/components/exam/Exam.js.map +1 -1
  12. package/dist/components/exam/Question.d.ts.map +1 -1
  13. package/dist/components/exam/Question.js +14 -6
  14. package/dist/components/exam/Question.js.map +1 -1
  15. package/dist/components/exam/SectionTitle.d.ts.map +1 -1
  16. package/dist/components/exam/SectionTitle.js +10 -2
  17. package/dist/components/exam/SectionTitle.js.map +1 -1
  18. package/dist/components/shared/TOCQuestion.d.ts +4 -0
  19. package/dist/components/shared/TOCQuestion.d.ts.map +1 -0
  20. package/dist/components/shared/TOCQuestion.js +77 -0
  21. package/dist/components/shared/TOCQuestion.js.map +1 -0
  22. package/dist/components/shared/TOCSection.d.ts +7 -0
  23. package/dist/components/shared/TOCSection.d.ts.map +1 -0
  24. package/dist/components/shared/TOCSection.js +15 -0
  25. package/dist/components/shared/TOCSection.js.map +1 -0
  26. package/dist/components/shared/TOCSectionTitle.d.ts +4 -0
  27. package/dist/components/shared/TOCSectionTitle.d.ts.map +1 -0
  28. package/dist/components/shared/TOCSectionTitle.js +34 -0
  29. package/dist/components/shared/TOCSectionTitle.js.map +1 -0
  30. package/dist/components/shared/TableOfContents.d.ts.map +1 -1
  31. package/dist/components/shared/TableOfContents.js +30 -104
  32. package/dist/components/shared/TableOfContents.js.map +1 -1
  33. package/dist/dom-utils.d.ts +1 -0
  34. package/dist/dom-utils.d.ts.map +1 -1
  35. package/dist/dom-utils.js +17 -1
  36. package/dist/dom-utils.js.map +1 -1
  37. package/dist/main-bundle.js +1 -1
  38. package/dist/main.css +1 -1
  39. package/package.json +2 -2
@@ -39,6 +39,18 @@ const examServerApi_1 = require("./examServerApi");
39
39
  const exam_engine_generator_1 = require("@digabi/exam-engine-generator");
40
40
  describe.each((0, exam_engine_exams_1.listExams)().map(exam => [path_1.default.basename(exam), exam]))('%s', (_basename, exam) => {
41
41
  const resolveAttachment = (filename) => path_1.default.resolve(path_1.default.dirname(exam), 'attachments', filename);
42
+ beforeEach(() => {
43
+ // @ts-expect-error fix "IntersectionObserver is not defined" error in tests
44
+ global.IntersectionObserver = jest.fn((cb, options = {}) => {
45
+ const instance = {
46
+ observe: jest.fn,
47
+ takeRecords: jest.fn,
48
+ unobserve: jest.fn,
49
+ disconnect: jest.fn
50
+ };
51
+ return instance;
52
+ });
53
+ });
42
54
  it('renders properly', async () => {
43
55
  const source = await fs_1.promises.readFile(exam, 'utf-8');
44
56
  const results = await (0, exam_engine_mastering_1.masterExam)(source, () => '', (0, exam_engine_mastering_1.getMediaMetadataFromLocalFile)(resolveAttachment), {
@@ -1 +1 @@
1
- {"version":3,"file":"testExamRendering.js","sourceRoot":"","sources":["../../__tests__/testExamRendering.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAQiC;AACjC,+FAAsE;AACtE,iEAAqD;AACrD,yEAAyF;AACzF,2BAAmC;AACnC,gDAAuB;AACvB,kDAAyB;AACzB,6DAA4C;AAC5C,6CAA8B;AAG9B,mDAA+C;AAC/C,yEAA+D;AAE/D,QAAQ,CAAC,IAAI,CAAC,IAAA,6BAAS,GAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,cAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,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