svelte-dev-helper
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -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 @@ |
{ | ||
"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); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21844
480