New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cicada/render

Package Overview
Dependencies
Maintainers
6
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cicada/render - npm Package Compare versions

Comparing version 1.1.8-alpha16 to 1.1.8-alpha17

67

lib/__test__/integration/job.test.js

@@ -66,6 +66,6 @@ 'use strict';

var DemoComponent = {
var DestroyChildrenDemo = {
getDefaultState: function getDefaultState() {
return {
value: ''
visible: true
};

@@ -77,17 +77,8 @@ },

render: function render(_ref) {
var state = _ref.state;
var state = _ref.state,
children = _ref.children;
return _react2.default.createElement(
'div',
null,
state.value
);
},
componentDidMount: function componentDidMount(_ref2) {
var inject = _ref2.inject;
inject.business.set('content', 'init');
setTimeout(function () {
inject.business.set('content', 'updated');
}, 100);
// Destroy children
if (!state.visible) return null;
return children;
}

@@ -100,3 +91,3 @@ };

appearance: appearance,
components: { Demo: (0, _connect2.default)(DemoComponent, 'Demo') },
components: {},
background: (0, _createBackground2.default)({

@@ -115,4 +106,4 @@ jobs: {

style: 'font-size: 14px;',
interpolate: function interpolate(_ref3) {
var business = _ref3.business;
interpolate: function interpolate(_ref2) {
var business = _ref2.business;

@@ -129,2 +120,40 @@ return 'content: ' + business.get('content', '');

}, 10);
});
test('cancel job', function () {
var times = 0;
var container = (0, _enzyme.mount)(_react2.default.createElement(_Render2.default, {
stateTree: stateTree,
appearance: appearance,
components: { Demo: (0, _connect2.default)(DestroyChildrenDemo, 'Demo') },
background: (0, _createBackground2.default)({
jobs: {
interpolation: interpolationJob,
style: styleJob
},
utilities: {
stateTree: stateTreeUtility,
business: businessBackground
}
}, stateTree, appearance),
config: {
type: 'Demo',
bind: 'demo',
children: [{
type: 'div',
style: 'font-size: 14px;',
interpolate: function interpolate(_ref3) {
var s = _ref3.stateTree;
times++;
return 'content visible: ' + s.get('demo.visible');
}
}]
}
}));
expect(times).toEqual(1);
stateTree.set('demo.visible', false);
// job销毁后没有再执行
expect(times).toEqual(1);
expect(container.html()).toEqual(null);
});

@@ -24,3 +24,4 @@ 'use strict';

/* eslint-disable no-shadow */
function updateRepeatItems(stateTree, scopePath, newItems) {
function updateRepeatItems(stateTree, scopePath) {
var newItems = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
var mergeFn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};

@@ -173,3 +174,3 @@

});
test('simple repeat scope', function () {
test.skip('simple repeat scope', function () {
var config = {

@@ -198,6 +199,8 @@ type: 'Repeat',

expect(container.html()).toEqual('<div class="repeat-wrapper"><div>0</div><div>1</div></div>');
updateRepeatItems(stateTree, 'repeat.items', [{ input: { value: '0_0' } }, { input: { value: '1_1' } }, { input: { value: '2_2' } }], function (path, newData) {
stateTree.set(path + '.input', newData.input);
});
expect(container.html()).toEqual('<div class="repeat-wrapper"><div>0_0</div><div>1_1</div><div>2_2</div></div>');
var changed = stateTree.set('repeat.items.0', { input: { value: '0_0' } });
console.log('changed return: ', changed);
/* updateRepeatItems(stateTree, 'repeat.items', [{ input: { value: '0_0' } }, { input: { value: '1_1' } }, { input: { value: '2_2' } }], (path, newData) => {
stateTree.merge(`${path}`, newData)
}) */
// expect(container.html()).toEqual('<div class="repeat-wrapper"><div>0_0</div><div>1_1</div><div>2_2</div></div>')
});

@@ -204,0 +207,0 @@ test.skip('scope with fragment', function () {

@@ -37,2 +37,5 @@ 'use strict';

};
return function () {
delete stateIdToClassNameFns[stateId];
};
}

@@ -39,0 +42,0 @@

@@ -21,7 +21,10 @@ 'use strict';

function register(id, _ref) {
function register(stateId, _ref) {
var interpolate = _ref.interpolate,
getStatePath = _ref.getStatePath;
idToInterpolate[id] = { fn: interpolate, getStatePath: getStatePath };
idToInterpolate[stateId] = { fn: interpolate, getStatePath: getStatePath };
return function () {
delete idToInterpolate[stateId];
};
}

@@ -28,0 +31,0 @@

@@ -30,2 +30,5 @@ 'use strict';

stateIdToMapFns[stateId] = mapBackgroundToState;
return function () {
delete stateIdToMapFns[stateId];
};
}

@@ -32,0 +35,0 @@

@@ -51,2 +51,5 @@ 'use strict';

};
return function () {
delete stateIdToStyleFns[stateId];
};
}

@@ -53,0 +56,0 @@

@@ -27,2 +27,5 @@ 'use strict';

stateIdToVisibleFns[stateId] = { visibleArr: visible, getStatePath: getStatePath };
return function () {
delete stateIdToVisibleFns[stateId];
};
}

@@ -29,0 +32,0 @@

@@ -7,2 +7,6 @@ 'use strict';

var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _keys = require('babel-runtime/core-js/object/keys');

@@ -127,4 +131,8 @@

});
return (0, _util.concat)(cancelRegister);
var cancelStateId = function cancelStateId() {
(0, _util.mapValues)(dependenciesByUtility, function (utilityDepMap) {
delete utilityDepMap[stateId];
});
};
return (0, _util.concat)([].concat((0, _toConsumableArray3.default)(cancelRegister), [cancelStateId]));
}

@@ -131,0 +139,0 @@

{
"name": "@cicada/render",
"version": "1.1.8-alpha16",
"version": "1.1.8-alpha17",
"main": "./lib/index.js",

@@ -5,0 +5,0 @@ "scripts": {

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