Skip to content

Commit

Permalink
fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mreinstein committed Sep 7, 2022
1 parent e85e863 commit 3436f3e
Showing 4 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -16,10 +16,11 @@
"examples": "serve .",
"predeploy": "npm run test",
"prepublishOnly": "npm run predeploy",
"test": "node test"
"test": "node test/index.js"
},
"devDependencies": {
"browser-env": "^3.3.0",
"resize-observer-polyfill": "^1.5.1",
"serve": "^14.0.0",
"tape": "^5.2.2"
},
2 changes: 1 addition & 1 deletion snabbdom-containerquery.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

// today it's more performant to have 1 resizeObserver observe multiple elements rather than 1 per element.
// see https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ
const observer = new ResizeObserver(function (entries) {
const observer = new window.ResizeObserver(function (entries) {
for (const entry of entries) {
const breakpoints = JSON.parse(entry.target.dataset.breakpoints);

15 changes: 15 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import browserEnv from 'browser-env'
import ResizeObserver from 'resize-observer-polyfill'


browserEnv()

// browser-env doesn't provide browser APIs beyond pure DOM/window stuff
window.ResizeObserver = ResizeObserver
window.requestAnimationFrame = function () { }

async function main () {
await import('./test.js');
}

main();
6 changes: 1 addition & 5 deletions test.js → test/test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import browserEnv from 'browser-env'
import snabby from './index.js'
import snabby from '../index.js'
import { h } from 'snabbdom' // helper function for creating vnodes
import test from 'tape'


browserEnv()


test('creation', function (t) {
t.plan(2)

0 comments on commit 3436f3e

Please sign in to comment.