Comparing version 0.4.1 to 0.4.2
@@ -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(); | ||
}); | ||
}); |
@@ -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(); | ||
}); | ||
}); |
{ | ||
"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
50353