Skip to content

Instantly share code, notes, and snippets.

@dawidlenkiewicz
Created January 12, 2015 15:04
Show Gist options
  • Save dawidlenkiewicz/1daa4c146478b123238f to your computer and use it in GitHub Desktop.
Save dawidlenkiewicz/1daa4c146478b123238f to your computer and use it in GitHub Desktop.
Jasmine example
describe("Fog", function() {
var fog;
beforeEach(function() {
fog = new Fog();
});
it("should create Fog with default parameters", function() {
expect(fog.settings.zMinMax).toEqual([ 0, 100 ]);
expect(fog.settings.intensity).toEqual(1);
expect(fog.settings.color).toEqual([0.1, 0.3, 0.9]);
});
it("should create Fog with no children", function() {
expect(fog.children).toEqual([]);
});
describe('#draw function', function() {
it("should add fog settings to uniforms", function() {
var uniforms = {tiling: [1.0, 1.0], material: {}};
fog.draw(uniforms);
expect(uniforms.fog).toEqual(fog.settings);
});
it("should run draw function for each children", function() {
fog2 = new Fog();
fog.addChilds(fog2);
spyOn(fog2, 'draw');
fog.draw();
expect(fog2.draw).toHaveBeenCalled();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment