Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nrk/core-scroll

Package Overview
Dependencies
Maintainers
125
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nrk/core-scroll - npm Package Compare versions

Comparing version 4.1.1 to 4.1.2

16

core-scroll.cjs.js

@@ -323,14 +323,14 @@ 'use strict';

var CoreScoll =
var CoreScroll =
/*#__PURE__*/
function (_HTMLElement) {
_inherits(CoreScoll, _HTMLElement);
_inherits(CoreScroll, _HTMLElement);
function CoreScoll() {
_classCallCheck(this, CoreScoll);
function CoreScroll() {
_classCallCheck(this, CoreScroll);
return _possibleConstructorReturn(this, _getPrototypeOf(CoreScoll).apply(this, arguments));
return _possibleConstructorReturn(this, _getPrototypeOf(CoreScroll).apply(this, arguments));
}
_createClass(CoreScoll, [{
_createClass(CoreScroll, [{
key: "connectedCallback",

@@ -465,3 +465,3 @@ value: function connectedCallback() {

return CoreScoll;
return CoreScroll;
}(_wrapNativeSuper(HTMLElement));

@@ -550,2 +550,2 @@

module.exports = CoreScoll;
module.exports = CoreScroll;

@@ -16,3 +16,3 @@ import { IS_BROWSER, addStyle, closest, dispatchEvent, throttle, getUUID, queryAll } from '../utils'

export default class CoreScoll extends HTMLElement {
export default class CoreScroll extends HTMLElement {
connectedCallback () {

@@ -19,0 +19,0 @@ // Hide scrollbar in WebKit and default to display block

@@ -329,14 +329,14 @@ (function (global, factory) {

var CoreScoll =
var CoreScroll =
/*#__PURE__*/
function (_HTMLElement) {
_inherits(CoreScoll, _HTMLElement);
_inherits(CoreScroll, _HTMLElement);
function CoreScoll() {
_classCallCheck(this, CoreScoll);
function CoreScroll() {
_classCallCheck(this, CoreScroll);
return _possibleConstructorReturn(this, _getPrototypeOf(CoreScoll).apply(this, arguments));
return _possibleConstructorReturn(this, _getPrototypeOf(CoreScroll).apply(this, arguments));
}
_createClass(CoreScoll, [{
_createClass(CoreScroll, [{
key: "connectedCallback",

@@ -471,3 +471,3 @@ value: function connectedCallback() {

return CoreScoll;
return CoreScroll;
}(_wrapNativeSuper(HTMLElement));

@@ -556,3 +556,3 @@

var version = "4.1.1";
var version = "4.1.2";

@@ -697,3 +697,3 @@ /**

var coreScroll = customElementToReact(CoreScoll, {
var coreScroll = customElementToReact(CoreScroll, {
customEvents: ['scroll.change', 'scroll.click'],

@@ -700,0 +700,0 @@ suffix: version

@@ -1,3 +0,3 @@

/*! @nrk/core-scroll v4.1.1 - Copyright (c) 2017-2019 NRK */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).coreScroll=e()}(this,function(){"use strict";function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t,e,n){return(i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return n&&c(i,n.prototype),i}).apply(null,arguments)}function a(t){var o="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||(e=t,-1===Function.toString.call(e).indexOf("[native code]")))return t;var e;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==o){if(o.has(t))return o.get(t);o.set(t,n)}function n(){return i(t,arguments,s(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),c(n,t)})(t)}function f(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var t="undefined"!=typeof window;t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform));t||global.HTMLElement||(global.HTMLElement=function(){return function t(){r(this,t)}}());var e,n,d=(e="undefined"==typeof window?{}:window.Element.prototype,n=e.matches||e.msMatchesSelector||e.webkitMatchesSelector,e.closest?function(t,e){return t.closest(e)}:function(t,e){for(;t;t=t.parentElement)if(n.call(t,e))return t;return null});function h(t,e){var n,o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},i="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[i])return!0;t[i]=!0,"function"==typeof window.CustomEvent?n=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:o}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,o);var r=t.dispatchEvent(n);return t[i]=null,r}function p(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document;if(t){if(t.nodeType)return[t];if("string"==typeof t)return[].slice.call(e.querySelectorAll(t));if(t.length)return[].slice.call(t)}return[]}var m={},v={up:{y:-1,prop:"top"},down:{y:1,prop:"bottom"},left:{x:-1},right:{x:1}},o=10,y=function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];try{window.addEventListener("test",null,{get passive(){t={passive:!0}}})}catch(t){}return t}(),g=t&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion)").matches,b=t&&(window.requestAnimationFrame||window.setTimeout);function w(t){m.diffX=m.pageX-(m.pageX=t.pageX),m.diffY=m.pageY-(m.pageY=t.pageY),m.diffSumX+=m.diffX,m.diffSumY+=m.diffY,m.target.scrollLeft=m.scrollX+=m.diffX,m.target.scrollTop=m.scrollY+=m.diffY,Math.max(Math.abs(m.diffSumX),Math.abs(m.diffSumY))>o&&(m.target.style.pointerEvents="none")}function E(t){var e=Math.abs(m.diffX||m.diffY)>o?20:0;document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",E),document.body.style.cursor="",e&&m.target.scroll({x:m.scrollX+m.diffX*e,y:m.scrollY+m.diffY*e}),m.target.style.pointerEvents="",m.target.style.cursor="-webkit-grab",m.target.style.cursor="grab",m.target=null}return function(t){function e(){return r(this,e),f(this,s(e).apply(this,arguments))}var n,o,i;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,a(HTMLElement)),n=e,(o=[{key:"connectedCallback",value:function(){var t,e,n,o,i=this;t=this.nodeName,e="\n ".concat(this.nodeName,"{display:block}\n ").concat(this.nodeName,"::-webkit-scrollbar{display:none}\n "),n="style-".concat(t.toLowerCase()),o=e.replace(/\/\*[^!][^*]*\*\//g,"").replace(/\s*(^|[:;,{}]|$)\s*/g,"$1"),document.getElementById(n)||document.head.insertAdjacentHTML("afterbegin",'<style id="'.concat(n,'">').concat(o,"</style>")),this.style.overflow="scroll",this.style.willChange="scroll-position",this.style.webkitOverflowScrolling="touch";var r,l,s,c=this.offsetWidth-this.clientWidth,u=this.offsetHeight-this.clientHeight;this.style.marginRight="-".concat(c,"px"),this.style.marginBottom="-".concat(u,"px"),this.style.maxHeight="calc(100% + ".concat(u,"px)"),this._throttledEvent=(r=this.handleEvent.bind(this),l=500,function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];s||(s=setTimeout(function(){r.apply(this,e),s=null},l))}),this.addEventListener("mousedown",this),this.addEventListener("wheel",this,y),this.addEventListener("scroll",this._throttledEvent,y),window.addEventListener("resize",this._throttledEvent,y),window.addEventListener("load",this),document.addEventListener("click",this),setTimeout(function(){return i.handleEvent()})}},{key:"disconnectedCallback",value:function(){this._throttledEvent=null,this.removeEventListener("mousedown",this),this.removeEventListener("wheel",this,y),this.removeEventListener("scroll",this._throttledEvent,y),window.removeEventListener("resize",this._throttledEvent,y),window.removeEventListener("load",this),document.removeEventListener("click",this)}},{key:"handleEvent",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!t.defaultPrevented)if("wheel"===t.type)m.animate=!1;else if("mousedown"===t.type)(function(t){if(d(t.target,'[contenteditable="true"],input,select,textarea'))return;t.preventDefault(),m.pageX=t.pageX,m.pageY=t.pageY,m.diffSumX=0,m.diffSumY=0,m.animate=m.diffX=m.diffY=0,m.scrollX=this.scrollLeft,m.scrollY=this.scrollTop,m.target=this,document.body.style.cursor=this.style.cursor="-webkit-grabbing",document.body.style.cursor=this.style.cursor="grabbing",document.addEventListener("mousemove",w),document.addEventListener("mouseup",E)}).call(this,t);else if("click"===t.type){var e=this.id&&d(t.target,'[for="'.concat(this.id,'"]'));e&&h(this,"scroll.click",{move:e.value})&&this.scroll(e.value)}else{var n={left:this.scrollLeft,up:this.scrollTop,right:this.scrollRight,down:this.scrollBottom},o=n.left||n.right||n.up||n.down?"grab":"";p(this.id&&'[for="'.concat(this.id,'"]')).forEach(function(t){return t.disabled=!n[t.value]}),h(this,"scroll.change"),t.type||(this.style.cursor="-webkit-".concat(o),this.style.cursor=o)}}},{key:"scroll",value:function(t){var e=this,n=function(t,o){var i="object"===u(o)?o:{move:o};"number"!=typeof i.x&&(i.x=t.scrollLeft);"number"!=typeof i.y&&(i.y=t.scrollTop);if(i.move=v[i.move]){var r=i.move.x?"x":"y",l=i.move.x?"left":"top",e=t.getBoundingClientRect(),s=e[l]-t[i.move.x?"scrollLeft":"scrollTop"],c=e[l]+e[i.move.x?"width":"height"]*i.move[r];t.items.every(function(t){var e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView.getComputedStyle(t)["margin-".concat(l)];return i[r]=e[l]-parseInt(n,10)-s,e[i.move.prop||o]<c})}return{x:Math.max(0,Math.min(i.x,t.scrollWidth-t.clientWidth)),y:Math.max(0,Math.min(i.y,t.scrollHeight-t.clientHeight))}}(this,t),o=n.x,i=n.y,r=m.animate=Date.now().toString(36)+Math.random().toString(36).slice(2,5),l=this.friction,s=g?1:o-this.scrollLeft,c=g?1:i-this.scrollTop;!function t(){m.animate===r&&(Math.round(s)||Math.round(c))&&(e.scrollLeft=o-Math.round(s*=l),e.scrollTop=i-Math.round(c*=l),b(t))}()}},{key:"items",get:function(){return p(this.getAttribute("items")||this.children,this)},set:function(t){this.setAttribute("items",t||"")}},{key:"scrollRight",get:function(){return this.scrollWidth-this.clientWidth-this.scrollLeft}},{key:"scrollBottom",get:function(){return this.scrollHeight-this.clientHeight-this.scrollTop}},{key:"friction",get:function(){return Math.min(.99,this.getAttribute("friction"))||.8},set:function(t){this.setAttribute("friction",t)}}])&&l(n.prototype,o),i&&l(n,i),e}()}),window.customElements.define("core-scroll",coreScroll);
/*! @nrk/core-scroll v4.1.2 - Copyright (c) 2017-2019 NRK */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).coreScroll=e()}(this,function(){"use strict";function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t,e,n){return(c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var i=new(Function.bind.apply(t,o));return n&&r(i,n.prototype),i}).apply(null,arguments)}function l(t){var n="function"==typeof Map?new Map:void 0;return(l=function(t){if(null===t||!function(t){return-1!==Function.toString.call(t).indexOf("[native code]")}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return c(t,arguments,i(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r(e,t)})(t)}function n(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var t="undefined"!=typeof window;t&&/(android)/i.test(navigator.userAgent),t&&/iPad|iPhone|iPod/.test(String(navigator.platform));t||global.HTMLElement||(global.HTMLElement=function(){return function t(){e(this,t)}}());var s,a,f=(s="undefined"==typeof window?{}:window.Element.prototype,a=s.matches||s.msMatchesSelector||s.webkitMatchesSelector,s.closest?function(t,e){return t.closest(e)}:function(t,e){for(;t;t=t.parentElement)if(a.call(t,e))return t;return null});function d(t,e,n){var o,i=2<arguments.length&&void 0!==n?n:{},r="prevent_recursive_dispatch_maximum_callstack".concat(e);if(t[r])return!0;t[r]=!0,"function"==typeof window.CustomEvent?o=new window.CustomEvent(e,{bubbles:!0,cancelable:!0,detail:i}):(o=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i);var c=t.dispatchEvent(o);return t[r]=null,c}function h(t,e){var n=1<arguments.length&&void 0!==e?e:document;if(t){if(t.nodeType)return[t];if("string"==typeof t)return[].slice.call(n.querySelectorAll(t));if(t.length)return[].slice.call(t)}return[]}var p={},m={up:{y:-1,prop:"top"},down:{y:1,prop:"bottom"},left:{x:-1},right:{x:1}},v=10,y=function(t){var e=0<arguments.length&&void 0!==t&&t;try{window.addEventListener("test",null,{get passive(){e={passive:!0}}})}catch(t){}return e}(),g=t&&window.matchMedia&&window.matchMedia("(prefers-reduced-motion)").matches,b=t&&(window.requestAnimationFrame||window.setTimeout);function w(t){p.diffX=p.pageX-(p.pageX=t.pageX),p.diffY=p.pageY-(p.pageY=t.pageY),p.diffSumX+=p.diffX,p.diffSumY+=p.diffY,p.target.scrollLeft=p.scrollX+=p.diffX,p.target.scrollTop=p.scrollY+=p.diffY,Math.max(Math.abs(p.diffSumX),Math.abs(p.diffSumY))>v&&(p.target.style.pointerEvents="none")}function E(t){var e=Math.abs(p.diffX||p.diffY)>v?20:0;document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",E),document.body.style.cursor="",e&&p.target.scroll({x:p.scrollX+p.diffX*e,y:p.scrollY+p.diffY*e}),p.target.style.pointerEvents="",p.target.style.cursor="-webkit-grab",p.target.style.cursor="grab",p.target=null}return function(){function t(){return e(this,t),n(this,i(t).apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}(t,l(HTMLElement)),function(t,e,n){e&&o(t.prototype,e),n&&o(t,n)}(t,[{key:"connectedCallback",value:function(){var t=this;!function(t,e){var n="style-".concat(t.toLowerCase()),o=e.replace(/\/\*[^!][^*]*\*\//g,"").replace(/\s*(^|[:;,{}]|$)\s*/g,"$1");document.getElementById(n)||document.head.insertAdjacentHTML("afterbegin",'<style id="'.concat(n,'">').concat(o,"</style>"))}(this.nodeName,"\n ".concat(this.nodeName,"{display:block}\n ").concat(this.nodeName,"::-webkit-scrollbar{display:none}\n ")),this.style.overflow="scroll",this.style.willChange="scroll-position",this.style.webkitOverflowScrolling="touch";var e=this.offsetWidth-this.clientWidth,n=this.offsetHeight-this.clientHeight;this.style.marginRight="-".concat(e,"px"),this.style.marginBottom="-".concat(n,"px"),this.style.maxHeight="calc(100% + ".concat(n,"px)"),this._throttledEvent=function(o,i){var r;return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];r=r||setTimeout(function(){o.apply(this,e),r=null},i)}}(this.handleEvent.bind(this),500),this.addEventListener("mousedown",this),this.addEventListener("wheel",this,y),this.addEventListener("scroll",this._throttledEvent,y),window.addEventListener("resize",this._throttledEvent,y),window.addEventListener("load",this),document.addEventListener("click",this),setTimeout(function(){return t.handleEvent()})}},{key:"disconnectedCallback",value:function(){this._throttledEvent=null,this.removeEventListener("mousedown",this),this.removeEventListener("wheel",this,y),this.removeEventListener("scroll",this._throttledEvent,y),window.removeEventListener("resize",this._throttledEvent,y),window.removeEventListener("load",this),document.removeEventListener("click",this)}},{key:"handleEvent",value:function(t){var e=0<arguments.length&&void 0!==t?t:{};if(!e.defaultPrevented)if("wheel"===e.type)p.animate=!1;else if("mousedown"===e.type)(function(t){if(f(t.target,'[contenteditable="true"],input,select,textarea'))return;t.preventDefault(),p.pageX=t.pageX,p.pageY=t.pageY,p.diffSumX=0,p.diffSumY=0,p.animate=p.diffX=p.diffY=0,p.scrollX=this.scrollLeft,p.scrollY=this.scrollTop,p.target=this,document.body.style.cursor=this.style.cursor="-webkit-grabbing",document.body.style.cursor=this.style.cursor="grabbing",document.addEventListener("mousemove",w),document.addEventListener("mouseup",E)}).call(this,e);else if("click"===e.type){var n=this.id&&f(e.target,'[for="'.concat(this.id,'"]'));n&&d(this,"scroll.click",{move:n.value})&&this.scroll(n.value)}else{var o={left:this.scrollLeft,up:this.scrollTop,right:this.scrollRight,down:this.scrollBottom},i=o.left||o.right||o.up||o.down?"grab":"";h(this.id&&'[for="'.concat(this.id,'"]')).forEach(function(t){return t.disabled=!o[t.value]}),d(this,"scroll.change"),e.type||(this.style.cursor="-webkit-".concat(i),this.style.cursor=i)}}},{key:"scroll",value:function(t){var e=this,n=function(t,o){var i="object"===u(o)?o:{move:o};"number"!=typeof i.x&&(i.x=t.scrollLeft);"number"!=typeof i.y&&(i.y=t.scrollTop);if(i.move=m[i.move]){var r=i.move.x?"x":"y",c=i.move.x?"left":"top",e=t.getBoundingClientRect(),l=e[c]-t[i.move.x?"scrollLeft":"scrollTop"],s=e[c]+e[i.move.x?"width":"height"]*i.move[r];t.items.every(function(t){var e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView.getComputedStyle(t)["margin-".concat(c)];return i[r]=e[c]-parseInt(n,10)-l,e[i.move.prop||o]<s})}return{x:Math.max(0,Math.min(i.x,t.scrollWidth-t.clientWidth)),y:Math.max(0,Math.min(i.y,t.scrollHeight-t.clientHeight))}}(this,t),o=n.x,i=n.y,r=p.animate=Date.now().toString(36)+Math.random().toString(36).slice(2,5),c=this.friction,l=g?1:o-this.scrollLeft,s=g?1:i-this.scrollTop;!function t(){p.animate===r&&(Math.round(l)||Math.round(s))&&(e.scrollLeft=o-Math.round(l*=c),e.scrollTop=i-Math.round(s*=c),b(t))}()}},{key:"items",get:function(){return h(this.getAttribute("items")||this.children,this)},set:function(t){this.setAttribute("items",t||"")}},{key:"scrollRight",get:function(){return this.scrollWidth-this.clientWidth-this.scrollLeft}},{key:"scrollBottom",get:function(){return this.scrollHeight-this.clientHeight-this.scrollTop}},{key:"friction",get:function(){return Math.min(.99,this.getAttribute("friction"))||.8},set:function(t){this.setAttribute("friction",t)}}]),t}()}),window.customElements.define("core-scroll",coreScroll);
//# sourceMappingURL=core-scroll.min.js.map

@@ -1,32 +0,30 @@

import test from 'ava'
import fs from 'fs'
import path from 'path'
import puppeteer from 'puppeteer'
async function withPage (t, run) {
const browser = await puppeteer.launch()
const page = await browser.newPage()
page.on('console', msg => console.log(msg._text))
await page.addScriptTag({ path: path.join(__dirname, 'core-scroll.min.js') })
try {
await run(t, page)
} finally {
await page.close()
await browser.close()
}
}
const coreScroll = fs.readFileSync(path.resolve(__dirname, 'core-scroll.min.js'), 'utf-8')
const customElements = fs.readFileSync(require.resolve('@webcomponents/custom-elements'), 'utf-8')
test('sets up properties', withPage, async (t, page) => {
await page.setContent(`
<button for="scroller" value="down">Down</button>
<core-scroll id="scroller">
<div>This is overflowing content</div>
<div>This is overflowing content</div>
<div>This is overflowing content</div>
</core-scroll>
`)
t.is(await page.$eval('core-scroll', el => el.style.overflow), 'scroll')
t.is(await page.$eval('core-scroll', el => el.style.webkitOverflowScrolling), 'touch')
t.is(await page.$eval('core-scroll', el => el.style.maxHeight), 'calc(100% + 0px)')
t.is(await page.$eval('core-scroll', el => el.style.marginRight), '0px')
t.is(await page.$eval('core-scroll', el => el.style.marginBottom), '0px')
describe('core-scroll', () => {
beforeEach(async () => {
await browser.refresh()
await browser.executeScript(customElements)
await browser.executeScript(coreScroll)
})
it('sets up properties', async () => {
await browser.executeScript(() => {
document.body.innerHTML = `
<button for="scroller" value="down">Down</button>
<core-scroll id="scroller">
<div>This is overflowing content</div>
<div>This is overflowing content</div>
<div>This is overflowing content</div>
</core-scroll>
`
})
await expect($('core-scroll').getCssValue('overflow')).toEqual('scroll')
await expect($('core-scroll').getCssValue('max-height')).toEqual('100%')
await expect($('core-scroll').getCssValue('margin-right')).toEqual('0px')
await expect($('core-scroll').getCssValue('margin-bottom')).toEqual('0px')
})
})

@@ -327,14 +327,14 @@ 'use strict';

var CoreScoll =
var CoreScroll =
/*#__PURE__*/
function (_HTMLElement) {
_inherits(CoreScoll, _HTMLElement);
_inherits(CoreScroll, _HTMLElement);
function CoreScoll() {
_classCallCheck(this, CoreScoll);
function CoreScroll() {
_classCallCheck(this, CoreScroll);
return _possibleConstructorReturn(this, _getPrototypeOf(CoreScoll).apply(this, arguments));
return _possibleConstructorReturn(this, _getPrototypeOf(CoreScroll).apply(this, arguments));
}
_createClass(CoreScoll, [{
_createClass(CoreScroll, [{
key: "connectedCallback",

@@ -469,3 +469,3 @@ value: function connectedCallback() {

return CoreScoll;
return CoreScroll;
}(_wrapNativeSuper(HTMLElement));

@@ -554,3 +554,3 @@

var version = "4.1.1";
var version = "4.1.2";

@@ -695,3 +695,3 @@ /**

var coreScroll = customElementToReact(CoreScoll, {
var coreScroll = customElementToReact(CoreScroll, {
customEvents: ['scroll.change', 'scroll.click'],

@@ -698,0 +698,0 @@ suffix: version

@@ -5,3 +5,3 @@ {

"author": "NRK <opensource@nrk.no> (https://www.nrk.no/)",
"version": "4.1.1",
"version": "4.1.2",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "core-scroll.cjs.js",

@@ -245,3 +245,3 @@ # Core Scroll

// Example check if the event.target is the correct @nrk/core-scoll
// Example check if the event.target is the correct @nrk/core-scroll
if (event.target.id === 'ID-OF-MY-CORE-SCROLL-HERE') {

@@ -248,0 +248,0 @@ // Do Something

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc