-
-
Notifications
You must be signed in to change notification settings - Fork 178
/
Comment.test.ts
44 lines (38 loc) · 1.14 KB
/
Comment.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import Window from '../../../src/window/Window.js';
import Document from '../../../src/nodes/document/Document.js';
import Comment from '../../../src/nodes/comment/Comment.js';
import { beforeEach, describe, it, expect } from 'vitest';
describe('Comment', () => {
let window: Window;
let document: Document;
beforeEach(() => {
window = new Window();
document = window.document;
});
describe('constructor()', () => {
it('Creates a new Comment node.', () => {
const node = new window.Comment('test');
expect(node).toBeInstanceOf(Comment);
expect(node.data).toBe('test');
});
});
describe('get nodeName()', () => {
it('Returns "#comment".', () => {
const node = document.createComment('test');
expect(node.nodeName).toBe('#comment');
});
});
describe('toString()', () => {
it('Returns "[object Comment]".', () => {
const node = document.createComment('test');
expect(node.toString()).toBe('[object Comment]');
});
});
describe('cloneNode()', () => {
it('Clones the node.', () => {
const node = document.createComment('test');
const clone = node.cloneNode();
expect(clone.data).toBe(node.data);
});
});
});