Skip to content

Commit

Permalink
chore: [#1330] Fixes wrong imports in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
capricorn86 committed Mar 19, 2024
1 parent 121fb40 commit 4edd575
Show file tree
Hide file tree
Showing 22 changed files with 17 additions and 38 deletions.
1 change: 0 additions & 1 deletion packages/happy-dom/test/clipboard/Clipboard.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import ClipboardItem from '../../src/clipboard/ClipboardItem.js';
import Blob from '../../src/file/Blob.js';
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import { beforeEach, describe, it, expect } from 'vitest';

describe('Clipboard', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import Element from '../../src/nodes/element/Element.js';
import DOMTokenList from '../../src/dom-token-list/DOMTokenList.js';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/event/Event.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import Event from '../../src/event/Event.js';
import CustomElement from '../CustomElement.js';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/fetch/Fetch.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Response from '../../src/fetch/Response.js';
import Headers from '../../src/fetch/Headers.js';
import DOMException from '../../src/exception/DOMException.js';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/fetch/Request.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import Request from '../../src/fetch/Request.js';
import URL from '../../src/url/URL.js';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/fetch/Response.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import File from '../../src/file/File.js';
import FormData from '../../src/form-data/FormData.js';
import Document from '../../src/nodes/document/Document.js';
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import * as PropertySymbol from '../../src/PropertySymbol.js';
import { ReadableStream } from 'stream/web';
import { beforeEach, afterEach, describe, it, expect, vi } from 'vitest';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/form-data/FormData.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import File from '../../src/file/File.js';
import { beforeEach, describe, it, expect } from 'vitest';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/match-media/MediaQueryList.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import MediaQueryList from '../../src/match-media/MediaQueryList.js';
import MediaQueryListEvent from '../../src/event/events/MediaQueryListEvent.js';
import { beforeEach, describe, it, expect } from 'vitest';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import Element from '../../src/nodes/element/Element.js';
import NamedNodeMap from '../../src/named-node-map/NamedNodeMap.js';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/navigator/Navigator.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Navigator from '../../src/navigator/Navigator.js';
import { beforeEach, afterEach, describe, it, expect, vi } from 'vitest';
import Permissions from '../../src/permissions/Permissions.js';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/permissions/Permissions.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import PermissionNameEnum from '../../src/permissions/PermissionNameEnum.js';
import { beforeEach, describe, it, expect } from 'vitest';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import HTMLElement from '../../src/nodes/html-element/HTMLElement.js';
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import QuerySelectorHTML from './data/QuerySelectorHTML.js';
import QuerySelectorNthChildHTML from './data/QuerySelectorNthChildHTML.js';
Expand Down
34 changes: 17 additions & 17 deletions packages/happy-dom/test/range/Range.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import Range from '../../src/range/Range.js';
import NodeTypeEnum from '../../src/nodes/node/NodeTypeEnum.js';
import Text from '../../src/nodes/text/Text.js';
import DOMRect from '../../src/nodes/element/DOMRect.js';
import { beforeEach, describe, it, expect } from 'vitest';
import Node from '../../src/nodes/node/Node.js';

describe('Range', () => {
let window: Window;
Expand Down Expand Up @@ -284,7 +284,7 @@ describe('Range', () => {
paragraph.innerHTML = 'Example: <i>italic</i> and <b>bold</b>';

range.setStart(paragraph.firstChild, 2);
range.setEnd(paragraph.querySelector('b').firstChild, 3);
range.setEnd((<Node>paragraph.querySelector('b')).firstChild, 3);

const documentFragment = range.cloneContents();

Expand All @@ -299,8 +299,8 @@ describe('Range', () => {

paragraph.innerHTML = 'Example: <i>italic</i> and <b>bold</b>';

range.setStart(paragraph.querySelector('i').firstChild, 2);
range.setEnd(paragraph.querySelector('b').firstChild, 3);
range.setStart((<Node>paragraph.querySelector('i')).firstChild, 2);
range.setEnd((<Node>paragraph.querySelector('b')).firstChild, 3);

const documentFragment = range.cloneContents();

Expand All @@ -317,7 +317,7 @@ describe('Range', () => {
paragraph.innerHTML = 'Example: <i>italic</i> and <b>bold</b>';

range.setStart(paragraph.firstChild, 2);
range.setEnd(paragraph.querySelector('b').firstChild, 3);
range.setEnd((<Node>paragraph.querySelector('b')).firstChild, 3);

const clone = range.cloneRange();

Expand Down Expand Up @@ -351,7 +351,7 @@ describe('Range', () => {
paragraph.innerHTML = 'Example: <i>italic</i> and <b>bold</b>';

range.setStart(paragraph.firstChild, 2);
range.setEnd(paragraph.querySelector('b').firstChild, 3);
range.setEnd((<Node>paragraph.querySelector('b')).firstChild, 3);

range.deleteContents();

Expand All @@ -374,7 +374,7 @@ describe('Range', () => {
document.body.appendChild(paragraph);

range.setStart(paragraph.firstChild, 2);
range.setEnd(paragraph.querySelector('b').firstChild, 3);
range.setEnd((<Node>paragraph.querySelector('b')).firstChild, 3);

const documentFragment = range.extractContents();

Expand Down Expand Up @@ -406,9 +406,9 @@ describe('Range', () => {
const paragraph = document.body.children[0];

range.setStart(paragraph.firstChild, 2);
range.setEnd(paragraph.querySelector('b').firstChild, 3);
range.setEnd((<Node>paragraph.querySelector('b')).firstChild, 3);

expect(range.isPointInRange(paragraph.querySelector('i').firstChild, 2)).toBe(true);
expect(range.isPointInRange((<Node>paragraph.querySelector('i')).firstChild, 2)).toBe(true);
expect(range.isPointInRange(document.body.children[1], 1)).toBe(false);
expect(range.isPointInRange(document.body.children[1].firstChild, 2)).toBe(false);
});
Expand All @@ -421,7 +421,7 @@ describe('Range', () => {
const paragraph = document.body.children[0];

range.setStart(paragraph.firstChild, 2);
range.setEnd(paragraph.querySelector('b').firstChild, 3);
range.setEnd((<Node>paragraph.querySelector('b')).firstChild, 3);

const newNode = document.createElement('u');
newNode.innerHTML = 'New node';
Expand All @@ -441,10 +441,10 @@ describe('Range', () => {
const paragraph = document.body.children[0];

range.setStart(paragraph.firstChild, 2);
range.setEnd(paragraph.querySelector('b').firstChild, 3);
range.setEnd((<Node>paragraph.querySelector('b')).firstChild, 3);

expect(range.intersectsNode(paragraph.querySelector('i'))).toBe(true);
expect(range.intersectsNode(paragraph.querySelector('i').firstChild)).toBe(true);
expect(range.intersectsNode(<Node>paragraph.querySelector('i'))).toBe(true);
expect(range.intersectsNode((<Node>paragraph.querySelector('i')).firstChild)).toBe(true);
expect(range.intersectsNode(document.body.children[1])).toBe(false);
expect(range.intersectsNode(document.body.children[1].firstChild)).toBe(false);
});
Expand All @@ -456,7 +456,7 @@ describe('Range', () => {

paragraph.innerHTML = 'Example: <i>italic</i> and <b>bold</b>';

const italic = paragraph.querySelector('i');
const italic = <Node>paragraph.querySelector('i');

range.selectNode(italic);

Expand All @@ -473,7 +473,7 @@ describe('Range', () => {

paragraph.innerHTML = 'Example: <i>italic</i> and <b>bold</b>';

const italic = paragraph.querySelector('i');
const italic = <Node>paragraph.querySelector('i');

range.selectNodeContents(italic);

Expand All @@ -488,7 +488,7 @@ describe('Range', () => {

paragraph.innerHTML = 'Example: <i>italic</i> and <b>bold</b>';

const text = paragraph.querySelector('i').firstChild;
const text = (<Node>paragraph.querySelector('i')).firstChild;

range.selectNodeContents(text);

Expand All @@ -505,7 +505,7 @@ describe('Range', () => {

paragraph.innerHTML = 'Example: <i>italic</i> and <b>bold</b>';

const italic = paragraph.querySelector('i');
const italic = <Node>paragraph.querySelector('i');

range.selectNodeContents(italic);

Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/selection/Selection.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import Selection from '../../src/selection/Selection.js';
import SelectionDirectionEnum from '../../src/selection/SelectionDirectionEnum.js';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/tree-walker/NodeIterator.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import NodeFilter from '../../src/tree-walker/NodeFilter.js';
import Element from '../../src/nodes/element/Element.js';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/tree-walker/TreeWalker.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import NodeFilter from '../../src/tree-walker/NodeFilter.js';
import Element from '../../src/nodes/element/Element.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import HTMLInputElement from '../../src/nodes/html-input-element/HTMLInputElement.js';
import { beforeEach, describe, it, expect } from 'vitest';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/window/DetachedWindowAPI.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import HTTP from 'http';
import Stream from 'stream';
import { beforeEach, afterEach, describe, it, expect, vi } from 'vitest';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/window/Window.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Document from '../../src/nodes/document/Document.js';
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Headers from '../../src/fetch/Headers.js';
import CustomElement from '../../test/CustomElement.js';
import Response from '../../src/fetch/Response.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import XMLHttpRequest from '../../src/xml-http-request/XMLHttpRequest.js';
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import XMLHttpRequestReadyStateEnum from '../../src/xml-http-request/XMLHttpRequestReadyStateEnum.js';
import XMLHttpResponseTypeEnum from '../../src/xml-http-request/XMLHttpResponseTypeEnum.js';
import ProgressEvent from '../../src/event/events/ProgressEvent.js';
Expand Down
1 change: 0 additions & 1 deletion packages/happy-dom/test/xml-parser/XMLParser.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import XMLParser from '../../src/xml-parser/XMLParser.js';
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import Node from '../../src/nodes/node/Node.js';
import HTMLElement from '../../src/nodes/html-element/HTMLElement.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import XMLSerializer from '../../src/xml-serializer/XMLSerializer.js';
import Window from '../../src/window/Window.js';
import Window from '../../src/window/Window.js';
import Document from '../../src/nodes/document/Document.js';
import CustomElement from '../CustomElement.js';
import { beforeEach, afterEach, describe, it, expect } from 'vitest';
Expand Down

0 comments on commit 4edd575

Please sign in to comment.