Skip to content

Commit

Permalink
prettier --write .
Browse files Browse the repository at this point in the history
  • Loading branch information
dcsaszar committed Mar 23, 2020
1 parent 58b4716 commit c695a4d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import { createBrowserHistory } from "history";

scrollToFragment({
// customize the target of a given fragment ID (default is getElementById):
getElement: fragmentId => document.getElementsByName(fragmentId)[0],
getElement: (fragmentId) => document.getElementsByName(fragmentId)[0],

// adjust the scroll position after history PUSH events:
history: createBrowserHistory(),

// customize scrolling behavior:
scrollIntoView: element => element.scrollIntoView({ behavior: "smooth" })
scrollIntoView: (element) => element.scrollIntoView({ behavior: "smooth" }),
});
```

Expand Down
6 changes: 3 additions & 3 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = function(config) {
module.exports = function (config) {
config.set({
frameworks: ["jasmine", "karma-typescript"],
files: ["spec/**/*.ts", "src/**/*.ts"],
preprocessors: {
"**/*.ts": ["karma-typescript"]
"**/*.ts": ["karma-typescript"],
},
reporters: ["progress", "karma-typescript"],
browsers: process.env.KARMA_BROWSER
? process.env.KARMA_BROWSER.split(",")
: ["ChromeHeadless", "FirefoxHeadless"]
: ["ChromeHeadless", "FirefoxHeadless"],
});
};
8 changes: 4 additions & 4 deletions spec/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { scrollToFragment } from "../src/index";

describe("scrollToFragment", () => {
beforeEach(done => {
beforeEach((done) => {
document.body.innerHTML = "";
document.body.insertAdjacentHTML(
"beforeend",
Expand All @@ -28,7 +28,7 @@ describe("scrollToFragment", () => {
});

describe("clicking a link to a different page", () => {
beforeEach(done => {
beforeEach((done) => {
window.scrollTo(0, 444);
document.getElementById("other").click();
wait(done);
Expand All @@ -40,7 +40,7 @@ describe("scrollToFragment", () => {
});

describe("clicking a hash link to the same page", () => {
beforeEach(done => {
beforeEach((done) => {
window.scrollTo(0, 444);
document.getElementById("same").click();
wait(done);
Expand All @@ -63,7 +63,7 @@ describe("scrollToFragment", () => {
});

describe("if the fragment appears later", () => {
beforeEach(done => {
beforeEach((done) => {
document
.getElementById("bottom")
.insertAdjacentHTML("beforebegin", "<h1 id='barbaz'>H1</h1>");
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function scrollToFragment(options: Options = {}) {
currentOptions = {
getElement: options.getElement ?? getElementById,
history: options.history,
scrollIntoView: options.scrollIntoView ?? scrollIntoView
scrollIntoView: options.scrollIntoView ?? scrollIntoView,
};

mount();
Expand Down Expand Up @@ -105,7 +105,7 @@ const OBSERVER_CONFIG = {
attributes: true,
characterData: true,
childList: true,
subtree: true
subtree: true,
};

const OBSERVE_TIMEOUT_MS = 10000;

0 comments on commit c695a4d

Please sign in to comment.