Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
binrysearch committed Jun 30, 2024
1 parent b26e4eb commit 110513f
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 328 deletions.
13 changes: 13 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Tour } from "./packages/tour";
import introJs from "./index";
import { Hint } from "./packages/hint";

describe("index", () => {
it("should create a new instance of Tour", () => {
Expand All @@ -13,4 +14,16 @@ describe("index", () => {
// Assert
expect(tourInstance).toBeInstanceOf(Tour);
});

it("should create a new instance of Hint", () => {
// Arrange
const stubElement = document.createElement("div");
jest.spyOn(document, "createElement").mockReturnValue(stubElement);

// Act
const hintInstance = introJs.hint(stubElement);

// Assert
expect(hintInstance).toBeInstanceOf(Hint);
});
});
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { version } from "../package.json";
import { Hint } from "./packages/hint/hint";
import { Hint } from "./packages/hint";
import { Tour } from "./packages/tour";

/**
Expand All @@ -13,6 +13,10 @@ const introJs = {
tour: (elementOrSelector?: string | HTMLElement) =>
new Tour(elementOrSelector),

/**
* Create a new Intro.js Hint instance
* @param elementOrSelector Optional target element to start the Hint on
*/
hint: (elementOrSelector?: string | HTMLElement) =>
new Hint(elementOrSelector),

Expand Down
320 changes: 0 additions & 320 deletions src/intro.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/packages/hint/hide.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Hint } from "./hint";
import { hideHintClassName } from "./className";
import { addClass } from "src/util/className";
import { addClass } from "../../util/className";
import { removeHintTooltip } from "./tooltip";
import { dataStepAttribute } from "./dataAttributes";
import { hintElement, hintElements } from "./selector";
Expand Down
6 changes: 3 additions & 3 deletions src/packages/hint/hint.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Package } from "../package";
import { getDefaultHintOptions, HintOptions } from "./option";
import { fetchHintItems, HintItem } from "./hintItem";
import { setOption, setOptions } from "src/option";
import { setOption, setOptions } from "../../option";
import isFunction from "../../util/isFunction";
import debounce from "../../util/debounce";
import { reAlignHints } from "./position";
import DOMEvent from "src/util/DOMEvent";
import { getContainerElement } from "src/util/containerElement";
import DOMEvent from "../../util/DOMEvent";
import { getContainerElement } from "../../util/containerElement";
import { renderHints } from "./render";
import { hideHint, hideHints } from "./hide";
import { showHint, showHints } from "./show";
Expand Down
1 change: 1 addition & 0 deletions src/packages/hint/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Hint } from "./hint";
2 changes: 1 addition & 1 deletion src/packages/hint/position.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import getOffset from "src/util/getOffset";
import getOffset from "../../util/getOffset";
import { HintPosition } from "./hintItem";
import { Hint } from "./hint";

Expand Down
Loading

0 comments on commit 110513f

Please sign in to comment.