diff --git a/test/core.test.ts b/test/core.test.ts
index 3cf06f0..eb7d8a9 100644
--- a/test/core.test.ts
+++ b/test/core.test.ts
@@ -1,127 +1,120 @@
-import { test, expect } from 'vitest';
-import { parser } from '../src';
+import { test, expect } from "vitest";
+import { parser } from "../src";
-test('should be parse doctype in uppercase', () => {
- const tree = parser('');
- const expected = [''];
+test("should be parse doctype in uppercase", () => {
+ const tree = parser("");
+ const expected = [""];
expect(tree).eql(expected);
});
-test('should be parse comment', () => {
- const tree = parser('');
- const expected = [''];
+test("should be parse comment", () => {
+ const tree = parser("");
+ const expected = [""];
expect(tree).eql(expected);
});
-test('should be parse CDATA', () => {
- const tree = parser('', {
+test("should be parse CDATA", () => {
+ const tree = parser("", {
xmlMode: true,
});
- const expected = [{ tag: 'script', content: ['console.log(1);'] }];
+ const expected = [{ tag: "script", content: ["console.log(1);"] }];
expect(tree).eql(expected);
});
-test('should be parse tag with escape object in attribute', () => {
+test("should be parse tag with escape object in attribute", () => {
const html =
- '';
+ '';
const tree = parser(html);
const expected = [
{
- tag: 'button',
+ tag: "button",
attrs: {
- type: 'submit',
- 'data-bem': '{"button":{"checkedView":"extra"}}',
+ type: "submit",
+ "data-bem": '{"button":{"checkedView":"extra"}}',
},
},
];
expect(tree).eql(expected);
});
-test.skip('should be parse tag with object in attribute data witchout escape', () => {
- const html =
- '';
+test.skip("should be parse tag with object in attribute data witchout escape", () => {
+ const html = '';
const tree = parser(html);
const expected = [
{
- tag: 'button',
+ tag: "button",
attrs: {
- type: 'submit',
- 'data-bem': '{"button":{"checkedView":"extra"}}',
+ type: "submit",
+ "data-bem": '{"button":{"checkedView":"extra"}}',
},
},
];
expect(tree).eql(expected);
});
-test.skip('should be parse tag with object in attribute data escape', () => {
- const json = JSON.stringify({ button: { checkedView: 'extra' } });
+test.skip("should be parse tag with object in attribute data escape", () => {
+ const json = JSON.stringify({ button: { checkedView: "extra" } });
const html = '';
const tree = parser(html);
const expected = [
{
- tag: 'button',
+ tag: "button",
attrs: {
- type: 'submit',
- 'data-bem': '{"button":{"checkedView":"extra"}}',
+ type: "submit",
+ "data-bem": '{"button":{"checkedView":"extra"}}',
},
},
];
expect(tree).eql(expected);
});
-test('should be parse isolated comment', () => {
- const tree = parser('
');
- const expected = [{ tag: 'div', content: [''] }];
+test("should be parse isolated comment", () => {
+ const tree = parser("");
+ const expected = [{ tag: "div", content: [""] }];
expect(tree).eql(expected);
});
-test('should be parse comment before text content', () => {
- const tree = parser('
Text after comment
');
- const expected = [
- { tag: 'div', content: ['', 'Text after comment'] },
- ];
+test("should be parse comment before text content", () => {
+ const tree = parser("
Text after comment
");
+ const expected = [{ tag: "div", content: ["", "Text after comment"] }];
expect(tree).eql(expected);
});
-test('should be parse comment after text content', () => {
- const tree = parser('
Text before comment.
');
- const expected = [
- { tag: 'div', content: ['Text before comment.', ''] },
- ];
+test("should be parse comment after text content", () => {
+ const tree = parser("
Text before comment.
");
+ const expected = [{ tag: "div", content: ["Text before comment.", ""] }];
expect(tree).eql(expected);
});
-test('should be parse comment in the middle of text content', () => {
- const tree = parser('
Text surrounding a comment.
');
+test("should be parse comment in the middle of text content", () => {
+ const tree = parser("