Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tipiirai committed Mar 6, 2024
1 parent 9c1c8ee commit 2f24f6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/nuekit/src/browser/app-router.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// Router for single-page applications
import { onclick, loadPage, setSelected } from './page-router.js'
import { onclick, loadPage, setActive } from './page-router.js'

const is_browser = typeof window == 'object'

Expand All @@ -11,7 +11,7 @@ async function fire(path) {
const data = match(pattern, path)
if (data) await fn(data)
}
setSelected(path)
setActive(path)
}

// clear existing routes
Expand Down
10 changes: 5 additions & 5 deletions packages/nuekit/src/browser/page-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ const is_browser = typeof window == 'object'

if (is_browser) {

// view transition fallback (Safari, Firefox) • caniuse.com/view-transitions
if (!document.startViewTransition) {
document.startViewTransition = (fn) => fn()
}

// Fix: window.onpopstate, event.state == null?
// https://stackoverflow.com/questions/11092736/window-onpopstate-event-state-null
history.pushState({ path: location.pathname }, 0)
Expand Down Expand Up @@ -116,11 +121,6 @@ if (is_browser) {

/* -------- utilities ---------- */

// view transition fallback (Safari, Firefox) • caniuse.com/view-transitions
if (!document.startViewTransition) {
document.startViewTransition = (fn) => fn()
}

function $(query, root=document) {
return root.querySelector(query)
}
Expand Down

0 comments on commit 2f24f6c

Please sign in to comment.