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

animar

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

animar - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

49

lib/__tests__/animar-test.js

@@ -258,51 +258,2 @@ jest.dontMock('../animar');

});
});
describe('_renderDOM()', function() {
var attributeMap, testElement;
beforeEach(function() {
animar._calculateAnimationValue = jest.genMockFn().mockReturnValue(-5);
animar._applyStyle = jest.genMockFn();
attributeMap = new Map();
testElement = document.createElement('div');
});
it('should calculate the target value and apply the style to the attribute', function() {
attributeMap.set('testAttribute1', {
model: 5,
animations: [{}]
});
animar.elementMap.set(testElement, attributeMap);
animar._renderDOM();
expect(animar._calculateAnimationValue).toBeCalled();
expect(animar._applyStyle).toBeCalledWith(testElement, 'testAttribute1', 0);
});
it('should correctly construct a transform string', function() {
attributeMap.set('translateX', { model: 5, animations: [{}] });
attributeMap.set('translateY', { model: 5, animations: [{}] });
attributeMap.set('scaleX', { model: 5, animations: [{}] });
attributeMap.set('scaleY', { model: 5, animations: [{}] });
attributeMap.set('rotate', { model: 5, animations: [{}] });
animar.elementMap.set(testElement, attributeMap);
animar._renderDOM();
expect(animar._applyStyle).toBeCalledWith(testElement, 'transform', 'translateX(0px) translateY(0px) scaleX(0) ' +
'scaleY(0) rotate(0deg) translateZ(0)');
});
it('should not apply a style when an element has no animations in progress', function() {
attributeMap.set('testAttribute1', {
model: 5,
animations: []
});
animar.elementMap.set(testElement, attributeMap);
animar._renderDOM();
expect(animar._calculateAnimationValue).not.toBeCalled();
expect(animar._applyStyle).not.toBeCalled();
});
});

49

lib/__tests__/animar2-test.js

@@ -323,2 +323,51 @@ jest.dontMock('../animar');

});
});
describe('_renderDOM()', function() {
var attributeMap, testElement;
beforeEach(function() {
animar._calculateAnimationValue = jest.genMockFn().mockReturnValue(-5);
animar._applyStyle = jest.genMockFn();
attributeMap = new Map();
testElement = document.createElement('div');
});
it('should calculate the target value and apply the style to the attribute', function() {
attributeMap.set('testAttribute1', {
model: 5,
animations: [{}]
});
animar.elementMap.set(testElement, attributeMap);
animar._renderDOM();
expect(animar._calculateAnimationValue).toBeCalled();
expect(animar._applyStyle).toBeCalledWith(testElement, 'testAttribute1', 0);
});
it('should correctly construct a transform string', function() {
attributeMap.set('translateX', { model: 5, animations: [{}] });
attributeMap.set('translateY', { model: 5, animations: [{}] });
attributeMap.set('scaleX', { model: 5, animations: [{}] });
attributeMap.set('scaleY', { model: 5, animations: [{}] });
attributeMap.set('rotate', { model: 5, animations: [{}] });
animar.elementMap.set(testElement, attributeMap);
animar._renderDOM();
expect(animar._applyStyle).toBeCalledWith(testElement, 'transform', 'translateX(0px) translateY(0px) scaleX(0) ' +
'scaleY(0) rotate(0deg) translateZ(0)');
});
it('should not apply a style when an element has no animations in progress', function() {
attributeMap.set('testAttribute1', {
model: 5,
animations: []
});
animar.elementMap.set(testElement, attributeMap);
animar._renderDOM();
expect(animar._calculateAnimationValue).not.toBeCalled();
expect(animar._applyStyle).not.toBeCalled();
});
});

6

package.json
{
"name": "animar",
"version": "0.4.1",
"version": "0.4.2",
"description": "a modern, focused, flexible javascript animation library.",

@@ -31,7 +31,5 @@ "keywords": [

"build": "./scripts/build.sh",
"deploy": "npm publish ./ && surge --project ./dist --domain animar.surge.sh",
"test": "jest",
"pretest": "npm run clean-coverage && npm run lint",
"prebuild": "npm run clean-dist",
"predeploy": "npm run build"
"prebuild": "npm run clean-dist"
},

@@ -38,0 +36,0 @@ "jshintConfig": {},

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