Permalink
Browse files

Added tests, fixed some errors.

  • Loading branch information...
koenbok committed Oct 13, 2013
1 parent 6eefeb0 commit 3e4051b9f70f0bce29c904357cc51299268fbc5f
Showing with 31 additions and 13 deletions.
  1. +5 −3 build/framer.js
  2. +0 −3 src/animation.coffee
  3. +4 −3 src/views/view.coffee
  4. +5 −3 template/framer.js
  5. +9 −1 test/tests/animation.coffee
  6. +8 −0 test/tests/view.coffee
@@ -1,7 +1,7 @@
// Framer 2.0-31-gf367c76 (c) 2013 Koen Bok
// Framer 2.0-32-g6eefeb0 (c) 2013 Koen Bok
// https://github.com/koenbok/Framer
window.FramerVersion = "2.0-31-gf367c76";
window.FramerVersion = "2.0-32-g6eefeb0";
(function(){var require = function (file, cwd) {
@@ -2727,6 +2727,9 @@ require.define("/src/views/view.coffee",function(require,module,exports,__dirnam
View.prototype._parseFilterCSS = function(css) {
var k, name, part, results, v, value, _i, _len, _ref;
results = {};
if (!css) {
return results;
}
_ref = css.split(" ");
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
part = _ref[_i];
@@ -4272,7 +4275,6 @@ require.define("/src/animation.coffee",function(require,module,exports,__dirname
cssString.push("}\n");
}
cssString.push("}\n");
console.log(cssString.join(""));
return cssString.join("");
};
@@ -380,9 +380,6 @@ class Animation extends EventEmitter
cssString.push "}\n"
cssString.push "}\n"
console.log cssString.join ""
cssString.join ""
_deltas: ->
@@ -285,8 +285,6 @@ class View extends Frame
#############################################################################
## Visual Filters
_getFilterValue: (name) ->
values = @_parseFilterCSS @style.webkitFilter
values[name] or FilterProperties[name].default
@@ -306,7 +304,10 @@ class View extends Frame
css.join " "
_parseFilterCSS: (css) ->
results = {}
results = {}
return results if not css
for part in css.split " "
if part
name = part.split("(")[0]
@@ -1,7 +1,7 @@
// Framer 2.0-31-gf367c76 (c) 2013 Koen Bok
// Framer 2.0-32-g6eefeb0 (c) 2013 Koen Bok
// https://github.com/koenbok/Framer
window.FramerVersion = "2.0-31-gf367c76";
window.FramerVersion = "2.0-32-g6eefeb0";
(function(){var require = function (file, cwd) {
@@ -2727,6 +2727,9 @@ require.define("/src/views/view.coffee",function(require,module,exports,__dirnam
View.prototype._parseFilterCSS = function(css) {
var k, name, part, results, v, value, _i, _len, _ref;
results = {};
if (!css) {
return results;
}
_ref = css.split(" ");
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
part = _ref[_i];
@@ -4272,7 +4275,6 @@ require.define("/src/animation.coffee",function(require,module,exports,__dirname
cssString.push("}\n");
}
cssString.push("}\n");
console.log(cssString.join(""));
return cssString.join("");
};
@@ -1,6 +1,8 @@
describe "Animation", ->
AnimatableMatrixProperties = (new Animation view:null).AnimatableMatrixProperties
AnimatableCSSProperties = (new Animation view:null).AnimatableCSSProperties
AnimatableFilterProperties = (new Animation view:null).AnimatableFilterProperties
AnimationTime = 200
halfway = (a, b) ->
@@ -45,8 +47,14 @@ describe "Animation", ->
animation.curveValues.length.should.equal \
(animation.time / 1000) * animation.precision
testProperties = []
testProperties = _.union testProperties, AnimatableMatrixProperties
# testProperties = _.union testProperties, _.keys AnimatableCSSProperties
# testProperties = _.union testProperties, _.keys AnimatableFilterProperties
AnimatableMatrixProperties.map (p) ->
console.log "testProperties", testProperties
testProperties.map (p) ->
# Todo: Z is weird. I'll have to figure this out later
if p in ["z"]
@@ -188,5 +188,13 @@ describe "View", ->
view.addClass('bar')
view.removeClass('bar')
view.class.should.equal "#{classA} foo"
describe "Filters", ->
for filterName in ["blur", "brightness", "saturate", "hueRotate", "contrast",
"invert", "grayscale", "sepia"]
view = createView()
view[filterName] = 10
view[filterName].should.equal 10

0 comments on commit 3e4051b

Please sign in to comment.