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 04be9be commit 32d51ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import PointerEvent from '../../../src/event/events/PointerEvent.js';
import Document from '../../../src/nodes/document/Document.js';
import HTMLElement from '../../../src/nodes/html-element/HTMLElement.js';
import HTMLElementUtility from '../../../src/nodes/html-element/HTMLElementUtility.js';
import HTMLElement from '../../../src/nodes/html-element/HTMLElement.js';
import SVGElement from '../../../src/nodes/svg-element/SVGElement.js';
import Window from '../../../src/window/Window.js';
import CustomElement from '../../CustomElement.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import ResourceFetch from '../../../src/fetch/ResourceFetch.js';
import { beforeEach, afterEach, describe, it, expect, vi } from 'vitest';
import Event from '../../../src/event/Event.js';
import ErrorEvent from '../../../src/event/events/ErrorEvent.js';
import Window from '../../../src/window/Window.js';
import BrowserWindow from '../../../src/window/BrowserWindow.js';
import Fetch from '../../../src/fetch/Fetch.js';
import BrowserErrorCaptureEnum from '../../../src/browser/enums/BrowserErrorCaptureEnum.js';
Expand Down
13 changes: 7 additions & 6 deletions packages/happy-dom/test/nodes/shadow-root/ShadowRoot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import HTMLElement from '../../../src/nodes/html-element/HTMLElement.js';
import Window from '../../../src/window/Window.js';
import Document from '../../../src/nodes/document/Document.js';
import CustomElement from '../../CustomElement.js';
import ShadowRoot from '../../../src/nodes/shadow-root/ShadowRoot.js';
import { beforeEach, describe, it, expect } from 'vitest';

describe('ShadowRoot', () => {
Expand All @@ -16,7 +17,7 @@ describe('ShadowRoot', () => {

describe('set innerHTML()', () => {
it('Sets the innerHTML of the shadow root.', () => {
const shadowRoot = document.createElement('custom-element').shadowRoot;
const shadowRoot = <ShadowRoot>document.createElement('custom-element').shadowRoot;
shadowRoot.innerHTML = '<div attr1="value1" attr2="value2"><span>Test</span></div>';
expect(shadowRoot.childNodes.length).toBe(1);
expect(shadowRoot.childNodes[0].childNodes.length).toBe(1);
Expand All @@ -28,7 +29,7 @@ describe('ShadowRoot', () => {
describe('get innerHTML()', () => {
it('Returns the innerHTML of the shadow root.', () => {
const html = '<div attr1="value1" attr2="value2"><span>Test</span></div>';
const shadowRoot = document.createElement('custom-element').shadowRoot;
const shadowRoot = <ShadowRoot>document.createElement('custom-element').shadowRoot;
shadowRoot.innerHTML = html;
expect(shadowRoot.innerHTML).toBe(html);
});
Expand All @@ -37,7 +38,7 @@ describe('ShadowRoot', () => {
describe('get activeElement()', () => {
it('Returns the currently active element within the ShadowRoot.', () => {
const customElement = document.createElement('custom-element');
const shadowRoot = customElement.shadowRoot;
const shadowRoot = <ShadowRoot>customElement.shadowRoot;
const div = <HTMLElement>document.createElement('div');
const span = <HTMLElement>document.createElement('span');

Expand Down Expand Up @@ -69,7 +70,7 @@ describe('ShadowRoot', () => {

it('Unsets the active element when it gets disconnected.', () => {
const customElement = document.createElement('custom-element');
const shadowRoot = customElement.shadowRoot;
const shadowRoot = <ShadowRoot>customElement.shadowRoot;
const div = <HTMLElement>document.createElement('div');

document.body.appendChild(customElement);
Expand All @@ -91,15 +92,15 @@ describe('ShadowRoot', () => {
describe('toString()', () => {
it('Returns the innerHTML of the shadow root.', () => {
const html = '<div attr1="value1" attr2="value2"><span>Test</span></div>';
const shadowRoot = document.createElement('custom-element').shadowRoot;
const shadowRoot = <ShadowRoot>document.createElement('custom-element').shadowRoot;
shadowRoot.innerHTML = html;
expect(shadowRoot.toString()).toBe(html);
});
});

describe('cloneNode()', () => {
it('Clones the value of the "mode" property when cloned.', () => {
const shadowRoot = document.createElement('custom-element').shadowRoot;
const shadowRoot = <ShadowRoot>document.createElement('custom-element').shadowRoot;
const clone = shadowRoot.cloneNode();
expect(shadowRoot.mode).toBe('open');
expect(clone.mode).toBe('open');
Expand Down

0 comments on commit 32d51ea

Please sign in to comment.