summaryrefslogtreecommitdiff
path: root/test/document-util.test.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-12-18 22:47:29 -0500
committerGitHub <noreply@github.com>2023-12-19 03:47:29 +0000
commit46821eeb7fc9e00645aeae1c7fce3e6e7b637ca0 (patch)
tree7ed0b027946081bbc88bffefc0bfcb2c20d15106 /test/document-util.test.js
parent521e87d01142063c785054741d3703de37a1636c (diff)
Test fixtures (#371)
* Move and rename document-test.js file * Only load HTML file content once * Move testDoc construction * Add createTranslatorTest * Add utilities * Update translator tests * Rename * Refactor anki note builder tests * Refactor * Use internal expect * Updates * Remove actual results * Remove concurrent
Diffstat (limited to 'test/document-util.test.js')
-rw-r--r--test/document-util.test.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/document-util.test.js b/test/document-util.test.js
index 10857df9..51872422 100644
--- a/test/document-util.test.js
+++ b/test/document-util.test.js
@@ -23,7 +23,7 @@ import {DocumentUtil} from '../ext/js/dom/document-util.js';
import {DOMTextScanner} from '../ext/js/dom/dom-text-scanner.js';
import {TextSourceElement} from '../ext/js/dom/text-source-element.js';
import {TextSourceRange} from '../ext/js/dom/text-source-range.js';
-import {domTest} from './document-test.js';
+import {createDomTest} from './fixtures/dom-test.js';
const dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -109,9 +109,10 @@ function findImposterElement(document) {
return document.querySelector('div[style*="2147483646"]>*');
}
+const test = createDomTest(path.join(dirname, 'data/html/test-document1.html'));
+
describe('DocumentUtil', () => {
- const testDoc = domTest(path.join(dirname, 'data/html/test-document1.html'));
- testDoc('Text scanning functions', ({window}) => {
+ test('Text scanning functions', ({window}) => {
const {document} = window;
for (const testElement of /** @type {NodeListOf<HTMLElement>} */ (document.querySelectorAll('.test[data-test-type=scan]'))) {
// Get test parameters
@@ -228,8 +229,7 @@ describe('DocumentUtil', () => {
});
describe('DOMTextScanner', () => {
- const testDoc = domTest(path.join(dirname, 'data/html/test-document1.html'));
- testDoc('Seek functions', async ({window}) => {
+ test('Seek functions', async ({window}) => {
const {document} = window;
for (const testElement of /** @type {NodeListOf<HTMLElement>} */ (document.querySelectorAll('.test[data-test-type=text-source-range-seek]'))) {
// Get test parameters