Socket
Socket
Sign inDemoInstall

svelte-dev-helper

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-dev-helper - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

test/fixtures/mockComponentWithStaticStuff.js

5

lib/proxy.js

@@ -215,5 +215,6 @@ import Registry from './registry';

//forward static properties and methods
const originalComponent = Registry.get(id).component;
if (originalComponent.preload) {
proxyComponent.preload = originalComponent.preload;
for (let key in originalComponent) {
proxyComponent[key] = originalComponent[key];
}

@@ -220,0 +221,0 @@

2

package.json
{
"name": "svelte-dev-helper",
"version": "1.1.3",
"version": "1.1.4",
"description": "Helper for svelte components to ease development",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -9,3 +9,3 @@ /* global describe, it */

const ErrorComponent = require('./fixtures/mockComponentWithError').default;
const PreloadComponent = require('./fixtures/mockComponentWithPreload').default;
const ComponentWithStatic = require('./fixtures/mockComponentWithStaticStuff').default;

@@ -37,3 +37,3 @@ chai.use(sinonChai);

const id = 'fixtures\\mockComponent.html';
const idPreload = 'fixtures\\mockComponentWithPreload.html';
const idStatic = 'fixtures\\mockComponentWithPreload.html';
const allMethods = 'get,fire,observe,on,set,teardown,_recompute,_set,_mount,_unmount,destroy,_register,_rerender'.split(',');

@@ -48,3 +48,4 @@ const straightProxiedMethods = allMethods.slice(0, 7);

SpiedErrorComponent = spy(ErrorComponent),
SpiedPreload = spy(PreloadComponent, 'preload');
SpiedPreload = spy(ComponentWithStatic, 'preload'),
SpiedBar = spy(ComponentWithStatic, 'bar');

@@ -57,5 +58,5 @@ Registry.set(id, {

Registry.set(idPreload, {
Registry.set(idStatic, {
rollback: null,
component: PreloadComponent,
component: ComponentWithStatic,
instances: []

@@ -66,3 +67,3 @@ });

wrappedComponent = new Wrapped({}),
PreloadWrapped = createProxy(idPreload);
WrappedWithStatic = createProxy(idStatic);

@@ -75,7 +76,13 @@ let methodSpies = {};

it('should forward calls to static preload method', function() {
PreloadWrapped.preload();
it('should forward calls to static methods', function() {
WrappedWithStatic.preload();
WrappedWithStatic.bar();
expect(SpiedPreload).to.be.calledOnce;
expect(SpiedBar).to.be.calledOnce;
});
it('should forward static properties', function() {
expect(WrappedWithStatic.foo).to.eq(42);
});
it('should contain the right component and instance in Registry', function() {

@@ -82,0 +89,0 @@ const item = Registry.get(id);

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