diff --git a/client/modules/edit-names.mjs b/client/modules/edit-names.mjs index d2ffc0b9..7ea3b4b6 100644 --- a/client/modules/edit-names.mjs +++ b/client/modules/edit-names.mjs @@ -213,4 +213,3 @@ export async function isChanged() { !cancel && await applyNames(); } - diff --git a/client/modules/polyfill.js b/client/modules/polyfill.mjs similarity index 50% rename from client/modules/polyfill.js rename to client/modules/polyfill.mjs index ff0e59c5..90b62689 100644 --- a/client/modules/polyfill.js +++ b/client/modules/polyfill.mjs @@ -1,12 +1,8 @@ -'use strict'; - -require('domtokenlist-shim'); - -const _scrollIntoViewIfNeeded = require('scroll-into-view-if-needed'); +import _scrollIntoViewIfNeeded from 'scroll-into-view-if-needed'; globalThis.DOM = globalThis.DOM || {}; -const scrollIntoViewIfNeeded = (el, overrides = {}) => { +export const scrollIntoViewIfNeeded = (el, overrides = {}) => { const { scroll = _scrollIntoViewIfNeeded, } = overrides; @@ -17,4 +13,3 @@ const scrollIntoViewIfNeeded = (el, overrides = {}) => { }; globalThis.DOM.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded; -module.exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded; diff --git a/client/modules/polyfill.spec.js b/client/modules/polyfill.spec.js deleted file mode 100644 index 79d9dfda..00000000 --- a/client/modules/polyfill.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -const {test, stub} = require('supertape'); -const {scrollIntoViewIfNeeded} = require('./polyfill'); - -test('cloudcmd: client: polyfill: scrollIntoViewIfNeaded', (t) => { - const scroll = stub(); - const el = {}; - - scrollIntoViewIfNeeded(el, { - scroll, - }); - - const args = [ - el, { - block: 'nearest', - }, - ]; - - t.calledWith(scroll, args, 'should call scrollIntoViewIfNeaded'); - t.end(); -}); diff --git a/client/modules/polyfill.spec.mjs b/client/modules/polyfill.spec.mjs new file mode 100644 index 00000000..f595be64 --- /dev/null +++ b/client/modules/polyfill.spec.mjs @@ -0,0 +1,20 @@ +import {test, stub} from 'supertape'; +import {scrollIntoViewIfNeeded} from './polyfill.mjs'; + +test('cloudcmd: client: polyfill: scrollIntoViewIfNeeded', (t) => { + const scroll = stub(); + const el = {}; + + scrollIntoViewIfNeeded(el, { + scroll, + }); + + const args = [ + el, { + block: 'nearest', + }, + ]; + + t.calledWith(scroll, args, 'should call scrollIntoViewIfNeeded'); + t.end(); +});