Skip to content

Commit

Permalink
Not preloading Gradients
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh committed Oct 2, 2017
1 parent f057af6 commit 2a91ec1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions framer/Extras/Preloader.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Preloader extends BaseClass
_.map(context.layers, "player").map(@addPlayer)

addImage: (image) =>
return if image instanceof Gradient
if image and image not in @_media
@_media.push(image)
# We simply count failed images as loaded for now so that we avoid
Expand Down
1 change: 1 addition & 0 deletions test/tests.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ require "./tests/DeviceComponentTest"
require "./tests/SliderComponentTest"
require "./tests/RangeSliderComponentTest"
require "./tests/FlowComponentTest"
require "./tests/PreloaderTest"

mocha.run()
10 changes: 10 additions & 0 deletions test/tests/PreloaderTest.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe "Preloader", ->
it "should not preload gradients", ->
Framer.CurrentContext = new Framer.Context(name: "test")
Framer.CurrentContext.run ->
new Layer
gradient:
start: "red"
Framer.Extras.Preloader.enable()
Framer.Preloader.addImagesFromContext(Framer.CurrentContext)
Framer.Preloader._media.length.should.equal 0

0 comments on commit 2a91ec1

Please sign in to comment.