From 531fca593769a696502be3ede2d5dbe424fc3dee Mon Sep 17 00:00:00 2001 From: adeveria Date: Tue, 17 Sep 2013 10:35:36 -0700 Subject: [PATCH 1/4] add filter tests --- test/filter.js | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ test/test.html | 1 + 2 files changed, 84 insertions(+) create mode 100644 test/filter.js diff --git a/test/filter.js b/test/filter.js new file mode 100644 index 0000000..c748351 --- /dev/null +++ b/test/filter.js @@ -0,0 +1,83 @@ +describe("Filter methods", function () { + it("Savage.filter.blur", function() { + var str = Savage.filter.blur(3); + expect(str).to.be(''); + str = Savage.filter.blur(0.123, 8); + expect(str).to.be(''); + }); + it("Savage.filter.brightness", function() { + var str = Savage.filter.brightness(0.3); + expect(str).to.be(''); + str = Savage.filter.brightness(1); + expect(str).to.be(''); + }); + it("Savage.filter.contrast", function() { + var str = Savage.filter.contrast(0.1); + expect(str).to.be(''); + str = Savage.filter.contrast(3); + expect(str).to.be(''); + }); + it("Savage.filter.grayscale", function() { + var str = Savage.filter.grayscale(0.5); + expect(str).to.be(''); + str = Savage.filter.grayscale(1); + expect(str).to.be(''); + }); + it("Savage.filter.hueRotate", function() { + var str = Savage.filter.hueRotate(180); + expect(str).to.be(''); + str = Savage.filter.hueRotate(90); + expect(str).to.be(''); + }); + it("Savage.filter.hueRotate", function() { + var str = Savage.filter.hueRotate(180); + expect(str).to.be(''); + str = Savage.filter.hueRotate(90); + expect(str).to.be(''); + }); + it("Savage.filter.invert", function() { + var str = Savage.filter.invert(0.6); + expect(str).to.be(''); + str = Savage.filter.invert(1); + expect(str).to.be(''); + }); + it("Savage.filter.saturate", function() { + var str = Savage.filter.saturate(0.3); + expect(str).to.be(''); + str = Savage.filter.saturate(1); + expect(str).to.be(''); + }); + it("Savage.filter.sepia", function() { + var str = Savage.filter.sepia(0.3); + expect(str).to.be(''); + str = Savage.filter.sepia(1); + expect(str).to.be(''); + }); + it("Savage.filter.shadow - dx & dy", function() { + var str = Savage.filter.shadow(5, 5); + expect(str).to.be(''); + str = Savage.filter.shadow(-1, 3); + expect(str).to.be(''); + }); + it("Savage.filter.shadow - dx & dy, blur", function() { + var str = Savage.filter.shadow(5, 5, 5); + expect(str).to.be(''); + str = Savage.filter.shadow(-1, 3, 10); + expect(str).to.be(''); + }); + it("Savage.filter.shadow - dx & dy, color", function() { + var str = Savage.filter.shadow(5, 5, '#F00'); + expect(str).to.be(''); + str = Savage.filter.shadow(-1, 3, 'hsla(128, 50%, 50%, 0.8)'); + expect(str).to.be(''); + }); + + it("Savage.filter.shadow - dx & dy, blur & color", function() { + var str = Savage.filter.shadow(5, 5, 5, '#F00'); + expect(str).to.be(''); + str = Savage.filter.shadow(-1, 3, 10, 'hsla(128, 50%, 50%, 0.8)'); + expect(str).to.be(''); + }); + + +}); \ No newline at end of file diff --git a/test/test.html b/test/test.html index 322e982..3a0e844 100644 --- a/test/test.html +++ b/test/test.html @@ -39,6 +39,7 @@ + + + +