Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: E2E tests

on:
push:
branches: [main, next]
pull_request:
workflow_dispatch:

jobs:
run-tests:
name: E2E tests
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Check out repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 18

- run: npm ci
- run: npm run build
- run: npm run test:e2e:install

- name: Run tests
run: npm run test:e2e

- uses: daun/playwright-report-summary@v2
with:
report-file: playwright-results.json
28 changes: 28 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Unit tests

on:
push:
branches: [main, next]
pull_request:
workflow_dispatch:

jobs:
run-tests:
name: Run unit tests
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Check out repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 18

- run: npm ci
- run: npm run build

- name: Run tests
run: npm run test:unit
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Swup Scroll plugin
# Swup Scroll Plugin

[![Unit Tests](https://img.shields.io/github/actions/workflow/status/swup/scroll-plugin/unit-tests.yml?branch=next&label=unit%20tests)](https://github.com/swup/scroll-plugin/actions/workflows/unit-tests.yml)
[![E2E Tests](https://img.shields.io/github/actions/workflow/status/swup/scroll-plugin/e2e-tests.yml?branch=next&label=e2e%20tests)](https://github.com/swup/scroll-plugin/actions/workflows/e2e-tests.yml)
[![License](https://img.shields.io/github/license/swup/scroll-plugin.svg)](https://github.com/swup/scroll-plugin/blob/main/LICENSE)

A [swup](https://swup.js.org) plugin for customizable smooth scrolling.

Expand Down Expand Up @@ -98,10 +102,6 @@ For finer control, you can pass an object:
}
```

### scrollFriction and scrollAcceleration

The animation behavior of the scroll animation can be adjusted by setting `scrollFriction` and `scrollAcceleration`.

### getAnchorElement

Customize how the scroll target is found on the page. Defaults to standard browser behavior (`#id` first, `a[name]` second).
Expand Down Expand Up @@ -190,8 +190,6 @@ new SwupScrollPlugin({
samePageWithHash: true,
samePage: true
},
scrollFriction: 0.3,
scrollAcceleration: 0.04,
getAnchorElement: null,
markScrollTarget: false,
offset: 0,
Expand Down Expand Up @@ -260,4 +258,4 @@ swup.scrollTo = (offset, animate, scrollingElement) => {
});
};

```
```
Loading
Loading