|
1 | 1 | import * as assert from 'node:assert';
|
2 | 2 | import * as parse5 from 'parse5';
|
3 | 3 | import { jest } from '@jest/globals';
|
4 |
| -import { Parser, ParserOptions } from './index.js'; |
5 |
| -import type { TreeAdapterTypeMap } from './../tree-adapters/interface.js'; |
6 | 4 | import { generateParsingTests } from 'parse5-test-utils/utils/generate-parsing-tests.js';
|
7 | 5 | import { treeAdapters } from 'parse5-test-utils/utils/common.js';
|
8 |
| -import { NAMESPACES as NS } from '../common/html.js'; |
9 |
| - |
10 |
| -const origParseFragment = Parser.parseFragment; |
11 | 6 |
|
12 | 7 | generateParsingTests(
|
13 | 8 | 'parser',
|
14 | 9 | 'Parser',
|
15 | 10 | {
|
16 | 11 | expectErrors: [
|
17 |
| - //NOTE: Foreign content behaviour was updated in the HTML spec. |
| 12 | + //TODO(GH-448): Foreign content behaviour was updated in the HTML spec. |
18 | 13 | //The old test suite still tests the old behaviour.
|
19 | 14 | '269.foreign-fragment',
|
20 | 15 | '270.foreign-fragment',
|
@@ -55,54 +50,6 @@ describe('parser', () => {
|
55 | 50 | assert.strictEqual(document.childNodes[0].data, '!DOCTYPE html SYSTEM "about:legacy-compat"');
|
56 | 51 | });
|
57 | 52 |
|
58 |
| - describe('Regression - Incorrect arguments fallback for the parser.parseFragment (GH-82, GH-83)', () => { |
59 |
| - beforeEach(() => { |
60 |
| - Parser.parseFragment = function <T extends TreeAdapterTypeMap>( |
61 |
| - html: string, |
62 |
| - fragmentContext?: T['element'], |
63 |
| - options?: ParserOptions<T> |
64 |
| - ): { |
65 |
| - html: string; |
66 |
| - fragmentContext: T['element'] | null | undefined; |
67 |
| - options: ParserOptions<T> | undefined; |
68 |
| - } { |
69 |
| - return { |
70 |
| - html, |
71 |
| - fragmentContext, |
72 |
| - options, |
73 |
| - }; |
74 |
| - }; |
75 |
| - }); |
76 |
| - |
77 |
| - afterEach(() => { |
78 |
| - Parser.parseFragment = origParseFragment; |
79 |
| - }); |
80 |
| - |
81 |
| - it('parses correctly', () => { |
82 |
| - const fragmentContext = treeAdapters.default.createElement('div', NS.HTML, []); |
83 |
| - const html = '<script></script>'; |
84 |
| - const opts = { sourceCodeLocationInfo: true }; |
85 |
| - |
86 |
| - let args: any = parse5.parseFragment(fragmentContext, html, opts); |
87 |
| - |
88 |
| - expect(args).toHaveProperty('fragmentContext', fragmentContext); |
89 |
| - expect(args).toHaveProperty('html', html); |
90 |
| - assert.ok(args.options.sourceCodeLocationInfo); |
91 |
| - |
92 |
| - args = parse5.parseFragment(html, opts); |
93 |
| - |
94 |
| - assert.ok(!args.fragmentContext); |
95 |
| - expect(args).toHaveProperty('html', html); |
96 |
| - assert.ok(args.options.sourceCodeLocationInfo); |
97 |
| - |
98 |
| - args = parse5.parseFragment(html); |
99 |
| - |
100 |
| - assert.ok(!args.fragmentContext); |
101 |
| - expect(args).toHaveProperty('html', html); |
102 |
| - assert.ok(!args.options); |
103 |
| - }); |
104 |
| - }); |
105 |
| - |
106 | 53 | describe("Regression - Don't inherit from Object when creating collections (GH-119)", () => {
|
107 | 54 | beforeEach(() => {
|
108 | 55 | /*eslint-disable no-extend-native*/
|
|
0 commit comments