Skip to content
Permalink
Browse files

More tests

  • Loading branch information...
Koen Bok
Koen Bok committed Mar 18, 2013
1 parent e73e07a commit d6348db2b2dad85adcd549a5e135d8c839c166ad
Showing with 47 additions and 23 deletions.
  1. +3 −7 build/framer.js
  2. +2 −2 src/utils.coffee
  3. +3 −7 template/framer.js
  4. +1 −0 test/init.coffee
  5. +27 −0 test/src/animation.coffee
  6. +11 −7 test/src/view.coffee
@@ -1,6 +1,6 @@
// Framer 0.5.0-31-g98ca654 (c) 2013 Koen Bok
// Framer 0.5.0-44-ge73e07a (c) 2013 Koen Bok

window.FramerVersion = "0.5.0-31-g98ca654";
window.FramerVersion = "0.5.0-44-ge73e07a";


(function(){var require = function (file, cwd) {
@@ -511,12 +511,8 @@ require.define("/src/utils.coffee",function(require,module,exports,__dirname,__f
};

exports.delay = function(time, f) {
var timer, _ref;
var timer;
timer = setTimeout(f, time);
if ((_ref = window._delayTimers) == null) {
window._delayTimers = [];
}
window._delayTimers.push(timer);
return timer;
};

@@ -64,8 +64,8 @@ exports.randomColor = (alpha) ->

exports.delay = (time, f) ->
timer = setTimeout f, time
window._delayTimers ?= []
window._delayTimers.push timer
# window._delayTimers ?= []
# window._delayTimers.push timer
return timer

exports.interval = (time, f) ->
@@ -1,6 +1,6 @@
// Framer 0.5.0-31-g98ca654 (c) 2013 Koen Bok
// Framer 0.5.0-44-ge73e07a (c) 2013 Koen Bok

window.FramerVersion = "0.5.0-31-g98ca654";
window.FramerVersion = "0.5.0-44-ge73e07a";


(function(){var require = function (file, cwd) {
@@ -511,12 +511,8 @@ require.define("/src/utils.coffee",function(require,module,exports,__dirname,__f
};

exports.delay = function(time, f) {
var timer, _ref;
var timer;
timer = setTimeout(f, time);
if ((_ref = window._delayTimers) == null) {
window._delayTimers = [];
}
window._delayTimers.push(timer);
return timer;
};

@@ -1 +1,2 @@
{ViewTest} = require './src/view'
{AnimationTest} = require './src/animation'
@@ -0,0 +1,27 @@
describe "Animation", ->

describe "Animations", ->

it "should animate", (callback) ->

view = new View()

animation = view.animate
properties: {x:500}

animation.on "end", ->
view.x.should.equal 500
callback()

it "should cancel", (callback) ->

view = new View()

animation = view.animate
properties: {x:200}
time: 2000

utils.delay 1000, ->
animation.stop()
view.x.should.be.within(90, 110)
callback()
@@ -49,14 +49,18 @@ describe "View", ->

describe "HTML", ->
it "should allow classes to be added", ->
view = new View()
classA = view.class
view.addClass("foo")
view.addClass("bar")
view.class.should.equal "#{classA} foo bar"

it "should allow classes to be removed", ->
view = new View()
classA = view.class
view.addClass('foo')
view.addClass('bar')
view.class.should.equal 'uilayer textureBacked foo bar'

# it "should allow classes to be removed", ->
# view.addClass('foo')
# view.addClass('bar')
# view.removeClass('bar')
# view.class.should.equal [ 'uilayer', 'textureBackend', 'foo' ]
view.removeClass('bar')
view.class.should.equal "#{classA} foo"


0 comments on commit d6348db

Please sign in to comment.
You can’t perform that action at this time.