16 lines
856 B
JavaScript
16 lines
856 B
JavaScript
const { test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const source = fs.readFileSync(path.join(__dirname, '..', 'public', 'js', 'learningHub.js'), 'utf8');
|
|
|
|
test('Learning Hub destroys embedded Tiptap editors before removing CMS rows', () => {
|
|
assert.match(source, /function destroyTpEditor\(editor\)/);
|
|
assert.match(source, /function destroyQuestionBlockEditors\(block\)/);
|
|
assert.match(source, /function clearQuestionBlocks\(container\)/);
|
|
assert.match(source, /destroyQuestionBlockEditors\(qb\); qb\.remove\(\)/);
|
|
assert.match(source, /destroyOptionEditor\(row\); row\.remove\(\)/);
|
|
assert.doesNotMatch(source, /document\.getElementById\('lh-cms-questions'\)\.innerHTML = ''/);
|
|
assert.doesNotMatch(source, /qContainer\.innerHTML = ''/);
|
|
});
|